2 # No way I try to deal with a crippled sh just for POSIX foo.
4 # Copyright (C) 2009 Joerg Jaspert <joerg@debian.org>
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License as
8 # published by the Free Software Foundation; version 2.
10 # This program is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 # make sure to only use defined variables
24 # import the general variable set.
25 export SCRIPTVARS=/srv/ftp.debian.org/dak/config/debian/vars
28 # common functions are "outsourced"
29 . "${configdir}/common"
31 # usually we are not using debug logs. Set to 1 if you want them.
35 PROGRAM="dinstall_reboot"
37 # where do we want mails to go? For example log entries made with error()
38 if [ "x$(hostname -s)x" != "xriesx" ]; then
39 # Not our ftpmaster host
40 MAILTO=${MAILTO:-"root"}
43 MAILTO=${MAILTO:-"ftpmaster@debian.org"}
46 # Marker for dinstall start
47 DINSTALLSTART="${lockdir}/dinstallstart"
48 # Marker for dinstall end
49 DINSTALLEND="${lockdir}/dinstallend"
52 starttime=$(/usr/bin/stat -c %Z "${DINSTALLSTART}")
53 endtime=$(/usr/bin/stat -c %Z "${DINSTALLEND}")
56 if [ ${endtime} -gt ${starttime} ]; then
57 # Great, last dinstall run did seem to end without trouble, no need to rerun
58 log "Last dinstall run did end without trouble, not rerunning"
61 # Hrm, it looks like we did not successfully end the last run.
62 # This either means dinstall did abort due to an error, or we had a reboot
63 # No way to tell, so lets restart and see what happens.
65 # Make sure we are not fooled by some random touching of the files, only
66 # really restart if we have the first stage stampfile there, indicating that
67 # dinstall got started
68 if [ -f "${stagedir}/savetimestamp" ]; then
69 log "Seems we have to restart a dinstall run after reboot"
70 ${configdir}/cron.dinstall