-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauto-install.sh
executable file
·37 lines (34 loc) · 1.08 KB
/
auto-install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env sh
THISDIR=$(cd "$(dirname "$0")"; pwd)
OS="$($THISDIR/os.sh)"
DIR="$(cd $(dirname ${1-}); pwd)"
echo "AUTOINSTALL"
echo $THISDIR
echo $OS
echo $DIR
if [ -f "$DIR/Brewfile" ] && [ "$OS" = "macos" ]; then
"$THISDIR/homebrew/install.sh"
brew bundle install --file="$DIR/Brewfile"
elif [ -f "$DIR/Debfile" ] && [ "$(which apt 2>/dev/null)"]; then
xargs -a "$THISDIR/Debfile" sudo apt install -qq -y --no-install-recommends
elif [ -f "$DIR/Yayfile" ] && [ "$(which pacman 2>/dev/null)" ]; then
echo 1
if !which yay 2&>/dev/null; then
echo 2
sudo pacman --noconfirm --needed -S yay
fi
echo 3
yes | xargs -a "$DIR/Yayfile" yay --needed --answerclean No --answerdiff N -S --noprovides
fi
if [ -d "$DIR/config" ]; then
echo "Installing config dirs..."
for DOTDIR in "$DIR/config/"*; do
XDGDIR="$HOME/.config/$(basename $DOTDIR)"
if [ ! -L "$XDGDIR" ] && [ -d "$XDGDIR" ]; then
MOVEDIR="$XDGDIR.old-$(date -Iseconds)"
echo "Found old dir, gracefully moving to $MOVEDIR"
mv -f "$XDGDIR" "$MOVEDIR"
fi
ln -sfn "$DOTDIR" "$XDGDIR"
done
fi