updated on Sat Jan 14 00:11:12 UTC 2012
[aur-mirror.git] / ikog / ikog.launcher
blob09d543bfff791d1f49fac5755cd759f3f15b768c
1 #!/bin/bash
2 # Launcher script for iKog
3 # TDY <tdy@gmx.com>
5 LOCAL_DIR="$HOME"/.ikog
6 ORIG_DIR=/usr/share/ikog
8 # Create ikog.db if necessary
9 check_db() {
10 local db="$LOCAL_DIR"/ikog.db
11 local bak="$LOCAL_DIR"/ikog.db.bak
12 local orig=$ORIG_DIR/ikog.py
14 if [[ -f $db ]]; then
15 echo " found $db"
16 elif [[ -f $bak ]]; then
17 echo " creating $db from $bak"
18 install -Dm644 "$bak" "$db"
19 elif [[ -f $orig ]]; then
20 echo " creating $db from $orig"
21 install -Dm644 $orig "$db"
22 else
23 echo -e " \033[1;31;40mno usable lists detected\033[1;0m"
24 exit
28 # Create ikog.css if necessary
29 check_css() {
30 local css="$LOCAL_DIR"/ikog.css
31 local orig=$ORIG_DIR/ikog.css
33 if [[ -f $css ]]; then
34 echo " found $css"
35 else
36 echo " creating $css from $orig"
37 install -Dm644 $orig "$css"
41 ### Main ###
43 echo ":: iKog sanity checks..."
44 check_db
45 check_css
47 echo ":: Launching iKog..."
48 cd "$LOCAL_DIR"
49 python2 ikog.db "$@"
50 exit $?