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