slitaz-tools rev 759
Add new scp-box
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Wed May 02 15:56:39 2012 +0200 (2012-05-02) |
parents | ac3b66b7cd05 |
children | dcd422726ad5 |
files | Makefile applications/scp-box.desktop applications/tazinst-doc.desktop boxes/scp-box doc/style.css |
line diff
1.1 --- a/Makefile Tue May 01 12:47:28 2012 +0200 1.2 +++ b/Makefile Wed May 02 15:56:39 2012 +0200 1.3 @@ -29,7 +29,7 @@ 1.4 @echo -n "Generating SliTaz Boxes pot file... " 1.5 @xgettext -o po/slitaz-boxes/slitaz-boxes.pot -L Shell \ 1.6 --package-name="SliTaz Boxes" \ 1.7 - ./boxes/wifi-box ./boxes/burn-box 1.8 + ./boxes/wifi-box ./boxes/burn-box ./boxes/scp-box 1.9 @echo "done" 1.10 1.11 tazbox-pot:
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/applications/scp-box.desktop Wed May 02 15:56:39 2012 +0200 2.3 @@ -0,0 +1,10 @@ 2.4 +[Desktop Entry] 2.5 +Encoding=UTF-8 2.6 +Name=SCP Secure copy 2.7 +Name[fr]=Copie sécurisée SCP 2.8 +Name[pt]=SCP Cópia Segura de Arquivos 2.9 +Name[pt_BR]=SCP Cópia Segura de Arquivos 2.10 +Exec=scp-box 2.11 +Icon=folder-remote 2.12 +Type=Application 2.13 +Categories=Application;Network;
3.1 --- a/applications/tazinst-doc.desktop Tue May 01 12:47:28 2012 +0200 3.2 +++ b/applications/tazinst-doc.desktop Wed May 02 15:56:39 2012 +0200 3.3 @@ -4,7 +4,7 @@ 3.4 Name[pt]=Manual do Tazinst 3.5 Name[pt_BR]=Manual do Tazinst 3.6 Name[fr]=Manuel de Tazinst 3.7 -Exec=browser file:///usr/share/doc/slitaz-tools/tazinst.html 3.8 +Exec=browser file:///usr/share/doc/slitaz/tazinst.html 3.9 Icon=text-html 3.10 Type=Application 3.11 Categories=Documentation;
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/boxes/scp-box Wed May 02 15:56:39 2012 +0200 4.3 @@ -0,0 +1,142 @@ 4.4 +#!/bin/sh 4.5 +# 4.6 +# SCP Box - Small front end to the secure file copy utility. 4.7 +# 4.8 +# Copyright (C) 2008-2012 SliTaz GNU/Linux - BSD License 4.9 +# 4.10 +# Author: Christophe Lincoln <pankso@slitaz.org> 4.11 +# 4.12 +. /lib/libtaz.sh 4.13 + 4.14 +[ "$file" ] || file="$HOME" 4.15 +[ "$dir" ] || dir="$HOME" 4.16 + 4.17 +# Internal variables (we need a space before options). 4.18 +config=$HOME/.config/scpbox 4.19 +icon=/usr/share/pixmaps/slitaz-icon.png 4.20 +term="xterm -geometry 80x16" 4.21 +scpopts=" -r -P 22" 4.22 + 4.23 +# Make sure we have a config files. 4.24 +if [ ! -d "$config" ] || [ -f "$config/hosts" ]; then 4.25 + mkdir -p $config 4.26 + touch $config/hosts && chmod 0600 $config/hosts 4.27 +fi 4.28 + 4.29 +# 4.30 +# Functions 4.31 +# 4.32 + 4.33 +# Help and usage 4.34 +usage() { 4.35 + cat << EOT 4.36 + 4.37 +$(gettext "Usage:") $(basename $0) [command|option] 4.38 + 4.39 +$(gettext "Commands:") 4.40 + list-hosts $(gettext "List all know hosts") 4.41 + 4.42 +$(gettext "Options:") 4.43 + --file=/path/to/file 4.44 + --dir=/path/to/directory 4.45 + 4.46 +$(gettext "Examples:") 4.47 + $(basename $0) --file=/path/to/file 4.48 + 4.49 +EOT 4.50 +} 4.51 + 4.52 +# List last used hosts. 4.53 +list_hosts() { 4.54 + for h in $(cat $config/hosts) 4.55 + do 4.56 + echo -n "!$h" 4.57 + done 4.58 +} 4.59 + 4.60 +# Main GUI box function with pure Yad spec 4.61 +scpbox_main() { 4.62 + text=$(gettext "<b>Secure copy</b> - Copy files remotly with scp") 4.63 + yad --form --title="SCP Box" --window-icon=$icon \ 4.64 + --image=folder-remote --image-on-top \ 4.65 + --height=320 --width=500 --text="$text" \ 4.66 + --field="$(gettext "User name:")" \ 4.67 + --field="$(gettext "Hostname:")" \ 4.68 + --field="$(gettext "Know hosts:")":CB \ 4.69 + --field="$(gettext "Options:")" \ 4.70 + --field="$(gettext "Local file:")":FL \ 4.71 + --field="$(gettext "Local directory:")":DIR \ 4.72 + --field="$(gettext "Remote path:")" \ 4.73 + --button="$(gettext "Download")":2 \ 4.74 + --button="$(gettext "Upload")":0 \ 4.75 + --button="gtk-close":1 \ 4.76 + "$USER" "" "$(list_hosts)" "$scpopts" "$file" "$dir" "" 4.77 +} 4.78 + 4.79 +# Main function 4.80 +scpbox() { 4.81 + # Store box results 4.82 + main=$(scpbox_main) 4.83 + ret=$? 4.84 + [ "$debug" ] && echo "DEBUG: main=$main" 4.85 + 4.86 + user=$(echo $main | cut -d "|" -f 1) 4.87 + hostname=$(echo $main | cut -d "|" -f 2) 4.88 + options=$(echo $main | cut -d "|" -f 4) 4.89 + remote=$(echo $main | cut -d "|" -f 7) 4.90 + 4.91 + # Use and store new hostname. 4.92 + if [ "$hostname" ]; then 4.93 + echo "$hostname" >> $config/hosts 4.94 + host="$hostname" 4.95 + else 4.96 + host=$(echo $main | cut -d "|" -f 3) 4.97 + fi 4.98 + if [ "$host" == "(null)" ] || [ ! "$host" ]; then 4.99 + echo "No host: exit" && exit 0 4.100 + fi 4.101 + 4.102 + # Deal with --button values 4.103 + case $ret in 4.104 + 0) 4.105 + # Upload: do we have a single file or a directory (skip $HOME) 4.106 + file=$(echo $main | cut -d "|" -f 5) 4.107 + dir=$(echo $main | cut -d "|" -f 6) 4.108 + if [ -f "$file" ]; then 4.109 + local="$file" 4.110 + elif [ "$dir" != "$HOME" ]; then 4.111 + local="$dir" 4.112 + else 4.113 + echo "No file: exit" && exit 0 4.114 + fi 4.115 + cmd="scp $options $local $user@$host:$remote" 4.116 + [ "$debug" ] && echo "DEBUG: $cmd" 4.117 + $term -e "$cmd" ;; 4.118 + 2) 4.119 + # Download: we need a remote a file. 4.120 + local=$(echo $main | cut -d "|" -f 6) 4.121 + if [ ! "$remote" ]; then 4.122 + echo "No remote file: exit" && exit 0 4.123 + fi 4.124 + cmd="scp $options $user@$host:$remote $local" 4.125 + [ "$debug" ] && echo "DEBUG: $cmd" 4.126 + $term -e "$cmd" ;; 4.127 + *) 4.128 + exit 0 ;; 4.129 + esac 4.130 +} 4.131 + 4.132 +# 4.133 +# Commands 4.134 +# 4.135 + 4.136 +case "$1" in 4.137 + list-hosts) 4.138 + list_hosts ;; 4.139 + ""|--*) 4.140 + scpbox ;; 4.141 + *) 4.142 + usage ;; 4.143 +esac 4.144 + 4.145 +exit 0
5.1 --- a/doc/style.css Tue May 01 12:47:28 2012 +0200 5.2 +++ b/doc/style.css Wed May 02 15:56:39 2012 +0200 5.3 @@ -1,7 +1,7 @@ 5.4 /* CSS style for SliTaz Doc */ 5.5 5.6 html { min-height: 102%; } 5.7 -body { font: 88% sans-serif, vernada, arial; margin: 0; } 5.8 +body { font: 13px sans-serif, vernada, arial; margin: 0; } 5.9 h1 { margin: 0; padding: 8px; color: #fff; font-size: 20px; } 5.10 h2 { color: #d66018; } h3 { color: #666; font-size: 140%; } 5.11 a:hover { text-decoration: none; }