Cleanup files before release
@@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"MD013": false,
|
|
||||||
"MD024": {
|
|
||||||
"siblings_only": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
1609
README.html
|
Before Width: | Height: | Size: 52 KiB |
|
Before Width: | Height: | Size: 40 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 52 KiB |
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 51 KiB |
|
Before Width: | Height: | Size: 25 KiB |
@@ -1,60 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
# Add a drive to the system
|
|
||||||
# TODO generalize
|
|
||||||
# Copyright 2021 Bryan C. Roessler
|
|
||||||
|
|
||||||
parent="${BASH_SOURCE[0]}"
|
|
||||||
parent=${parent%/*}
|
|
||||||
|
|
||||||
[[ -f $parent/script-functions ]] && . "$parent"/script-functions || exit 1
|
|
||||||
|
|
||||||
is_root
|
|
||||||
|
|
||||||
unset drive mountpoint
|
|
||||||
|
|
||||||
[[ $# -eq 0 ]] && lsblk -f && echo "Must provide a drive identifier" && exit 1
|
|
||||||
|
|
||||||
[[ $# -ge 1 ]] && drive="$1"
|
|
||||||
|
|
||||||
[[ $# -eq 2 ]] && mountpoint="$2"
|
|
||||||
|
|
||||||
[[ $# -gt 2 ]] && echo "Too many arguments passed" && exit 1
|
|
||||||
|
|
||||||
! info=$(lsblk -n -o NAME,FSTYPE,LABEL,UUID,MOUNTPOINT "$drive" | tr -s ' ') && echo "Drive $drive does not exist" && exit 1
|
|
||||||
|
|
||||||
#name=$(cut -d' ' -f1 <<< "$info")
|
|
||||||
#fstype=$(cut -d' ' -f2 <<< "$info")
|
|
||||||
label=$(cut -d' ' -f3 <<< "$info")
|
|
||||||
#uuid=$(cut -d' ' -f4 <<< "$info")
|
|
||||||
mountedpoint=$(cut -d' ' -f5 <<< "$info")
|
|
||||||
|
|
||||||
|
|
||||||
if [[ -d "$mountedpoint" ]]; then
|
|
||||||
echo "Drive $drive is already mounted at $mountedpoint"
|
|
||||||
ask_ok "OK to unmount?" || exit $?
|
|
||||||
umount "$mountedpoint" || exit $?
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -v mountpoint ]]; then
|
|
||||||
label=$(cut -d' ' -f3 <<< "$info")
|
|
||||||
if [[ "$label" == "" ]]; then
|
|
||||||
echo "No mount point provided and could not autodetect FS label"
|
|
||||||
read -r -p "Please enter a mountpoint: " mountpoint
|
|
||||||
else
|
|
||||||
mountpoint="/mnt/$label"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -d "$mountpoint" ]] && [[ "$(ls -A /path/to/dir)" ]]; then
|
|
||||||
echo "Warning: $mountpoint is not empty!"
|
|
||||||
echo "Here are the contents:"
|
|
||||||
ls -al "$mountpoint"
|
|
||||||
read -r -p "Please enter an empty mountpoint: " mountpoint
|
|
||||||
fi
|
|
||||||
|
|
||||||
[[ ! -d "$mountpoint" ]] && mkdir -p "$mountpoint"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||