#!/bin/sh -eu ERRCNT="" # Known good post-debootstrap values passwd_bootstrap="12e43f2db1904588e57222ec6dc5680e" shadow_bootstrap="68a335c6f7f9e8d26c1dc98b0004b57a" group_bootstrap="aaf84a9eebc91636adb0e2b38cedd0e1" gshadow_bootstrap="7c976f5ac7b8f8207c7009dcac48eecb" # Current post-debootstrap values passwd_hash=$(set -- $(md5sum /etc/passwd) && echo $1) shadow_hash=$(set -- $(cat /etc/shadow | sed "s/:.*:0:99999:/:0:99999:/g" | md5sum) && echo $1) group_hash=$(set -- $(md5sum /etc/group) && echo $1) gshadow_hash=$(set -- $(md5sum /etc/gshadow) && echo $1) # /etc/passwd if [ "$passwd_bootstrap" = "$passwd_hash" ]; then cat > /etc/passwd <&2 echo "The output below might help to resolve the issue" >&2 cat /etc/passwd echo "passwd md5sum: $passwd_hash" >&2 ERRCNT=1 fi # /etc/shadow if [ "$shadow_bootstrap" = "$shadow_hash" ]; then cat > /etc/shadow <&2 echo "The output below might help to resolve the issue" >&2 cat /etc/shadow echo "shadow md5sum: $shadow_hash" >&2 ERRCNT=1 fi # /etc/group if [ "$group_bootstrap" = "$group_hash" ]; then cat > /etc/group <&2 echo "The output below might help to resolve the issue" >&2 cat /etc/group echo "group md5sum: $group_hash" >&2 ERRCNT=1 fi # /etc/gshadow if [ "$gshadow_bootstrap" = "$gshadow_hash" ]; then cat > /etc/gshadow <&2 echo "The output below might help to resolve the issue" >&2 cat /etc/gshadow echo "gshadow md5sum: $gshadow_hash" >&2 ERRCNT=1 fi if [ -n "$ERRCNT" ]; then echo "There were changes to the password database," >&2 echo "please adjust the values in the livecd-rootfs source in the file:" >&2 echo "live-build/ubuntu-touch/hooks/00-uid-gid-fix.chroot_early" >&2 echo >&2 echo "Please check also if a maintainer script of the package" >&2 echo "that added these entries perhaps created a home directory and," >&2 echo "if needed, add code for creation of it to the above hook" >&2 exit 1 fi # Create some missing directories mkdir -p /var/lib/lightdm chown lightdm:lightdm /var/lib/lightdm chmod 750 /var/lib/lightdm mkdir -p /var/lib/usermetrics chown usermetrics:usermetrics /var/lib/usermetrics chmod 750 /var/lib/usermetrics echo "adjusting ownership of /var/log" >&2 chown root:syslog /var/log ls -ln /var | grep log >&2 # Record the current state for later comparison for file in /etc/passwd /etc/shadow /etc/group /etc/gshadow; do rm -f ${file}- cp ${file} ${file}.orig done