Skip to content

Commit

Permalink
sys-power/auto-cpufreq: delete all rogue files created by package
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
antecrescent committed Aug 13, 2024
1 parent b102a73 commit c16943a
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 29 deletions.
18 changes: 9 additions & 9 deletions sys-power/auto-cpufreq/auto-cpufreq-2.1.0-r1.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -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

# Remove auto-cpufreq's cpufreqctl binary
# it overwrites cpufreqctl.sh
if [ -f "/usr/bin/cpufreqctl" ]; then
rm /usr/bin/cpufreqctl || die
# 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

# 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
# Remove auto-cpufreq's cpufreqctl binary
# it overwrites cpufreqctl.sh
if [ -f "${EROOT}/usr/bin/cpufreqctl" ]; then
rm "${EROOT}"/usr/bin/cpufreqctl || die
fi
}
21 changes: 11 additions & 10 deletions sys-power/auto-cpufreq/auto-cpufreq-2.2.0.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
21 changes: 11 additions & 10 deletions sys-power/auto-cpufreq/auto-cpufreq-2.3.0.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit c16943a

Please sign in to comment.