# restart upgrade under script for logging purposes
if [ "$1" == "--no-script" ]; then
+ # restore umask to default
+ umask 0022
+
shift
elif [ -x /usr/bin/script ]; then
+ # make logs safe
+ umask 0077
+ chmod og= /var/log/carnet-upgrade.* 2>/dev/null
+
+ # restart through script
exec /usr/bin/script -a -t -f -c "$0 --no-script $@" \
/var/log/carnet-upgrade.typescript 2>>/var/log/carnet-upgrade.timing
fi
}
log() {
+ local old_umask
logfile=${logfile:=/var/log/carnet-upgrade.log}
- touch $logfile
+
+ old_umask=$(umask)
+ umask 0077
+
echo "$(date +'%Y-%m-%d %H:%M:%S') $*" >> $logfile
echo "CN: $*"
+
+ umask $old_umask
+ chmod og= $logfile
}
# find first free uid/gid in range