fixes
This commit is contained in:
parent
9456753877
commit
525b36dc28
39
install.sh
39
install.sh
@ -64,11 +64,11 @@ echo "Found SSH key: ${SSH_KEY:0:50}..."
|
|||||||
|
|
||||||
# Ask for hostname
|
# Ask for hostname
|
||||||
echo -e "\n[+] Server configuration"
|
echo -e "\n[+] Server configuration"
|
||||||
read -p "Enter hostname [nullpoint]: " HOSTNAME
|
read -r -p "Enter hostname [nullpoint]: " HOSTNAME < /dev/tty
|
||||||
HOSTNAME=${HOSTNAME:-nullpoint}
|
HOSTNAME=${HOSTNAME:-nullpoint}
|
||||||
|
|
||||||
# Ask for username
|
# Ask for username
|
||||||
read -p "Enter username for admin account [null]: " USERNAME
|
read -r -p "Enter username for admin account [null]: " USERNAME < /dev/tty
|
||||||
USERNAME=${USERNAME:-null}
|
USERNAME=${USERNAME:-null}
|
||||||
|
|
||||||
# Generate secure LUKS passphrase
|
# Generate secure LUKS passphrase
|
||||||
@ -80,7 +80,7 @@ echo "LUKS PASSPHRASE (SAVE THIS!):"
|
|||||||
echo "$LUKS_PASS"
|
echo "$LUKS_PASS"
|
||||||
echo "================================================"
|
echo "================================================"
|
||||||
echo -e "\nPress Enter when you've saved the passphrase..."
|
echo -e "\nPress Enter when you've saved the passphrase..."
|
||||||
read
|
read -r < /dev/tty
|
||||||
|
|
||||||
# Clone or download the nullpoint repo
|
# Clone or download the nullpoint repo
|
||||||
echo "[+] Downloading nullpoint configuration..."
|
echo "[+] Downloading nullpoint configuration..."
|
||||||
@ -95,8 +95,21 @@ fi
|
|||||||
# Update install.conf
|
# Update install.conf
|
||||||
echo "[+] Configuring installation..."
|
echo "[+] Configuring installation..."
|
||||||
cd /tmp/nullpoint
|
cd /tmp/nullpoint
|
||||||
sed -i "s/^HOSTNAME .*/HOSTNAME $HOSTNAME/" install.conf
|
# Update install.conf with proper escaping
|
||||||
sed -i "s/^CRYPTPASSWORD .*/CRYPTPASSWORD $LUKS_PASS/" install.conf
|
if ! sed -i "s/^HOSTNAME .*/HOSTNAME $HOSTNAME/" install.conf; then
|
||||||
|
echo "ERROR: Failed to update HOSTNAME in install.conf"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Use awk for CRYPTPASSWORD to handle special characters
|
||||||
|
if ! awk -v pass="$LUKS_PASS" '
|
||||||
|
/^CRYPTPASSWORD / { print "CRYPTPASSWORD " pass; next }
|
||||||
|
{ print }
|
||||||
|
' install.conf > install.conf.tmp; then
|
||||||
|
echo "ERROR: Failed to update CRYPTPASSWORD in install.conf"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
mv install.conf.tmp install.conf
|
||||||
|
|
||||||
# Update post-install.sh
|
# Update post-install.sh
|
||||||
if ! sed -i "s/^ALMA_USER=.*/ALMA_USER=\"$USERNAME\"/" post-install.sh; then
|
if ! sed -i "s/^ALMA_USER=.*/ALMA_USER=\"$USERNAME\"/" post-install.sh; then
|
||||||
@ -129,25 +142,25 @@ chmod +x /root/post-install.sh
|
|||||||
|
|
||||||
# Ask for optional features
|
# Ask for optional features
|
||||||
echo -e "\n[+] Optional features:"
|
echo -e "\n[+] Optional features:"
|
||||||
read -p "Do you have a TPM and want to use it? [y/N]: " USE_TPM
|
read -r -p "Do you have a TPM and want to use it? [y/N]: " USE_TPM < /dev/tty
|
||||||
if [[ "$USE_TPM" =~ ^[Yy]$ ]]; then
|
if [[ "$USE_TPM" =~ ^[Yy]$ ]]; then
|
||||||
echo "TPM will be configured if available."
|
echo "TPM will be configured if available."
|
||||||
else
|
else
|
||||||
sed -i 's/^TPM_ENABLED=.*/TPM_ENABLED=false/' /root/post-install.sh
|
sed -i 's/^TPM_ENABLED=.*/TPM_ENABLED=false/' /root/post-install.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
read -p "Do you want to configure remote unlock Tang servers? [y/N]: " USE_TANG
|
read -r -p "Do you want to configure remote unlock Tang servers? [y/N]: " USE_TANG < /dev/tty
|
||||||
if [[ "$USE_TANG" =~ ^[Yy]$ ]]; then
|
if [[ "$USE_TANG" =~ ^[Yy]$ ]]; then
|
||||||
echo "Configuring Tang servers..."
|
echo "Configuring Tang servers..."
|
||||||
TANG_CONFIG=""
|
TANG_CONFIG=""
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
read -p "Enter Tang server URL (or press Enter to finish): " TANG_URL
|
read -r -p "Enter Tang server URL (or press Enter to finish): " TANG_URL < /dev/tty
|
||||||
if [ -z "$TANG_URL" ]; then
|
if [ -z "$TANG_URL" ]; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|
||||||
read -p "Enter thumbprint for $TANG_URL: " TANG_THUMBPRINT
|
read -r -p "Enter thumbprint for $TANG_URL: " TANG_THUMBPRINT < /dev/tty
|
||||||
if [ -n "$TANG_THUMBPRINT" ]; then
|
if [ -n "$TANG_THUMBPRINT" ]; then
|
||||||
TANG_CONFIG+=" \"$TANG_URL $TANG_THUMBPRINT\"\n"
|
TANG_CONFIG+=" \"$TANG_URL $TANG_THUMBPRINT\"\n"
|
||||||
echo "Added Tang server: $TANG_URL"
|
echo "Added Tang server: $TANG_URL"
|
||||||
@ -181,7 +194,7 @@ echo " Username: $USERNAME"
|
|||||||
echo " SSH Key: ${SSH_KEY:0:50}..."
|
echo " SSH Key: ${SSH_KEY:0:50}..."
|
||||||
echo " LUKS Passphrase: $LUKS_PASS"
|
echo " LUKS Passphrase: $LUKS_PASS"
|
||||||
echo ""
|
echo ""
|
||||||
read -p "Proceed with installation? [Y/n]: " CONFIRM
|
read -r -p "Proceed with installation? [Y/n]: " CONFIRM < /dev/tty
|
||||||
if [[ "$CONFIRM" =~ ^[Nn]$ ]]; then
|
if [[ "$CONFIRM" =~ ^[Nn]$ ]]; then
|
||||||
echo "Installation cancelled."
|
echo "Installation cancelled."
|
||||||
exit 1
|
exit 1
|
||||||
@ -209,7 +222,11 @@ fi
|
|||||||
echo -e "\n[+] Starting Hetzner installimage..."
|
echo -e "\n[+] Starting Hetzner installimage..."
|
||||||
echo "The installer will now run. Follow any prompts if needed."
|
echo "The installer will now run. Follow any prompts if needed."
|
||||||
echo ""
|
echo ""
|
||||||
$INSTALLIMAGE_CMD -a -c /root/install.conf -s /root/post-install.sh
|
if ! $INSTALLIMAGE_CMD -a -c /root/install.conf -s /root/post-install.sh; then
|
||||||
|
echo -e "\nERROR: Installation failed!"
|
||||||
|
echo "Please check the error messages above."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
echo -e "\n[+] Installation complete!"
|
echo -e "\n[+] Installation complete!"
|
||||||
echo ""
|
echo ""
|
||||||
|
Loading…
Reference in New Issue
Block a user