-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
62 lines (47 loc) · 1.7 KB
/
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
DIR="nvim"
TARGET_DIR="$HOME/.config/$DIR"
CURRENT_DIR=$(pwd)
echo "biri baa boom boob ..."
sleep 0.4
# check if directory exists
if [[ -d $TARGET_DIR ]]; then
# check if the directory is not empty
if [[ ! -z "$(ls $TARGET_DIR -A)" ]]; then
# checking backup directory
if [[ -d "$CURRENT_DIR/recover" ]]; then
# read confirm
read -p "Recover files already exists, You sure want to ovewrite them? (y) " confirm
if [[ $confirm == "y" || $confirm == "Y" ]]; then
echo "Removing existing backup ..."
rm -rf $CURRENT_DIR/recover
mkdir -p $CURRENT_DIR/recover
# backup the existing files
echo "Creating Backup of existing files ..."
cp -r $TARGET_DIR/* $CURRENT_DIR/recover || { echo "Error copying files to backup..."; exit 1; }
else
# skip this dip shit
echo "Skipping Backup of existing files ..."
fi
else
# creating directory
mkdir -p $CURRENT_DIR/recover
cp -r $TARGET_DIR/* $CURRENT_DIR/recover || { echo "Error copying files to be backup..."; exit 1; }
echo "Backup of existing files created ..."
fi
fi
else
# create directiry if it doesn't exist
mkdir -p $TARGET_DIR
echo "Directiry created ..."
fi
sleep 0.4
# transfering files to config
echo "Transfring files ..."
sleep 0.4
cp -r $CURRENT_DIR/lua $TARGET_DIR || { echo "Error copying lua directory"; exit 1; }
cp -r $CURRENT_DIR/init.lua $TARGET_DIR || { echo "Error copying init.lua"; exit 1; }
cp -r $CURRENT_DIR/*.json $TARGET_DIR || { echo "Error copying .json"; exit 1; }
cp -r $CURRENT_DIR/.git $TARGET_DIR || { echo "Error copying .git"; exit 1; }
echo "You'r good to GO ;) "
sleep 0.4