Kerala Cyber Warriors
KCW Uploader V1.1

Path : /proc/self/root/var/lib/dpkg/info/
File Upload :
Current File : //proc/self/root/var/lib/dpkg/info/cpanel-exim.preinst

#!/bin/bash
set -e

# https://wiki.debian.org/MaintainerScripts

## <asset scriplets/pre>


# in all pre
pre_upgrade() {
    # on upgrades we need to stop exim while we rebuild the configuration
    echo "Stopping previous version of exim on upgrade"
    /usr/local/cpanel/scripts/restartsrv exim --stop ||:
}

# Install, not upgrade
pre_install() {
    hname=`/bin/hostname -f`
    if [ -e "/etc/valiases/${hname}" ]; then
        /bin/rm -f /etc/valiases/${hname}
    fi
    
    echo "Resetting Exim to cPanel Defaults and Installing the Latest Version"
    
    for file in /etc/rc.d/init.d/exim /etc/systemd/system/exim.service /etc/exim.conf /etc/exim.pl /usr/sbin/sendmail /usr/lib/sendmail
    do
        if [ -f "$file" ]; then
            if [ ! -L $file ]; then
                /usr/bin/chattr -i $file
            fi
        fi
    done
    
    for file in /etc/localdomains /etc/aliases /etc/secondarymx
    do
        if [ -e $file ]; then
            /bin/cp -af $file ${file}.eximreset
        fi
    done
    
    /bin/rm -f /usr/share/amavis/amavis-filter
    
    /bin/rm -f /etc/exim.crt.preinstall
    if [ -e '/etc/exim.crt' ]; then
        /bin/mv -f /etc/exim.crt /etc/exim.crt.preinstall
        /bin/cp -af /etc/exim.crt.preinstall /etc/exim.crt
    fi
    
    /bin/rm -f /etc/exim.key.preinstall
    if [ -e '/etc/exim.key' ]; then
        /bin/mv -f /etc/exim.key /etc/exim.key.preinstall
        /bin/cp -af /etc/exim.key.preinstall /etc/exim.key
    fi
    
    /usr/sbin/useradd -c "Exim" -u 47 -s /bin/false -r -d /var/spool/mqueue mailnull 2> /dev/null || :
    /usr/sbin/groupadd -f -r mailnull >/dev/null 2>&1
    /usr/sbin/groupadd -f -r mailtrap >/dev/null 2>&1
}

## </asset>


case "$1" in
    upgrade)
        pre_upgrade;
        pre_install;
    ;;
    install)
        pre_install;
    ;;
esac

exit 0

-=[ KCW uplo4d3r c0ded by cJ_n4p573r ]=-
Ⓒ2017 ҠЄГѦLѦ СүѣЄГ ЩѦГГіѺГՏ