#!/bin/bash # postinst script for condor set -e condor_user=condor condor_gecos="HTCondor Daemons" # make this one fixed because 'condor_config_val -tilde' relies on the user # home dir to exist condor_home=/var/lib/condor case "$1" in configure) # according to http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=621833#119 # this should always work if ! adduser --system --group --gecos "$condor_gecos" --home $condor_home \ --disabled-password --disabled-login $condor_user --quiet 2>/dev/null; then # the only time where it would fail, is when there is an existing # non-system 'condor' user. This could happen e.g. in a heterogenous # HTCondor pool (various OSes) where the adminstrative HTCondor user # comes from LDAP and the home dir is shared across machines. This # is a supported deployment scenario for HTCondor (see installation # manual section 3.2) # the only problem is the possibility to conflict with an actual # "human" user with the same name, so only proceed when the # respective user is locked down SH=$(getent passwd | egrep '^condor:'| cut -d : -f 7 | head -1) if [ "$SH" = "/bin/true" -o "$SH" = "/bin/false" -o \ "$SH" = "/sbin/nologin" -o "$SH" = "/usr/sbin/nologin" -o \ "$SH" = "/bin/nosh" ]; then echo "WARNING: HTCondor will be running under an existing non-system user account 'condor'." else echo "ERROR: HTCondor cannot run under unlocked non-system account 'condor'" 1>&2 exit 1 fi fi # condor's home directory needs to be world readable for proper operation if [ -d $condor_home ]; then # Open up the permission, if the directory exists chmod o+rx $condor_home else # Create the home directory, if non-existant mkdir -p $condor_home chown $condor_user $condor_home fi # condor_master needs a log directory to start up dirname=$(condor_config_val LOG 2>/dev/null) mkdir -p $dirname chown $condor_user $dirname # create a configuration directory for packagers mkdir -p /usr/share/condor/config.d # tell systemd to create tmpfiles, but do no harm if not available systemd-tmpfiles --create --exclude-prefix=/dev || true # reload system-daemon as service unit may have changed systemctl daemon-reload >/dev/null || true ;; abort-upgrade|abort-remove|abort-deconfigure) ;; *) echo "postinst called with unknown argument \`$1'" >&2 exit 1 ;; esac # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. # Automatically added by dh_python3 if command -v py3compile >/dev/null 2>&1; then py3compile -p condor:amd64 fi if command -v pypy3compile >/dev/null 2>&1; then pypy3compile -p condor:amd64 || true fi # End automatically added section # Automatically added by dh_installtmpfiles/13.24.2 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -x "$(command -v systemd-tmpfiles)" ]; then systemd-tmpfiles ${DPKG_ROOT:+--root="$DPKG_ROOT"} --create condor-tmpfiles.conf || true fi fi # End automatically added section # Automatically added by dh_installsystemd/13.24.2 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then # The following line should be removed in trixie or trixie+1 deb-systemd-helper unmask 'condor.service' >/dev/null || true # was-enabled defaults to true, so new installations run enable. if deb-systemd-helper --quiet was-enabled 'condor.service'; then # Enables the unit on first installation, creates new # symlinks on upgrades if the unit file has changed. deb-systemd-helper enable 'condor.service' >/dev/null || true else # Update the statefile to add new symlinks (if any), which need to be # cleaned up on purge. Also remove old symlinks. deb-systemd-helper update-state 'condor.service' >/dev/null || true fi fi # End automatically added section # Automatically added by dh_installsystemd/13.24.2 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -d /run/systemd/system ]; then systemctl --system daemon-reload >/dev/null || true if [ -n "$2" ]; then _dh_action=restart else _dh_action=start fi deb-systemd-invoke $_dh_action 'condor.service' >/dev/null || true fi fi # End automatically added section exit 0