diff --git a/private_dot_config/menu/executable_hr_rts.sh b/private_dot_config/menu/executable_hr_rts.sh index 275b1d3..add770c 100644 --- a/private_dot_config/menu/executable_hr_rts.sh +++ b/private_dot_config/menu/executable_hr_rts.sh @@ -5,4 +5,4 @@ spawn="niri msg action spawn --" $spawn codium --enable-features=UseOzonePlatform,WaylandWindowDecorations \ --ozone-platform=wayland --new-window $HOME/projects/HR/rts10_reports/ # $spawn flatpak run md.obsidian.Obsidian file://$HOME/projects/hr/rts10_reports/ -$spawn open obsidain://open?vault=$HOME/projects/HR/rts10_reports/ +$spawn open obsidian://open?vault=$HOME/projects/HR/rts10_reports/ diff --git a/private_dot_local/bin/executable_auto_clone b/private_dot_local/bin/executable_auto_clone index 8ca7d97..3d8565e 100755 --- a/private_dot_local/bin/executable_auto_clone +++ b/private_dot_local/bin/executable_auto_clone @@ -1,23 +1,20 @@ #!/bin/bash -token="$1" -page=1 project_dir="$HOME/projects" -base_url="https://gitea.finnvanreenen.nl/api/v1" - function process_repo() { - json="$1" + local json="$1" + local remote_name="$2" - checkout="$project_dir" + local checkout="$project_dir" if [[ "$(echo "$json" | jq -r '.name')" == 'dotfiles' ]]; then return # do not clone dotfiles fi - full_name="$(echo "$json" | jq -r '.full_name')" - clone_url="$(echo "$json" | jq -r '.clone_url')" - ssh_url="$(echo "$json" | jq -r '.ssh_url')" + local full_name="$(echo "$json" | jq -r '.full_name')" + local clone_url="$(echo "$json" | jq -r '.clone_url')" + local ssh_url="$(echo "$json" | jq -r '.ssh_url')" echo "$full_name" @@ -32,32 +29,50 @@ function process_repo() { if [ -d "$checkout/$full_name" ] then echo " already exists" + if [[ "$(git -C "$checkout/$full_name" remote | grep "^$remote_name\$")" == "" ]] + then + git -C "$checkout/$full_name" remote add "$remote_name" "$ssh_url" + else + git -C "$checkout/$full_name" remote set-url "$remote_name" "$ssh_url" + fi else echo " clone to $checkout/$full_name" url="$(echo "$clone_url" | sed "s|://|://$token@|")" - git clone "$clone_url" "$project_dir/$full_name" - git -C "$project_dir/$full_name" remote set-url origin "$ssh_url" + git clone "$url" "$checkout/$full_name" + git -C "$checkout/$full_name" remote set-url origin "$ssh_url" + git -C "$checkout/$full_name" remote add "$remote_name" "$ssh_url" fi } -while [[ $page -lt 50 ]] -do - # echo - echo "get repo list page $page" - repos="$(curl -X 'GET' "$base_url/user/repos?page=$page&token=$token" \ - -H 'accept: application/json')" +function fetch_repos() { + local base_url="$1" + local remote_name="$2" + local token="$3" - if [[ "$repos" != "[]" ]] - then - for repo in $(echo "$repos" | jq -c '.[]' | sed -e 's/ /%20;/g') - do - repo="$( echo "$repo" | sed -e 's/%20;/ /g' )" - process_repo "$repo" - done - else - echo "No more repositories found." - page=999 - fi + local page=1 - page="$(( $page + 1 ))" -done + while [[ $page -lt 50 ]] + do + # echo + echo "get repo list page $page" + repos="$(curl -X 'GET' "$base_url/user/repos?page=$page&token=$token" \ + -H 'accept: application/json')" + + if [[ "$repos" != "[]" ]] + then + for repo in $(echo "$repos" | jq -c '.[]' | sed -e 's/ /%20;/g') + do + repo="$( echo "$repo" | sed -e 's/%20;/ /g' )" + process_repo "$repo" + done + else + echo "No more repositories found." + page=999 + fi + + page="$(( $page + 1 ))" + done +} + +fetch_repos https://gitea.finnvanreenen.nl/api/v1 tea "$(pass show gitea.finnvanreenen.nl/autoclone)" +fetch_repos https://git.gay/api/v1 gay "$(pass show git.gay/autoclone)" diff --git a/private_dot_local/bin/executable_flatrun b/private_dot_local/bin/executable_flatrun new file mode 100644 index 0000000..e458a25 --- /dev/null +++ b/private_dot_local/bin/executable_flatrun @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +app="$(flatpak list --app --columns=name,application | sed -e 's/\t/ (/' -e 's/$/)/' | fzf)" + +flatpak run "$(echo "$app" | sed -e 's/^.*(\(.*\))$/\1/')" diff --git a/private_dot_local/bin/executable_proj_fetch_all b/private_dot_local/bin/executable_proj_fetch_all new file mode 100755 index 0000000..394e6db --- /dev/null +++ b/private_dot_local/bin/executable_proj_fetch_all @@ -0,0 +1,78 @@ +#!/bin/bash + +function update_remote() { + local repo="$1" + + for remote in $(git -C "$repo" remote 2>/dev/null) + do + local new_url="$(git -C "$repo" remote get-url "$remote" | sed -e 's|^https://FReenen:[0-9a-f]*@gitea.finnvanreenen.nl/|git@gitea.finnvanreenen.nl:|')" + git -C "$repo" remote set-url "$remote" "$new_url" + done + + return 1 +} + +for repo in $(find $HOME/projects/ -type d -name '.git' | sed -e 's/ /%20;/g') +do + repo="$( echo "$repo" | sed -e 's/%20;/ /g' -e 's|/\.git$||' )" + git -C "$repo" fetch --all 1>/dev/null \ + || update_remote "$repo" \ + || { echo "failt to fetch $repo" ; echo ; } + + changes="" + + staged="" + unsgated="" + git diff --cached --exit-code &>/dev/null || staged="staged" + git diff --exit-code &>/dev/null || unsgated="unsgated" + + if [[ ! -z "$staged" && ! -z "$unstaged" ]] + then + changes="staged and unstaged changes" + elif [[ ! -z "$unstaged" ]] + then + changes="unstaged changes" + elif [[ ! -z "$staged" ]] + then + changes="staged changes" + fi + + remote="" + + b=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/') + if [ "$b" != "" ] + then + behind=$(git rev-list HEAD...@{u} --ignore-submodules --count 2>/dev/null) + ahead=$(git rev-list @{u}...HEAD --ignore-submodules --count 2>/dev/null) + if [[ "$behind" > 0 && "$ahead" > 0 ]] + then + remote="merge with remote" + elif [[ "$behind" > 0 ]] + then + remote="push to remote" + elif [[ "$ahead" > 0 ]] + then + remote="pull from remote" + fi + fi + + if [[ ! -z "$changes" || ! -z "$remote" ]] + then + echo "# $repo" + echo + + if [[ ! -z "$changes" && ! -z "$remote" ]] + then + echo "has $changes and has to $remote" + elif [[ ! -z "$changes" ]] + then + echo "has $changes" + elif [[ ! -z "$remote" ]] + then + echo "has to $remote" + fi + + echo + fi + +done diff --git a/private_dot_local/share/flatpak/exact_overrides/org.mozilla.firefox b/private_dot_local/share/flatpak/exact_overrides/org.mozilla.firefox index 0c8b956..01e1636 100644 --- a/private_dot_local/share/flatpak/exact_overrides/org.mozilla.firefox +++ b/private_dot_local/share/flatpak/exact_overrides/org.mozilla.firefox @@ -1,2 +1,3 @@ [Context] -filesystems=/home/freenen/.local/share/vdhcoapp:ro;~/projects:ro;~/.local/tiCloudAgent;~/.local/share/vdhcoapp; +sockets=gpg-agent +filesystems=~/.local/share/vdhcoapp:ro;~/projects:ro;~/.local/tiCloudAgent;~/.local/share/browserpass;~/.password-store/;~/.gnupg