~ salmonella-environment-setup (master) 013ad9911efe61ae52522302092428e979676052
commit 013ad9911efe61ae52522302092428e979676052
Author: Mario Domenech Goulart <mario@parenteses.org>
AuthorDate: Sun Mar 30 18:44:42 2025 +0200
Commit: Mario Domenech Goulart <mario@parenteses.org>
CommitDate: Sun Mar 30 18:44:42 2025 +0200
Add scripts/common/system-update.sh
diff --git a/scripts/common/system-update.sh b/scripts/common/system-update.sh
new file mode 100755
index 0000000..85ecaa8
--- /dev/null
+++ b/scripts/common/system-update.sh
@@ -0,0 +1,26 @@
+#! /bin/sh
+
+os=$(uname)
+
+if [ "$(id -u)" != 0 ]; then
+ if [ "$os" = "OpenBSD" ]; then
+ exec doas "$0" "$@"
+ else
+ exec sudo "$0" "$@"
+ fi
+fi
+
+case "$os" in
+ OpenBSD)
+ syspatch
+ pkg_add -u
+ ;;
+ Linux)
+ apt-get update
+ apt-get dist-upgrade
+ apt-get clean
+ ;;
+ *)
+ echo "Unsupported operating system" >&2
+ exit 1
+esac
Trap