feat: Automatically execute script after installation (#423)

This commit is contained in:
hellodword 2024-04-28 11:03:37 +00:00 committed by GitHub
parent 3390ef8101
commit 02c95fb960
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 120 additions and 3 deletions

View file

@ -1082,6 +1082,35 @@ updateImage() {
return 0
}
copyOEM() {
local dir="$1"
local folder="$STORAGE/oem"
local src
[ ! -d "$folder" ] && folder="$STORAGE/OEM"
[ ! -d "$folder" ] && folder="$STORAGE/shared/oem"
[ ! -d "$folder" ] && folder="$STORAGE/shared/OEM"
[ ! -d "$folder" ] && return 0
local msg="Copying OEM folder to image..."
info "$msg" && html "$msg"
src=$(find "$dir" -maxdepth 1 -type d -iname sources | head -n 1)
if [ ! -d "$src" ]; then
error "failed to locate 'sources' folder in ISO image!" && return 1
fi
local dest="$src/\$OEM\$/\$1/"
mkdir -p "$dest"
if ! cp -r "$folder" "$dest"; then
error "Failed to copy OEM folder!" && return 1
fi
return 0
}
buildImage() {
local dir="$1"
@ -1242,6 +1271,10 @@ if ! rm -f "$ISO" 2> /dev/null; then
rm -f "$ISO"
fi
if ! copyOEM "$DIR"; then
exit 63
fi
if ! buildImage "$DIR"; then
exit 65
fi