-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_extras.sh
executable file
·68 lines (61 loc) · 1.58 KB
/
install_extras.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
62
63
64
65
66
67
#!/bin/bash
# install_extras - Install "extra" stuff useful for building packages.
#
# makepkg.conf - My makepkg.conf which support additions in PKGBUILDS:
# Instructions therein and simple support for various CFLAGS (native, lto, etc),
# and profiling support, alongside other pacman-utils tools
#
for arg in "$@";
do
if ( echo "${arg}" | grep -q '^PREFIX=' );
then
export "${arg}"
elif ( echo "${arg}" | grep -q '^DESTDIR=' );
then
export "${arg}"
fi
done
if [ -z "${PREFIX}" ];
then
PREFIX="usr"
else
if [ "${PREFIX}" != "/" ];
then
PREFIX="$(echo "${PREFIX}" | sed 's|[/][/]*$||g')"
PREFIX="$(echo "${PREFIX}" | sed 's|//|/|g')"
fi
fi
if [ -z "${DESTDIR}" ];
then
DESTDIR=""
else
if [ "${DESTDIR}" != "/" ];
then
DESTDIR="$(echo "${DESTDIR}" | sed 's|[/][/]*$||g')"
DESTDIR="$(echo "${DESTDIR}" | sed 's|//|/|g')"
else
DESTDIR=''
fi
fi
ETCDIR="${DESTDIR}/etc"
ETCDIR="$(echo "${ETCDIR}" | sed 's|//|/|g')"
mkdir -p "${ETCDIR}"
if [ -f "${ETCDIR}/makepkg.conf" ];
then
echo "Backing up '${ETCDIR}/makepkg.conf' to '${ETCDIR}/makepkg.conf.bak'" >&2
cp -f "${ETCDIR}/makepkg.conf" "${ETCDIR}/makepkg.conf.bak"
if [ $? -ne 0 ];
then
echo "Failed to backup '${ETCDIR}/makepkg.conf' to '${ETCDIR}/makepkg.conf.bak'" >&2
exit 1
fi
fi
install -v -m 644 "data/makepkg.conf" "${ETCDIR}/makepkg.conf"
RET=$?
if [ $RET -ne 0 ];
then
echo;
echo;
echo 'Error installing extras! Please check error messages above for more info!'
exit $RET
fi