aboutsummaryrefslogtreecommitdiff
path: root/update-everything.sh
diff options
context:
space:
mode:
authorclyhtsuriva <aimeric@adjutor.xyz>2022-11-01 22:27:43 +0100
committerclyhtsuriva <aimeric@adjutor.xyz>2022-11-01 22:27:43 +0100
commit1d047ac51d82c8d72b20bff623903dedd9756107 (patch)
tree7a0b4bd1ed6e78003fd238585bb2f616b68beaa0 /update-everything.sh
Inital commit
Diffstat (limited to 'update-everything.sh')
-rwxr-xr-xupdate-everything.sh94
1 files changed, 94 insertions, 0 deletions
diff --git a/update-everything.sh b/update-everything.sh
new file mode 100755
index 0000000..6f2109e
--- /dev/null
+++ b/update-everything.sh
@@ -0,0 +1,94 @@
+#!/usr/bin/env bash
+#
+# Author: Clyhtsuriva
+
+
+# FUNCTIONS
+#
+# echo_n_notify
+# local_update
+# remote_update
+# non_free_update
+# pip_update
+
+
+xi='sudo xbps-install'
+xr='sudo xbps-remove'
+
+# Print to stdout
+# And as a notification
+echo_n_notify(){
+ printf "%s\n" "[$1]"
+ notify-send "[$1]"
+}
+
+echo_n_notify "Updating everything ..."
+
+# Update local xbps packages
+# And clean the cache and remove orphans
+local_update(){
+
+ echo_n_notify "local update"
+
+ $xi --sync --update --verbose && \
+ $xr --clean-cache --remove-orphans --verbose
+
+}
+
+# Update remote debian server using Ansible
+remote_update(){
+
+ echo_n_notify "remote update"
+
+# ssh -p8022 debian@adjutor.xyz '\
+# sudo apt-fast update && \
+# sudo apt-fast upgrade && \
+# sudo apt-fast autoremove'
+
+ ansible-playbook --inventory-file "$HOME/workbench/ansible/hosts" \
+ "$HOME/workbench/ansible/update_adjutor.yml"
+
+}
+
+# Update non-free xbps packages
+non_free_update(){
+
+ echo_n_notify "non-free update"
+
+ pushd ~/workbench/auto-void-packages || exit 1
+ ./update-git-repo.sh
+ cd ../void-packages || exit 1
+ ./xbps-src pkg teams-bin && \
+ $xi --repository=hostdir/binpkgs/nonfree teams-bin
+ ./xbps-src pkg discord && \
+ $xi --repository=hostdir/binpkgs/nonfree discord
+ ./xbps-src pkg spotify && \
+ $xi --repository=hostdir/binpkgs/nonfree spotify
+ popd || exit 1
+
+}
+
+# Update pip packages needing one
+pip_update(){
+
+ echo_n_notify "pip update"
+
+ python3 -m pip list --outdated --format=json | \
+ jq -r '.[] | "\(.name)==\(.latest_version)"' | \
+ xargs -n1 pip3 install -U
+
+}
+
+
+# ___ ___ ___ _____ _ _
+# | \/ | / _ \|_ _|| \ | |
+# | . . |/ /_\ \ | | | \| |
+# | |\/| || _ | | | | . ` |
+# | | | || | | |_| |_ | |\ |
+# \_| |_/\_| |_/\___/ \_| \_/
+#
+
+local_update
+remote_update
+non_free_update
+pip_update