diff options
Diffstat (limited to 'sbin/itzks-update-disklserver-squashfs-images')
| -rwxr-xr-x | sbin/itzks-update-disklserver-squashfs-images | 19 | 
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 | 
