Added git + lots of echo
This commit is contained in:
@@ -82,21 +82,26 @@ done
|
|||||||
echo "Replacing content..."
|
echo "Replacing content..."
|
||||||
|
|
||||||
# 5.1 generated/ henrov → user
|
# 5.1 generated/ henrov → user
|
||||||
|
echo "henrov → $USER..."
|
||||||
if [ -d "$TARGET_DIR/generated" ]; then
|
if [ -d "$TARGET_DIR/generated" ]; then
|
||||||
find "$TARGET_DIR/generated" -type f -exec sed -i "s/henrov/$USER_NAME/g" {} +
|
find "$TARGET_DIR/generated" -type f -exec sed -i "s/henrov/$USER_NAME/g" {} +
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# 5.3 path replacement (skip binaries loosely)
|
# 5.3 path replacement (skip binaries loosely)
|
||||||
|
echo "path replacement..."
|
||||||
find "$TARGET_DIR" -type f -exec grep -Iq . {} \; -print | while read -r file; do
|
find "$TARGET_DIR" -type f -exec grep -Iq . {} \; -print | while read -r file; do
|
||||||
sed -i "s#~/Repos/nixos/Droidnix#~/Droidnix#g" "$file" || true
|
sed -i "s#~/Repos/nixos/Droidnix#~/Droidnix#g" "$file" || true
|
||||||
done
|
done
|
||||||
|
|
||||||
# 5.4 traveldroid → hostname everywhere
|
# 5.4 traveldroid → hostname everywhere
|
||||||
|
echo "traveldroid → $HOSTNAME"
|
||||||
find "$TARGET_DIR" -type f -exec grep -Iq . {} \; -print | while read -r file; do
|
find "$TARGET_DIR" -type f -exec grep -Iq . {} \; -print | while read -r file; do
|
||||||
sed -i "s/traveldroid/$HOSTNAME/g" "$file" || true
|
sed -i "s/traveldroid/$HOSTNAME/g" "$file" || true
|
||||||
done
|
done
|
||||||
|
|
||||||
# 5.2 & 5.6 README.org block replacement
|
# 5.2 & 5.6 README.org block replacement
|
||||||
|
echo "README.org block replacement"
|
||||||
README="$TARGET_DIR/README.org"
|
README="$TARGET_DIR/README.org"
|
||||||
|
|
||||||
if [ -f "$README" ]; then
|
if [ -f "$README" ]; then
|
||||||
@@ -117,6 +122,7 @@ fi
|
|||||||
### ─────────────────────────────
|
### ─────────────────────────────
|
||||||
### Step 6 — Hardware config
|
### Step 6 — Hardware config
|
||||||
### ─────────────────────────────
|
### ─────────────────────────────
|
||||||
|
echo "$HOST_DIR/hardware-configuration.nix"
|
||||||
HOST_DIR="$TARGET_DIR/generated/hosts/$HOSTNAME"
|
HOST_DIR="$TARGET_DIR/generated/hosts/$HOSTNAME"
|
||||||
mkdir -p "$HOST_DIR"
|
mkdir -p "$HOST_DIR"
|
||||||
|
|
||||||
@@ -127,7 +133,7 @@ sudo nixos-generate-config --show-hardware-config > \
|
|||||||
### ─────────────────────────────
|
### ─────────────────────────────
|
||||||
### Step 7 — Inject hardware into README.org
|
### Step 7 — Inject hardware into README.org
|
||||||
### ─────────────────────────────
|
### ─────────────────────────────
|
||||||
|
echo "$HOST_DIR/hardware-configuration.nix"
|
||||||
if [ -f "$README" ]; then
|
if [ -f "$README" ]; then
|
||||||
awk -v file="$HOST_DIR/hardware-configuration.nix" '
|
awk -v file="$HOST_DIR/hardware-configuration.nix" '
|
||||||
BEGIN {inblock=0}
|
BEGIN {inblock=0}
|
||||||
@@ -155,6 +161,7 @@ fi
|
|||||||
### ─────────────────────────────
|
### ─────────────────────────────
|
||||||
### Step 8 — Build system
|
### Step 8 — Build system
|
||||||
### ─────────────────────────────
|
### ─────────────────────────────
|
||||||
|
echo "sudo nixos-rebuild switch --flake .#$HOSTNAME"
|
||||||
cd "$TARGET_DIR"
|
cd "$TARGET_DIR"
|
||||||
git -C "/home/$USER/Droidnix" add "flake.nix"
|
git -C "/home/$USER/Droidnix" add "flake.nix"
|
||||||
sudo nixos-rebuild switch --flake ".#$HOSTNAME"
|
sudo nixos-rebuild switch --flake ".#$HOSTNAME"
|
||||||
|
|||||||
Reference in New Issue
Block a user