sys-power/auto-cpufreq: delete all rogue files created by package

The rogue creation of files in /usr/bin should be reported upstream..
This commit also ensures operation of ${EROOT} instead of /.

Signed-off-by: Lucio Sauer <watermanpaint@posteo.net>
This commit is contained in:
Lucio Sauer
2024-08-13 17:29:35 +02:00
parent b102a73d41
commit c16943af68
3 changed files with 31 additions and 29 deletions

View File

@@ -66,18 +66,18 @@ pkg_postinst() {
pkg_postrm() {
# Remove auto-cpufreq log file
if [ -f "/var/log/auto-cpufreq.log" ]; then
rm /var/log/auto-cpufreq.log || die
if [ -f "${EROOT}/var/log/auto-cpufreq.log" ]; then
rm "${EROOT}"/var/log/auto-cpufreq.log || die
fi
# Restore original cpufreqctl binary if backup was made
if [ -f "${EROOT}/usr/bin/cpufreqctl.auto-cpufreq.bak" ]; then
mv "${EROOT}"/usr/bin/cpufreqctl.auto-cpufreq{.bak,} || die
fi
# Remove auto-cpufreq's cpufreqctl binary
# it overwrites cpufreqctl.sh
if [ -f "/usr/bin/cpufreqctl" ]; then
rm /usr/bin/cpufreqctl || die
fi
# Restore original cpufreqctl binary if backup was made
if [ -f "/usr/bin/cpufreqctl.auto-cpufreq.bak" ]; then
mv /usr/bin/cpufreqctl.auto-cpufreq.bak /usr/bin/cpufreqctl || die
if [ -f "${EROOT}/usr/bin/cpufreqctl" ]; then
rm "${EROOT}"/usr/bin/cpufreqctl || die
fi
}

View File

@@ -121,21 +121,22 @@ pkg_postrm() {
xdg_desktop_database_update
# Remove the override.pickle file and directory
if [[ -d "/var/lib/auto-cpufreq" ]]; then
rm -rf /var/lib/auto-cpufreq
if [[ -d "${EROOT}/var/lib/auto-cpufreq" ]]; then
rm -rf "${EROOT}"/var/lib/auto-cpufreq || die
fi
# Remove auto-cpufreq log file
if [ -f "/var/log/auto-cpufreq.log" ]; then
rm /var/log/auto-cpufreq.log || die
if [ -f "${EROOT}/var/log/auto-cpufreq.log" ]; then
rm "${EROOT}"/var/log/auto-cpufreq.log || die
fi
# Restore original cpufreqctl binary if backup was made
if [ -f "${EROOT}/usr/bin/cpufreqctl.auto-cpufreq.bak" ]; then
mv "${EROOT}"/usr/bin/cpufreqctl.auto-cpufreq{.bak,} || die
fi
# Remove auto-cpufreq's cpufreqctl binary
# it overwrites cpufreqctl.sh
if [ -f "/usr/bin/cpufreqctl" ]; then
rm /usr/bin/cpufreqctl || die
fi
# Restore original cpufreqctl binary if backup was made
if [ -f "/usr/bin/cpufreqctl.auto-cpufreq.bak" ]; then
mv /usr/bin/cpufreqctl.auto-cpufreq.bak /usr/bin/cpufreqctl || die
if [ -f "${EROOT}/usr/bin/cpufreqctl" ]; then
rm "${EROOT}"/usr/bin/cpufreqctl || die
fi
}

View File

@@ -121,21 +121,22 @@ pkg_postrm() {
xdg_desktop_database_update
# Remove the override.pickle file and directory
if [[ -d "/var/lib/auto-cpufreq" ]]; then
rm -rf /var/lib/auto-cpufreq
if [[ -d "${EROOT}/var/lib/auto-cpufreq" ]]; then
rm -rf "${EROOT}"/var/lib/auto-cpufreq || die
fi
# Remove auto-cpufreq log file
if [ -f "/var/log/auto-cpufreq.log" ]; then
rm /var/log/auto-cpufreq.log || die
if [ -f "${EROOT}/var/log/auto-cpufreq.log" ]; then
rm "${EROOT}"/var/log/auto-cpufreq.log || die
fi
# Restore original cpufreqctl binary if backup was made
if [ -f "${EROOT}/usr/bin/cpufreqctl.auto-cpufreq.bak" ]; then
mv "${EROOT}"/usr/bin/cpufreqctl.auto-cpufreq{.bak,} || die
fi
# Remove auto-cpufreq's cpufreqctl binary
# it overwrites cpufreqctl.sh
if [ -f "/usr/bin/cpufreqctl" ]; then
rm /usr/bin/cpufreqctl || die
fi
# Restore original cpufreqctl binary if backup was made
if [ -f "/usr/bin/cpufreqctl.auto-cpufreq.bak" ]; then
mv /usr/bin/cpufreqctl.auto-cpufreq.bak /usr/bin/cpufreqctl || die
if [ -f "${EROOT}/usr/bin/cpufreqctl" ]; then
rm "${EROOT}"/usr/bin/cpufreqctl || die
fi
}