+touch_stuff() {
+ local user="$1"
+ local home=$(getent passwd "$user" | awk -F: '{print $6}')
+
+ if ! test -e "$home"/NO-DAEMON-PLEASE; then
+ if [ -e "$home"/build/buildd.pid ] ; then
+ echo "Touching ${home}/NO-DAEMON-PLEASE ${home}/EXIT-DAEMON-PLEASE"
+ sudo -u "$user" touch "$home"/NO-DAEMON-PLEASE "$home"/EXIT-DAEMON-PLEASE
+ sudo -u "$user" sh -c "echo waiting-for-clean-shutdown > '${home}/'NO-DAEMON-PLEASE"
+ sudo chgrp -v adm "$home"/NO-DAEMON-PLEASE
+
+ echo "Sending HUP to $user:buildd"
+ sudo -u "$user" kill -HUP "$(sudo cat "${home}"/build/buildd.pid)"
+ else
+ echo "$user: no-daemon-please does not exist, but there is no buildd.pid file either"
+ if pgrep -u "$user" -x buildd ; then
+ echo "But there is a buildd running. Bad?"
+ exit 3
+ fi
+ fi
+ else
+ echo "no-daemon-please already exists"
+ fi
+}