From: Nicolas Boisselier Date: Wed, 26 Jun 2019 02:44:54 +0000 (+0100) Subject: etc/profile.d/sys.sh X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=a7212a8aeb823b19a2c1061dc4e2d98ffd8e90d4;p=nb.git etc/profile.d/sys.sh --- diff --git a/etc/profile.d/sys.sh b/etc/profile.d/sys.sh index 4a893aad..699eb26c 100644 --- a/etc/profile.d/sys.sh +++ b/etc/profile.d/sys.sh @@ -84,17 +84,7 @@ sys_df() { # On docker root / mount point is "none" [ -e "$mount" -o "$dir" = "/" ] || continue -# NB 12.12.17 inodes=($(df -P -l "$dir" | tail -n +2)) -# NB 12.12.17 iused=${inodes[2]} -# NB 12.12.17 ifree=${inodes[3]} -# NB 12.12.17 ipcent=${inodes[4]} -# NB 12.12.17 ipcent=${pcent//%/} -# NB 12.12.17 idir=${inodes[5]} - echo -e "$dir\t$pcent\t$used\t$free" - #echo -e "$dir\tused\t$used" - #echo -e "$dir\tfree\t$free" - #echo -e "$dir\tpcent\t$pcent" done } @@ -245,32 +235,3 @@ sys_temperatures() { # NB 13.05.19 awk '{printf("%.1f\n",$1/1000)}' /sys/class/thermal/thermal_zone*/temp #awk '{ count++; sum+=$1 } END {printf("%.1f",sum/count/1000)}' /sys/class/thermal/thermal_zone*/temp } - -sys_umount_dir() { - sys_mount_dir --unmount $@ -} - -sys_mount_dir() { - local usage="Usage: sys_mount_dir [--umount] DIR" - - local umount=0 - [ "$1" = "--unmount" ] && umount=1 && shift - - local dir=${1:?$usage} - [ ! -d "$dir" ] && echo "$usage" && return 1 - local real_dir="$(cd "$dir" && pwd -P)" - [ 0 = 1 \ - -o "$real_dir" = "/" \ - -o "$real_dir" = "$(pwd)" \ - ] && echo "Directory not allowed: $dir ( $real_dir )" && return 1 - - for i in proc dev dev/pts dev/shm sys; do - [ -d "/$i" -a -d "$dir/$i" ] || continue - - if [ "$umount" = "0" ]; then - echo mount -v -o bind /$i $dir/$i - else - echo umount -v $dir/$i - fi - done -}