diff options
author | jakobst1n <jakob.stendahl@outlook.com> | 2022-03-01 13:44:09 +0100 |
---|---|---|
committer | jakobst1n <jakob.stendahl@outlook.com> | 2022-03-01 13:44:09 +0100 |
commit | 8c8ea3760651c226e585a67b3800e676a2cc86c0 (patch) | |
tree | 0fd2c24d2f1187fdfb9249f7c6b95f74b360ff7a /bin | |
parent | 661605170322a3f7eff49f733fa2e0b25038ef22 (diff) | |
download | dotfiles-8c8ea3760651c226e585a67b3800e676a2cc86c0.tar.gz dotfiles-8c8ea3760651c226e585a67b3800e676a2cc86c0.zip |
Update a few things
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/auto-autorandr.sh | 4 | ||||
-rw-r--r-- | bin/automon.sh | 0 | ||||
-rwxr-xr-x | bin/mount_dev | 50 | ||||
-rwxr-xr-x | bin/umount_dev | 8 |
4 files changed, 62 insertions, 0 deletions
diff --git a/bin/auto-autorandr.sh b/bin/auto-autorandr.sh new file mode 100755 index 0000000..c97e90a --- /dev/null +++ b/bin/auto-autorandr.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +sleep 1 +autorandr --change diff --git a/bin/automon.sh b/bin/automon.sh deleted file mode 100644 index e69de29..0000000 --- a/bin/automon.sh +++ /dev/null diff --git a/bin/mount_dev b/bin/mount_dev new file mode 100755 index 0000000..5255a18 --- /dev/null +++ b/bin/mount_dev @@ -0,0 +1,50 @@ +#!/bin/sh + +DIR="/usr/local/Development/$2" +tput setaf 4 +echo "Mounting \"$1:$DIR\" to \"$DIR\"." +tput sgr0 + +if [ ! -d "$DIR" ]; then + tput setaf 3 + echo "Directory does not exist, creating now." + tput sgr0 + sudo mkdir -p "$DIR" + sudo chown "$USER":"$USER" "$DIR" +fi + +# Check if there is an existing mount of the mountpoint +EMOUNT=$(findmnt -l | grep "$DIR") +if [ "$EMOUNT" ]; then + source="$(awk '{split($0, a); print a[2]}' <<< $EMOUNT)" + fs="$(awk '{split($0, a); print a[3]}' <<< $EMOUNT)" + tput setaf 1 + echo "\"$source\" mounted on mountpoint using \"$fs\" already." + tput sgr0 + exit 1 +fi + +if [ "$(ls -A $DIR)" ]; then + tput setaf 1 + echo "Mountpoint is not empty, exiting..." + tput sgr0 + exit 1 +fi + +sshfs "$1":"$DIR" "$DIR" + +if [ ! -f "/media/$2" ]; then + sudo mkdir -p /media/$2 + sudo chown "$USER":"$USER" "/media/$2" +fi +if [ "$(ls -A /media/$2)" ]; then + tput setaf 1 + echo "\"/media/$2\" exists, will not create symlink to mountpoint" + tput sgr0 +else + sudo mount --bind --verbose "$DIR" "/media/$2" +fi + +tput setaf 2 +echo "Done" +tput sgr0 diff --git a/bin/umount_dev b/bin/umount_dev new file mode 100755 index 0000000..e2cc87a --- /dev/null +++ b/bin/umount_dev @@ -0,0 +1,8 @@ +#!/bin/sh + +echo "Unmounting /media/$1" +sudo umount -l "/media/$1" +sudo rm -r "/media/$1" +echo "Unmounting /usr/local/Development/$1" +sudo umount -l "/usr/local/Development/$1" +echo "EOF" |