ssfs annotate ssfs-box @ rev 12

Tiny edits
author Paul Issott <paul@slitaz.org>
date Sat Jun 11 19:15:28 2011 +0100 (2011-06-11)
parents ef6a5580a9cb
children 4b29fae9fce8
rev   line source
pankso@7 1 #!/bin/sh
pankso@7 2 #
pankso@7 3 # SliTaz Secure File Storage GTK user interface using Yad.
pankso@7 4 #
pankso@7 5 # Copyright (C) SliTaz GNU/Linux - BSD License
pankso@7 6 # Author: Christophe Lincoln <pankso@slitaz.org>
pankso@7 7 #
pankso@7 8
pankso@7 9 app=$(basename $0)
pankso@7 10 config=$HOME/.config/ssfs/client.lua
pankso@7 11
pankso@7 12 #
pankso@7 13 # Functions
pankso@7 14 #
pankso@7 15
pankso@7 16 info() {
pankso@7 17 size=$(du -sh $HOME/Sync | awk '{print $1}')
pankso@7 18 host=$(fgrep 'host' $config | cut -d '"' -f 2)
pankso@7 19 login=${host%@*}
pankso@7 20 host=${host#*@}
pankso@7 21 echo -e "Login\n$login
pankso@7 22 Host\n$host
pankso@7 23 Size\n$size
pankso@7 24 RSA Key\n~/.ssh/id_rsa"
pankso@7 25 }
pankso@7 26
pankso@7 27 # Default tools GUI box function.
pankso@7 28 tools_main() {
pankso@7 29 if [ ! -s "$config" ]; then
pankso@10 30 $0 setup && exit 0
pankso@7 31 fi
paul@12 32 text=$(gettext "<b>Welcome to the Ssfs GTK user interface</b>")
pankso@7 33 info | yad \
pankso@7 34 --list --title="Ssfs GTK tools" \
pankso@7 35 --width=460 --height=280 --image-on-top \
pankso@7 36 --text="$text" --image="slitaz-menu" \
pankso@7 37 --column "Ssfs" --column "$(gettext "Value")" \
pankso@7 38 --button="$(gettext "Edit config"):3" \
pankso@7 39 --button="$(gettext "Browse files"):2" \
pankso@7 40 --button="gtk-close:1"
pankso@7 41 }
pankso@7 42
pankso@7 43 # Default tools functions.
pankso@7 44 tools() {
pankso@7 45 # Store box results
pankso@7 46 main=$(tools_main)
pankso@7 47 # Deal with --button values
pankso@7 48 case $? in
pankso@7 49 1) exit 0 ;;
pankso@7 50 2) file-manager $HOME/Sync ;;
pankso@7 51 3) editor $config ;;
pankso@7 52 *) continue ;;
pankso@7 53 esac
pankso@7 54 case $main in
pankso@7 55 RSA*)
pankso@7 56 yad --text-info --title="RSA Key" \
pankso@7 57 --width=560 --height=380 \
pankso@7 58 --filename=$HOME/.ssh/id_rsa ;;
pankso@7 59 *)
pankso@7 60 echo "TODO: $main" ;;
pankso@7 61 esac
pankso@7 62 }
pankso@7 63
pankso@7 64 # Setup GUI box function.
pankso@7 65 setup_main() {
pankso@7 66 text=$(gettext \
paul@12 67 "<b>Welcome to the Ssfs Setup</b>\n
pankso@7 68 Any account on a server yet ? You can vist www.slitaz.org
pankso@7 69 services or setup your own server in a few minutes!\n")
pankso@7 70 yad --form --title="Ssfs GTK Setup" \
pankso@7 71 --width=460 --height=200 --image-on-top \
pankso@7 72 --text="$text" --image="slitaz-menu" \
pankso@7 73 --field="Login" --field="Server"
pankso@7 74 }
pankso@7 75
pankso@7 76 # Default tools functions.
pankso@7 77 setup() {
pankso@7 78 # Store box results and setup.
pankso@7 79 main=$(setup_main)
pankso@7 80 [ $? == 1 ] && exit 0
pankso@7 81 login=$(echo $main | cut -d '|' -f 1)
pankso@7 82 host=$(echo $main | cut -d '|' -f 2)
pankso@7 83 [ "$host" ] || exit 0
pankso@10 84 terminal -hold -geometry 72x14 \
pankso@7 85 -e "ssfs setup --login=$login --host=$host"
pankso@7 86 }
pankso@7 87
pankso@7 88 #
pankso@7 89 # Commands
pankso@7 90 #
pankso@7 91
pankso@7 92 case "$1" in
pankso@7 93 help)
pankso@7 94 echo "Usage: $app [command]" ;;
pankso@7 95 setup)
pankso@7 96 setup ;;
pankso@7 97 *)
pankso@7 98 tools ;;
pankso@7 99 esac
pankso@7 100 exit 0