common_deb: Fix typos. Use extra debootstrap_args. Shellchecked

This commit is contained in:
timoxa0 2024-10-27 18:36:35 +05:00
parent d70d0ddad8
commit db951502cd

View file

@ -2,10 +2,11 @@
source ./common.d/functions.sh source ./common.d/functions.sh
source ./common.d/build_functions.sh source ./common.d/build_functions.sh
require "debootstarp" require "debootstrap"
export DEBIAN_FRONTEND=noninteractive export DEBIAN_FRONTEND=noninteractive
# shellcheck disable=SC2086
fetch_base_system() fetch_base_system()
{ {
local rootdir="$1" local rootdir="$1"
@ -18,9 +19,9 @@ fetch_base_system()
log "Rootdir [$rootdir] does not exists" ierror log "Rootdir [$rootdir] does not exists" ierror
return 2 return 2
} }
log "Fetching base system" internal debootstrap --arch arm64 --components="$components" $debootstrap_flags "$branch" "$rootdir" "$repo" || {
debootstarp --arch arm64 --components "$components" "$branch" "$rootdir" "$repo" || {
log "Failed to fetch base system" ierror log "Failed to fetch base system" ierror
return 1
} }
} }
@ -81,7 +82,7 @@ install_nabu_packages()
} }
cp ./packages/*.deb "$rootdir/opt/" cp ./packages/*.deb "$rootdir/opt/"
chroot "$rootdir" bash -c "dpkg -i /opt/*.deb" { chroot "$rootdir" bash -c "dpkg -i /opt/*.deb" || {
log "Failed to install packages" ierror log "Failed to install packages" ierror
return 1 return 1
} }
@ -94,16 +95,17 @@ install_nabu_packages()
} }
} }
# shellcheck disable=SC2086
install_packages() install_packages()
{ {
local rootdir="$1" local rootdir="$1"
local packages="${@:2}" local packages="${*:2}"
[ ! -d "$rootdir" ] && { [ ! -d "$rootdir" ] && {
log "Rootdir [$rootdir] does not exists" ierror log "Rootdir [$rootdir] does not exists" ierror
return 2 return 2
} }
chroot "$rootdir" apt install ${packages[*]} -y || { chroot "$rootdir" apt install $packages -y || {
log "Failed to install package(s)" ierror log "Failed to install package(s)" ierror
return 1 return 1
} }
@ -123,7 +125,7 @@ finish_system()
return 1 return 1
} }
log "Updating runtime linked bindings" internal log "Updating runtime linker bindings" internal
chroot "$rootdir" ldconfig || { chroot "$rootdir" ldconfig || {
log "Failed to update runtime linker bindings" ierror log "Failed to update runtime linker bindings" ierror
return 1 return 1