Compare commits

..

2 Commits

Author SHA1 Message Date
Sage Vaillancourt b32cf97e95 Add require function to copy.sh
Add requirements for jq and gron - used by mirror.sh
2024-08-29 14:26:28 -04:00
Sage Vaillancourt 48ebb1ea44 Add git-mirror-machine to copy.sh
This way, any machine using dotfiles will also maintain a mirror of my git repos.
2024-08-29 14:19:31 -04:00
1 changed files with 26 additions and 8 deletions

30
copy.sh
View File

@ -6,15 +6,21 @@ SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
FAKE_HOME="$SCRIPT_DIR/fake_home"
export f="$FAKE_HOME"
if ! command -v wget &> /dev/null; then
echo "wget must be installed!"
function require {
local success=true
for comm in "$@"; do
if ! command -v "$comm" &> /dev/null; then
echo "$comm must be installed!"
success=false
fi
done
if ! $success; then
echo "Missing copy.sh dependencies! Exiting!"
exit 1
fi
}
if ! command -v curl &> /dev/null; then
echo "curl must be installed!"
exit 1
fi
require git wget curl find jq gron
mkdir -p "$HOME/.tmp" || exit 1
@ -124,6 +130,18 @@ if ! test -f "$HOME/.local/share/fonts/FiraCodeNerdFontMono-Medium.ttf"; then
fc-cache -f -v
fi
curdir="$(pwd)"
cd $SCRIPT_DIR || exit 1
if test -d git-mirror-machine; then
cd git-mirror-machine
git pull
else
git clone 'https://git.sagev.space/sage/git-mirror-machine.git'
cd git-mirror-machine
fi
./mirror.sh
cd "$curdir" || exit 1
if ! command -v fzf &> /dev/null; then
echo "You may wish to install fzf for sofi and other search"
fi