Sophie

Sophie

distrib > Fedora > 20 > x86_64 > by-pkgid > ae24f28e8d491091137f6088883caa8a > scriptlet

cups-filters-1.0.53-6.fc20.x86_64.rpm

PREUN

/bin/sh

if [ $1 -eq 0 ] ; then 
        # Package removal, not upgrade 
        systemctl --no-reload disable cups-browsed.service > /dev/null 2>&1 || : 
        systemctl stop cups-browsed.service > /dev/null 2>&1 || : 
fi

POSTIN

/bin/sh

if [ $1 -eq 1 ] ; then 
        # Initial installation 
        systemctl preset cups-browsed.service >/dev/null 2>&1 || : 
fi 

# Initial installation
if [ $1 -eq 1 ] ; then
    IN=/etc/cups/cupsd.conf
    OUT=/etc/cups/cups-browsed.conf
    keyword=BrowsePoll

    # We can remove this after few releases, it's just for the introduction of cups-browsed.
    if [ -f "$OUT" ]; then
        echo -e "\n# NOTE: This file is not part of CUPS. You need to start & enable cups-browsed service." >> "$OUT"
    fi

    # move BrowsePoll from cupsd.conf to cups-browsed.conf
    if [ -f "$IN" ] && grep -iq ^$keyword "$IN"; then
        if ! grep -iq ^$keyword "$OUT"; then
            (cat >> "$OUT" <<EOF

# Settings automatically moved from cupsd.conf by RPM package:
EOF
            ) || :
            (grep -i ^$keyword "$IN" >> "$OUT") || :
            #systemctl enable cups-browsed.service >/dev/null 2>&1 || :
        fi
        sed -i -e "s,^$keyword,#$keyword directive moved to cups-browsed.conf\n#$keyword,i" "$IN" || :
    fi
fi

POSTUN

/bin/sh

systemctl daemon-reload >/dev/null 2>&1 || : 
if [ $1 -ge 1 ] ; then 
        # Package upgrade, not uninstall 
        systemctl try-restart cups-browsed.service >/dev/null 2>&1 || : 
fi