Skip to content

Commit

Permalink
scripts: Clean up, add root check
Browse files Browse the repository at this point in the history
- Add `set -euo pipefail` to several scripts which were missing it
- Add a check for if `nix-setup` is running as root and exit if so
  • Loading branch information
RandomSpaceship authored and DingoOz committed Jan 6, 2025
1 parent 88af433 commit add8dd0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion software/scripts/clean.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#! /usr/bin/env bash
set -e
set -euo pipefail

shopt -s globstar # Enable globstar for recursive globbing

Expand Down
2 changes: 1 addition & 1 deletion software/scripts/nix-package.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

set -e
set -euo pipefail

# cd to the software directory
cd "$(git rev-parse --show-toplevel)"/software
Expand Down
8 changes: 7 additions & 1 deletion software/scripts/nix-setup.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#!/usr/bin/env bash

set -e
set -euo pipefail

# exit if run as root
if [ "$EUID" -eq 0 ]; then
echo "Please run as yourself! Running as superuser (ie, with sudo) breaks the setup."
exit
fi

echo "Setting up git submodule repos"

Expand Down

0 comments on commit add8dd0

Please sign in to comment.