-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall_sys.sh
More file actions
executable file
·71 lines (61 loc) · 2.2 KB
/
install_sys.sh
File metadata and controls
executable file
·71 lines (61 loc) · 2.2 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env bash
###############################################################
### Initial install script
### Copyright (C) 2021 ALEXPRO100 (alealexpro100)
### License: GPL v3.0
###############################################################
set -e
CONFIG_FILE="$(realpath "$1")"
if [[ ! -f ./version_install ]]; then
cd "${BASH_SOURCE[0]%/*}"
[[ ! -f ./version_install ]] && echo "Failed to locate version_install." && exit 1
fi
echo "Starting ${BASH_SOURCE[0]} $(cat ./version_install)"
#Use libraries
export ALEXPRO100_LIB_LOCATION="${ALEXPRO100_LIB_LOCATION:-./lib/alexpro100_lib.sh}"
# shellcheck disable=SC1091
source ./lib/common/lib_connect.sh
# shellcheck disable=SC1091
source ./lib/common/lib_var_op.sh
has_root || return_err "This script requries root permissions!"
# shellcheck disable=SC1091
[[ -f ./public_parameters ]] && source ./public_parameters
# shellcheck disable=SC1091
[[ -f ./private_parameters ]] && source ./private_parameters
declare -gx cp_safe="cp -Rf"
function custom_actions() {
[[ -d "$CUSTOM_DIR" ]] || CUSTOM_DIR=./custom
if [[ -d $CUSTOM_DIR/rootfs ]]; then
msg_print note "Copying custom files..."
$cp_safe "$CUSTOM_DIR/rootfs/." "${dir:?}"
fi
if [[ -f $CUSTOM_DIR/custom_script.sh && -n "$arch_chroot_command" ]]; then
cp "$CUSTOM_DIR/custom_script.sh" "$dir/root/custom_script.sh"
chmod +x "$dir/root/custom_script.sh"
msg_print note "Executing custom script..."
$arch_chroot_command "${dir:?}" bash /root/custom_script.sh
rm -rf "$dir/root/custom_script.sh"
fi
}
if [[ -z $CONFIG_FILE ]]; then
echo "Main install script. Requries profile for installation."
echo "Example: $0 profile_install.sh"
exit 1
fi
if [[ -f "$CONFIG_FILE" ]]; then
# shellcheck disable=SC1090
source "$CONFIG_FILE" || return_err "Failed to use profile!"
parse_arch "$(uname -m)"
# shellcheck disable=SC1090
source "./lib/distr/${distr:?}/distr_actions.sh"
custom_actions
if is_function profile_end_action; then
profile_end_action || return_err "Couldn't do profile_end_action."
fi
msg_print note "Installed $distr with $CONFIG_FILE to $dir."
else
return_err "No file $CONFIG_FILE!"
fi
# =)
echo "Script succesfully ended its work. Have a nice day!"
exit 0