Fix utility script bugs

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2024-12-20 10:00:01 +00:00
parent dbc913fcd8
commit 6c32412fa3
7 changed files with 35 additions and 20 deletions

View File

@@ -59,7 +59,7 @@ setup_wifi() {
fi
echo "Waiting for a network connection..."
for i in {1..10}; do
for _ in {1..10}; do
if ping -c 1 google.com &>/dev/null; then
echo "Connected to the network successfully."
return
@@ -73,8 +73,9 @@ setup_wifi() {
select_host() {
echo "Available hosts:"
echo $(nix --experimental-features "nix-command flakes" flake show --json |
nix --experimental-features "nix-command flakes" shell nixpkgs#jq --command jq -r '.nixosConfigurations | keys[]')
hosts=$(nix --experimental-features "nix-command flakes" flake show --json \
| nix --experimental-features "nix-command flakes" shell nixpkgs#jq --command jq -r '.nixosConfigurations | keys[]')
echo "${hosts}"
echo "Enter host:"
read -r host
@@ -120,8 +121,8 @@ copy_config() {
read -r copy_config
if [[ "${copy_config}" =~ ^([yY][eE][sS]|[yY])$ ]]; then
rm -rf /mnt/etc/nixos
cp -r . /mnt/etc/nixos
rm -rf /mnt/persist/etc/nixos
cp -r . /mnt/persist/etc/nixos
echo "Configuration copied successfully."
fi
}