Magellan Linux

Contents of /trunk/mlivecdbuild/profiles/alx-0_7_branch/prepare_custom

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2121 - (show annotations) (download)
Thu May 16 13:20:55 2013 UTC (10 years, 11 months ago) by niro
File size: 4538 byte(s)
-install missing xinitrc for user station and install a mount unit for /mnt/cdrom, which gets later provided by alxinstall
1 #!/bin/bash
2
3 # set an empty root password
4 chroot ${CDCHROOTDIR} passwd -d root
5
6 # install a custom boot-duration matching this livecd
7 install -d ${CDCHROOTDIR}/var/lib/plymouth || die
8 install -m 0644 $(get_profile boot-duration.livecd) ${CDCHROOTDIR}/var/lib/plymouth/boot-duration || die
9
10 # install mnt-cdrom mount service, should be provided by alxinstall-ng
11 install -m 0644 $(get_profile mnt-cdrom.mount) ${CDCHROOTDIR}/ust/lib/systemd/system/mnt-cdrom.mount || die
12 ln -snf ../mnt-cdrom.mount ${CDCHROOTDIR}/ust/lib/systemd/system/local-fs.target.wants/mnt-cdrom.mount || die
13
14 # disable splash X11 vt change and set splash to be always verbose
15 #if [[ -f ${CDCHROOTDIR}/etc/splash/splash.conf ]]
16 #then
17 # sed -i -e 's:^\(SPLASH_X11_TTY=.*\):#\1:' \
18 # -e 's:^\(SPLASH_MODE=\).*:\1\"verbose\":' \
19 # ${CDCHROOTDIR}/etc/splash/splash.conf
20 #fi
21
22 # stop here if the user don't want to create the install tarball
23 [[ ! -z ${SKIP_CREATE_INSTALL_TARBALL} ]] && exit 0
24
25
26 ##
27 # create the install tarball
28 ##
29
30 install -d ${LIVECDROOT}/install-temp
31 install -d ${CDISOROOT}/system
32
33 # use all settings from the global config, but the basesystem
34 # has to be the normal install basesystem not for livecds
35 mage-bootstrap \
36 --root ${LIVECDROOT}/install-temp \
37 --profile ${MAGE_PROFILE} \
38 --magerc ${MAGERC} \
39 --toolchain ${TOOLCHAIN} \
40 --update-tarball \
41 --basesystem basesystem || die "bootstrapping target system failed!"
42
43 # set an empty root password for the install system too
44 chroot ${LIVECDROOT}/install-temp passwd -d root
45
46 # add user station with empty password
47 chroot ${LIVECDROOT}/install-temp adduser -G users -h /home/station -s /bin/bash -D station
48
49 # install xinitrc
50 echo 'exec startfluxbox' > ${LIVECDROOT}/install-temp/home/station/.xinitrc
51
52 # fix hostname and hosts file
53 echo "alx-i486" > ${LIVECDROOT}/install-temp/etc/hostname
54 echo "127.0.0.1 localhost alx-i486.magellan-linux.de alx-i486" > ${LIVECDROOT}/install-temp/etc/hosts
55 cat >> ${LIVECDROOT}/install-temp/etc/hosts << EOF
56 ::1 ip6-localhost ip6-loopback
57 fe00::0 ip6-localnet
58 ff00::0 ip6-mcastprefix
59 ff02::1 ip6-allnodes
60 ff02::2 ip6-allrouters
61 ff02::3 ip6-allhosts
62 EOF
63
64 # create a default network interface config file
65 cat > ${LIVECDROOT}/install-temp/etc/conf.d/net.eth0 << EOF
66 ONBOOT="yes"
67 NETWORKING="dhcp"
68 EOF
69
70 # fix mage.rc and config.rc
71 updateconfig()
72 {
73 local variables="$@"
74 local value
75 local i
76
77 if [[ -z ${CONFIG} ]]
78 then
79 echo "You must define \$CONFIG varibale first!"
80 return 1
81 fi
82
83 for i in ${variables}
84 do
85 value="$(eval echo \${NEW_${i}})"
86 if [[ ! -z $(grep "^${i}=" ${CONFIG}) ]]
87 then
88 echo "fixing ${i} -> ${value}"
89 sed -i "s|^\(${i}=\).*|\1\"${value}\"|" ${CONFIG}
90 else
91 echo "adding ${i}=${value}"
92 echo "${i}=\"${value}\"" >> ${CONFIG}
93 fi
94 done
95 }
96 NEW_SQL_USER="alx_install"
97 NEW_SQL_PASS="@lx"
98 NEW_SQL_HOST="128.20.41.110"
99 NEW_SQL_DB="alx_web"
100 NEW_SMB_UPDATE_HOST="//${NEW_SQL_HOST}/magetmp"
101 NEW_SMB_UPDATE_USER="${NEW_SQL_USER}"
102 NEW_SMB_UPDATE_PASS="${NEW_SQL_PASS}"
103 NEW_MAGE_MIRRORS="http://${NEW_SQL_HOST}/magellan/alx-070"
104 NEW_MAGE_RSYNC="rsync://${NEW_SQL_HOST}/mage-alx-070"
105 NEW_RSYNC="${NEW_MAGE_RSYNC}"
106 NEW_SMAGE2RSYNC="rsync://${NEW_SQL_HOST}/smage-alx-070"
107 NEW_MIRRORS="${NEW_MAGE_MIRRORS}"
108 NEW_MAGE_UNINSTALL_TIMEOUT="0"
109 CONFIG="${LIVECDROOT}/install-temp/etc/mage.rc"
110 updateconfig RSYNC SMAGE2RSYNC MIRRORS MAGE_UNINSTALL_TIMEOUT
111 CONFIG="${LIVECDROOT}/install-temp/etc/alxconfig-ng/config.rc"
112 updateconfig SQL_USER SQL_PASS SQL_HOST SQL_DB SMB_UPDATE_HOST SMB_UPDATE_USER SMB_UPDATE_PASS MAGE_MIRRORS MAGE_RSYNC
113
114 # create tarball
115 [[ -f ${CDISOROOT}/system/alx-i486.tar.bz2 ]] && rm ${CDISOROOT}/system/alx-i486.tar.bz2
116 ( cd ${LIVECDROOT}/install-temp; tar cvjpf ${CDISOROOT}/system/alx-i486.tar.bz2 ./ | tee log)
117
118 # create images.conf
119 echo "CDIMAGENAME=alx-i486.tar.bz2" > ${CDISOROOT}/system/images.conf
120 echo "TOTALLINES=$(wc -l ${LIVECDROOT}/install-temp/log | cut -d' ' -f1)" >> ${CDISOROOT}/system/images.conf
121
122 # clean up
123 if [[ -d ${LIVECDROOT}/install-temp ]]
124 then
125 rm -rf ${LIVECDROOT}/install-temp
126 fi
127
128 # install usb-install script
129 [ ! -d ${CDISOROOT}/usb-install ] && mkdir ${CDISOROOT}/usb-install
130 [ -f $(get_profile usb-install/usb-install.cmd) ] && cp $(get_profile usb-install)/usb-install.cmd ${CDISOROOT}/usb-install
131 [ -f $(get_profile usb-install/syslinux.exe) ] && cp $(get_profile usb-install)/syslinux.exe ${CDISOROOT}/usb-install
132 [ -f $(get_profile usb-install/syslinux.cfg) ] && cp $(get_profile usb-install)/syslinux.cfg ${CDISOROOT}/usb-install