Remove auto-installer from installed system

- Add cleanup code to remove auto-installer.sh from target system
- Remove installation log file from target system
- Exclude auto-installer log from rsync copy (but keep script for installation)
- Auto-installer now self-destructs after successful installation
- Keeps installed system clean by removing installation artifacts
parent 646ceea7
...@@ -521,6 +521,7 @@ copy_live_system() { ...@@ -521,6 +521,7 @@ copy_live_system() {
--exclude=/cdrom \ --exclude=/cdrom \
--exclude=/var/cache/apt/archives/*.deb \ --exclude=/var/cache/apt/archives/*.deb \
--exclude=/var/log/* \ --exclude=/var/log/* \
--exclude=/var/log/auto-installer.log \
/ "$TARGET_MOUNT/" / "$TARGET_MOUNT/"
print_status "Live system copied successfully" print_status "Live system copied successfully"
...@@ -659,7 +660,12 @@ run_post_install() { ...@@ -659,7 +660,12 @@ run_post_install() {
# Cleanup and unmount # Cleanup and unmount
cleanup() { cleanup() {
print_header "Installation Complete" print_header "Installation Complete"
# Remove auto-installer from installed system (cleanup)
print_status "Removing auto-installer from installed system..."
rm -f "$TARGET_MOUNT/usr/local/bin/auto-installer.sh" 2>/dev/null || true
rm -f "$TARGET_MOUNT/var/log/auto-installer.log" 2>/dev/null || true
print_status "Unmounting filesystems..." print_status "Unmounting filesystems..."
umount "$TARGET_MOUNT/dev/pts" 2>/dev/null || true umount "$TARGET_MOUNT/dev/pts" 2>/dev/null || true
umount "$TARGET_MOUNT/dev" 2>/dev/null || true umount "$TARGET_MOUNT/dev" 2>/dev/null || true
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment