about summary refs log tree commit diff stats
path: root/pkgs/by-name/au/aumo/aumo.sh
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xpkgs/by-name/au/aumo/aumo.sh29
1 files changed, 22 insertions, 7 deletions
diff --git a/pkgs/by-name/au/aumo/aumo.sh b/pkgs/by-name/au/aumo/aumo.sh
index d86165b2..dba5ef63 100755
--- a/pkgs/by-name/au/aumo/aumo.sh
+++ b/pkgs/by-name/au/aumo/aumo.sh
@@ -1,5 +1,15 @@
 #! /usr/bin/env dash
 
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
+
 NAME="aumo"
 
 error() {
@@ -8,11 +18,11 @@ error() {
 
 die() {
     error "$1"
-    if [ -n "$2" ]; then
-        exit "$2"
-    else
-        exit 1
-    fi
+    exit "${2-1}"
+}
+
+usage() {
+    echo "Usage: $NAME mount|unmount"
 }
 
 get_mounted_labels() {
@@ -45,14 +55,19 @@ mounting() {
     udisksctl mount --block-device "/dev/disk/by-label/$disk_name"
 }
 
-case "$1" in
+case "${1-unset}" in
 "mount")
     mounting
     ;;
 "unmount" | "umount")
     unmounting
     ;;
+"unset")
+    usage
+    die "You need to provide one argument."
+    ;;
 *)
-    die "Usage: $NAME mount|unmount"
+    usage
+    die "Unknown command: '$1'"
     ;;
 esac