tazpanel rev 376
Add non-root support
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Wed Jul 31 22:43:46 2013 +0200 (2013-07-31) |
parents | c48b0c995b14 |
children | aa22bfbb483c |
files | data/httpd.conf hardware.cgi lib/libtazpanel |
line diff
1.1 --- a/data/httpd.conf Mon Jul 29 20:45:13 2013 +0200 1.2 +++ b/data/httpd.conf Wed Jul 31 22:43:46 2013 +0200 1.3 @@ -3,4 +3,4 @@ 1.4 D:* 1.5 *.cgi:/bin/sh 1.6 I:index.cgi 1.7 -/:root:* 1.8 +/:*:*
2.1 --- a/hardware.cgi Mon Jul 29 20:45:13 2013 +0200 2.2 +++ b/hardware.cgi Wed Jul 31 22:43:46 2013 +0200 2.3 @@ -272,6 +272,20 @@ 2.4 2.5 2.6 # 2.7 + # Loop device management actions 2.8 + # 2.9 + device=$(GET loopdev) 2.10 + lib crypto $device 2.11 + case "$device" in 2.12 + /dev/loop*) 2.13 + set -- $(losetup | grep ^$device:) 2.14 + [ -n "$3" ] && losetup -d $device 2.15 + ro="" 2.16 + [ -n "$(GET readonly)" ] && ro="-r" 2.17 + file="$(GET backingfile)" 2.18 + [ -n "$file" ] && losetup -o $(GET offset) $ro $device $file 2.19 + esac 2.20 + # 2.21 # Disk stats and management (mount, umount, check) 2.22 # 2.23 device=$(GET device) 2.24 @@ -291,7 +305,7 @@ 2.25 EOT 2.26 df_thead 2.27 echo '<tbody>' 2.28 - for fs in $(blkid | sort | sed 's/:.*//') 2.29 + for fs in $(blkid | sed 's/:.*//') 2.30 do 2.31 set -- $(df -h | grep "^$fs ") 2.32 size=$2 2.33 @@ -367,8 +381,10 @@ 2.34 EOT 2.35 2.36 grep -v '^#' /etc/fstab | awk 'BEGIN{print "<table class=\"zebra outbox\">\ 2.37 - <thead><tr><td>spec</td><td>file</td><td>vfstype</td><td>mntops</td><td>\ 2.38 - freq</td><td>passno</td></thead><tbody>"}{print "<tr><td>"$1"</td><td>"$2\ 2.39 + <thead><tr><td>$(gettext 'Disk')</td><td>$(gettext 'Mount point')</td><td>\ 2.40 + $(gettext 'Type')</td><td>$(gettext 'Options')</td><td>\ 2.41 + $(gettext 'Freq')</td><td>$(gettext 'Pass')</td></thead><tbody>"}\ 2.42 + {print "<tr><td>"$1"</td><td>"$2\ 2.43 "</td><td>"$3"</td><td>"$4"</td><td>"$5"</td><td>"$6"</td></tr>"} 2.44 END{print "</tbody></table>"}' 2.45 2.46 @@ -380,19 +396,8 @@ 2.47 <h3>$(gettext 'Loop devices')</h3> 2.48 EOT 2.49 # 2.50 - # Loop device management 2.51 + # Loop device management gui 2.52 # 2.53 - device=$(GET loopdev) 2.54 - lib crypto $device 2.55 - case "$device" in 2.56 - /dev/loop*) 2.57 - set -- $(losetup | grep ^$device:) 2.58 - [ -n "$3" ] && losetup -d $device 2.59 - ro="" 2.60 - [ -n "$(GET readonly)" ] && ro="-r" 2.61 - file="$(GET backingfile)" 2.62 - [ -n "$file" ] && losetup -o $(GET offset) $ro $device $file 2.63 - esac 2.64 cat << EOT 2.65 <form method="get" action="$SCRIPT_NAME#loop"> 2.66 <table id="loop" class="zebra outbox nowrap">
3.1 --- a/lib/libtazpanel Mon Jul 29 20:45:13 2013 +0200 3.2 +++ b/lib/libtazpanel Wed Jul 31 22:43:46 2013 +0200 3.3 @@ -3,6 +3,8 @@ 3.4 # Common functions for TazPanel CGI and cmdline interface 3.5 # 3.6 3.7 +[ "$(id -un)" == "$REMOTE_USER" ] || exec su -c "$(realpath $0) $@" $REMOTE_USER 3.8 + 3.9 # Get parameters with GET, POST and FILE functions 3.10 . /usr/lib/slitaz/httphelper 3.11