removed GIT

This commit is contained in:
2026-05-04 19:12:07 +02:00
parent b197f763a8
commit 49bfa0b972
+23 -40
View File
@@ -4,7 +4,6 @@ set -euo pipefail
### ───────────────────────────── ### ─────────────────────────────
### Configuration ### Configuration
### ───────────────────────────── ### ─────────────────────────────
REPO_URL="https://gitea.data-pro.nu/henrov/nixos.git"
ZIP_URL="https://gitea.data-pro.nu/henrov/nixos/archive/main.zip" ZIP_URL="https://gitea.data-pro.nu/henrov/nixos/archive/main.zip"
TARGET_DIR="$HOME/Droidnix" TARGET_DIR="$HOME/Droidnix"
@@ -26,7 +25,7 @@ rm -rf "$TARGET_DIR"
mkdir -p "$TARGET_DIR" mkdir -p "$TARGET_DIR"
### ───────────────────────────── ### ─────────────────────────────
### Step 3 — Download repository ### Step 3 — Download repository (ZIP ONLY)
### ───────────────────────────── ### ─────────────────────────────
TMP_DIR="$(mktemp -d)" TMP_DIR="$(mktemp -d)"
@@ -35,28 +34,26 @@ cleanup() {
} }
trap cleanup EXIT trap cleanup EXIT
if command -v git >/dev/null 2>&1; then if command -v wget >/dev/null 2>&1; then
echo "Using git clone..." echo "Downloading with wget..."
git clone "$REPO_URL" "$TMP_DIR/repo"
cp -r "$TMP_DIR/repo/Droidnix/"* "$TARGET_DIR/"
elif command -v wget >/dev/null 2>&1; then
echo "Using wget..."
wget -O "$TMP_DIR/main.zip" "$ZIP_URL" wget -O "$TMP_DIR/main.zip" "$ZIP_URL"
unzip -q "$TMP_DIR/main.zip" -d "$TMP_DIR/unzipped"
cp -r "$TMP_DIR/unzipped"/*/Droidnix/* "$TARGET_DIR/"
elif command -v curl >/dev/null 2>&1; then elif command -v curl >/dev/null 2>&1; then
echo "Using curl..." echo "Downloading with curl..."
curl -L "$ZIP_URL" -o "$TMP_DIR/main.zip" curl -L "$ZIP_URL" -o "$TMP_DIR/main.zip"
unzip -q "$TMP_DIR/main.zip" -d "$TMP_DIR/unzipped"
cp -r "$TMP_DIR/unzipped"/*/Droidnix/* "$TARGET_DIR/"
else else
echo "Error: need git, wget, or curl" echo "Error: need wget or curl"
exit 1 exit 1
fi fi
echo "Extracting..."
unzip -q "$TMP_DIR/main.zip" -d "$TMP_DIR/unzipped"
# Gitea zip contains folder like: repo-main/
# Adjusting safely:
cp -r "$TMP_DIR"/unzipped/*/Droidnix/* "$TARGET_DIR/"
### ───────────────────────────── ### ─────────────────────────────
### Step 4 — Rename files (deepest first) ### Step 4 — Rename files (deepest first)
### ───────────────────────────── ### ─────────────────────────────
@@ -67,7 +64,6 @@ find "$TARGET_DIR" -depth | while read -r path; do
base=$(basename "$path") base=$(basename "$path")
newbase="$base" newbase="$base"
newbase="${newbase//traveldroid/$HOSTNAME}" newbase="${newbase//traveldroid/$HOSTNAME}"
newbase="${newbase//henrov/$USER_NAME}" newbase="${newbase//henrov/$USER_NAME}"
@@ -84,26 +80,21 @@ 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
# 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
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 # 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
@@ -112,11 +103,14 @@ if [ -f "$README" ]; then
{ {
if ($0 ~ /^\*\* =/) inblock=1 if ($0 ~ /^\*\* =/) inblock=1
if (inblock == 1) { if (inblock == 1) {
gsub("henrov", user) gsub("henrov", user)
gsub("traveldroid", host) gsub("traveldroid", host)
} }
print $0 print $0
if ($0 ~ /^#\+END_SRC/) inblock=0 if ($0 ~ /^#\+END_SRC/) inblock=0
}' "$README" > "$README.tmp" && mv "$README.tmp" "$README" }' "$README" > "$README.tmp" && mv "$README.tmp" "$README"
fi fi
@@ -125,7 +119,6 @@ fi
### Step 6 — Hardware config ### Step 6 — Hardware config
### ───────────────────────────── ### ─────────────────────────────
HOST_DIR="$TARGET_DIR/generated/hosts/$HOSTNAME" HOST_DIR="$TARGET_DIR/generated/hosts/$HOSTNAME"
echo "$HOST_DIR/hardware-configuration.nix"
mkdir -p "$HOST_DIR" mkdir -p "$HOST_DIR"
echo "Generating hardware configuration..." echo "Generating hardware configuration..."
@@ -135,7 +128,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}
@@ -163,12 +156,9 @@ fi
### ───────────────────────────── ### ─────────────────────────────
### Step 8 — Build system ### Step 8 — Build system
### ───────────────────────────── ### ─────────────────────────────
echo "sudo nixos-rebuild switch --flake .#$HOSTNAME in $TARGET_DIR" echo "Building NixOS configuration..."
cd "$TARGET_DIR" cd "$TARGET_DIR"
git init
git branch -m main
git add "flake.nix"
git commit -m "1st install"
sudo nixos-rebuild switch --flake ".#$HOSTNAME" sudo nixos-rebuild switch --flake ".#$HOSTNAME"
### ───────────────────────────── ### ─────────────────────────────
@@ -178,16 +168,9 @@ cat <<EOF
Installation complete. Please reboot your system. Installation complete. Please reboot your system.
After rebooting, any changes to your NixOS configuration must be made in After rebooting, any changes must be made in:
~/Droidnix/README.org. Before rebuilding, first tangle the org file using: ~/Droidnix/README.org
emacs --batch --no-init-file ~/Droidnix/README.org \
--eval "(require 'org)" \
--eval "(require 'ob-tangle)" \
--eval "(find-file \"README.org\")" \
--eval "(with-temp-message \"\" (org-babel-tangle))" \
--eval "(with-temp-message \"\" (org-html-export-to-html))"
Then rebuild with: Then rebuild with: