Add sync-history

This commit is contained in:
Sage Vaillancourt 2024-02-24 13:36:19 -05:00
parent b35022a684
commit b0bc85b327
1 changed files with 16 additions and 2 deletions

View File

@ -127,6 +127,17 @@ function push-extensions {
scp -P 11275 /tmp/gnome-extension-list 'sage@sagev.space:~/gnome-extension-list'
}
function merge-hist {
\diff --unified=9999999999999999 "$1" "$2" | tail -n +4 | sed 's/^.//'
}
function sync-history {
scp -P 11275 'sage@sagev.space:~/histfile' "/tmp/.histfile"
merge-hist "$HOME/.histfile" "/tmp/.histfile" > "/tmp/$(whoami).histfile"
mv "/tmp/$(whoami).histfile" "$HOME/.histfile"
scp -P 11275 "$HOME/.histfile" "/tmp/$(whoami).histfile"
}
function load-extensions {
if ! command -v gnome-extensions &> /dev/null; then
echo "gnome-extensions is not installed!"
@ -139,7 +150,7 @@ function load-extensions {
continue
fi
VERSION_TAG=$(curl -Lfs "https://extensions.gnome.org/extension-query/?search=${ext}" | jq '.extensions[0] | .shell_version_map | map(.pk) | max')
wget -O ${ext}.zip "https://extensions.gnome.org/download-extension/${ext}.shell-extension.zip?version_tag=$VERSION_TAG"
wget -O ${ext}.zip "https://extensions.gnome.org/download-extension/${ext}.shell-extension.zip?version_tag=$VERSION_TAG" || continue
gnome-extensions install --force ${EXTENSION_ID}.zip
if ! gnome-extensions list | grep --quiet ${ext}; then
busctl --user call org.gnome.Shell.Extensions /org/gnome/Shell/Extensions org.gnome.Shell.Extensions InstallRemoteExtension s ${ext}
@ -160,7 +171,7 @@ function pushdot {
res="$?"
fi
if [[ "$res" == "0" ]]; then
git push -u origin main && push-extensions && push-dconf
git push -u origin main && push-extensions && sync-history && push-dconf
fi
cd -
return $res
@ -173,7 +184,10 @@ function getdot {
fi
cd "$DOT_DIR" || return 1
git pull && ./copy.sh
load-extensions
sync-history
rm /tmp/dconf-dump &> /dev/null
scp -P 11275 'sage@sagev.space:~/dconf-dump' /tmp/dconf-dump
dconf-dump > /tmp/current-dconf-dump