ssfs rev 36
ssfs-server: Add notes support for the web interface
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Sun Jun 12 14:26:41 2011 +0200 (2011-06-12) |
parents | 72c49d4cc4e9 |
children | 9b2eacb4078b |
files | ssfs-server |
line diff
1.1 --- a/ssfs-server Sun Jun 12 13:38:25 2011 +0200 1.2 +++ b/ssfs-server Sun Jun 12 14:26:41 2011 +0200 1.3 @@ -111,6 +111,16 @@ 1.4 echo "" 1.5 } 1.6 1.7 +vdisk_config() { 1.8 + cat > $root/etc/vdisk.conf << EOT 1.9 +# /etc/vdisk.conf: Ssfs virtual autogenated config file. 1.10 + 1.11 +VDATE="$date" 1.12 +VSIZE="$size" 1.13 +FILES="$files" 1.14 +EOT 1.15 +} 1.16 + 1.17 # Handle Ssfs virtual disk. 1.18 umount_vdisk() { 1.19 if mount | fgrep -q $root; then 1.20 @@ -210,6 +220,14 @@ 1.21 chroot $root 1.22 gettext -e "\nBack to the host system:" 1.23 echo -e " $(hostname)\n" ;; 1.24 + note) 1.25 + # Admin notes for users and displayed on the web interface. 1.26 + note="$2" 1.27 + date=$(date "+%Y-%m-%d %H:%M") 1.28 + if [ "$note" ]; then 1.29 + gettext "Adding note to:"; echo " $state/notes" 1.30 + echo "$date : $note" >> $state/notes 1.31 + fi ;; 1.32 gen-vdisk) 1.33 # Generate a virtual disk with a minimal chroot for Ssfs users home. 1.34 rootfs=$share/rootfs 1.35 @@ -278,9 +296,10 @@ 1.36 cp -a /lib/$l* $root/lib 1.37 done && status 1.38 1.39 - # Ssfs chroot SHell 1.40 + # Ssfs chroot SHell and declare vdisk config. 1.41 gettext "Installing Ssfs SHell..." 1.42 install -m 0755 /bin/ssfs-sh $root/bin 1.43 + touch $root/etc/vdisk.conf 1.44 status 1.45 1.46 # List of all system files. 1.47 @@ -290,11 +309,16 @@ 1.48 do 1.49 find ./$d | sed s'/^.//' >> $state/vdisk.files 1.50 done 1.51 - cat $state/vdisk.files | wc -l 1.52 - 1.53 + files=$(cat $state/vdisk.files | wc -l) 1.54 + echo "$files" 1.55 + 1.56 + # Create chroot /etc/vdisk.conf 1.57 + size=$(du -sh $vdisk | awk '{print $1}') 1.58 + used=$(du -sh $root | awk '{print $1}') 1.59 + date=$(date '+%Y-%m-%d %H:%M') 1.60 + vdisk_config 1.61 separator 1.62 - size=$(du -sh $root | awk '{print $1}') 1.63 - gettext "Vdisk used space:"; echo -e " $size\n" ;; 1.64 + gettext "Vdisk used space:"; echo -e " $used - $date\n" ;; 1.65 mount-vdisk) 1.66 mount_vdisk ;; 1.67 umount-vdisk)