Last active
August 29, 2015 13:56
-
-
Save xupyprmv/9322394 to your computer and use it in GitHub Desktop.
Revisions
-
xupyprmv renamed this gist
Mar 3, 2014 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
xupyprmv revised this gist
Mar 3, 2014 . 1 changed file with 25 additions and 18 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,22 +1,29 @@ #!/bin/sh # Check parameter if [ $# -eq 0 ]; then echo "No argument specified. Right syntax is: automount.sh MOUNTPATH" exit 1 else # Check fstab contains folder if cat /etc/fstab | grep $1 > /dev/null; then # Check directory already mapped if mountpoint $1 | grep 'is not a mountpoint' > /dev/null; then # Move content into tmp folder if dir is not empty if [ "$(ls -A $1)" ]; then TDIR=`mktemp -d`. mv "$1"/* $TDIR || exit 1 # Mount folder mount $1 || true # Copy content from tmp folder to mounted folder mv "$TDIR"/* $1 else. # Just mount folder mount $1 fi fi else echo "/etc/fstab not contains folder $1" exit 1 fi fi -
xupyprmv revised this gist
Mar 3, 2014 . 2 changed files with 22 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ #!/bin/sh # Check parameter if [ $# -eq 0 ] then echo "No argument specified. Right syntax is: automount.sh MOUNTPATH" exit 1 else # Check fstab contains directory if [cat /etc/fstab/ | grep $1] then # Check directory already mapped if [ mountpoint -q $1 ] then echo "123" mount $1 fi else echo "/etc/fstab not contains $1 directory" exit 1 fi fi This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +0,0 @@ -
xupyprmv created this gist
Mar 3, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ Проверено на Ubuntu 12.04. automount.sh mountpoint -q /foo/bar || mount -o bind /some/directory/here /foo/bar