-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.setconf
executable file
·257 lines (211 loc) · 7.64 KB
/
.setconf
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
#!/usr/bin/env bash
source ${HOME}/.bashrc
################################################################################
declare ROOT_DST="${ROOT_DST:-}"
declare SETCONF_DIR="${SETUP:-/.g/_data/zactive/.setup}"
declare SETUP_DIR="${ROOT_DST}/.setup"
declare SETCONF=".setconf"
declare RUNIT_DIR="${ROOT_DST}/.runit"
########################################
declare ISSUE_FILE="/.g/_data/zactive/coding/gary-os/artifacts/files/issue"
if [[ ! -f ${ISSUE_FILE} ]]; then
ISSUE_FILE="/.gary-os/artifacts/files/issue"
fi
declare LIBVIRT_DIR="/.g/_data/_systems/libvirt"
################################################################################
${RM} ${ROOT_DST}/etc/localtime
${LN} -r ${ROOT_DST}/usr/share/zoneinfo/US/Pacific ${ROOT_DST}/etc/localtime
${RM} ${ROOT_DST}/run/udev
${LN} -r ${ROOT_DST}/dev/.udev ${ROOT_DST}/run/udev
########################################
declare FILE=
declare DIR=
#>>> awstats \
#>>> nginx \
#>>> vmware \
for DIR in \
apache \
bind \
cups \
dhcpd \
dovecot \
etc \
gentoo \
grub \
hostapd \
libvirt \
locales \
minicom \
ntp \
nut \
openvpn \
proftpd \
samba \
ssh \
udev \
ulogd \
wpa_supplicant \
xorg
do
${MKDIR} ${SETUP_DIR}/${DIR}
setconf ${SETCONF_DIR}/${DIR} ${SETUP_DIR}/${DIR}
done
########################################
chown -vR root:root ${SETUP_DIR}
chmod -vR 755 ${SETUP_DIR}
${RM} ${SETUP_DIR}/${SETCONF}
${LN} ${SETCONF_DIR}/${SETCONF} ${SETUP_DIR}/${SETCONF}
########################################
# apache
${RM} ${ROOT_DST}/etc/apache2
${LN} -r ${SETUP_DIR}/apache ${ROOT_DST}/etc/apache2
# awstats
#>>>${RM} ${ROOT_DST}/etc/awstats
#>>>${LN} -r ${SETUP_DIR}/awstats ${ROOT_DST}/etc/awstats
# bind
chown -vR nobody:root ${SETUP_DIR}/bind
${RM} ${ROOT_DST}/etc/bind
${LN} -r ${SETUP_DIR}/bind ${ROOT_DST}/etc/bind
${RM} ${ROOT_DST}/etc/named.conf
${LN} -r ${SETUP_DIR}/bind/named.conf ${ROOT_DST}/etc/named.conf
# cups
${RM} ${SETUP_DIR}/cups/mime.*
${LN} -r ${ROOT_DST}/usr/share/cups/mime/mime.* ${SETUP_DIR}/cups
${RM} ${ROOT_DST}/etc/cups
${LN} -r ${SETUP_DIR}/cups ${ROOT_DST}/etc/cups
# dhcpd
${RM} ${ROOT_DST}/etc/dhcp/dhcpd.conf
${LN} -r ${SETUP_DIR}/dhcpd/dhcpd.conf ${ROOT_DST}/etc/dhcp/dhcpd.conf
${RM} ${ROOT_DST}/etc/dhcpd.conf
${LN} -r ${SETUP_DIR}/dhcpd/dhcpd.conf ${ROOT_DST}/etc/dhcpd.conf
# dovecot
${RM} ${ROOT_DST}/etc/dovecot
${LN} -r ${SETUP_DIR}/dovecot ${ROOT_DST}/etc/dovecot
# etc
${RM} ${ROOT_DST}/etc/resolv.conf.*
if [[ -f ${ISSUE_FILE} ]]; then
${CP} ${ISSUE_FILE} ${SETUP_DIR}/etc/issue
${SED} \
-e "s|[\]e[[]([0-9]+[;])?[0-9]+[;][0-9]+m||g" \
-e "/^[\][a-z]/d" \
${SETUP_DIR}/etc/issue >${SETUP_DIR}/etc/motd
fi
for FILE in ${SETUP_DIR}/etc/*; do
${RM} ${ROOT_DST}/etc/$(basename ${FILE})
${LN} -r ${FILE} ${ROOT_DST}/etc/$(basename ${FILE})
done
# gentoo
declare OVERLAY="${SETUP_DIR}/gentoo/overlay/overlay.conf"
for FILE in ${SETUP_DIR}/gentoo/[a-z]*; do
${RM} ${ROOT_DST}/etc/portage/$(basename ${FILE})
${LN} -r ${FILE} ${ROOT_DST}/etc/portage/$(basename ${FILE})
done
${RM} ${ROOT_DST}/etc/portage/repos.conf/$(basename ${OVERLAY})
${LN} -r ${OVERLAY} ${ROOT_DST}/etc/portage/repos.conf/$(basename ${OVERLAY})
# grub
cat ${SETUP_DIR}/grub/grub.defaults.cfg >>${SETUP_DIR}/grub/grub.cfg
cat ${SETUP_DIR}/grub/grub.menu.main.cfg >>${SETUP_DIR}/grub/grub.cfg
cat ${SETUP_DIR}/grub/grub.menu.windows.cfg >>${SETUP_DIR}/grub/grub.cfg
${MKDIR} ${ROOT_DST}/boot/grub
${RM} ${ROOT_DST}/boot/grub/grub.cfg
${LN} -r ${SETUP_DIR}/grub/grub.cfg ${ROOT_DST}/boot/grub/grub.cfg
# hostapd
${RM} ${ROOT_DST}/etc/hostapd/hostapd.conf
${LN} -r ${SETUP_DIR}/hostapd/hostapd.conf ${ROOT_DST}/etc/hostapd/hostapd.conf
# libvirt
${RM} ${ROOT_DST}/etc/libvirt/libvirt.conf
${LN} -r ${SETUP_DIR}/libvirt/libvirt.conf ${ROOT_DST}/etc/libvirt/libvirt.conf
${RM} ${ROOT_DST}/etc/libvirt/libvirtd.conf
${LN} -r ${SETUP_DIR}/libvirt/libvirtd.conf ${ROOT_DST}/etc/libvirt/libvirtd.conf
${RM} ${ROOT_DST}/etc/libvirt/qemu
${LN} ${LIBVIRT_DIR}/qemu ${ROOT_DST}/etc/libvirt/qemu
${RM} ${ROOT_DST}/etc/libvirt/storage
${LN} ${LIBVIRT_DIR}/storage ${ROOT_DST}/etc/libvirt/storage
${RM} ${ROOT_DST}/var/lib/libvirt/qemu
${LN} ${LIBVIRT_DIR}/qemu.lib ${ROOT_DST}/var/lib/libvirt/qemu
# locales
for FILE in ${SETUP_DIR}/locales/*; do
${RM} ${ROOT_DST}/usr/share/i18n/locales/$(basename ${FILE})
${LN} -r ${FILE} ${ROOT_DST}/usr/share/i18n/locales/$(basename ${FILE})
done
# minicom
${RM} ${ROOT_DST}/etc/minicom
${LN} -r ${SETUP_DIR}/minicom ${ROOT_DST}/etc/minicom
${RM} ${ROOT_DST}/etc/minirc.dfl
${LN} -r ${SETUP_DIR}/minicom/minirc.dfl ${ROOT_DST}/etc/minirc.dfl
# nginx
#>>>${RM} ${ROOT_DST}/etc/nginx
#>>>${LN} -r ${SETUP_DIR}/nginx ${ROOT_DST}/etc/nginx
# ntp
${RM} ${ROOT_DST}/etc/ntp-servers.conf
${LN} -r ${SETUP_DIR}/ntp/ntp-servers.conf ${ROOT_DST}/etc/ntp-servers.conf
${RM} ${ROOT_DST}/etc/ntp.conf
${LN} -r ${SETUP_DIR}/ntp/ntp.conf ${ROOT_DST}/etc/ntp.conf
# nut
${RM} ${ROOT_DST}/etc/nut
${LN} -r ${SETUP_DIR}/nut ${ROOT_DST}/etc/nut
chown -vR root:nut ${ROOT_DST}${SETUP_DIR}/nut
chmod -vR 750 ${ROOT_DST}${SETUP_DIR}/nut
# openvpn
${RM} ${ROOT_DST}/etc/openvpn
${LN} -r ${SETUP_DIR}/openvpn ${ROOT_DST}/etc/openvpn
# proftpd
${RM} ${ROOT_DST}/etc/proftpd/proftpd.conf
${LN} -r ${SETUP_DIR}/proftpd/proftpd.conf ${ROOT_DST}/etc/proftpd/proftpd.conf
# samba
${MKDIR} ${SETUP_DIR}/samba/private/msg.sock
chmod -v 700 ${SETUP_DIR}/samba/private{,/msg.sock}
chmod -v 600 ${SETUP_DIR}/samba/private/*.tdb
${RM} ${ROOT_DST}/etc/samba
${LN} -r ${SETUP_DIR}/samba ${ROOT_DST}/etc/samba
${RM} ${ROOT_DST}/var/lib/samba/private
${LN} -r ${SETUP_DIR}/samba/private ${ROOT_DST}/var/lib/samba/private
echo "create /var/lib/samba/winbindd_idmap.tdb" | chroot ${ROOT_DST:-/} tdbtool
# ssh
chmod -v 400 ${SETUP_DIR}/ssh/ssh_host_*
${RM} ${ROOT_DST}/etc/ssh
${LN} -r ${SETUP_DIR}/ssh ${ROOT_DST}/etc/ssh
# udev
${RM} ${ROOT_DST}/etc/udev/rules.d
${LN} -r ${SETUP_DIR}/udev/rules.d ${ROOT_DST}/etc/udev/rules.d
# ulogd
${RM} ${ROOT_DST}/etc/ulogd.conf
${LN} -r ${SETUP_DIR}/ulogd/ulogd.conf ${ROOT_DST}/etc/ulogd.conf
# vmware
#>>>chown -vR plastic:root ${SETUP_DIR}/vmware
#>>>${RM} ${ROOT_DST}/etc/vmware
#>>>${LN} -r ${SETUP_DIR}/vmware ${ROOT_DST}/etc/vmware
#>>>${RM} ${ROOT_DST}/etc/vmware-tools
#>>>${LN} -r ${SETUP_DIR}/vmware/etc ${ROOT_DST}/etc/vmware-tools
#>>>${RM} ${ROOT_DST}/opt/vmware-tools
#>>>${LN} -r ${SETUP_DIR}/vmware/opt ${ROOT_DST}/opt/vmware-tools
# wpa_supplicant
declare WPA_SOURCE="${SETUP_DIR}/wpa_supplicant/wpa_supplicant.source.conf"
${RM} ${ROOT_DST}/etc/wpa_supplicant/$(basename ${WPA_SOURCE})
${LN} -r ${WPA_SOURCE} ${ROOT_DST}/etc/wpa_supplicant/$(basename ${WPA_SOURCE})
# xorg
${RM} ${ROOT_DST}/etc/X11/Xmodmap
${LN} -r ${SETUP_DIR}/xorg/Xmodmap ${ROOT_DST}/etc/X11/Xmodmap
${RM} ${ROOT_DST}/etc/X11/xorg.conf
#>>>${LN} -r ${SETUP_DIR}/xorg/xorg.conf ${ROOT_DST}/etc/X11/xorg.conf
########################################
${MKDIR} ${RUNIT_DIR}
setconf ${SETCONF_DIR}/runit ${RUNIT_DIR}
if [[ ${1} == -r ]]; then
(cd ${RUNIT_DIR}; ROOT_DST="${ROOT_DST}" ./_build.sh)
fi
################################################################################
echo -en "\n"
${LL} -d $(find \
${SETUP_DIR} \
${ROOT_DST}/etc \
-type f \
|
${GREP} "(ssl|ssh)" |
${GREP} -v "/etc/ssl/(certs|misc)" |
sort
)
exit 0
################################################################################
# end of file
################################################################################