-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
macInstall
executable file
·113 lines (96 loc) · 2.94 KB
/
macInstall
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/bin/bash
PKG="DoctorFreeScripts"
DESTDIR="/usr/local"
DEST="${DESTDIR}/${PKG}"
SRC=${HOME}/src
SRC_NAME="DoctorFreeScripts"
SUDO=sudo
[ -f "${SRC}/${SRC_NAME}/VERSION" ] || {
echo "$SRC/$SRC_NAME/VERSION does not exist. Exiting."
exit 1
}
. "${SRC}/${SRC_NAME}/VERSION"
PKG_VER=${VERSION}
PKG_REL=${RELEASE}
SUBDIRS="Config IFTTT binance chrome-themes \
clone coinmarketcap doc profittrailer systemd"
DOT_FILES="bash_aliases bash_profile bashrc dircolors drfree kv vimrc wallutils"
IMG_FILES="Scripts-Logo.png Vertical.png"
while true
do
read -p "Install ${SRC_NAME} version ${PKG_VER}-${PKG_REL} ? ('Y'/'N'): " yn
case $yn in
[Yy]*)
break
;;
[Nn]*)
exit 0
;;
* )
echo "Please answer yes or no."
;;
esac
done
export PATH=/usr/local/bin:/usr/bin:$PATH
[ -d /usr/local ] || ${SUDO} mkdir /usr/local
[ -d /usr/local/bin ] || ${SUDO} mkdir /usr/local/bin
[ -d ${DEST} ] || ${SUDO} mkdir ${DEST}
for dir in "${DESTDIR}" "${DESTDIR}/share" \
"${DESTDIR}/share/applications" \
"${DESTDIR}/share/doc" "${DESTDIR}/share/doc/${PKG}" \
"${DEST}"/bin "${DEST}"/etc
do
[ -d ${dir} ] || ${SUDO} mkdir ${dir}
done
for script in Wallpapers/*.sh
do
grep ${script} .gitignore > /dev/null || {
b=`basename ${script}`
dest=`echo ${b} | sed -e "s/\.sh//"`
${SUDO} cp ${script} ${DEST}/bin/${dest}
}
done
for util in Utils/bin/*
do
[ -d ${util} ] && continue
grep ${util} .gitignore > /dev/null || {
dest=`basename ${util}`
${SUDO} cp ${util} ${DEST}/bin/${dest}
}
done
for script in scripts/*.sh
do
grep ${script} .gitignore > /dev/null || {
dest=`echo ${script} | sed -e "s/scripts\///" -e "s/\.sh//"`
${SUDO} cp ${script} ${DEST}/bin/${dest}
}
done
${SUDO} cp Config/autostart/*.desktop "${DESTDIR}/share/applications"
${SUDO} cp AUTHORS ${DESTDIR}/share/doc/${PKG}/AUTHORS
${SUDO} cp LICENSE ${DESTDIR}/share/doc/${PKG}/copyright
${SUDO} cp CHANGELOG.md ${DESTDIR}/share/doc/${PKG}/changelog
${SUDO} cp README.md ${DESTDIR}/share/doc/${PKG}/README
${SUDO} gzip -9 ${DESTDIR}/share/doc/${PKG}/changelog
${SUDO} cp -a man ${DESTDIR}/share/man
for dir in ${SUBDIRS}
do
${SUDO} cp -a ${dir} ${DEST}/${dir}
done
[ -d ${DESTDIR}/share ] || ${SUDO} mkdir -p ${DESTDIR}/share
[ -d ${DESTDIR}/share/bash ] || ${SUDO} mkdir -p ${DESTDIR}/share/bash
${SUDO} cp ${DOT_FILES} ${DESTDIR}/share/bash
[ -d ${DESTDIR}/share/images ] || ${SUDO} mkdir -p ${DESTDIR}/share/images
${SUDO} cp ${IMG_FILES} ${DESTDIR}/share/images
[ -d ${DEST}/etc ] || ${SUDO} mkdir -p ${DEST}/etc
${SUDO} cp etc/* ${DEST}/etc
[ -f .gitignore ] && {
while read ignore
do
${SUDO} rm -f ${DEST}/${ignore}
done < .gitignore
}
${SUDO} chmod 755 ${DEST}/bin/*
${SUDO} chown -R root:wheel ${DEST}
[ -x /usr/local/DoctorFreeScripts/etc/postinstall ] && {
sudo /usr/local/DoctorFreeScripts/etc/postinstall
}