summaryrefslogtreecommitdiff
path: root/sbin/itzks-update-disklserver-squashfs-images
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2022-01-05 23:15:00 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2022-01-05 23:15:00 +0100
commita5e7e25ae1cf12050737d4844ae8c3ec43566b84 (patch)
tree3ccf43c29264349bbde9a043b278434f1eb90f3e /sbin/itzks-update-disklserver-squashfs-images
parente4eeef4ebae8b5d980adbc4d94036fccfceefeb2 (diff)
downloaditzks-systems-a5e7e25ae1cf12050737d4844ae8c3ec43566b84.tar.gz
itzks-systems-a5e7e25ae1cf12050737d4844ae8c3ec43566b84.tar.bz2
itzks-systems-a5e7e25ae1cf12050737d4844ae8c3ec43566b84.zip
sbin/itzks-update-disklserver-squashfs-images: Create ltsp.conf from ltsp.conf.in template file and use disklserver's root PW for root@<diskless-workstation>.
Diffstat (limited to 'sbin/itzks-update-disklserver-squashfs-images')
-rwxr-xr-xsbin/itzks-update-disklserver-squashfs-images19
1 files changed, 18 insertions, 1 deletions
diff --git a/sbin/itzks-update-disklserver-squashfs-images b/sbin/itzks-update-disklserver-squashfs-images
index ed0d94f..1e8d8ce 100755
--- a/sbin/itzks-update-disklserver-squashfs-images
+++ b/sbin/itzks-update-disklserver-squashfs-images
@@ -29,12 +29,29 @@ mkdir -p ${TMPDIR}/
chown root:root ${TMPDIR}
chmod 1777 ${TMPDIR}
-ltsp_chroots=$(ls "${LTSP_OPT}" | while read chroot_dir; do test ! -h "${LTSP_OPT}/${chroot_dir}" -a -x "${LTSP_OPT}/${chroot_dir}/bin/bash" && echo -n "${chroot_dir} "; done)
+if [ -e "/etc/ltsp/ltsp.conf.in" ] && cat "/etc/ltsp/ltsp.conf.in" | grep -v "#" | grep -q "@rootpw@"; then
+
+ # Drop previous ltsp.conf (yes, we want to do that!)
+ rm /etc/ltsp/ltsp.conf
+ touch /etc/ltsp/ltsp.conf
+ chown root:root /etc/ltsp/ltsp.conf
+ chmod 0600 /etc/ltsp/ltsp.conf
+
+ echo "# THIS FILE IS RECREATED DAILY FROM /etc/ltsp/ltsp.conf.in - DON'T EDIT THIS FILE" >> /etc/ltsp/ltsp.conf
+ echo >> /etc/ltsp/ltsp.conf
+
+ # configure LTSP before creating ltsp.img and iPXE config
+ host_rootpw=$(cat /etc/shadow | grep -E "^root:" | cut -d":" -f2)
+ [ "$host_rootpw" ] && export host_rootpw && perl -p -e "s/\@rootpw\@/\$ENV{host_rootpw}/g" "/etc/ltsp/ltsp.conf.in" >> "/etc/ltsp/ltsp.conf"
+ unset host_rootpw
+fi
# let's update ltsp.img (LTSP initrd) and LTSP's iPXE boot menu configuration, just in case...
ltsp initrd
ltsp ipxe
+ltsp_chroots=$(ls "${LTSP_OPT}" | while read chroot_dir; do test ! -h "${LTSP_OPT}/${chroot_dir}" -a -x "${LTSP_OPT}/${chroot_dir}/bin/bash" && echo -n "${chroot_dir} "; done)
+
for chroot in ${ltsp_chroots}; do
if [ -e "${LTSP_OPT}/${chroot}/chroot-upgrade-in-process" ]; then