feat(post-install): add dedicated post-boot setup script
- commit
- db9e0da1f5166738d88be437003fd981160d06e4
- author
- bnema · · 2025-10-21 06:13 UTC
- parent
- 361b44b
- signature
- unsigned
1 file · +30 -0
A install/post-install/post-boot-setup.sh +30 -0
| @@ -0,0 +1,30 @@ | |||
| 1 | + | #!/bin/bash | |
| 2 | + | # Setup post-boot scripts and first-boot service | |
| 3 | + | ||
| 4 | + | gum style --foreground 6 --padding "1 0 0 $PADDING_LEFT" "Setting up first-boot service..." | |
| 5 | + | ||
| 6 | + | # Create post-boot directory | |
| 7 | + | mkdir -p /mnt/usr/local/share/archup/post-boot | |
| 8 | + | ||
| 9 | + | # Copy all post-boot scripts | |
| 10 | + | cp "$ARCHUP_INSTALL/post-boot/all.sh" /mnt/usr/local/share/archup/post-boot/ | |
| 11 | + | cp "$ARCHUP_INSTALL/post-boot/snapper.sh" /mnt/usr/local/share/archup/post-boot/ | |
| 12 | + | cp "$ARCHUP_INSTALL/post-boot/ssh-keygen.sh" /mnt/usr/local/share/archup/post-boot/ | |
| 13 | + | cp "$ARCHUP_INSTALL/post-boot/archup-cli.sh" /mnt/usr/local/share/archup/post-boot/ | |
| 14 | + | ||
| 15 | + | # Make all scripts executable | |
| 16 | + | chmod +x /mnt/usr/local/share/archup/post-boot/*.sh | |
| 17 | + | ||
| 18 | + | # Install systemd service (substitute email and username) | |
| 19 | + | sed "s|__ARCHUP_EMAIL__|$(config_get "ARCHUP_EMAIL")|g; s|__ARCHUP_USERNAME__|$(config_get "ARCHUP_USERNAME")|g" \ | |
| 20 | + | "$ARCHUP_INSTALL/post-boot/archup-first-boot.service" > /mnt/etc/systemd/system/archup-first-boot.service | |
| 21 | + | ||
| 22 | + | # Enable the service | |
| 23 | + | arch-chroot /mnt systemctl enable archup-first-boot.service >> "$ARCHUP_INSTALL_LOG_FILE" 2>&1 | |
| 24 | + | ||
| 25 | + | echo "First-boot service will run on first reboot to:" >> "$ARCHUP_INSTALL_LOG_FILE" | |
| 26 | + | echo " - Configure snapper snapshots" >> "$ARCHUP_INSTALL_LOG_FILE" | |
| 27 | + | echo " - Generate SSH keys" >> "$ARCHUP_INSTALL_LOG_FILE" | |
| 28 | + | echo " - Build and install archup-cli from GitHub" >> "$ARCHUP_INSTALL_LOG_FILE" | |
| 29 | + | ||
| 30 | + | gum style --foreground 2 --padding "0 0 1 $PADDING_LEFT" "[OK] First-boot service configured" | |
| @@ -0,0 +1,30 @@ | |||||
| 1 | + | #!/bin/bash | |||
| 2 | + | # Setup post-boot scripts and first-boot service | |||
| 3 | + | ||||
| 4 | + | gum style --foreground 6 --padding "1 0 0 $PADDING_LEFT" "Setting up first-boot service..." | |||
| 5 | + | ||||
| 6 | + | # Create post-boot directory | |||
| 7 | + | mkdir -p /mnt/usr/local/share/archup/post-boot | |||
| 8 | + | ||||
| 9 | + | # Copy all post-boot scripts | |||
| 10 | + | cp "$ARCHUP_INSTALL/post-boot/all.sh" /mnt/usr/local/share/archup/post-boot/ | |||
| 11 | + | cp "$ARCHUP_INSTALL/post-boot/snapper.sh" /mnt/usr/local/share/archup/post-boot/ | |||
| 12 | + | cp "$ARCHUP_INSTALL/post-boot/ssh-keygen.sh" /mnt/usr/local/share/archup/post-boot/ | |||
| 13 | + | cp "$ARCHUP_INSTALL/post-boot/archup-cli.sh" /mnt/usr/local/share/archup/post-boot/ | |||
| 14 | + | ||||
| 15 | + | # Make all scripts executable | |||
| 16 | + | chmod +x /mnt/usr/local/share/archup/post-boot/*.sh | |||
| 17 | + | ||||
| 18 | + | # Install systemd service (substitute email and username) | |||
| 19 | + | sed "s|__ARCHUP_EMAIL__|$(config_get "ARCHUP_EMAIL")|g; s|__ARCHUP_USERNAME__|$(config_get "ARCHUP_USERNAME")|g" \ | |||
| 20 | + | "$ARCHUP_INSTALL/post-boot/archup-first-boot.service" > /mnt/etc/systemd/system/archup-first-boot.service | |||
| 21 | + | ||||
| 22 | + | # Enable the service | |||
| 23 | + | arch-chroot /mnt systemctl enable archup-first-boot.service >> "$ARCHUP_INSTALL_LOG_FILE" 2>&1 | |||
| 24 | + | ||||
| 25 | + | echo "First-boot service will run on first reboot to:" >> "$ARCHUP_INSTALL_LOG_FILE" | |||
| 26 | + | echo " - Configure snapper snapshots" >> "$ARCHUP_INSTALL_LOG_FILE" | |||
| 27 | + | echo " - Generate SSH keys" >> "$ARCHUP_INSTALL_LOG_FILE" | |||
| 28 | + | echo " - Build and install archup-cli from GitHub" >> "$ARCHUP_INSTALL_LOG_FILE" | |||
| 29 | + | ||||
| 30 | + | gum style --foreground 2 --padding "0 0 1 $PADDING_LEFT" "[OK] First-boot service configured" | |||