-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall
More file actions
executable file
·53 lines (48 loc) · 1.31 KB
/
install
File metadata and controls
executable file
·53 lines (48 loc) · 1.31 KB
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
#!/usr/bin/env bash
##Created by Edward "edge226" Tunnah.
## Check for root! If the user is not running the script as root advise
## that root is required to operate this script and then drop out. If
## the script is run as root then continue.
if [ "$EUID" != "0" ]; then
printf "error: This script must be run as root.\n"
exit 1
fi
## check if the install.conf file exists and import it if it does.
if [[ -f ./install.conf ]]
## This file is imported for the variables used in this file.
then
source ./install.conf
fi
if [[ ! -d "$bin" ]]
then
mkdir -p "$bin"
fi
if [[ ! -d "$conf" ]]
then
mkdir -p "$conf"
fi
for type in "${install_array[@]}"
do
## I do this eval so I can reference the location in the config file that $type points to.
eval "ref=\$$type"
if [[ ! -d "$ref" ]]
then
printf '\n%s %s\n\n' "Creating directory:" "$ref"
mkdir -p "$ref"
fi
## printf '\n%s %s\n\n' "The type of type is:" "$type"
if [[ -d "$type" ]]
then
for file in ./"$type"/*
do
## printf '%s %s %s %s\n' "Adding file to source:" "$file" "for" "$ref"
source+=( "$file" )
done
fi
## add installation stuff here.
printf '\n%s %s %s %s\n' "rsyncing files from" "$type" "to" "$ref"
rsync -rvp "${source[@]}" "$ref/"
printf '\n'
unset source
unset -n ref
done