Change how we install packages

First scan the supplied package list for missing packages.
Then install them all in one go rather than one at a time.
Significantly improves rootfs build time
This commit is contained in:
Ryan Houdek 2022-01-26 15:17:19 -08:00
parent 35b2da387a
commit 3fa5b16050
4 changed files with 23 additions and 6 deletions

View File

@ -13,7 +13,7 @@
"The package command used to install packages"
],
"PKGInstallCMD" : "apt-get install -y ",
"PKGInstallCMD" : "/root/mega_install_packages.sh ",
"PackagesToAdd_CMT": [
"Which package names to install",
@ -24,6 +24,7 @@
"PackagesToAdd" : [
"sudo",
"rsync",
"apt-utils",
"lsb-release",
"libc-bin",
@ -167,6 +168,7 @@
"CopyFiles_Stage0": [
"cross_x86",
"build_install_mesa.sh",
"mega_install_packages.sh",
"break_chroot.sh",
"unbreak_chroot.sh"
],
@ -180,6 +182,7 @@
"CopyFiles_Stage1": [
["cross_x86", "root/"],
["build_install_mesa.sh", "root/"],
["mega_install_packages.sh", "root/"],
["break_chroot.sh", "/"],
["unbreak_chroot.sh", "/"]
],

View File

@ -13,7 +13,7 @@
"The package command used to install packages"
],
"PKGInstallCMD" : "apt-get install -y ",
"PKGInstallCMD" : "/root/mega_install_packages.sh ",
"PackagesToAdd_CMT": [
"Which package names to install",
@ -24,6 +24,7 @@
"PackagesToAdd" : [
"sudo",
"rsync",
"apt-utils",
"lsb-release",
"libc-bin",
@ -169,6 +170,7 @@
"CopyFiles_Stage0": [
"cross_x86",
"build_install_mesa.sh",
"mega_install_packages.sh",
"break_chroot.sh",
"unbreak_chroot.sh"
],
@ -182,6 +184,7 @@
"CopyFiles_Stage1": [
["cross_x86", "root/"],
["build_install_mesa.sh", "root/"],
["mega_install_packages.sh", "root/"],
["break_chroot.sh", "/"],
["unbreak_chroot.sh", "/"]
],

View File

@ -307,7 +307,7 @@ def Stage1(CacheDir, RootFSDir, config_json):
for command in config_json["Commands_InChroot"]:
ExecuteCommandAndWait(tn, command)
Command = "for pkg in "
Command = config_json["PKGInstallCMD"]
Send = False
for app in config_json["PackagesToAdd"]:
Command = Command + " " + app
@ -315,12 +315,10 @@ def Stage1(CacheDir, RootFSDir, config_json):
# Lets not go right up against the limit to be safe, but get close
MAX_COMMAND_LENGTH = 2048000
if len(Command) > MAX_COMMAND_LENGTH:
Command = Command + "; do " + config_json["PKGInstallCMD"] + "$pkg; done"
ExecuteCommandAndWait(tn, Command)
Command = "for pkg in "
Command = config_json["PKGInstallCMD"]
# Finish the remaining installs
Command = Command + "; do " + config_json["PKGInstallCMD"] + "$pkg; done"
ExecuteCommandAndWait(tn, Command)
print("Commands_InChroot2")

13
mega_install_packages.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/sh
for i in $@
do
if [ -z "$(apt-cache madison $i 2>/dev/null)" ]; then
echo " > Package $i not available on repo."
echo "Package Not Found: $i" >> /Unknown_Packages
else
echo " > Add package $i to the install list"
packages="$packages $i"
fi
done
echo "$packages" #you could comment this.
apt-get -y install $packages