-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
install
executable file
·39 lines (33 loc) · 1.02 KB
/
install
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
#!/bin/bash
# Copyright (C) 2017-2018 Andrei Pavel, [email protected]
# Licensed under the MIT License
# Header
ARGUMENTS="\
[-p|--prefix] \$prefix sets the \${pkgdir} used for AUR PKGBUILD
"
SCRIPT_PATH="$(dirname "$(readlink -f "${0}")")"
. "${SCRIPT_PATH}/share/portunus/lib/header"
# Parse arguments.
pkgdir=
while (( ${#} > 0 )); do
case "${1}" in
# [-p|--prefix] \$prefix sets the \${pkgdir} used for AUR PKGBUILD
'-p'|'--prefix') shift && pkgdir="${1}";;
*)
# Unrecognized argument
printf "${RED}ERROR: Unrecognized argument '%s'${RESET}\\n" "${1}" 1>&2; print-usage; exit 1;;
esac; shift
done
#------------------------------------------------------------------------------#
pushd "${SCRIPT_PATH}" > /dev/null
{
./share/install-initial-configuration
if (( EUID == 0 )); then
./share/install-with-sudo -p "${pkgdir}"
else
sudo ./share/install-initial-configuration
# Needs to run as root but keep ${HOME}
sudo ./share/install-with-sudo -p "${pkgdir}"
fi
}
popd 1> /dev/null