Skip to content

Commit

Permalink
extrapolate get_current_arch to separate script
Browse files Browse the repository at this point in the history
  • Loading branch information
moritztim committed Nov 23, 2024
1 parent 6ae4e08 commit bc0ab60
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ echo "# This script is GENERATED. Do not edit directly."
echo
cat "$DEFAULT_CONFIGURATION_FILE"
cat "$SOURCE/read_config.sh"
cat "$SOURCE/get_current_arch.sh"
cat "$SOURCE/nixos_kexec.sh"
1 change: 1 addition & 0 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ set -o pipefail -o errexit
cd "$(dirname "$0")"

source "$SOURCE/read_config.sh"
source "$SOURCE/get_current_arch.sh"
source "$SOURCE/nixos_kexec.sh" "$@"
8 changes: 8 additions & 0 deletions src/get_current_arch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Function to get system architecture
get_current_arch() {
local arch=$(uname -m)
case "$arch" in
x86_64|aarch64) echo "$arch-linux" ;;
*) echo "Unsupported architecture: $arch" >&2; exit 1 ;;
esac
}
9 changes: 0 additions & 9 deletions src/nixos_kexec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,6 @@ EOF
exit 0
}

# Function to get system architecture
get_current_arch() {
local arch=$(uname -m)
case "$arch" in
x86_64|aarch64) echo "$arch-linux" ;;
*) echo "Unsupported architecture: $arch" >&2; exit 1 ;;
esac
}

# Function to prompt for missing values
prompt_missing_values() {
if [[ -z "${SOURCE:-}" ]]; then
Expand Down

0 comments on commit bc0ab60

Please sign in to comment.