]> git.gir.st - hardpass.git/blob - oled/mainmenu.sh
Merge branch 'master' of https://github.com/girst/hardpass-passwordmanager
[hardpass.git] / oled / mainmenu.sh
1 #!/bin/bash
2 #must run as root
3
4 $CONFIG_FILE = hardpass-config.sh
5 source $CONFIG_FILE
6
7 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
8 $DIR/oled_menu "1: type passwords" "2: settings" "3: update (git)" "4: about"
9 menu_sel=$?
10
11 case $menu_sel in
12 1) echo "pass show ... stuff";; #TODO TODO TODO
13 2) settings;;
14 3) pass_update;;
15 4) echo "(C) 2016 Tobias Girstmair, licensed under the GNU GPL" #TODO: should be on oled
16 esac
17
18
19 function settings {
20 $DIR/oled_menu "1: English (US)" "2: German (AT)" "3: German (ND)"
21 LAYOUT=$?
22 $DIR/oled_menu "1: GTK (Hold)" "2: GTK (Space)" "3: Windows"
23 UNICODE=$?
24
25 sed -c -i "s/\(LAYOUT *= *\).*/\1$LAYOUT/" $CONFIG_FILE
26 sed -c -i "s/\(UNICODE *= *\).*/\1$UNICODE/" $CONFIG_FILE
27 }
28
29 function pass_update {
30 #TODO: show notificaton / msgbox on oled /TODO
31 rmmod i2c-dev
32 modprobe mac80211
33 modprobe esp8089
34 #TODO: wait for network connection /TODO
35 pass git push #(necessary??)
36 retval=$(pass git pull)
37 case $retval in
38 "Already up-to-date.") #TODO: display something on oled
39 *) #TODO: display number of changes
40 esac
41 rmmod mac80211
42 rmmod esp8089
43 modprobe i2c-dev
44 # TODO: display menu again
45 }
Imprint / Impressum