Guard-clause-style scpace checks
This commit is contained in:
parent
b96fff3c6a
commit
3132e9ce0d
|
@ -105,13 +105,13 @@ function dconf-dump {
|
||||||
}
|
}
|
||||||
|
|
||||||
function push-dconf {
|
function push-dconf {
|
||||||
if command -v scpace &> /dev/null; then
|
if ! command -v scpace &> /dev/null; then
|
||||||
rm /tmp/dconf-dump &> /dev/null
|
|
||||||
dconf-dump > /tmp/dconf-dump || return 1
|
|
||||||
scp -P 11275 /tmp/dconf-dump 'sage@sagev.space:~/dconf-dump'
|
|
||||||
else
|
|
||||||
echo "An alias for scpace has not been defined on this device!"
|
echo "An alias for scpace has not been defined on this device!"
|
||||||
|
return 1
|
||||||
fi
|
fi
|
||||||
|
rm /tmp/dconf-dump &> /dev/null
|
||||||
|
dconf-dump > /tmp/dconf-dump || return 1
|
||||||
|
scp -P 11275 /tmp/dconf-dump 'sage@sagev.space:~/dconf-dump'
|
||||||
}
|
}
|
||||||
|
|
||||||
function pushdot {
|
function pushdot {
|
||||||
|
@ -129,25 +129,25 @@ function pushdot {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getdot {
|
function getdot {
|
||||||
|
if ! command -v scpace &> /dev/null; then
|
||||||
|
echo "An alias for scpace has not been defined on this device!"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
cd "$DOT_DIR" || return 1
|
cd "$DOT_DIR" || return 1
|
||||||
git pull && ./copy.sh
|
git pull && ./copy.sh
|
||||||
if command -v scpace &> /dev/null; then
|
rm /tmp/dconf-dump
|
||||||
rm /tmp/dconf-dump
|
scp -P 11275 'sage@sagev.space:~/dconf-dump' /tmp/dconf-dump
|
||||||
scp -P 11275 'sage@sagev.space:~/dconf-dump' /tmp/dconf-dump
|
dconf-dump > /tmp/current-dconf-dump
|
||||||
dconf-dump > /tmp/current-dconf-dump
|
if ! git --no-pager diff --no-index /tmp/current-dconf-dump /tmp/dconf-dump &> /dev/null; then
|
||||||
if ! git --no-pager diff --no-index /tmp/current-dconf-dump /tmp/dconf-dump &> /dev/null; then
|
echo
|
||||||
echo
|
echo "Incoming conf changes:"
|
||||||
echo "Incoming conf changes:"
|
echo
|
||||||
echo
|
git --no-pager diff --no-index /tmp/current-dconf-dump /tmp/dconf-dump
|
||||||
git --no-pager diff --no-index /tmp/current-dconf-dump /tmp/dconf-dump
|
echo
|
||||||
echo
|
bash -c 'read -p "Press enter to continue, or Ctrl-C to cancel."' || return 1
|
||||||
bash -c 'read -p "Press enter to continue, or Ctrl-C to cancel."' || return 1
|
echo "Applying changes..."
|
||||||
echo "Applying changes..."
|
|
||||||
fi
|
|
||||||
dconf load / < /tmp/dconf-dump || return 1
|
|
||||||
else
|
|
||||||
echo "An alias for scpace has not been defined on this device!"
|
|
||||||
fi
|
fi
|
||||||
|
dconf load / < /tmp/dconf-dump || return 1
|
||||||
cd - > /dev/null
|
cd - > /dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue