multi-script support
This commit is contained in:
parent
f31aa555e7
commit
87dc4c9133
8 changed files with 31 additions and 16 deletions
|
@ -4,6 +4,8 @@
|
|||
"download_link": "http://deb.debian.org/debian/",
|
||||
"download_name": "bookworm",
|
||||
"packages": "grub-pc linux-image-amd64 task-gnome-desktop",
|
||||
"script": "configs/scripts/install.sh",
|
||||
"script": [
|
||||
"configs/scripts/install.sh"
|
||||
],
|
||||
"package_manager": "apt"
|
||||
}
|
|
@ -4,6 +4,8 @@
|
|||
"download_link": "http://deb.debian.org/debian/",
|
||||
"download_name": "bookworm",
|
||||
"packages": "grub-pc linux-image-amd64 task-kde-desktop",
|
||||
"script": "configs/scripts/install.sh",
|
||||
"script": [
|
||||
"configs/scripts/install.sh"
|
||||
],
|
||||
"package_manager": "apt"
|
||||
}
|
|
@ -4,6 +4,8 @@
|
|||
"download_link": "http://deb.debian.org/debian/",
|
||||
"download_name": "bookworm",
|
||||
"packages": "nginx grub-pc linux-image-amd64",
|
||||
"script": "configs/scripts/install.sh",
|
||||
"script": [
|
||||
"configs/scripts/install.sh"
|
||||
],
|
||||
"package_manager": "apt"
|
||||
}
|
|
@ -73,7 +73,3 @@ while true; do
|
|||
break
|
||||
fi
|
||||
done
|
||||
|
||||
umount -R /mnt
|
||||
|
||||
reboot
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
"download_link": "https://cdimage.ubuntu.com/ubuntu-base/noble/daily/current/noble-base-amd64.tar.gz",
|
||||
"download_name": "noble-base-amd64.tar.gz",
|
||||
"packages": "grub-pc linux-image-generic ubuntu-desktop",
|
||||
"script": "configs/scripts/install.sh",
|
||||
"script": [
|
||||
"configs/scripts/install.sh"
|
||||
],
|
||||
"package_manager": "apt"
|
||||
}
|
|
@ -4,6 +4,8 @@
|
|||
"download_link": "https://cdimage.ubuntu.com/ubuntu-base/noble/daily/current/noble-base-amd64.tar.gz",
|
||||
"download_name": "noble-base-amd64.tar.gz",
|
||||
"packages": "grub-pc linux-image-generic kubuntu-desktop",
|
||||
"script": "configs/scripts/install.sh",
|
||||
"script": [
|
||||
"configs/scripts/install.sh"
|
||||
],
|
||||
"package_manager": "apt"
|
||||
}
|
|
@ -4,6 +4,8 @@
|
|||
"download_link": "https://cdimage.ubuntu.com/ubuntu-base/noble/daily/current/noble-base-amd64.tar.gz",
|
||||
"download_name": "noble-base-amd64.tar.gz",
|
||||
"packages": "nginx grub-pc linux-image-generic",
|
||||
"script": "configs/scripts/install.sh",
|
||||
"script": [
|
||||
"configs/scripts/install.sh"
|
||||
],
|
||||
"package_manager": "apt"
|
||||
}
|
19
main.py
19
main.py
|
@ -71,9 +71,9 @@ def rootfs_creator(filename):
|
|||
|
||||
|
||||
# packaging rootfs
|
||||
def rootfs_package(filename, installer):
|
||||
infile = f"{filename}.tar.gz"
|
||||
outfile = f"{filename}.iso"
|
||||
def rootfs_package(identifier, scripts):
|
||||
infile = f"{identifier}.tar.gz"
|
||||
outfile = f"{identifier}.iso"
|
||||
|
||||
close_chroot()
|
||||
command(f"sudo rm -rf '{chroot}'")
|
||||
|
@ -102,9 +102,16 @@ def rootfs_package(filename, installer):
|
|||
close_chroot()
|
||||
|
||||
command(f"sudo cp '{resources}/grub.cfg' '{chroot}/boot/grub/grub.cfg'")
|
||||
command(f"sudo cp '{installer}' '{chroot}/root/install.sh'")
|
||||
command(f"echo './install.sh' | sudo tee -a '{chroot}/root/.profile'")
|
||||
command(f"echo './install.sh' | sudo tee -a '{chroot}/root/.bashrc'")
|
||||
for script in scripts:
|
||||
result = script.split("/")[-1]
|
||||
command(f"sudo cp '{script}' '{chroot}/root/{result}'")
|
||||
command(f"echo './{result}' | sudo tee -a '{chroot}/root/.profile'")
|
||||
command(f"echo './{result}' | sudo tee -a '{chroot}/root/.bashrc'")
|
||||
|
||||
command(f"echo 'umount -R /mnt' | sudo tee -a '{chroot}/root/.profile'")
|
||||
command(f"echo 'umount -R /mnt' | sudo tee -a '{chroot}/root/.bashrc'")
|
||||
command(f"echo 'reboot' | sudo tee -a '{chroot}/root/.profile'")
|
||||
command(f"echo 'reboot' | sudo tee -a '{chroot}/root/.bashrc'")
|
||||
|
||||
if shutil.which("grub-mkrescue"):
|
||||
command(f"sudo grub-mkrescue -o '{outfile}' '{chroot}'")
|
||||
|
|
Loading…
Reference in a new issue