# # cron class install script for explorer3 # $Id: //depot/dev/proactive/explorer3/pkg/i.cron#5 $ # #if [ "${EXP_CRONTAB_RUN}" = "yes" -a -z "${PKG_INSTALL_ROOT}" ]; then # # Commented out the previous line because we want this to # run, but we will modify our behavior based on the # contents of ${PKG_INSTALL_ROOT} # if [ "${EXP_CRONTAB_RUN}" = "yes" ]; then # Escape / in EXP_HOME PAT=`echo ${EXP_HOME} | sed 's!\/!\\\/!g'` HOUR=`echo ${EXP_CRONTAB_HOUR} | sed 's!\/!\\\/!g'` MIN=`echo ${EXP_CRONTAB_MINUTE} | sed 's!\/!\\\/!g'` DAY=`echo ${EXP_CRONTAB_DAY} | sed 's!\/!\\\/!g'` while read src dest do # If ${PKG_INSTALL_ROOT} is empty, then we can # assume that we are not jumpstarting (IE root is # not on /a and cron is actually running) if [ -z "${PKG_INSTALL_ROOT}" ]; then # Remove old instances crontab -l | sed -e "/.*#${PKGINST}$/d" > /tmp/$$crontab fi # Add comment to new instance and expand variables # Prefix the file creation with ${PKG_INSTALL_ROOT} # so that it's empty, then nothing happens, but # it does get written to the /tmp file system. # This is probably unnecessary as it shouldn't # really matter where the temp file gets written to. sed -e "s/\${EXP_CRONTAB_HOUR}/${EXP_CRONTAB_HOUR}/g" \ -e "s/\${EXP_CRONTAB_MINUTE}/${EXP_CRONTAB_MINUTE}/g" \ -e "s/\${EXP_CRONTAB_DAY}/${EXP_CRONTAB_DAY}/g" \ -e "s/\${EXP_HOME}/${PAT}/g" \ -e "s/$/ # ${PKGINST}/" \ $src >> ${PKG_INSTALL_ROOT}/tmp/$$crontab # # If ${PKG_INSTALL_ROOT} is empty, then go ahead and use # crontab to update this file. # # If ${PKG_INSTALL_ROOT} contains a value (most likely # a mount point where / is currently mounted), then # assume that we're just appending to the root crontab # entry on a file system that is not an active root # file system. This avoids the need for a postinstall # script, and the changes will be picked up the next # time the system boots with this root filesystem. if [ -z "${PKG_INSTALL_ROOT}" ]; then # Update crontab crontab /tmp/$$crontab else cat ${PKG_INSTALL_ROOT}/tmp/$$crontab >> ${PKG_INSTALL_ROOT}/var/spool/cron/crontabs/root fi # Cleanup rm -f ${PKG_INSTALL_ROOT}/tmp/$$crontab done else while read src dest do touch $dest done fi