Refactor packages
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env -S nix shell nixpkgs#ssh-to-age nixpkgs#age nixpkgs#sops -c bash
|
||||
# shellcheck shell=bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
|
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env -S nix shell nixpkgs#ssh-to-age -c bash
|
||||
# shellcheck shell=bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
|
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env -S nix shell nixpkgs#sops -c bash
|
||||
# shellcheck shell=bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
|
@@ -4,28 +4,30 @@ set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
echo "Updating submodules..."
|
||||
|
||||
paths=$(git config --file .gitmodules --name-only --get-regexp path | while read -r line; do
|
||||
path=$(git config --file .gitmodules --get "${line}")
|
||||
path=$(git config --file .gitmodules --get "$line")
|
||||
url=$(git config --file .gitmodules --get "${line%.*}.url")
|
||||
if [[ ${url} == *"karaolidis"* ]]; then
|
||||
echo "${path}"
|
||||
if [[ $url == *"karaolidis"* ]]; then
|
||||
echo "$path"
|
||||
fi
|
||||
done)
|
||||
|
||||
for path in ${paths}; do
|
||||
echo "Processing submodule: ${path}"
|
||||
for path in $paths; do
|
||||
echo "Processing submodule: $path"
|
||||
|
||||
cd "${path}" || exit
|
||||
cd "$path" || exit
|
||||
|
||||
default_branch=$(git remote show origin | awk '/HEAD branch/ {print $NF}')
|
||||
git checkout "${default_branch}"
|
||||
git checkout "$default_branch"
|
||||
git fetch upstream
|
||||
git merge "upstream/${default_branch}"
|
||||
git merge "upstream/$default_branch"
|
||||
|
||||
branches=$(git for-each-ref --format='%(refname:short)' refs/heads/ | grep -v "^${default_branch}$")
|
||||
for branch in ${branches}; do
|
||||
git checkout "${branch}"
|
||||
git rebase "${default_branch}"
|
||||
for branch in $branches; do
|
||||
git checkout "$branch"
|
||||
git rebase "$default_branch"
|
||||
done
|
||||
|
||||
git checkout integration
|
||||
@@ -37,4 +39,16 @@ done
|
||||
|
||||
echo "All submodules updated successfully."
|
||||
|
||||
echo "Updating packages..."
|
||||
|
||||
find packages -type f -name "*.nix" | while read -r file; do
|
||||
update_command=$(grep -oP '^#\s*AUTO-UPDATE:\s*\K.+' "$file" || true)
|
||||
if [[ -n "$update_command" ]]; then
|
||||
echo "Running update command in: $file"
|
||||
eval "$update_command"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "All packages updated successfully."
|
||||
|
||||
nix flake update
|
||||
|
Reference in New Issue
Block a user