aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ansible/update_adjutor.yml12
-rw-r--r--ansible/update_nginx.yml25
-rwxr-xr-xauto-void-packages/auto-build-all-orphans.sh17
-rwxr-xr-xauto-void-packages/update-git-repo.sh12
-rwxr-xr-xauto-void-packages/update-package.sh15
-rwxr-xr-xauto-void-packages/who-needs-update.sh4
-rwxr-xr-xbin/update-everything.sh26
-rwxr-xr-xbin/update-scripts-repo.sh5
8 files changed, 38 insertions, 78 deletions
diff --git a/ansible/update_adjutor.yml b/ansible/update_adjutor.yml
deleted file mode 100644
index 2724a30..0000000
--- a/ansible/update_adjutor.yml
+++ /dev/null
@@ -1,12 +0,0 @@
----
-- name: Update the server
- hosts: vps
- become: true
- tasks:
-
- - name: Update and upgrade apt packages
- ansible.builtin.apt:
- update_cache: true
- upgrade: true
- autoremove: true
-...
diff --git a/ansible/update_nginx.yml b/ansible/update_nginx.yml
deleted file mode 100644
index 4813e6c..0000000
--- a/ansible/update_nginx.yml
+++ /dev/null
@@ -1,25 +0,0 @@
----
-- name: Update nginx if needed
- hosts: vps
- become: true
- become_user: root
- tasks:
-
- - name: Ensure nginx is at the latest version
- ansible.builtin.package:
- name: nginx
- state: latest
- notify: restart nginx
-
- - name: Ensure nginx is running
- ansible.builtin.service:
- name: nginx
- state: started
- enabled: true
-
- handlers:
- - name: Restart nginx
- ansible.builtin.service:
- name: nginx
- state: restarted
-...
diff --git a/auto-void-packages/auto-build-all-orphans.sh b/auto-void-packages/auto-build-all-orphans.sh
index 373a058..8c4c8cf 100755
--- a/auto-void-packages/auto-build-all-orphans.sh
+++ b/auto-void-packages/auto-build-all-orphans.sh
@@ -42,6 +42,7 @@ typeset package=""
typeset -A pkgs_to_update=()
typeset -i nb_of_pkgs_to_build=0
+typeset pkgs_to_update_fp="/tmp/pkgs_to_update.txt"
typeset pkgs_to_exclude=""
typeset auto_build_archs_path=""
typeset -i pkg_counter=0
@@ -109,10 +110,15 @@ do
done
stop_spinner
+# Infos
echo -n "Number of orphan packages needing an update : " ; printf_green "${#pkgs_to_update[@]}"
echo -n "Number of orphan packages you want to build : " ; printf_red "$nb_of_pkgs_to_build"
echo -n "Packages you want to exclude : " ; printf_red "$pkgs_to_exclude"
+# Saving the content of the pkgs_to_update to a file
+[ -f $pkgs_to_update_fp ] && rm $pkgs_to_update_fp
+echo "${!pkgs_to_update[@]}" > $pkgs_to_update_fp
+
[ $nb_of_pkgs_to_build == 0 ] && exit 1
echo "Executing update-git-repo.sh"
@@ -120,15 +126,10 @@ echo "Executing update-git-repo.sh"
for package in "${!pkgs_to_update[@]}"; do
- echo "DEBUG : package : $package"
-
# If the currently selected package is in the exclude list, continue to the next package
- if echo "$pkgs_to_exclude" | grep -q "$package"; then #TODO
- echo "DEBUG : before continue"
+ if echo "$package" | grep -q -E "^($(echo "$pkgs_to_exclude" | tr ',' '|'))"; then
continue
- echo "DEBUG : after continue"
fi
- echo "DEBUG : after if exclude"
# If we've hit the max number of packages asked by the user, break the loop
if [ $pkg_counter -ge $nb_of_pkgs_to_build ]; then
@@ -137,9 +138,11 @@ for package in "${!pkgs_to_update[@]}"; do
latest_version="${pkgs_to_update[$package]}"
auto_build_archs_path="$HOME/workbench/auto-void-packages/auto-build/archs-${package}-${latest_version}.txt"
- echo "[$package - $latest_version]"
+ echo ">>>[$package - $latest_version]>>>"
./update-package.sh "$package" "$latest_version" "$auto_build_archs_path"
+ echo "<<<[$package - $latest_version]<<<"
+
((pkg_counter++))
done
diff --git a/auto-void-packages/update-git-repo.sh b/auto-void-packages/update-git-repo.sh
index e71701c..9533bc9 100755
--- a/auto-void-packages/update-git-repo.sh
+++ b/auto-void-packages/update-git-repo.sh
@@ -5,19 +5,15 @@ echo_n_notify(){
}
pushd "$HOME/workbench/void-packages" || exit 1
-CHECKOUT="checkout"
-FETCH="fetch"
-MERGE="merge"
-PUSH="push"
git checkout master && \
- echo_n_notify "$CHECKOUT: ok" && \
+ echo_n_notify "checkout: ok" && \
git fetch upstream && \
- echo_n_notify "$FETCH: ok" && \
+ echo_n_notify "fetch: ok" && \
git merge upstream/master && \
- echo_n_notify "$MERGE: ok" && \
+ echo_n_notify "merge: ok" && \
git push && \
- echo_n_notify "$PUSH: ok"
+ echo_n_notify "push: ok"
./xbps-src bootstrap-update
diff --git a/auto-void-packages/update-package.sh b/auto-void-packages/update-package.sh
index a21dd6c..11345ef 100755
--- a/auto-void-packages/update-package.sh
+++ b/auto-void-packages/update-package.sh
@@ -14,10 +14,13 @@ printf "path (optional): path of architectures file, defaults to '\$HOME/workben
PKG="$1"
VER="$2"
archs_fp="${3:-$HOME/workbench/auto-void-packages/architectures.txt}"
+template_path="srcpkgs/$PKG/template"
printf "Updating %s to %s.\n" "$PKG" "$VER"
pushd ~/workbench/void-packages || exit 1
+./xbps-src binary-bootstrap && ./xbps-src clean-repocache
+
git checkout master
git checkout -b "$PKG-update" || ( \
git checkout master &&\
@@ -25,17 +28,23 @@ git checkout -b "$PKG-update" || ( \
git checkout -b "$PKG-update" ) || \
exit 1
-sed -i "s/version=.*/version=$VER/g" "srcpkgs/$PKG/template"
-sed -i "s/revision=.*/revision=1/g" "srcpkgs/$PKG/template"
+sed -i "s/version=.*/version=$VER/g" "$template_path"
+sed -i "s/revision=.*/revision=1/g" "$template_path"
xgensum -f -i "$PKG" ; xgensum -f -i "$PKG" || exit 1
+xlint "$template_path" || exit 1
+
[ -f "$archs_fp" ] && rm -v "$archs_fp"
+
+./xbps-src clean "$PKG"
./xbps-src -a armv7l pkg "$PKG" && echo " - armv7l" >> "$archs_fp"
./xbps-src -a armv6l-musl pkg "$PKG" && echo " - armv6l-musl" >> "$archs_fp"
./xbps-src -a aarch64-musl pkg "$PKG" && echo " - aarch64-musl" >> "$archs_fp"
./xbps-src pkg "$PKG" || exit 1
-xi -S --repository="hostdir/binpkgs/$PKG-update" "$PKG" && $PKG --version
+./xbps-src check "$PKG" || exit 1
+
+sudo xbps-install -S --repository="hostdir/binpkgs/$PKG-update" "$PKG" && $PKG --version
popd || exit 1
diff --git a/auto-void-packages/who-needs-update.sh b/auto-void-packages/who-needs-update.sh
index e01af13..e798847 100755
--- a/auto-void-packages/who-needs-update.sh
+++ b/auto-void-packages/who-needs-update.sh
@@ -38,6 +38,10 @@ VOID_UPDATES=$(curl --silent "$VOID_UPDATES_URL")
# v for needing one
while read -r PKG;
do
+ # checks if there's a # at the beginning of the line
+ # if so, skip the current iteration
+ echo "$PKG" | grep -q '^#' && continue
+
printf_magenta "$PKG"
UPDATES=$(echo "$VOID_UPDATES" | grep -e "^$PKG ")
if [ -z "$UPDATES" ];
diff --git a/bin/update-everything.sh b/bin/update-everything.sh
index 5bced73..e69f705 100755
--- a/bin/update-everything.sh
+++ b/bin/update-everything.sh
@@ -9,7 +9,6 @@
# printf_accross_width
# local_update
# remote_update
-# non_free_update
# pip_update
# update_scripts_repo
# update_whatis_db
@@ -53,23 +52,10 @@ remote_update(){
printf_n_notify "remote update"
- ansible-playbook --inventory-file "$HOME/workbench/ansible/hosts" \
- "$HOME/workbench/ansible/update_adjutor.yml"
-
-}
-
-
-# Update non-free xbps packages
-non_free_update(){
-
- printf_n_notify "non-free update"
-
- pushd ~/workbench/auto-void-packages || exit 1
- ./update-git-repo.sh
- cd ../void-packages || exit 1
- ./xbps-src pkg discord && $xi --repository=hostdir/binpkgs/nonfree discord
- ./xbps-src pkg vagrant && $xi --repository=hostdir/binpkgs/nonfree vagrant
- popd || exit 1
+ export ANSIBLE_CONFIG="$HOME/workbench/homelab-iac/ansible/ansible.cfg"
+ ansible-playbook -v -b \
+ --inventory-file "$HOME/workbench/homelab-iac/ansible/inventory.yaml" \
+ "$HOME/workbench/homelab-iac/ansible/playbooks/update_system.yml"
}
@@ -79,6 +65,8 @@ pip_update(){
printf_n_notify "pip update"
+ "$HOME/workbench/pyvenv/bin/pip3" install --upgrade pip
+
"$HOME/workbench/pyvenv/bin/pip3" list --outdated --format=json | \
jq -r '.[] | "\(.name)==\(.latest_version)"' | \
xargs -n1 "$HOME/workbench/pyvenv/bin/pip3" install --upgrade
@@ -114,8 +102,6 @@ local_update
printf_accross_width "%"
remote_update
printf_accross_width "%"
-non_free_update
-printf_accross_width "%"
pip_update
printf_accross_width "%"
update_scripts_repo
diff --git a/bin/update-scripts-repo.sh b/bin/update-scripts-repo.sh
index 03a20ee..22e0807 100755
--- a/bin/update-scripts-repo.sh
+++ b/bin/update-scripts-repo.sh
@@ -7,9 +7,8 @@ pushd "$SCRIPTS_REPO_PATH" || exit 1
cp -rv "$HOME/.local/usr/local/bin" .
cp -rv "$HOME/workbench/auto-void-packages" .
-cp -rv "$HOME/workbench/ansible" .
-git status | less && git diff | less
-git add . && git commit && git push -v --progress
+git status | less
+git add --patch . && git commit -v && git push -v --progress
popd || exit 1