0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 3.144.224.116


Current Path : /proc/thread-self/root/var/lib/dpkg/info/
Upload File :
Current File : //proc/thread-self/root/var/lib/dpkg/info/cron.postinst

#!/bin/sh
set -e

crondir="/var/spool/cron"
action="$1"

if [ "$action" != configure ]; then
    exit 0
fi


# LEGACY: This hasn't been relevant to Debian cron since the last Millenium,
# but we keep it here to preserve the upgrade path... 
# Copy existing allow/deny files
pausemessage="F"
for fname in allow deny ; do
    if [ -f $crondir/$fname ] ; then
	if [ ! -f $/etc/cron.$fname ] ; then
	    mv $crondir/$fname /etc/cron.$fname
	    echo " "
	    echo "Moving $crondir/$fname to /etc/cron.$fname to comply with Debian policy"
	    pausemessage="T"
	else
	    echo " "
	    echo "Warning:"
	    echo "Both $crondir/$fname and /etc/cron.$fname exist -- cron will"
	    echo "use /etc/cron.$fname"
	    pausemessage="T"
	fi
    fi
done

# Conffiles that are now obsolete
dpkg-maintscript-helper rm_conffile /etc/cron.monthly/standard "3.0pl1-113" -- "$@"
dpkg-maintscript-helper rm_conffile /etc/cron.daily/standard "3.0pl1-124" -- "$@"
# If dpkg-maintscript-helper renames it instead of removing it because it has
# local modifications, we must rename it back to a valid name, or crond
# will not accept it. Thanks to Raphaël Hertzog for the tip.
if [ -e /etc/cron.monthly/standard.dpkg-bak ]; then
    mv /etc/cron.monthly/standard.dpkg-bak \
        /etc/cron.monthly/standard-obsolete-please-verify-and-remove
fi


# Add group for crontabs
getent group crontab > /dev/null 2>&1 || addgroup --system crontab

# Fixup crontab binary for new group 'crontab'.
if ! dpkg-statoverride --list /usr/bin/crontab > /dev/null ; then
    dpkg-statoverride --update --add root crontab 2755 /usr/bin/crontab
fi

# Fixup crontab , directory and files for new group 'crontab'.
# Can't use dpkg-statoverride for this because it doesn't cooperate nicely
# with cron alternatives such as bcron
if [ -d $crondir/crontabs ] ; then
    chown root:crontab $crondir/crontabs
    chmod 1730 $crondir/crontabs
    # This used to be done conditionally. For versions prior to "3.0pl1-81"
    # It has been disabled to suit cron alternative such as bcron. 
    cd $crondir/crontabs
    set +e

    # Iterate over each entry in the spool directory, perform some sanity
    # checks (see CVE-2017-9525), and chown/chgroup the crontabs
    for tab_name in *
    do
        [ "$tab_name" = "*" ] && continue
        tab_type=`stat -c '%F' "$tab_name"`
        tab_links=`stat -c '%h' "$tab_name"`
        tab_owner=`stat -c '%U' "$tab_name"`

        if [ "$tab_type" != "regular file" -a "$tab_type" != "regular empty file" ]
        then
            echo "Warning: $tab_name is not a regular file!"
            continue
        elif [ "$tab_links" -ne 1 ]
        then
            echo "Warning: $tab_name has more than one hard link!"
            continue
        elif [ "$tab_name" != "$tab_owner" ]
        then
            echo "Warning: $tab_name name differs from owner $tab_owner!"
            continue
        fi

		chown "$tab_owner:crontab" "$tab_name"
		chmod 600 "$tab_name"
    done
    set -e
fi


# Automatically added by dh_systemd_enable/11.1.6ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
	# This will only remove masks created by d-s-h on package removal.
	deb-systemd-helper unmask 'cron.service' >/dev/null || true

	# was-enabled defaults to true, so new installations run enable.
	if deb-systemd-helper --quiet was-enabled 'cron.service'; then
		# Enables the unit on first installation, creates new
		# symlinks on upgrades if the unit file has changed.
		deb-systemd-helper enable 'cron.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 'cron.service' >/dev/null || true
	fi
fi
# End automatically added section
# Automatically added by dh_installdeb/11.1.6ubuntu1
dpkg-maintscript-helper rm_conffile /etc/init/cron.conf 3.0pl1-128ubuntu5~ cron -- "$@"
# End automatically added section
# Automatically added by dh_installinit/11.1.6ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
	if [ -x "/etc/init.d/cron" ]; then
		update-rc.d cron start 89 2 3 4 5 . >/dev/null
		invoke-rc.d cron start || exit 1
	fi
fi
# End automatically added section