Skip to content

Commit

Permalink
workaround for installing samba in chroot due to service restart (lef…
Browse files Browse the repository at this point in the history
…t samba working, but technically half installed)
  • Loading branch information
joolswills committed Jun 21, 2016
1 parent 1a8f8c0 commit 6b2b569
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions scriptmodules/helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,23 @@ function getDepends() {
fi

aptInstall --no-install-recommends "${packages[@]}"
# check the required packages again rather than return code of apt-get, as apt-get
# might fail for other reasons (other broken packages, eg samba in a chroot environment)

# check the required packages again rather than return code of apt-get,
# as apt-get might fail for other reasons (eg other half installed packages)
for required in ${packages[@]}; do
hasPackage "$required" || failed+=("$required")
if ! hasPackage "$required"; then
# workaround for installing samba in a chroot (fails due to failed smbd service restart)
# we replace the init.d script with an empty script so the install completes
if [[ "$required" == "samba" && "$__chroot" -eq 1 ]]; then
mv /etc/init.d/smbd /etc/init.d/smbd.old
echo "#!/bin/sh" >/etc/init.d/smbd
chmod u+x /etc/init.d/smbd
apt-get -f install
mv /etc/init.d/smbd.old /etc/init.d/smbd
else
failed+=("$required")
fi
fi
done
if [[ ${#failed[@]} -eq 0 ]]; then
printMsgs "console" "Successfully installed package(s): ${packages[*]}."
Expand Down

0 comments on commit 6b2b569

Please sign in to comment.