summaryrefslogtreecommitdiffstats
path: root/make_slackware_live.sh
diff options
context:
space:
mode:
author Eric Hameleers <alien@slackware.com>2021-01-27 07:17:02 +0100
committer Eric Hameleers <alien@slackware.com>2021-01-27 07:17:02 +0100
commit75307c549b5ea1a9d13e8b0a3ec1ae78d87c2708 (patch)
treefe303ad3f7b9d79041881b52815e6bb97fe16891 /make_slackware_live.sh
parent0413244da62352b9126920064ac0fbaa274e6a5f (diff)
downloadliveslak-75307c549b5ea1a9d13e8b0a3ec1ae78d87c2708.tar.gz
liveslak-75307c549b5ea1a9d13e8b0a3ec1ae78d87c2708.tar.xz
The 'chpassword -R' segfaults in some cases, us a chroot as fallback
Diffstat (limited to '')
-rwxr-xr-xmake_slackware_live.sh16
1 files changed, 12 insertions, 4 deletions
diff --git a/make_slackware_live.sh b/make_slackware_live.sh
index 50fabc7..57fffde 100755
--- a/make_slackware_live.sh
+++ b/make_slackware_live.sh
@@ -1632,14 +1632,18 @@ KERNEL=="loop*", ENV{UDISKS_IGNORE}="1"
EOL
# Set a root password.
-echo "root:${ROOTPW}" | /usr/sbin/chpasswd -R ${LIVE_ROOTDIR}
+if ! echo "root:${ROOTPW}" | /usr/sbin/chpasswd -R ${LIVE_ROOTDIR} ; then
+ echo "root:${ROOTPW}" | chroot ${LIVE_ROOTDIR} /usr/sbin/chpasswd
+fi
# Create group and user for the nvidia persistence daemon:
if ! chroot ${LIVE_ROOTDIR} /usr/bin/getent passwd ${NVUID} > /dev/null 2>&1 ;
then
chroot ${LIVE_ROOTDIR} /usr/sbin/groupadd -g ${NVGRPNR} ${NVGRP}
chroot ${LIVE_ROOTDIR} /usr/sbin/useradd -c "Nvidia persistence" -u ${NVUIDNR} -g ${NVGRPNR} -d /dev/null -s /bin/false ${NVUID}
- echo "${NVUID}:$(openssl rand -base64 12)" | /usr/sbin/chpasswd -R ${LIVE_ROOTDIR}
+ if ! echo "${NVUID}:$(openssl rand -base64 12)" | /usr/sbin/chpasswd -R ${LIVE_ROOTDIR} ; then
+ echo "${NVUID}:$(openssl rand -base64 12)" | chroot ${LIVE_ROOTDIR} /usr/sbin/chpasswd
+ fi
fi
# Determine the full name of the live account in the image:
@@ -1652,7 +1656,9 @@ fi
# Create a nonprivileged user account (called "live" by default):
chroot ${LIVE_ROOTDIR} /usr/sbin/useradd -c "${LIVEUIDFN}" -g users -G wheel,audio,cdrom,floppy,plugdev,video,power,netdev,lp,scanner,kmem,dialout,games,disk,input -u ${LIVEUIDNR} -d /home/${LIVEUID} -m -s /bin/bash ${LIVEUID}
-echo "${LIVEUID}:${LIVEPW}" | /usr/sbin/chpasswd -R ${LIVE_ROOTDIR}
+if ! echo "${LIVEUID}:${LIVEPW}" | /usr/sbin/chpasswd -R ${LIVE_ROOTDIR} ; then
+ echo "${LIVEUID}:${LIVEPW}" | chroot ${LIVE_ROOTDIR} /usr/sbin/chpasswd
+fi
# Configure suauth if we are not on a PAM system (where this does not work):
if [ ! -L ${LIVE_ROOTDIR}/lib${DIRSUFFIX}/libpam.so.? ]; then
@@ -2577,7 +2583,9 @@ if [ "$LIVEDE" = "STUDIOWARE" ]; then
# Create group and user for the Avahi service:
chroot ${LIVE_ROOTDIR} /usr/sbin/groupadd -g 214 avahi
chroot ${LIVE_ROOTDIR} /usr/sbin/useradd -c "Avahi Service Account" -u 214 -g 214 -d /dev/null -s /bin/false avahi
- echo "avahi:$(openssl rand -base64 12)" | /usr/sbin/chpasswd -R ${LIVE_ROOTDIR}
+ if ! echo "avahi:$(openssl rand -base64 12)" | /usr/sbin/chpasswd -R ${LIVE_ROOTDIR} ; then
+ echo "avahi:$(openssl rand -base64 12)" | chroot ${LIVE_ROOTDIR} /usr/sbin/chpasswd
+ fi
fi # End LIVEDE = STUDIOWARE