Merge pull request #213 from naturallaw777/copilot/remove-chroot-chpasswd-block
[WIP] Remove chroot/chpasswd block from installer script
This commit is contained in:
@@ -1017,21 +1017,6 @@ class InstallerWindow(Adw.ApplicationWindow):
|
|||||||
raise RuntimeError(proc.stderr.strip() or "Failed to write root-password")
|
raise RuntimeError(proc.stderr.strip() or "Failed to write root-password")
|
||||||
run(["sudo", "chmod", "600", "/mnt/var/lib/secrets/root-password"])
|
run(["sudo", "chmod", "600", "/mnt/var/lib/secrets/root-password"])
|
||||||
|
|
||||||
proc = subprocess.run(
|
|
||||||
["sudo", "chroot", "/mnt", "/run/current-system/sw/bin/chpasswd"],
|
|
||||||
input=f"free:{self.free_password}\nroot:{root_password}",
|
|
||||||
capture_output=True, text=True
|
|
||||||
)
|
|
||||||
if proc.returncode != 0:
|
|
||||||
proc = subprocess.run(
|
|
||||||
["sudo", "chroot", "/mnt", "chpasswd"],
|
|
||||||
input=f"free:{self.free_password}\nroot:{root_password}",
|
|
||||||
capture_output=True, text=True
|
|
||||||
)
|
|
||||||
if proc.returncode != 0:
|
|
||||||
log(proc.stderr)
|
|
||||||
raise RuntimeError(proc.stderr.strip() or "Failed to set passwords via chpasswd")
|
|
||||||
|
|
||||||
GLib.idle_add(self.push_complete)
|
GLib.idle_add(self.push_complete)
|
||||||
|
|
||||||
# ── Complete ───────────────────────────────────────────────────────────
|
# ── Complete ───────────────────────────────────────────────────────────
|
||||||
|
|||||||
@@ -107,10 +107,10 @@ in
|
|||||||
W3=''${WORD_ARRAY[$((RANDOM % COUNT))]}
|
W3=''${WORD_ARRAY[$((RANDOM % COUNT))]}
|
||||||
DIGIT=$((RANDOM % 10))
|
DIGIT=$((RANDOM % 10))
|
||||||
ROOT_PASS="$W1-$W2-$W3-$DIGIT"
|
ROOT_PASS="$W1-$W2-$W3-$DIGIT"
|
||||||
echo "root:$ROOT_PASS" | chpasswd
|
|
||||||
echo "$ROOT_PASS" > "$SECRET_FILE"
|
echo "$ROOT_PASS" > "$SECRET_FILE"
|
||||||
chmod 600 "$SECRET_FILE"
|
chmod 600 "$SECRET_FILE"
|
||||||
fi
|
fi
|
||||||
|
echo "root:$(cat "$SECRET_FILE")" | chpasswd
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -144,10 +144,10 @@ in
|
|||||||
W3=''${WORD_ARRAY[$((RANDOM % COUNT))]}
|
W3=''${WORD_ARRAY[$((RANDOM % COUNT))]}
|
||||||
DIGIT=$((RANDOM % 10))
|
DIGIT=$((RANDOM % 10))
|
||||||
FREE_PASS="$W1-$W2-$W3-$DIGIT"
|
FREE_PASS="$W1-$W2-$W3-$DIGIT"
|
||||||
echo "free:$FREE_PASS" | chpasswd
|
|
||||||
echo "$FREE_PASS" > "$SECRET_FILE"
|
echo "$FREE_PASS" > "$SECRET_FILE"
|
||||||
chmod 600 "$SECRET_FILE"
|
chmod 600 "$SECRET_FILE"
|
||||||
fi
|
fi
|
||||||
|
echo "free:$(cat "$SECRET_FILE")" | chpasswd
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user