52 |
local services="$2" |
local services="$2" |
53 |
|
|
54 |
case ${cmd} in |
case ${cmd} in |
55 |
add|del|default) continue;; |
add|del|default) |
56 |
|
# add given services from profile |
57 |
|
if [[ -n ${services} ]] |
58 |
|
then |
59 |
|
local i |
60 |
|
for i in ${services} |
61 |
|
do |
62 |
|
MROOT="${CDCHROOTDIR}" rc-config ${cmd} ${i} || die "rc ${cmd} ${i}" |
63 |
|
done |
64 |
|
fi |
65 |
|
;; |
66 |
*) die "custom_services: unkown command ${cmd}";; |
*) die "custom_services: unkown command ${cmd}";; |
67 |
esac |
esac |
|
|
|
|
# add given services from profile |
|
|
if [[ -n ${services} ]] |
|
|
then |
|
|
local i |
|
|
for i in ${services} |
|
|
do |
|
|
MROOT="${CDCHROOTDIR}" rc-config ${cmd} ${i} || die "rc ${cmd} ${i}" |
|
|
done |
|
|
fi |
|
68 |
} |
} |
69 |
|
|
70 |
add_initrc() |
add_initrc() |
82 |
local packages="$2" |
local packages="$2" |
83 |
|
|
84 |
case ${cmd} in |
case ${cmd} in |
85 |
install|uninstall) continue;; |
install|uninstall) |
86 |
|
if [[ -n ${packages} ]] |
87 |
|
then |
88 |
|
:> ${CDCHROOTDIR}/.installrc |
89 |
|
local i |
90 |
|
for i in ${packages} |
91 |
|
do |
92 |
|
add_initrc "mage install ${i}" |
93 |
|
done |
94 |
|
add_initrc "mage clean" |
95 |
|
|
96 |
|
# now run the .installrc script |
97 |
|
mount -t proc proc ${CDCHROOTDIR}/proc || die "mount proc" |
98 |
|
mount -t sysfs sysfs ${CDCHROOTDIR}/sys || die "mount sys" |
99 |
|
mount -o bind /dev ${CDCHROOTDIR}/dev || die "mount dev" |
100 |
|
chroot ${CDCHROOTDIR} /bin/bash -i /.installrc || die "chr00ting" |
101 |
|
umount ${CDCHROOTDIR}/dev || die "umount dev" |
102 |
|
umount ${CDCHROOTDIR}/proc || die "umount proc" |
103 |
|
umount ${CDCHROOTDIR}/sys || die "umount sys" |
104 |
|
[ -f ${CDCHROOTDIR}/.installrc ] && rm ${CDCHROOTDIR}/.installrc |
105 |
|
fi |
106 |
|
;; |
107 |
*) die "custom_packages: unkown command ${cmd}";; |
*) die "custom_packages: unkown command ${cmd}";; |
108 |
esac |
esac |
|
|
|
|
if [[ -n ${packages} ]] |
|
|
then |
|
|
|
|
|
:> ${CDCHROOTDIR}/.installrc |
|
|
local i |
|
|
for i in ${packages} |
|
|
do |
|
|
add_initrc "mage install ${i}" |
|
|
done |
|
|
add_initrc "mage clean" |
|
|
|
|
|
# now run the .installrc script |
|
|
mount -t proc proc ${CDCHROOTDIR}/proc || die "mount proc" |
|
|
mount -t sysfs sysfs ${CDCHROOTDIR}/sys || die "mount sys" |
|
|
mount -o bind /dev ${CDCHROOTDIR}/dev || die "mount dev" |
|
|
chroot ${CDCHROOTDIR} /bin/bash -i /.installrc || die "chr00ting" |
|
|
umount ${CDCHROOTDIR}/dev || die "umount dev" |
|
|
umount ${CDCHROOTDIR}/proc || die "umount proc" |
|
|
umount ${CDCHROOTDIR}/sys || die "umount sys" |
|
|
[ -f ${CDCHROOTDIR}/.installrc ] && rm ${CDCHROOTDIR}/.installrc |
|
|
fi |
|
109 |
} |
} |
110 |
|
|
111 |
read_config() |
read_config() |