From a8f84076e19e5ec06e251d7131ad6e3ce584028e Mon Sep 17 00:00:00 2001 From: Emmet Date: Sat, 28 Dec 2024 11:03:24 -0600 Subject: [PATCH] Moved scripts into scripts/ --- harden.sh => scripts/harden.sh | 4 ++-- install.sh => scripts/install.sh | 2 +- pull.sh => scripts/pull.sh | 4 ++-- soften.sh => scripts/soften.sh | 2 +- sync-posthook.sh => scripts/sync-posthook.sh | 0 sync-system.sh => scripts/sync-system.sh | 2 +- sync-user.sh => scripts/sync-user.sh | 2 +- sync.sh => scripts/sync.sh | 0 update.sh => scripts/update.sh | 2 +- upgrade.sh => scripts/upgrade.sh | 0 system/bin/phoenix.nix | 18 +++++++++--------- 11 files changed, 18 insertions(+), 18 deletions(-) rename harden.sh => scripts/harden.sh (93%) rename install.sh => scripts/install.sh (97%) rename pull.sh => scripts/pull.sh (85%) rename soften.sh => scripts/soften.sh (94%) rename sync-posthook.sh => scripts/sync-posthook.sh (100%) rename sync-system.sh => scripts/sync-system.sh (78%) rename sync-user.sh => scripts/sync-user.sh (82%) rename sync.sh => scripts/sync.sh (100%) rename update.sh => scripts/update.sh (88%) rename upgrade.sh => scripts/upgrade.sh (100%) diff --git a/harden.sh b/scripts/harden.sh similarity index 93% rename from harden.sh rename to scripts/harden.sh index ef13c6d6..02416d26 100755 --- a/harden.sh +++ b/scripts/harden.sh @@ -18,16 +18,16 @@ if [ "$#" = 1 ]; then else SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) fi -pushd $SCRIPT_DIR &> /dev/null; +pushd $SCRIPT_DIR/.. &> /dev/null; sudo chown 0:0 .; sudo chown 0:0 profiles/*; sudo chown -R 0:0 system; +sudo chown 0:0 -R scripts; sudo chown -R 0:0 patches; sudo chown 0:0 flake.lock; sudo chown 0:0 flake.nix sudo chown 0:0 profiles sudo chown 0:0 profiles/*/configuration.nix; sudo chown 0:0 profiles/homelab/base.nix; -sudo chown 0:0 *.sh; sudo chown 1000:users **/README.org; popd &> /dev/null; diff --git a/install.sh b/scripts/install.sh similarity index 97% rename from install.sh rename to scripts/install.sh index c167cf48..16f0afdb 100755 --- a/install.sh +++ b/scripts/install.sh @@ -36,7 +36,7 @@ fi $EDITOR $SCRIPT_DIR/flake.nix; # Permissions for files that should be owned by root -sudo $SCRIPT_DIR/harden.sh $SCRIPT_DIR; +sudo $SCRIPT_DIR/scripts/harden.sh $SCRIPT_DIR; # Rebuild system sudo nixos-rebuild switch --flake $SCRIPT_DIR#system; diff --git a/pull.sh b/scripts/pull.sh similarity index 85% rename from pull.sh rename to scripts/pull.sh index 951733a9..5c27c5c0 100755 --- a/pull.sh +++ b/scripts/pull.sh @@ -7,10 +7,10 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) # Relax permissions temporarily so git can work -sudo $SCRIPT_DIR/soften.sh $SCRIPT_DIR; +sudo $SCRIPT_DIR/scripts/soften.sh $SCRIPT_DIR; # Stash local edits, pull changes, and re-apply local edits -pushd $SCRIPT_DIR &> /dev/null; +pushd $SCRIPT_DIR/.. &> /dev/null; git stash; git pull; git stash apply; diff --git a/soften.sh b/scripts/soften.sh similarity index 94% rename from soften.sh rename to scripts/soften.sh index 84dde5f3..ba3196d4 100755 --- a/soften.sh +++ b/scripts/soften.sh @@ -22,6 +22,6 @@ if [ "$#" = 1 ]; then else SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) fi -pushd $SCRIPT_DIR &> /dev/null; +pushd $SCRIPT_DIR/scripts &> /dev/null; sudo chown -R 1000:users .; popd &> /dev/null; diff --git a/sync-posthook.sh b/scripts/sync-posthook.sh similarity index 100% rename from sync-posthook.sh rename to scripts/sync-posthook.sh diff --git a/sync-system.sh b/scripts/sync-system.sh similarity index 78% rename from sync-system.sh rename to scripts/sync-system.sh index 34f27e83..050ae2cd 100755 --- a/sync-system.sh +++ b/scripts/sync-system.sh @@ -7,4 +7,4 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) # Rebuild system -sudo nixos-rebuild switch --flake $SCRIPT_DIR#system; +sudo nixos-rebuild switch --flake $SCRIPT_DIR/..#system; diff --git a/sync-user.sh b/scripts/sync-user.sh similarity index 82% rename from sync-user.sh rename to scripts/sync-user.sh index 7bcfde5a..c9d3372f 100755 --- a/sync-user.sh +++ b/scripts/sync-user.sh @@ -7,6 +7,6 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) # Install and build home-manager configuration -home-manager switch --flake $SCRIPT_DIR#user -b bkp; +home-manager switch --flake $SCRIPT_DIR/..#user -b bkp; $SCRIPT_DIR/sync-posthook.sh diff --git a/sync.sh b/scripts/sync.sh similarity index 100% rename from sync.sh rename to scripts/sync.sh diff --git a/update.sh b/scripts/update.sh similarity index 88% rename from update.sh rename to scripts/update.sh index 26ab74c9..ee4b5929 100755 --- a/update.sh +++ b/scripts/update.sh @@ -6,7 +6,7 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) # Update flake -pushd $SCRIPT_DIR &> /dev/null; +pushd $SCRIPT_DIR/.. &> /dev/null; sudo nix flake update; sudo nix-channel --update; nix-channel --update; diff --git a/upgrade.sh b/scripts/upgrade.sh similarity index 100% rename from upgrade.sh rename to scripts/upgrade.sh diff --git a/system/bin/phoenix.nix b/system/bin/phoenix.nix index 15e8ccc1..3d88c100 100644 --- a/system/bin/phoenix.nix +++ b/system/bin/phoenix.nix @@ -3,13 +3,13 @@ let myScript = '' if [ "$1" = "sync" ]; then if [ "$#" = 1 ]; then - ''+userSettings.dotfilesDir+''/sync.sh; + ''+userSettings.dotfilesDir+''/scripts/sync.sh; exit 0; elif [ "$2" = "user" ]; then - ''+userSettings.dotfilesDir+''/sync-user.sh; + ''+userSettings.dotfilesDir+''/scripts/sync-user.sh; exit 0; elif [ "$2" = "system" ]; then - ''+userSettings.dotfilesDir+''/sync-system.sh; + ''+userSettings.dotfilesDir+''/scripts/sync-system.sh; exit 0; else echo "Please pass 'system' or 'user' if supplying a second argument" @@ -18,37 +18,37 @@ let myScript = '' if [ "$#" -gt 1 ]; then echo "Warning: The 'refresh' command has no subcommands (no $2 subcommand)"; fi - ''+userSettings.dotfilesDir+''/sync-posthook.sh; + ''+userSettings.dotfilesDir+''/scripts/sync-posthook.sh; exit 0; elif [ "$1" = "update" ]; then if [ "$#" -gt 1 ]; then echo "Warning: The 'update' command has no subcommands (no $2 subcommand)"; fi - ''+userSettings.dotfilesDir+''/update.sh; + ''+userSettings.dotfilesDir+''/scripts/update.sh; exit 0; elif [ "$1" = "upgrade" ]; then if [ "$#" -gt 1 ]; then echo "Warning: The 'update' command has no subcommands (no $2 subcommand)"; fi - ''+userSettings.dotfilesDir+''/upgrade.sh; + ''+userSettings.dotfilesDir+''/scripts/upgrade.sh; exit 0; elif [ "$1" = "pull" ]; then if [ "$#" -gt 1 ]; then echo "Warning: The 'upgrade' command has no subcommands (no $2 subcommand)"; fi - ''+userSettings.dotfilesDir+''/pull.sh; + ''+userSettings.dotfilesDir+''/scripts/pull.sh; exit 0; elif [ "$1" = "harden" ]; then if [ "$#" -gt 1 ]; then echo "Warning: The 'harden' command has no subcommands (no $2 subcommand)"; fi - ''+userSettings.dotfilesDir+''/harden.sh; + ''+userSettings.dotfilesDir+''/scripts/harden.sh; exit 0; elif [ "$1" = "soften" ]; then if [ "$#" -gt 1 ]; then echo "Warning: The 'soften' command has no subcommands (no $2 subcommand)"; fi - ''+userSettings.dotfilesDir+''/soften.sh; + ''+userSettings.dotfilesDir+''/scripts/soften.sh; exit 0; elif [ "$1" = "gc" ]; then if [ "$#" -gt 2 ]; then