19 |
PROFILES_DIR="/usr/lib/mlivecdbuild/profiles" |
PROFILES_DIR="/usr/lib/mlivecdbuild/profiles" |
20 |
GLOBAL_PROFILE="${PROFILES_DIR}/global" |
GLOBAL_PROFILE="${PROFILES_DIR}/global" |
21 |
|
|
22 |
# get full path to isolinux.bin, may vary an multilib systems |
# get full path to isolinux.bin, may vary on multilib systems |
23 |
if [[ -f /usr/lib64/mkinitrd/isolinux.bin ]] |
if [[ -f /usr/share/syslinux/isolinux.bin ]] |
24 |
|
then |
25 |
|
ISOLINUX_BIN=/usr/share/syslinux/isolinux.bin |
26 |
|
elif [[ -f /usr/lib64/mkinitrd/isolinux.bin ]] |
27 |
then |
then |
28 |
ISOLINUX_BIN=/usr/lib64/mkinitrd/isolinux.bin |
ISOLINUX_BIN=/usr/lib64/mkinitrd/isolinux.bin |
29 |
else |
else |
77 |
case ${cmd} in |
case ${cmd} in |
78 |
add) chroot ${CDCHROOTDIR} systemctl enable ${i} ;; |
add) chroot ${CDCHROOTDIR} systemctl enable ${i} ;; |
79 |
del) chroot ${CDCHROOTDIR} systemctl disable ${i} ;; |
del) chroot ${CDCHROOTDIR} systemctl disable ${i} ;; |
80 |
|
default) |
81 |
|
# convert targets |
82 |
|
case ${i} in |
83 |
|
2|3) service="multi-user.target" ;; |
84 |
|
5) service="graphical.target" ;; |
85 |
|
esac |
86 |
|
chroot ${CDCHROOTDIR} systemctl enable ${i} ;; |
87 |
esac |
esac |
88 |
fi |
fi |
89 |
# busybox and sysvinit |
# busybox and sysvinit |
180 |
then |
then |
181 |
install -m 0644 $(get_profile inittab) ${CDCHROOTDIR}/etc/inittab || die |
install -m 0644 $(get_profile inittab) ${CDCHROOTDIR}/etc/inittab || die |
182 |
fi |
fi |
183 |
|
if [[ -x ${CDCHROOTDIR}/bin/systemctl ]] |
184 |
|
then |
185 |
|
# check lock group on systemd systems |
186 |
|
if [[ -z $(chroot ${CDCHROOTDIR} getent group lock) ]] |
187 |
|
then |
188 |
|
echo "adding missing group 'lock'" |
189 |
|
chroot ${CDCHROOTDIR} groupadd -g 54 lock |
190 |
|
fi |
191 |
|
# dbus plugdev group |
192 |
|
if [[ -z $(chroot ${CDCHROOTDIR} getent group plugdev) ]] |
193 |
|
then |
194 |
|
echo "adding missing group 'plugdev'" |
195 |
|
chroot ${CDCHROOTDIR} groupadd -g 302 plugdev |
196 |
|
fi |
197 |
|
# dbus messagebus group |
198 |
|
if [[ -z $(chroot ${CDCHROOTDIR} getent group messagebus) ]] |
199 |
|
then |
200 |
|
echo "adding missing group 'messagebus'" |
201 |
|
chroot ${CDCHROOTDIR} groupadd -g 300 messagebus |
202 |
|
fi |
203 |
|
# dbus messagebus user |
204 |
|
if [[ -z $(chroot ${CDCHROOTDIR} getent passwd messagebus) ]] |
205 |
|
then |
206 |
|
echo "adding missing user 'messagebus'" |
207 |
|
chroot ${CDCHROOTDIR} useradd -u 300 -g messagebus -d /dev/null -s /bin/false messagebus |
208 |
|
fi |
209 |
|
fi |
210 |
install -m 0644 $(get_profile fstab) ${CDCHROOTDIR}/etc/fstab || die |
install -m 0644 $(get_profile fstab) ${CDCHROOTDIR}/etc/fstab || die |
211 |
install -m 0644 $(get_profile motd) ${CDCHROOTDIR}/etc/motd || die |
install -m 0644 $(get_profile motd) ${CDCHROOTDIR}/etc/motd || die |
212 |
install -m 0644 $(get_profile issue) ${CDCHROOTDIR}/etc/issue || die |
install -m 0644 $(get_profile issue) ${CDCHROOTDIR}/etc/issue || die |
215 |
|
|
216 |
echo Setting up services ... |
echo Setting up services ... |
217 |
|
|
218 |
|
# install systemd default services |
219 |
|
if [[ -x ${CDCHROOTDIR}/bin/systemctl ]] |
220 |
|
then |
221 |
|
# install tmpfs /tmp and /var/tmp |
222 |
|
install -m 0644 $(get_profile tmp.mount) ${CDCHROOTDIR}/lib/systemd/system/ || die |
223 |
|
install -m 0644 $(get_profile var-tmp.mount) ${CDCHROOTDIR}/lib/systemd/system/ || die |
224 |
|
# enable them |
225 |
|
ln -snf ../tmp.mount ${CDCHROOTDIR}/lib/systemd/system/local-fs.target.wants/tmp.mount || die |
226 |
|
ln -snf ../var-tmp.mount ${CDCHROOTDIR}/lib/systemd/system/local-fs.target.wants/var-tmp.mount || die |
227 |
|
|
228 |
|
install -m 0644 $(get_profile getty) ${CDCHROOTDIR}/etc/conf.d/getty || die |
229 |
|
|
230 |
|
custom_services add getty@.service |
231 |
|
custom_services add remote-fs.target |
232 |
|
# disable readahead |
233 |
|
custom_services del systemd-readahead-replay.service |
234 |
|
custom_services del systemd-readahead-collect.service |
235 |
|
fi |
236 |
|
|
237 |
# # add hardware detection |
# # add hardware detection |
238 |
# if [[ -x ${CDCHROOTDIR}/sbin/rc-config ]] |
# if [[ -x ${CDCHROOTDIR}/sbin/rc-config ]] |
239 |
# then |
# then |
304 |
install -d ${LIVECDROOT}/loop/{LiveOS,mnt} || die |
install -d ${LIVECDROOT}/loop/{LiveOS,mnt} || die |
305 |
|
|
306 |
# get the actual size of the chroot |
# get the actual size of the chroot |
307 |
size=$(du -s chroot | sed 's:^\(.*\)[[:space:]].*:\1:') |
size=$(du -s ${LIVECDROOT}/chroot | sed 's:^\(.*\)[[:space:]].*:\1:') |
308 |
|
|
309 |
# generate a ext3fs file for devicemapper |
# generate a ext3fs file for devicemapper |
310 |
dd if=/dev/zero of=${LIVECDROOT}/loop/LiveOS/ext3fs.img bs=1024 count=$(( ${size} + 10 )) || die |
dd if=/dev/zero of=${LIVECDROOT}/loop/LiveOS/ext3fs.img bs=1024 count=$(( ${size} + 10 )) || die |
372 |
install -m 0644 $(get_profile boot.lss) ${CDISOROOT}/isolinux || die |
install -m 0644 $(get_profile boot.lss) ${CDISOROOT}/isolinux || die |
373 |
install -m 0644 $(get_profile boot.msg) ${CDISOROOT}/isolinux || die |
install -m 0644 $(get_profile boot.msg) ${CDISOROOT}/isolinux || die |
374 |
install -m 0644 $(get_profile help.msg) ${CDISOROOT}/isolinux || die |
install -m 0644 $(get_profile help.msg) ${CDISOROOT}/isolinux || die |
375 |
|
# support the new layout too |
376 |
|
if [[ -f $(get_profile index.msg) ]] |
377 |
|
then |
378 |
|
install -m 0644 $(get_profile index.msg) ${CDISOROOT}/isolinux || die |
379 |
|
fi |
380 |
|
if [[ -f $(get_profile debug.msg) ]] |
381 |
|
then |
382 |
|
install -m 0644 $(get_profile debug.msg) ${CDISOROOT}/isolinux || die |
383 |
|
fi |
384 |
|
|
385 |
return 0 |
return 0 |
386 |
} |
} |