Add gron install to copy.sh
Add connection timeout to sagev.space scp connections
This commit is contained in:
parent
a8719e3c4d
commit
2424e2210f
7
copy.sh
7
copy.sh
|
@ -20,6 +20,13 @@ function require {
|
|||
fi
|
||||
}
|
||||
|
||||
if ! command -v gron &> /dev/null; then
|
||||
wget 'https://github.com/tomnomnom/gron/releases/download/v0.7.1/gron-linux-amd64-0.7.1.tgz' -O gron.tgz
|
||||
tar -xvf gron.tgz
|
||||
mv gron "$HOME/.bin"
|
||||
rm gron.tgz
|
||||
fi
|
||||
|
||||
require git wget curl find jq gron
|
||||
|
||||
mkdir -p "$HOME/.tmp" || exit 1
|
||||
|
|
|
@ -118,6 +118,8 @@ function dconf-dump {
|
|||
dconf dump / > "$HOME/.dconf-dump.tmp"
|
||||
}
|
||||
|
||||
alias tscp="scp -o ConnectTimeout=8"
|
||||
|
||||
function push-dconf {
|
||||
if ! command -v dconf &> /dev/null; then
|
||||
echo "The current system does not include dconf"
|
||||
|
@ -128,7 +130,7 @@ function push-dconf {
|
|||
return 1
|
||||
fi
|
||||
dconf-dump > $HOME/.tmp/dconf-dump || return 1
|
||||
scp -P 11275 $HOME/.tmp/dconf-dump 'sage@sagev.space:~/dconf-dump'
|
||||
tscp -P 11275 $HOME/.tmp/dconf-dump 'sage@sagev.space:~/dconf-dump'
|
||||
}
|
||||
|
||||
function push-extensions {
|
||||
|
@ -138,11 +140,11 @@ function push-extensions {
|
|||
fi
|
||||
mv $HOME/.tmp/gnome-extension-list "$HOME/.tmp/prev-gnome-extension-list" &> /dev/null
|
||||
gnome-extensions list --enabled > "$HOME/.tmp/gnome-extension-list"
|
||||
# If there is NO difference, skip scp
|
||||
# If there is NO difference, skip tscp
|
||||
if [[ "$1" != "--force" ]] && diff "$HOME/.tmp/gnome-extension-list" "$HOME/.tmp/prev-gnome-extension-list" &> /dev/null; then
|
||||
return
|
||||
fi
|
||||
scp -P 11275 "$HOME/.tmp/gnome-extension-list" 'sage@sagev.space:~/gnome-extension-list'
|
||||
tscp -P 11275 "$HOME/.tmp/gnome-extension-list" 'sage@sagev.space:~/gnome-extension-list'
|
||||
}
|
||||
|
||||
function merge-hist {
|
||||
|
@ -151,9 +153,9 @@ function merge-hist {
|
|||
|
||||
function sync-history {
|
||||
echo "Downloading shared history..."
|
||||
if ! scp -P 11275 'sage@sagev.space:~/histfile' "$HOME/.tmp/.histfile"; then
|
||||
if ! tscp -P 11275 'sage@sagev.space:~/histfile' "$HOME/.tmp/.histfile"; then
|
||||
echo "Shared history download failed!"
|
||||
scp -P 11275 "$HOME/.histfile" 'sage@sagev.space:~/histfile'
|
||||
tscp -P 11275 "$HOME/.histfile" 'sage@sagev.space:~/histfile'
|
||||
return
|
||||
fi
|
||||
echo "Merging history files..."
|
||||
|
@ -162,7 +164,7 @@ function sync-history {
|
|||
mv "$HOME/.tmp/$(whoami).histfile" "$HOME/.histfile"
|
||||
fc -R # Read from new history file
|
||||
echo "Uploading new shared history..."
|
||||
scp -P 11275 "$HOME/.histfile" 'sage@sagev.space:~/histfile'
|
||||
tscp -P 11275 "$HOME/.histfile" 'sage@sagev.space:~/histfile'
|
||||
}
|
||||
|
||||
function install-extension {
|
||||
|
@ -184,7 +186,7 @@ function load-extensions {
|
|||
echo "gnome-extensions is not installed!"
|
||||
return
|
||||
fi
|
||||
scp -P 11275 'sage@sagev.space:~/gnome-extension-list' $HOME/.tmp/gnome-extension-list
|
||||
tscp -P 11275 'sage@sagev.space:~/gnome-extension-list' $HOME/.tmp/gnome-extension-list
|
||||
touch "$HOME/.unavailable-extensions"
|
||||
local existing="$(cat <(gnome-extensions list) "$HOME/.unavailable-extensions")"
|
||||
for ext in $(cat $HOME/.tmp/gnome-extension-list); do
|
||||
|
@ -278,7 +280,7 @@ function sync-dconf {
|
|||
return
|
||||
fi
|
||||
rm $HOME/.tmp/dconf-dump &> /dev/null
|
||||
scp -P 11275 'sage@sagev.space:~/dconf-dump' $HOME/.tmp/dconf-dump-inbound
|
||||
tscp -P 11275 'sage@sagev.space:~/dconf-dump' $HOME/.tmp/dconf-dump-inbound
|
||||
dconf-clean $HOME/.tmp/dconf-dump-inbound > $HOME/.tmp/dconf-dump
|
||||
dconf-dump > $HOME/.tmp/current-dconf-dump
|
||||
if ! git --no-pager diff --no-index $HOME/.tmp/current-dconf-dump $HOME/.tmp/dconf-dump &> /dev/null; then
|
||||
|
|
Loading…
Reference in New Issue