Save Battery Life (#32)

* Added parameters (also made the script more of a program).

* Add additional options for unplugged devices.

* Allow disabling of cron jobs and lowering of telegraf frequency through new config options.

* Fix cron package name.

* Fix ssh service name for Ubuntu.

* Add output to the options so user knows they were switched.

* Prevent some tasks when device is mobile.

* Enhance and add to comments.

* Add function to check flatpak app disk usage.

* Add repair into flatpak commands to help clean disk space of unused apps.

* Remove "Done!" output from flatpak-usage.

* Go ahead and add function for purging Flatpak apps.

* Few more comment changes.
This commit is contained in:
2022-12-03 15:28:29 -06:00
committed by GitHub
parent 3e05260423
commit e39aeb20e7
11 changed files with 162 additions and 48 deletions

View File

@ -259,6 +259,24 @@
check-trash --clean
sudo df -h
}
function_flatpak_usage: |
function flatpak-usage() {
flatpak list --columns=application | while read app; do
size=`flatpak info -s $app 2>/dev/null`
if [[ ! -z $size ]]; then
mb=$(( size / (1000*1000) ))
echo "${mb} MB, $size Bytes, $app"
fi
done | sort -n
}
function_flatpak_purge: |
function flatpak-purge() {
flatpak remove --all --delete-data &&
flatpak repair &&
echo "Finished purging all Flatpak apps. Executable may still need uninstalled." &&
return
echo "ERROR: Something went wrong while removing Flatpak apps!"
}
- name: General | Account Management | Users | Files | Common Variable
set_fact:
@ -282,6 +300,8 @@
{{ edit_config }}
{{ function_check_trash }}
{{ function_clean }}
{{ function_flatpak_usage }}
{{ function_flatpak_purge }}
- name: General | Account Management | Users | Files | .bashrc
blockinfile: