diff --git a/scripts/.local/bin/erase-disk.sh b/scripts/.local/bin/erase-disk.sh index c3feb43..859b5e3 100755 --- a/scripts/.local/bin/erase-disk.sh +++ b/scripts/.local/bin/erase-disk.sh @@ -2,8 +2,42 @@ # USAGE: erase-disk.sh # Must be run as root -echo "# Securely erasing the disk device $2" +usage() { + echo "Usage: erase-disk.sh PASSES DEVICE" + echo "Securely erase DEVICE with PASSES passes" + echo + echo "Flags:" + echo " -h, --help \tDisplay this help message" + echo + echo "Options:" + echo " DEVICE \tThe device to erase" + echo " PASSES \tHow many times to erase DEVICE" + echo + echo "This script will securely erase a disk device with the specified amount" + echo "of passes (rounds). It does so by overwriting the specified device with" + echo "random data on the first pass, and with zeroes on the other passes." + echo "Due to the nature of disk device access permissions, the script must" + echo "be run as root." + echo + echo "erase-disk.sh is licensed under The Unlicense." + exit 0 +} + +[ "$1" = "-h" -o "$1" = "--help" ] && usage + +if [ $(id -u) -ne 0 ]; then + echo "This script must be run as root. Quitting..." + exit 1 +elif [ -z "$1" ]; then + echo "Please specify number of passes. Quitting..." + exit 1 +elif [ -z "$2" ]; then + echo "Please specify device to erase. Quitting..." + exit 1 +fi + +echo "# Securely erasing the disk device $2" i=1 while [ $i -le $1 ]; do diff --git a/zsh/.config/zsh/.zlogout b/zsh/.config/zsh/.zlogout index ff668dd..eab1c4d 100644 --- a/zsh/.config/zsh/.zlogout +++ b/zsh/.config/zsh/.zlogout @@ -1,4 +1,4 @@ -kill_services () { +kill_services() { pgrep "^ivpn-service$" && ivpn disconnect doas pkill "^ivpn-service$" diff --git a/zsh/.config/zsh/functions.zsh b/zsh/.config/zsh/functions.zsh index bf8220b..786f421 100644 --- a/zsh/.config/zsh/functions.zsh +++ b/zsh/.config/zsh/functions.zsh @@ -1,4 +1,4 @@ -doasedit () { +doasedit() { (( ${+commands[doas]} )) || return 1 doas -L doas $EDITOR /etc/doas.conf @@ -6,12 +6,12 @@ doasedit () { doas -L } -get_ip () { +get_ip() { (( ${+commands[wget]} )) || return 1 wget $@ -qO- "https://ifconfig.co/json" } -pz_upgrade () { +pz_upgrade() { pz zcompile -c >/dev/null pz pull pz zcompile >/dev/null