#!/bin/sh # postinst script for gridengine-common # # see: dh_installdeb(1) set -e # Source debconf library . /usr/share/debconf/confmodule user=sgeadmin case "$1" in configure) # Only create the user if it doesn't exist # We can't rely on adduser to do it as a lot of sites stick the # sgeadmin user in LDAP or something like that... if ! id ${user} >/dev/null 2>&1; then adduser --system --no-create-home --quiet \ --disabled-password --disabled-login \ --shell /bin/false --group --home /var/lib/gridengine ${user} fi # Set up the sgeadmin user and basic config on new install if [ -z "$2" ]; then mkdir -p /var/lib/gridengine # Get our debconf answers SGE_CELL=default db_get shared/gridengineconfig || true if [ "${RET}" = "true" ]; then # Get Cell name db_get shared/gridenginecell || true SGE_CELL="${RET}" if [ -z "${SGE_CELL}" ]; then SGE_CELL=default fi fi for d in /var/lib/gridengine \ /var/lib/gridengine/${SGE_CELL} \ /var/lib/gridengine/${SGE_CELL}/common do mkdir -p ${d} chmod 755 ${d} chown ${user}:${user} ${d} done # Copy the default bootstrap file install -m0644 -o sgeadmin -g sgeadmin /usr/share/gridengine/default-bootstrap /var/lib/gridengine/${SGE_CELL}/common/bootstrap # Copy in the default file having set SGE_CELL and use ucf to install it TMPFILE=$(mktemp) chown root:root ${TMPFILE} chmod 644 ${TMPFILE} sed "s@^SGE_CELL=.*@SGE_CELL=${SGE_CELL}@" /usr/share/gridengine/templates/gridengine.default >> ${TMPFILE} ucf --debconf-ok ${TMPFILE} /etc/default/gridengine rm -f ${TMPFILE} else # On upgrades, only certain things need to happen # From before 6.2-2, we need to fix the stupid chown/chmod bug on /etc/default/gridengine if dpkg --compare-versions "$2" lt 6.2-2; then chown root:root /etc/default/gridengine chmod 644 /etc/default/gridengine fi fi ;; *) echo "postinst called with unknown argument \`$1'" >&2 exit 1 ;; esac db_stop || true # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. exit 0