aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2021-01-17 23:05:58 -0300
committerEuAndreh <eu@euandre.org>2021-01-17 23:05:58 -0300
commit7a6e5e0cddd65cfa806c6dc8079913a053ead738 (patch)
treedd9ee0b08f4a3c146dc0c77f7da9b96c3d954242
parentbash/util.sh: Use urandom for genpassword (diff)
downloaddotfiles-7a6e5e0cddd65cfa806c6dc8079913a053ead738.tar.gz
dotfiles-7a6e5e0cddd65cfa806c6dc8079913a053ead738.tar.xz
Fix color sourcing in gc.sh script
-rwxr-xr-xscripts/gc-mail.sh3
-rwxr-xr-xscripts/gc-nix.sh2
-rwxr-xr-xscripts/gc.sh28
3 files changed, 20 insertions, 13 deletions
diff --git a/scripts/gc-mail.sh b/scripts/gc-mail.sh
index 5952cf78..e631850f 100755
--- a/scripts/gc-mail.sh
+++ b/scripts/gc-mail.sh
@@ -1,5 +1,8 @@
#!/bin/sh -eux
+# shellcheck source=/dev/null
+. "$DOTFILES/bash/colors.sh"
+
# Source: https://www.reddit.com/r/emacs/comments/6wqfp3/notmuch_delete_mail/
yellow "Clean up deleted email files"
notmuch search --output=files --exclude=false tag:deleted | xargs -I{} rm "{}"
diff --git a/scripts/gc-nix.sh b/scripts/gc-nix.sh
index 056c1ebe..5bb448cc 100755
--- a/scripts/gc-nix.sh
+++ b/scripts/gc-nix.sh
@@ -3,7 +3,7 @@ set -Eeuo pipefail
# shellcheck source=/dev/null
. "$DOTFILES/bash/colors.sh"
-yellow "Cleaning up the NixOS store"
+yellow "Cleaning up the NixOS store\n"
profiles=(per-user/root/channels per-user/andreh/profile per-user/andreh/channels system)
diff --git a/scripts/gc.sh b/scripts/gc.sh
index bdc00431..e7834dfe 100755
--- a/scripts/gc.sh
+++ b/scripts/gc.sh
@@ -1,4 +1,7 @@
-#!/bin/sh -eux
+#!/bin/sh -eu
+
+# shellcheck source=/dev/null
+. "$DOTFILES/bash/colors.sh"
disk_space() {
u | awk '{print $5" "$6}'
@@ -8,26 +11,27 @@ before=$(disk_space)
gc-nix.sh
-yellow "Cleaning up Guix store"
+yellow "Cleaning up Guix store\n"
guix gc
-yellow "Cleaning up up the Trash and /tmp folders"
+yellow "Cleaning up up the Trash and /tmp folders\n"
sudo rm -rf ~/.local/share/Trash/files/*
# https://askubuntu.com/a/609396
sudo find /tmp -type f -atime +10 -delete
-yellow "Erasing docker images"
+yellow "Erasing docker images\n"
+set -x
echo y | docker system prune -a
-docker rmi "$(docker images -a -q)"
-docker rm "$(docker ps -a -f status=exited -q)"
+docker rmi "$(docker images -a -q)" ||:
+docker rm "$(docker ps -a -f status=exited -q)" ||:
-docker stop "$(docker ps -a -q)"
-docker rm "$(docker ps -a -q)"
+docker stop "$(docker ps -a -q)" ||:
+docker rm "$(docker ps -a -q)" ||:
echo y | docker volume prune
echo y | docker container prune
@@ -36,7 +40,7 @@ gc-mail.sh
after=$(disk_space)
-green "Done."
-green "Disk space before and after:"
-blue " before: ${before}"
-blue " after: ${after}"
+green "Done.\n"
+green "Disk space before and after:\n"
+blue " before: ${before}\n"
+blue " after: ${after}\n"