|
@@ -36,8 +36,17 @@ export TEXTDOMAINDIR="/usr/share/locale"
|
36
|
36
|
MY_EMAIL_ADDRESS=$USER@$HOSTNAME
|
37
|
37
|
GPG_ID=$(gpg --fingerprint $MY_EMAIL_ADDRESS | grep -i "pub" | head -n 1 | awk -F '/' '{print $2}' | awk -F ' ' '{print $1}')
|
38
|
38
|
|
39
|
|
-SYNCTHING_CONFIG_FILE=~/.syncthingids
|
40
|
|
-SYNCTHING_ID=$(cat ~/.syncthing-server-id)
|
|
39
|
+UTILS_FILES=/usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-*
|
|
40
|
+for f in $UTILS_FILES
|
|
41
|
+do
|
|
42
|
+ source $f
|
|
43
|
+done
|
|
44
|
+
|
|
45
|
+APP_FILES=/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-*
|
|
46
|
+for f in $APP_FILES
|
|
47
|
+do
|
|
48
|
+ source $f
|
|
49
|
+done
|
41
|
50
|
|
42
|
51
|
function any_key {
|
43
|
52
|
echo ' '
|
|
@@ -595,147 +604,6 @@ function smtp_proxy {
|
595
|
604
|
fi
|
596
|
605
|
}
|
597
|
606
|
|
598
|
|
-function syncthing_create_ids_file {
|
599
|
|
- if [ ! -f ~/.syncthing-server-id ]; then
|
600
|
|
- return
|
601
|
|
- fi
|
602
|
|
-
|
603
|
|
- SYNCTHING_ID=$(cat ~/.syncthing-server-id)
|
604
|
|
- if [ ! -f $SYNCTHING_CONFIG_FILE ]; then
|
605
|
|
- echo $'# Your syncthing configuration file' > $SYNCTHING_CONFIG_FILE
|
606
|
|
- echo '#' >> $SYNCTHING_CONFIG_FILE
|
607
|
|
- echo $"# The ${PROJECT_NAME} syncthing ID is: $SYNCTHING_ID" >> $SYNCTHING_CONFIG_FILE
|
608
|
|
- echo '#' >> $SYNCTHING_CONFIG_FILE
|
609
|
|
- echo '# Paste the IDs of your devices below' >> $SYNCTHING_CONFIG_FILE
|
610
|
|
- echo '#' >> $SYNCTHING_CONFIG_FILE
|
611
|
|
- fi
|
612
|
|
-}
|
613
|
|
-
|
614
|
|
-function syncthing_manual_edit {
|
615
|
|
- if [ ! -f ~/.syncthing-server-id ]; then
|
616
|
|
- return
|
617
|
|
- fi
|
618
|
|
- syncthing_create_ids_file
|
619
|
|
- editor $SYNCTHING_CONFIG_FILE
|
620
|
|
-
|
621
|
|
- # force an update of the configuration
|
622
|
|
- touch ~/.syncthing-update
|
623
|
|
-}
|
624
|
|
-
|
625
|
|
-function syncthing_show_id {
|
626
|
|
- if [ ! -f ~/.syncthing-server-id ]; then
|
627
|
|
- return
|
628
|
|
- fi
|
629
|
|
-
|
630
|
|
- SYNCTHING_ID=$(cat ~/.syncthing-server-id)
|
631
|
|
- dialog --title $"Device ID for ${PROJECT_NAME}" \
|
632
|
|
- --backtitle $"Freedombone User Control Panel" \
|
633
|
|
- --msgbox $"In a desktop terminal press shift and select the ID below,\nthen right click and copy.\n\nWithin Connectbot select Menu/Copy and then highlight the ID below\n\n$SYNCTHING_ID" 12 78
|
634
|
|
-}
|
635
|
|
-
|
636
|
|
-function syncthing_add_id {
|
637
|
|
- if [ ! -f ~/.syncthing-server-id ]; then
|
638
|
|
- return
|
639
|
|
- fi
|
640
|
|
-
|
641
|
|
- syncthing_create_ids_file
|
642
|
|
-
|
643
|
|
- data=$(tempfile 2>/dev/null)
|
644
|
|
- trap "rm -f $data" 0 1 2 5 15
|
645
|
|
- dialog --backtitle $"Freedombone User Control Panel" \
|
646
|
|
- --title $"Add a Syncthing device ID" \
|
647
|
|
- --form $"Paste the device ID for your laptop/desktop/netbook/phone/tablet below" 9 80 2 \
|
648
|
|
- $"Device ID:" 1 1 "" 1 26 80 80 \
|
649
|
|
- $"Description (optional):" 2 1 "" 2 26 80 80 \
|
650
|
|
- 2> $data
|
651
|
|
- sel=$?
|
652
|
|
- case $sel in
|
653
|
|
- 1) return;;
|
654
|
|
- 255) return;;
|
655
|
|
- esac
|
656
|
|
- SYNCTHING_DEVICE_ID=$(cat $data | sed -n 1p)
|
657
|
|
- SYNCTHING_DESCRIPTION=$(cat $data | sed -n 2p)
|
658
|
|
-
|
659
|
|
- if [ ${#SYNCTHING_DEVICE_ID} -lt 10 ]; then
|
660
|
|
- return
|
661
|
|
- fi
|
662
|
|
-
|
663
|
|
- if [[ $SYNCTHING_DEVICE_ID == *"#"* || $SYNCTHING_DEVICE_ID == *"*"* || $SYNCTHING_DEVICE_ID == *'/'* || $SYNCTHING_DEVICE_ID != *"-"* ]]; then
|
664
|
|
- dialog --title $"Add a Syncthing device ID" \
|
665
|
|
- --backtitle $"Freedombone User Control Panel" \
|
666
|
|
- --msgbox $"That doesn't look like a device ID" 6 50
|
667
|
|
- return
|
668
|
|
- fi
|
669
|
|
-
|
670
|
|
- if grep -q "$SYNCTHING_DEVICE_ID" $SYNCTHING_CONFIG_FILE; then
|
671
|
|
- dialog --title $"Add a Syncthing device ID" \
|
672
|
|
- --backtitle $"Freedombone User Control Panel" \
|
673
|
|
- --msgbox $"That ID has already been added" 6 50
|
674
|
|
- return
|
675
|
|
- fi
|
676
|
|
-
|
677
|
|
- if [ ${#SYNCTHING_DESCRIPTION} -gt 0 ]; then
|
678
|
|
- echo "# $SYNCTHING_DESCRIPTION" >> $SYNCTHING_CONFIG_FILE
|
679
|
|
- fi
|
680
|
|
- echo "$SYNCTHING_DEVICE_ID" >> $SYNCTHING_CONFIG_FILE
|
681
|
|
-
|
682
|
|
- # force an update of the configuration
|
683
|
|
- touch ~/.syncthing-update
|
684
|
|
-
|
685
|
|
- dialog --title $"Add a Syncthing device ID" \
|
686
|
|
- --backtitle $"Freedombone User Control Panel" \
|
687
|
|
- --msgbox $"The ID was added" 6 50
|
688
|
|
-}
|
689
|
|
-
|
690
|
|
-function syncthing_remove_id {
|
691
|
|
- if [ ! -f ~/.syncthing-server-id ]; then
|
692
|
|
- return
|
693
|
|
- fi
|
694
|
|
-
|
695
|
|
- syncthing_create_ids_file
|
696
|
|
-
|
697
|
|
- data=$(tempfile 2>/dev/null)
|
698
|
|
- trap "rm -f $data" 0 1 2 5 15
|
699
|
|
- dialog --backtitle $"Freedombone User Control Panel" \
|
700
|
|
- --title $"Remove a Syncthing device ID" \
|
701
|
|
- --form $"Paste the device ID which is to be removed below" 8 80 1 \
|
702
|
|
- $"Device ID:" 1 1 "" 1 14 80 80 \
|
703
|
|
- 2> $data
|
704
|
|
- sel=$?
|
705
|
|
- case $sel in
|
706
|
|
- 1) return;;
|
707
|
|
- 255) return;;
|
708
|
|
- esac
|
709
|
|
- SYNCTHING_DEVICE_ID=$(cat $data | sed -n 1p)
|
710
|
|
-
|
711
|
|
- if [ ${#SYNCTHING_DEVICE_ID} -lt 10 ]; then
|
712
|
|
- return
|
713
|
|
- fi
|
714
|
|
-
|
715
|
|
- if [[ $SYNCTHING_DEVICE_ID == *"#"* || $SYNCTHING_DEVICE_ID == *"*"* || $SYNCTHING_DEVICE_ID == *'/'* || $SYNCTHING_DEVICE_ID != *"-"* ]]; then
|
716
|
|
- dialog --title $"Remove a Syncthing device ID" \
|
717
|
|
- --backtitle $"Freedombone User Control Panel" \
|
718
|
|
- --msgbox $"That doesn't look like a device ID" 6 50
|
719
|
|
- return
|
720
|
|
- fi
|
721
|
|
-
|
722
|
|
- if ! grep -q "$SYNCTHING_DEVICE_ID" $SYNCTHING_CONFIG_FILE; then
|
723
|
|
- dialog --title $"Remove a Syncthing device ID" \
|
724
|
|
- --backtitle $"Freedombone User Control Panel" \
|
725
|
|
- --msgbox $"That ID wasn't registered anyway" 6 50
|
726
|
|
- return
|
727
|
|
- fi
|
728
|
|
-
|
729
|
|
- sed -i "/$SYNCTHING_DEVICE_ID/d" $SYNCTHING_CONFIG_FILE
|
730
|
|
-
|
731
|
|
- # force an update of the configuration
|
732
|
|
- touch ~/.syncthing-update
|
733
|
|
-
|
734
|
|
- dialog --title $"Remove a Syncthing device ID" \
|
735
|
|
- --backtitle $"Freedombone User Control Panel" \
|
736
|
|
- --msgbox $"The ID was removed" 6 50
|
737
|
|
-}
|
738
|
|
-
|
739
|
607
|
function sign_gpg_key {
|
740
|
608
|
data=$(tempfile 2>/dev/null)
|
741
|
609
|
trap "rm -f $data" 0 1 2 5 15
|
|
@@ -854,34 +722,6 @@ function menu_email {
|
854
|
722
|
done
|
855
|
723
|
}
|
856
|
724
|
|
857
|
|
-function menu_syncthing {
|
858
|
|
- while true
|
859
|
|
- do
|
860
|
|
- data=$(tempfile 2>/dev/null)
|
861
|
|
- trap "rm -f $data" 0 1 2 5 15
|
862
|
|
- dialog --backtitle $"Freedombone User Control Panel" \
|
863
|
|
- --title $"File Synchronization" \
|
864
|
|
- --radiolist $"Choose an operation:" 12 70 6 \
|
865
|
|
- 1 $"Show device ID for ${PROJECT_NAME}" off \
|
866
|
|
- 2 $"Add an ID for another machine or device" off \
|
867
|
|
- 3 $"Remove an ID for another machine or device" off \
|
868
|
|
- 4 $"Manually edit device IDs" off \
|
869
|
|
- 5 $"Back to main menu" on 2> $data
|
870
|
|
- sel=$?
|
871
|
|
- case $sel in
|
872
|
|
- 1) break;;
|
873
|
|
- 255) break;;
|
874
|
|
- esac
|
875
|
|
- case $(cat $data) in
|
876
|
|
- 1) syncthing_show_id;;
|
877
|
|
- 2) syncthing_add_id;;
|
878
|
|
- 3) syncthing_remove_id;;
|
879
|
|
- 4) syncthing_manual_edit;;
|
880
|
|
- 5) break;;
|
881
|
|
- esac
|
882
|
|
- done
|
883
|
|
-}
|
884
|
|
-
|
885
|
725
|
function menu_admin {
|
886
|
726
|
if [ ! -f /etc/sudoers ]; then
|
887
|
727
|
clear
|
|
@@ -905,14 +745,43 @@ function sign_keys {
|
905
|
745
|
esac
|
906
|
746
|
}
|
907
|
747
|
|
908
|
|
-function run_tox_client {
|
909
|
|
- # create a tox user
|
910
|
|
- if [ ! -f /home/${USER}/.config/tox/data.tox ]; then
|
911
|
|
- mkdir -p /home/${USER}/.config/tox
|
912
|
|
- chown -R ${USER}:${USER} /home/${USER}/.config
|
913
|
|
- toxid -u ${USER} -n data
|
|
748
|
+function menu_run_client_app {
|
|
749
|
+ detect_installable_apps
|
|
750
|
+
|
|
751
|
+ applist=""
|
|
752
|
+ appnames=()
|
|
753
|
+ n=1
|
|
754
|
+ app_index=0
|
|
755
|
+ for a in "${APPS_AVAILABLE[@]}"
|
|
756
|
+ do
|
|
757
|
+ if [[ ${APPS_INSTALLED[$app_index]} != "0" ]]; then
|
|
758
|
+ if [[ $(function_exists run_client_${a}) == "1" ]]; then
|
|
759
|
+ applist="$applist $n $a off"
|
|
760
|
+ n=$[n+1]
|
|
761
|
+ appnames+=("$a")
|
|
762
|
+ fi
|
|
763
|
+ fi
|
|
764
|
+ app_index=$[app_index+1]
|
|
765
|
+ done
|
|
766
|
+ if [ $n -le 1 ]; then
|
|
767
|
+ return
|
|
768
|
+ fi
|
|
769
|
+ backstr=$'Exit'
|
|
770
|
+ applist="$applist $n $backstr on"
|
|
771
|
+ appnames+=("Exit")
|
|
772
|
+
|
|
773
|
+ choice=$(dialog --stdout --backtitle $"Freedombone" \
|
|
774
|
+ --title $"Run an App" \
|
|
775
|
+ --radiolist $'Choose:' \
|
|
776
|
+ 16 40 20 $applist)
|
|
777
|
+
|
|
778
|
+ if [ $? -eq 0 ]; then
|
|
779
|
+ app_index=$[choice-1]
|
|
780
|
+ chosen_app=${appnames[$app_index]}
|
|
781
|
+ if [[ $chosen_app != "Exit" ]]; then
|
|
782
|
+ run_client_${chosen_app}
|
|
783
|
+ fi
|
914
|
784
|
fi
|
915
|
|
- toxic -f /home/${USER}/.config/tox/data.tox --force-tcp --SOCKS5-proxy 127.0.0.1 9050
|
916
|
785
|
}
|
917
|
786
|
|
918
|
787
|
function menu_top_level {
|
|
@@ -925,16 +794,14 @@ function menu_top_level {
|
925
|
794
|
--radiolist $"Choose an operation:" 19 50 12 \
|
926
|
795
|
1 $"Use Email" off \
|
927
|
796
|
2 $"Change Email Filtering Rules" off \
|
928
|
|
- 3 $"Use Tox Chat" off \
|
929
|
|
- 4 $"Use XMPP Chat" off \
|
930
|
|
- 5 $"Use IRC" off \
|
931
|
|
- 6 $"Browse the Web" off \
|
932
|
|
- 7 $"File Synchronization" off \
|
933
|
|
- 8 $"My Encryption Keys" off \
|
934
|
|
- 9 $"Set an outgoing email proxy" off \
|
935
|
|
- 10 $"Administrator controls" off \
|
936
|
|
- 11 $"Exit to the command line" off \
|
937
|
|
- 12 $"Log out" on 2> $data
|
|
797
|
+ 3 $"Run an App" off \
|
|
798
|
+ 4 $"Browse the Web" off \
|
|
799
|
+ 5 $"File Synchronization" off \
|
|
800
|
+ 6 $"My Encryption Keys" off \
|
|
801
|
+ 7 $"Set an outgoing email proxy" off \
|
|
802
|
+ 8 $"Administrator controls" off \
|
|
803
|
+ 9 $"Exit to the command line" off \
|
|
804
|
+ 10 $"Log out" on 2> $data
|
938
|
805
|
sel=$?
|
939
|
806
|
case $sel in
|
940
|
807
|
1) exit 1;;
|
|
@@ -943,16 +810,13 @@ function menu_top_level {
|
943
|
810
|
case $(cat $data) in
|
944
|
811
|
1) mutt;;
|
945
|
812
|
2) menu_email;;
|
946
|
|
- 3) run_tox_client;;
|
947
|
|
- 4) torify profanity;;
|
948
|
|
- 5) irssi;;
|
949
|
|
- 6) torify elinks;;
|
950
|
|
- 7) menu_syncthing;;
|
951
|
|
- 8) menu_encryption_keys;;
|
952
|
|
- 9) smtp_proxy;;
|
953
|
|
- 10) menu_admin;;
|
954
|
|
- 11) break;;
|
955
|
|
- 12) kill -HUP `pgrep -s 0 -o`;;
|
|
813
|
+ 3) menu_run_client_app;;
|
|
814
|
+ 4) torify elinks;;
|
|
815
|
+ 5) menu_encryption_keys;;
|
|
816
|
+ 6) smtp_proxy;;
|
|
817
|
+ 7) menu_admin;;
|
|
818
|
+ 8) break;;
|
|
819
|
+ 9) kill -HUP `pgrep -s 0 -o`;;
|
956
|
820
|
esac
|
957
|
821
|
done
|
958
|
822
|
}
|