Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3060 by niro, Fri Jul 17 11:43:55 2015 UTC revision 3061 by niro, Thu Aug 31 12:27:43 2017 UTC
# Line 44  create_install_tarball() Line 44  create_install_tarball()
44   --update-tarball \   --update-tarball \
45   --basesystem basesystem || die "bootstrapping target system failed!"   --basesystem basesystem || die "bootstrapping target system failed!"
46    
47   # set an empty root password for the install system too  # # HACK: add all mesa-gallium modules but intel modules
48    # local i
49    # for i in nouveau r300 r600 radeonsi swrast
50    # do
51    # CDCHROOTDIR=${LIVECDROOT}/install-temp custom_packages install "mesa-gallium-${i}" || die
52    # done
53    #
54    # # HACK: add mesa-gallium-i915
55    # CDCHROOTDIR=${LIVECDROOT}/install-temp custom_packages install "mesa-gallium-i915" || die
56    #
57    # # HACK: add all mesa-dri modules
58    # local i
59    # for i in i915 i965 nouveau r200 radeon swrast
60    # do
61    # CDCHROOTDIR=${LIVECDROOT}/install-temp custom_packages install "mesa-dri-${i}" || die
62    # done
63    # # but disable i915_dri atm, which breaks
64    # if [[ -L ${LIVECDROOT}/install-temp/usr/lib/dri/i915_dri.so ]]
65    # then
66    # rm ${LIVECDROOT}/install-temp/usr/lib/dri/i915_dri.so
67    # fi
68    
69    ## DEV SERVER ##
70    # NEW_MCORE_CONTROL_SERVER="alx-control-dev.dom-aka-nt.intern"
71    # CONFIG="${LIVECDROOT}/install-temp/etc/mcore/mcore.conf"
72    # updateconfig MCORE_CONTROL_SERVER
73    ###
74    
75     # fix missing symlink
76     if [ ! -L ${LIVECDROOT}/install-temp/usr/bin/X ]
77     then
78     ln -snf Xorg ${LIVECDROOT}/install-temp/usr/bin/X
79     fi
80    
81     # generate a new machine-id on first-boot
82     :> ${LIVECDROOT}/install-temp/etc/machine-id
83    
84     # fix localtime symlink
85     ln -snf ../usr/share/zoneinfo/Europe/Berlin ${LIVECDROOT}/install-temp/etc/localtime
86    
87     # activate timeserver via dhcp (NTP - option 42)
88     CDCHROOTDIR=${LIVECDROOT}/install-temp custom_services add systemd-timesyncd.service
89    
90     # empty root password
91   chroot ${LIVECDROOT}/install-temp passwd -d root   chroot ${LIVECDROOT}/install-temp passwd -d root
92    
93   # add user station with empty password   # add user station with empty password
94   chroot ${LIVECDROOT}/install-temp adduser -G users -h /home/station -s /bin/bash -D station  # chroot ${LIVECDROOT}/install-temp adduser -G users -h /home/station -s /bin/bash -D station
95    
96     # empty user password
97     chroot ${LIVECDROOT}/install-temp passwd -d station
98    
99   # install xinitrc   # install xinitrc
100   echo 'exec startfluxbox' > ${LIVECDROOT}/install-temp/home/station/.xinitrc  # echo 'exec startfluxbox' > ${LIVECDROOT}/install-temp/home/station/.xinitrc
101    
102     if [ -x ${LIVECDROOT}/install-temp/usr/bin/mcorepasswd ] ||
103     [ -L ${LIVECDROOT}/install-temp/usr/bin/mcorepasswd ]
104     then
105     # add mcored default user
106     ( echo "foobar"; sleep 0.1; echo "foobar" ) | chroot ${LIVECDROOT}/install-temp /usr/bin/mcorepasswd mcore
107     fi
108    
109   # fix hostname and hosts file   # fix hostname and hosts file
110   echo "alx-i486" > ${LIVECDROOT}/install-temp/etc/hostname   echo "alx-i486" > ${LIVECDROOT}/install-temp/etc/hostname
# Line 65  ff02::2         ip6-allrouters Line 118  ff02::2         ip6-allrouters
118  ff02::3         ip6-allhosts  ff02::3         ip6-allhosts
119  EOF  EOF
120    
121   # create a default network interface config file  # # create a default network interface config file
122   cat > ${LIVECDROOT}/install-temp/etc/conf.d/net.eth0 << EOF  # cat > ${LIVECDROOT}/install-temp/etc/conf.d/net.eth0 << EOF
123  ONBOOT="yes"  #ONBOOT="yes"
124  NETWORKING="dhcp"  #NETWORKING="dhcp"
125  EOF  #EOF
126    
127   # fix mage.rc and config.rc   # fix mage.rc and config.rc
128   NEW_SQL_USER="alx_install"  # NEW_SQL_USER="alx_install"
129   NEW_SQL_PASS="@lx"  # NEW_SQL_PASS="@lx"
130   NEW_SQL_HOST="128.20.41.110"  # NEW_SQL_HOST="128.20.41.110"
131   NEW_SQL_DB="alx_web"  # NEW_SQL_DB="alx_web"
132   NEW_SMB_UPDATE_HOST="//${NEW_SQL_HOST}/magetmp"  # NEW_SMB_UPDATE_HOST="//${NEW_SQL_HOST}/magetmp"
133   NEW_SMB_UPDATE_USER="${NEW_SQL_USER}"  # NEW_SMB_UPDATE_USER="${NEW_SQL_USER}"
134   NEW_SMB_UPDATE_PASS="${NEW_SQL_PASS}"  # NEW_SMB_UPDATE_PASS="${NEW_SQL_PASS}"
135   NEW_MAGE_MIRRORS="http://${NEW_SQL_HOST}/magellan/alx-070"  # NEW_MAGE_MIRRORS="http://${NEW_SQL_HOST}/magellan/alx-070"
136   NEW_MAGE_RSYNC="rsync://${NEW_SQL_HOST}/mage-alx-070"  # NEW_MAGE_RSYNC="rsync://${NEW_SQL_HOST}/mage-alx-070"
137   NEW_RSYNC="${NEW_MAGE_RSYNC}"  # NEW_RSYNC="${NEW_MAGE_RSYNC}"
138   NEW_SMAGE2RSYNC="rsync://${NEW_SQL_HOST}/smage-alx-070"  # NEW_SMAGE2RSYNC="rsync://${NEW_SQL_HOST}/smage-alx-070"
139   NEW_MIRRORS="${NEW_MAGE_MIRRORS}"  # NEW_MIRRORS="${NEW_MAGE_MIRRORS}"
140   NEW_MAGE_UNINSTALL_TIMEOUT="0"  # NEW_MAGE_UNINSTALL_TIMEOUT="0"
141   CONFIG="${LIVECDROOT}/install-temp/etc/mage.rc"  # CONFIG="${LIVECDROOT}/install-temp/etc/mage.rc"
142   updateconfig RSYNC SMAGE2RSYNC MIRRORS MAGE_UNINSTALL_TIMEOUT  # updateconfig RSYNC SMAGE2RSYNC MIRRORS MAGE_UNINSTALL_TIMEOUT
143   CONFIG="${LIVECDROOT}/install-temp/etc/alxconfig-ng/config.rc"  # CONFIG="${LIVECDROOT}/install-temp/etc/alxconfig-ng/config.rc"
144   updateconfig SQL_USER SQL_PASS SQL_HOST SQL_DB SMB_UPDATE_HOST SMB_UPDATE_USER SMB_UPDATE_PASS MAGE_MIRRORS MAGE_RSYNC  # updateconfig SQL_USER SQL_PASS SQL_HOST SQL_DB SMB_UPDATE_HOST SMB_UPDATE_USER SMB_UPDATE_PASS MAGE_MIRRORS MAGE_RSYNC
145    
146   # create tarball   # create tarball
147   [[ -f ${CDISOROOT}/system/alx-i486.tar.bz2 ]] && rm ${CDISOROOT}/system/alx-i486.tar.bz2   [[ -f ${CDISOROOT}/system/alx-i486.tar.bz2 ]] && rm ${CDISOROOT}/system/alx-i486.tar.bz2
# Line 117  create_netboot_image() Line 170  create_netboot_image()
170    
171   install -d ${LIVECDROOT}/network-temp/{LiveOS,mnt} || die   install -d ${LIVECDROOT}/network-temp/{LiveOS,mnt} || die
172    
173     # fix fstab, use the livecd fstab without rootfs and swap
174     install -m 0644 $(get_profile fstab) ${LIVECDROOT}/install-temp/etc/fstab || die
175    
176   # get the actual size of the chroot   # get the actual size of the chroot
177   size=$(du -s ${LIVECDROOT}/install-temp | sed 's:^\(.*\)[[:space:]].*:\1:')   size=$(du -s ${LIVECDROOT}/install-temp | sed 's:^\(.*\)[[:space:]].*:\1:')
178    
179   # generate a ext3fs file for devicemapper   # generate a ext3fs file for devicemapper
180   dd if=/dev/zero of=${LIVECDROOT}/network-temp/LiveOS/ext3fs.img bs=1024 count=$(( ${size} + 10 )) || die   dd if=/dev/zero of=${LIVECDROOT}/network-temp/LiveOS/ext3fs.img bs=1024 count=$(( ${size} + 20000 )) || die
181   # create a filesystem   # create a filesystem
182   mkfs.ext3 -L "_${CDID}_EXT3" -m 1 -b 1024 -F ${LIVECDROOT}/network-temp/LiveOS/ext3fs.img || die   mkfs.ext3 -L "_${CDID}_EXT3" -m 1 -b 1024 -F ${LIVECDROOT}/network-temp/LiveOS/ext3fs.img || die
183   # set mount_counts and check_intervals to 0   # set mount_counts and check_intervals to 0
184   # set dir_index top, to speed up thing with hashed b-trees   # set dir_index top, to speed up things with hashed b-trees
185   # allow acls too   # allow acls too
186   tune2fs -c0 -i0 -Odir_index -ouser_xattr,acl ${LIVECDROOT}/network-temp/LiveOS/ext3fs.img || die   tune2fs -c0 -i0 -Odir_index -ouser_xattr,acl ${LIVECDROOT}/network-temp/LiveOS/ext3fs.img || die
187     # strip the journal
188    # tune2fs -O^has_journal ${LIVECDROOT}/network-temp/LiveOS/ext3fs.img || die
189     # fsck after journal removal
190    # fsck ${LIVECDROOT}/network-temp/LiveOS/ext3fs.img || die
191    
192   # losetup the device   # losetup the device
193   loopdev=$(losetup -f)   loopdev=$(losetup -f)
# Line 159  create_netboot_image() Line 219  create_netboot_image()
219   # initrd   # initrd
220   install -d ${CDCHROOTDIR}/etc/dracut.conf.d || die   install -d ${CDCHROOTDIR}/etc/dracut.conf.d || die
221   echo 'add_dracutmodules+=" livenet busybox "' > ${CDCHROOTDIR}/etc/dracut.conf.d/03-netboot.conf || die   echo 'add_dracutmodules+=" livenet busybox "' > ${CDCHROOTDIR}/etc/dracut.conf.d/03-netboot.conf || die
222   echo 'omit_dracutmodules+=" systemd plymouth mcored "' >> ${CDCHROOTDIR}/etc/dracut.conf.d/03-netboot.conf || die   #echo 'omit_dracutmodules+=" systemd plymouth mcored "' >> ${CDCHROOTDIR}/etc/dracut.conf.d/03-netboot.conf || die
223     # use plymouth to get all kms modules, but boot with nosplash as default to fix some Xorg issues
224     #echo 'omit_dracutmodules+=" systemd mcored "' >> ${CDCHROOTDIR}/etc/dracut.conf.d/03-netboot.conf || die
225     echo 'omit_dracutmodules+=" mcored "' >> ${CDCHROOTDIR}/etc/dracut.conf.d/03-netboot.conf || die
226     echo 'hostonly="no"' >> ${CDCHROOTDIR}/etc/dracut.conf.d/03-netboot.conf || die
227   # install dracut-dev package to have all modules   # install dracut-dev package to have all modules
228   custom_packages install "dracut-dev curl curl-dev" || die   custom_packages install "dracut-dev curl curl-dev" || die
229   ## mlivecdbuild function   ## mlivecdbuild function
230   generate_initrd   generate_initrd
231   mv ${CDISOROOT}/isolinux/initrd.gz ${CDISOROOT}/netboot/ || die   mv ${CDISOROOT}/isolinux/initrd.gz ${CDISOROOT}/netboot/ || die
232   custom_packages uninstall "dracut-dev curl curl-dev" || die   # fix initrd permissions
233     chmod 0644 ${CDISOROOT}/netboot/initrd.gz || die
234    # custom_packages uninstall "dracut-dev curl curl-dev" || die
235   if [ -e ${CDCHROOTDIR}/etc/dracut.conf.d/03-netboot.conf ]   if [ -e ${CDCHROOTDIR}/etc/dracut.conf.d/03-netboot.conf ]
236   then   then
237   rm ${CDCHROOTDIR}/etc/dracut.conf.d/03-netboot.conf   rm ${CDCHROOTDIR}/etc/dracut.conf.d/03-netboot.conf
238   fi   fi
239   # bootloader   # bootloader pxelinux
240   install -d ${CDISOROOT}/netboot/pxelinux.cfg   install -d ${CDISOROOT}/netboot/pxelinux/pxelinux.cfg
241   [ -f $(get_profile netboot/pxelinux.0) ] && install -m0644 $(get_profile netboot/pxelinux.0) ${CDISOROOT}/netboot   [ -f $(get_profile netboot/pxelinux.0) ] && install -m0644 $(get_profile netboot/pxelinux.0) ${CDISOROOT}/netboot/pxelinux/
242   [ -f $(get_profile netboot/pxelinux.cfg/default) ] && install -m0644 $(get_profile netboot/pxelinux.cfg/default) ${CDISOROOT}/netboot/pxelinux.cfg   [ -f $(get_profile netboot/pxelinux.cfg/pxelinux-default) ] && install -m0644 $(get_profile netboot/pxelinux.cfg/pxelinux-default) ${CDISOROOT}/netboot/pxelinux/pxelinux.cfg
243   [ -f $(get_profile netboot/pxelinux.cfg/boot.cat) ] && install -m0644 $(get_profile netboot/pxelinux.cfg/boot.cat) ${CDISOROOT}/netboot/pxelinux.cfg   [ -f $(get_profile netboot/pxelinux.cfg/boot.cat) ] && install -m0644 $(get_profile netboot/pxelinux.cfg/boot.cat) ${CDISOROOT}/netboot/pxelinux/
244   [ -f $(get_profile boot.lss) ] && install -m0644 $(get_profile boot.lss) ${CDISOROOT}/netboot/pxelinux.cfg   [ -f $(get_profile boot.lss) ] && install -m0644 $(get_profile boot.lss) ${CDISOROOT}/netboot/pxelinux/
245   [ -f $(get_profile boot.msg) ] && install -m0644 $(get_profile boot.msg) ${CDISOROOT}/netboot/pxelinux.cfg   [ -f $(get_profile boot.msg) ] && install -m0644 $(get_profile boot.msg) ${CDISOROOT}/netboot/pxelinux/
246   [ -f $(get_profile debug.msg) ] && install -m0644 $(get_profile debug.msg) ${CDISOROOT}/netboot/pxelinux.cfg   [ -f $(get_profile debug.msg) ] && install -m0644 $(get_profile debug.msg) ${CDISOROOT}/netboot/pxelinux/
247   [ -f $(get_profile help.msg) ] && install -m0644 $(get_profile help.msg) ${CDISOROOT}/netboot/pxelinux.cfg   [ -f $(get_profile help.msg) ] && install -m0644 $(get_profile help.msg) ${CDISOROOT}/netboot/pxelinux/
248   [ -f $(get_profile index.msg) ] && install -m0644 $(get_profile index.msg) ${CDISOROOT}/netboot/pxelinux.cfg   [ -f $(get_profile index.msg) ] && install -m0644 $(get_profile index.msg) ${CDISOROOT}/netboot/pxelinux/
249     # bootloader lpxelinux
250     install -d ${CDISOROOT}/netboot/lpxelinux/pxelinux.cfg
251     [ -f $(get_profile netboot/lpxelinux.0) ] && install -m0644 $(get_profile netboot/lpxelinux.0) ${CDISOROOT}/netboot/lpxelinux/
252     [ -f $(get_profile netboot/ldlinux.c32) ] && install -m0644 $(get_profile netboot/ldlinux.c32) ${CDISOROOT}/netboot/lpxelinux/
253     [ -f $(get_profile netboot/pxelinux.cfg/lpxelinux-default) ] && install -m0644 $(get_profile netboot/pxelinux.cfg/lpxelinux-default) ${CDISOROOT}/netboot/lpxelinux/pxelinux.cfg
254     [ -f $(get_profile netboot/pxelinux.cfg/boot.cat) ] && install -m0644 $(get_profile netboot/pxelinux.cfg/boot.cat) ${CDISOROOT}/netboot/lpxelinux/
255     [ -f $(get_profile boot.lss) ] && install -m0644 $(get_profile boot.lss) ${CDISOROOT}/netboot/lpxelinux/
256     [ -f $(get_profile boot.msg) ] && install -m0644 $(get_profile boot.msg) ${CDISOROOT}/netboot/lpxelinux/
257     [ -f $(get_profile debug.msg) ] && install -m0644 $(get_profile debug.msg) ${CDISOROOT}/netboot/lpxelinux/
258     [ -f $(get_profile help.msg) ] && install -m0644 $(get_profile help.msg) ${CDISOROOT}/netboot/lpxelinux/
259     [ -f $(get_profile index.msg) ] && install -m0644 $(get_profile index.msg) ${CDISOROOT}/netboot/lpxelinux/
260    
261   # final cleanup   # final cleanup
262   if [[ -d ${LIVECDROOT}/network-temp ]]   if [[ -d ${LIVECDROOT}/network-temp ]]
# Line 188  create_netboot_image() Line 265  create_netboot_image()
265   fi   fi
266  }  }
267    
268    ##
269    # create the server tarball
270    ##
271    create_server_tarball()
272    {
273     install -d ${LIVECDROOT}/server-temp
274     install -d ${CDISOROOT}/server
275    
276     mage-bootstrap \
277     --root ${LIVECDROOT}/server-temp \
278     --profile ${MAGE_PROFILE} \
279     --magerc ${MAGERC} \
280     --toolchain ${TOOLCHAIN} \
281     --update-tarball \
282     --basesystem serversystem || die "bootstrapping target system failed!"
283    
284     # generate a new machine-id on first-boot
285     :> ${LIVECDROOT}/server-temp/etc/machine-id
286    
287     # enable getty1
288     install -d ${LIVECDROOT}/server-temp/etc/systemd/system/getty.target.wants
289     ln -snf /usr/lib/systemd/system/getty@.service ${LIVECDROOT}/server-temp/etc/systemd/system/getty.target.wants/getty@tty1.service
290    
291     # be more verbose
292     sed -i 's:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1"rd.info":' ${LIVECDROOT}/server-temp/etc/conf.d/grub
293    
294     # fix localtime symlink
295     ln -snf ../usr/share/zoneinfo/Europe/Berlin ${LIVECDROOT}/server-temp/etc/localtime
296    
297     # activate timeserver via dhcp (NTP - option 42)
298     CDCHROOTDIR=${LIVECDROOT}/server-temp custom_services add systemd-timesyncd.service
299    
300     # empty root password
301     chroot ${LIVECDROOT}/server-temp passwd -d root
302    
303     # empty user password
304     chroot ${LIVECDROOT}/server-temp passwd -d station
305    
306     if [ -x ${LIVECDROOT}/server-temp/usr/bin/mcorepasswd ] ||
307     [ -L ${LIVECDROOT}/server-temp/usr/bin/mcorepasswd ]
308     then
309     # add mcored default user
310     ( echo "foobar"; sleep 0.1; echo "foobar" ) | chroot ${LIVECDROOT}/server-temp /usr/bin/mcorepasswd mcore
311     fi
312    
313     # remove phpmyadmin configuration directory
314     if [ -d ${LIVECDROOT}/server-temp/usr/share/phpmyadmin/config ]
315     then
316     rm -r ${LIVECDROOT}/server-temp/usr/share/phpmyadmin/config
317     fi
318    
319     # fix hostname and hosts file
320     echo "alx-svr-i486" > ${LIVECDROOT}/server-temp/etc/hostname
321     echo "127.0.0.1 localhost alx-svr-i486.magellan-linux.de alx-svr-i486" > ${LIVECDROOT}/server-temp/etc/hosts
322     # fix certificate issues with mcored (common name of cert issuer) and >php-5.4
323     echo "127.0.0.1 mcored" >> ${LIVECDROOT}/server-temp/etc/hosts
324     cat >> ${LIVECDROOT}/server-temp/etc/hosts << EOF
325    ::1             ip6-localhost   ip6-loopback
326    fe00::0         ip6-localnet
327    ff00::0         ip6-mcastprefix
328    ff02::1         ip6-allnodes
329    ff02::2         ip6-allrouters
330    ff02::3         ip6-allhosts
331    EOF
332    
333     # create tarball
334     [[ -f ${CDISOROOT}/server/alx-svr-i486.tar.bz2 ]] && rm ${CDISOROOT}/server/alx-svr-i486.tar.bz2
335     ( cd ${LIVECDROOT}/server-temp; tar cvjpf ${CDISOROOT}/server/alx-svr-i486.tar.bz2 ./ | tee log)
336    
337     # create images.conf
338     echo "CDIMAGENAME=alx-svr-i486.tar.bz2" > ${CDISOROOT}/server/images.conf
339     echo "TOTALLINES=$(wc -l ${LIVECDROOT}/server-temp/log | cut -d' ' -f1)" >> ${CDISOROOT}/server/images.conf
340    
341     # clean up
342     if [[ -d ${LIVECDROOT}/server-temp ]]
343     then
344     rm -rf ${LIVECDROOT}/server-temp
345     fi
346    }
347    
348  # set an empty root password  # set an empty root password
349  chroot ${CDCHROOTDIR} passwd -d root  chroot ${CDCHROOTDIR} passwd -d root
350    
# Line 226  fi Line 383  fi
383  # stop here if the user don't want to create the install tarball  # stop here if the user don't want to create the install tarball
384  [[ -n ${SKIP_CREATE_INSTALL_TARBALL} ]] || create_install_tarball  [[ -n ${SKIP_CREATE_INSTALL_TARBALL} ]] || create_install_tarball
385    
386    # stop here if the user don't want to create the server tarball
387    [[ -n ${SKIP_CREATE_SERVER_TARBALL} ]] || create_server_tarball
388    
389  # install usb-install script  # install usb-install script
390  [ ! -d ${CDISOROOT}/usb-install ] && mkdir ${CDISOROOT}/usb-install  [ ! -d ${CDISOROOT}/usb-install ] && mkdir ${CDISOROOT}/usb-install
391  [ -f $(get_profile usb-install/usb-install.cmd) ] && cp $(get_profile usb-install)/usb-install.cmd ${CDISOROOT}/usb-install  [ -f $(get_profile usb-install/usb-install.cmd) ] && cp $(get_profile usb-install)/usb-install.cmd ${CDISOROOT}/usb-install
392  [ -f $(get_profile usb-install/syslinux.exe) ] && cp $(get_profile usb-install)/syslinux.exe ${CDISOROOT}/usb-install  [ -f $(get_profile usb-install/syslinux.exe) ] && cp $(get_profile usb-install)/syslinux.exe ${CDISOROOT}/usb-install
393  [ -f $(get_profile usb-install/syslinux.cfg) ] && cp $(get_profile usb-install)/syslinux.cfg ${CDISOROOT}/usb-install  [ -f $(get_profile usb-install/syslinux.cfg) ] && cp $(get_profile usb-install)/syslinux.cfg ${CDISOROOT}/usb-install
394    
395    # add installer-server script
396    cat > ${CDCHROOTDIR}/usr/bin/installer-server << EOF
397    #!/bin/bash
398    /usr/bin/installer --imageroot /run/initramfs/live/server
399    EOF
400    chmod 0755 ${CDCHROOTDIR}/usr/bin/installer-server

Legend:
Removed from v.3060  
changed lines
  Added in v.3061