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 2873 by niro, Fri Jul 17 11:43:55 2015 UTC revision 3064 by niro, Thu Aug 31 12:55:23 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  ## DEV SERVER ##
48    # NEW_MCORE_CONTROL_SERVER="alx-control-dev.dom-aka-nt.intern"
49    # CONFIG="${LIVECDROOT}/install-temp/etc/mcore/mcore.conf"
50    # updateconfig MCORE_CONTROL_SERVER
51    ###
52    
53     # fix missing symlink
54     if [ ! -L ${LIVECDROOT}/install-temp/usr/bin/X ]
55     then
56     ln -snf Xorg ${LIVECDROOT}/install-temp/usr/bin/X
57     fi
58    
59     # generate a new machine-id on first-boot
60     :> ${LIVECDROOT}/install-temp/etc/machine-id
61    
62     # fix localtime symlink
63     ln -snf ../usr/share/zoneinfo/Europe/Berlin ${LIVECDROOT}/install-temp/etc/localtime
64    
65     # activate timeserver via dhcp (NTP - option 42)
66     CDCHROOTDIR=${LIVECDROOT}/install-temp custom_services add systemd-timesyncd.service
67    
68     # empty root password
69   chroot ${LIVECDROOT}/install-temp passwd -d root   chroot ${LIVECDROOT}/install-temp passwd -d root
70    
71   # add user station with empty password   # empty user password
72   chroot ${LIVECDROOT}/install-temp adduser -G users -h /home/station -s /bin/bash -D station   chroot ${LIVECDROOT}/install-temp passwd -d station
73    
74   # install xinitrc   if [ -x ${LIVECDROOT}/install-temp/usr/bin/mcorepasswd ] ||
75   echo 'exec startfluxbox' > ${LIVECDROOT}/install-temp/home/station/.xinitrc   [ -L ${LIVECDROOT}/install-temp/usr/bin/mcorepasswd ]
76     then
77     # add mcored default user
78     ( echo "foobar"; sleep 0.1; echo "foobar" ) | chroot ${LIVECDROOT}/install-temp /usr/bin/mcorepasswd mcore
79     fi
80    
81   # fix hostname and hosts file   # fix hostname and hosts file
82   echo "alx-i486" > ${LIVECDROOT}/install-temp/etc/hostname   echo "alx-i486" > ${LIVECDROOT}/install-temp/etc/hostname
# Line 65  ff02::2         ip6-allrouters Line 90  ff02::2         ip6-allrouters
90  ff02::3         ip6-allhosts  ff02::3         ip6-allhosts
91  EOF  EOF
92    
  # create a default network interface config file  
  cat > ${LIVECDROOT}/install-temp/etc/conf.d/net.eth0 << EOF  
 ONBOOT="yes"  
 NETWORKING="dhcp"  
 EOF  
   
  # fix mage.rc and config.rc  
  NEW_SQL_USER="alx_install"  
  NEW_SQL_PASS="@lx"  
  NEW_SQL_HOST="128.20.41.110"  
  NEW_SQL_DB="alx_web"  
  NEW_SMB_UPDATE_HOST="//${NEW_SQL_HOST}/magetmp"  
  NEW_SMB_UPDATE_USER="${NEW_SQL_USER}"  
  NEW_SMB_UPDATE_PASS="${NEW_SQL_PASS}"  
  NEW_MAGE_MIRRORS="http://${NEW_SQL_HOST}/magellan/alx-070"  
  NEW_MAGE_RSYNC="rsync://${NEW_SQL_HOST}/mage-alx-070"  
  NEW_RSYNC="${NEW_MAGE_RSYNC}"  
  NEW_SMAGE2RSYNC="rsync://${NEW_SQL_HOST}/smage-alx-070"  
  NEW_MIRRORS="${NEW_MAGE_MIRRORS}"  
  NEW_MAGE_UNINSTALL_TIMEOUT="0"  
  CONFIG="${LIVECDROOT}/install-temp/etc/mage.rc"  
  updateconfig RSYNC SMAGE2RSYNC MIRRORS MAGE_UNINSTALL_TIMEOUT  
  CONFIG="${LIVECDROOT}/install-temp/etc/alxconfig-ng/config.rc"  
  updateconfig SQL_USER SQL_PASS SQL_HOST SQL_DB SMB_UPDATE_HOST SMB_UPDATE_USER SMB_UPDATE_PASS MAGE_MIRRORS MAGE_RSYNC  
   
93   # create tarball   # create tarball
94   [[ -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
95   ( cd ${LIVECDROOT}/install-temp; tar cvjpf ${CDISOROOT}/system/alx-i486.tar.bz2 ./ | tee log)   ( cd ${LIVECDROOT}/install-temp; tar cvjpf ${CDISOROOT}/system/alx-i486.tar.bz2 ./ | tee log)
# Line 117  create_netboot_image() Line 117  create_netboot_image()
117    
118   install -d ${LIVECDROOT}/network-temp/{LiveOS,mnt} || die   install -d ${LIVECDROOT}/network-temp/{LiveOS,mnt} || die
119    
120     # fix fstab, use the livecd fstab without rootfs and swap
121     install -m 0644 $(get_profile fstab) ${LIVECDROOT}/install-temp/etc/fstab || die
122    
123   # get the actual size of the chroot   # get the actual size of the chroot
124   size=$(du -s ${LIVECDROOT}/install-temp | sed 's:^\(.*\)[[:space:]].*:\1:')   size=$(du -s ${LIVECDROOT}/install-temp | sed 's:^\(.*\)[[:space:]].*:\1:')
125    
126   # generate a ext3fs file for devicemapper   # generate a ext3fs file for devicemapper
127   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
128   # create a filesystem   # create a filesystem
129   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
130   # set mount_counts and check_intervals to 0   # set mount_counts and check_intervals to 0
131   # set dir_index top, to speed up thing with hashed b-trees   # set dir_index top, to speed up things with hashed b-trees
132   # allow acls too   # allow acls too
133   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
134     # strip the journal
135    # tune2fs -O^has_journal ${LIVECDROOT}/network-temp/LiveOS/ext3fs.img || die
136     # fsck after journal removal
137    # fsck ${LIVECDROOT}/network-temp/LiveOS/ext3fs.img || die
138    
139   # losetup the device   # losetup the device
140   loopdev=$(losetup -f)   loopdev=$(losetup -f)
# Line 159  create_netboot_image() Line 166  create_netboot_image()
166   # initrd   # initrd
167   install -d ${CDCHROOTDIR}/etc/dracut.conf.d || die   install -d ${CDCHROOTDIR}/etc/dracut.conf.d || die
168   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
169   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
170     # use plymouth to get all kms modules, but boot with nosplash as default to fix some Xorg issues
171     #echo 'omit_dracutmodules+=" systemd mcored "' >> ${CDCHROOTDIR}/etc/dracut.conf.d/03-netboot.conf || die
172     echo 'omit_dracutmodules+=" mcored "' >> ${CDCHROOTDIR}/etc/dracut.conf.d/03-netboot.conf || die
173     echo 'hostonly="no"' >> ${CDCHROOTDIR}/etc/dracut.conf.d/03-netboot.conf || die
174   # install dracut-dev package to have all modules   # install dracut-dev package to have all modules
175   custom_packages install "dracut-dev curl curl-dev" || die   custom_packages install "dracut-dev curl curl-dev" || die
176   ## mlivecdbuild function   ## mlivecdbuild function
177   generate_initrd   generate_initrd
178   mv ${CDISOROOT}/isolinux/initrd.gz ${CDISOROOT}/netboot/ || die   mv ${CDISOROOT}/isolinux/initrd.gz ${CDISOROOT}/netboot/ || die
179   custom_packages uninstall "dracut-dev curl curl-dev" || die   # fix initrd permissions
180     chmod 0644 ${CDISOROOT}/netboot/initrd.gz || die
181    # custom_packages uninstall "dracut-dev curl curl-dev" || die
182   if [ -e ${CDCHROOTDIR}/etc/dracut.conf.d/03-netboot.conf ]   if [ -e ${CDCHROOTDIR}/etc/dracut.conf.d/03-netboot.conf ]
183   then   then
184   rm ${CDCHROOTDIR}/etc/dracut.conf.d/03-netboot.conf   rm ${CDCHROOTDIR}/etc/dracut.conf.d/03-netboot.conf
185   fi   fi
186   # bootloader   # bootloader pxelinux
187   install -d ${CDISOROOT}/netboot/pxelinux.cfg   install -d ${CDISOROOT}/netboot/pxelinux/pxelinux.cfg
188   [ -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/
189   [ -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
190   [ -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/
191   [ -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/
192   [ -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/
193   [ -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/
194   [ -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/
195   [ -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/
196     # bootloader lpxelinux
197     install -d ${CDISOROOT}/netboot/lpxelinux/pxelinux.cfg
198     [ -f $(get_profile netboot/lpxelinux.0) ] && install -m0644 $(get_profile netboot/lpxelinux.0) ${CDISOROOT}/netboot/lpxelinux/
199     [ -f $(get_profile netboot/ldlinux.c32) ] && install -m0644 $(get_profile netboot/ldlinux.c32) ${CDISOROOT}/netboot/lpxelinux/
200     [ -f $(get_profile netboot/pxelinux.cfg/lpxelinux-default) ] && install -m0644 $(get_profile netboot/pxelinux.cfg/lpxelinux-default) ${CDISOROOT}/netboot/lpxelinux/pxelinux.cfg
201     [ -f $(get_profile netboot/pxelinux.cfg/boot.cat) ] && install -m0644 $(get_profile netboot/pxelinux.cfg/boot.cat) ${CDISOROOT}/netboot/lpxelinux/
202     [ -f $(get_profile boot.lss) ] && install -m0644 $(get_profile boot.lss) ${CDISOROOT}/netboot/lpxelinux/
203     [ -f $(get_profile boot.msg) ] && install -m0644 $(get_profile boot.msg) ${CDISOROOT}/netboot/lpxelinux/
204     [ -f $(get_profile debug.msg) ] && install -m0644 $(get_profile debug.msg) ${CDISOROOT}/netboot/lpxelinux/
205     [ -f $(get_profile help.msg) ] && install -m0644 $(get_profile help.msg) ${CDISOROOT}/netboot/lpxelinux/
206     [ -f $(get_profile index.msg) ] && install -m0644 $(get_profile index.msg) ${CDISOROOT}/netboot/lpxelinux/
207    
208   # final cleanup   # final cleanup
209   if [[ -d ${LIVECDROOT}/network-temp ]]   if [[ -d ${LIVECDROOT}/network-temp ]]
# Line 188  create_netboot_image() Line 212  create_netboot_image()
212   fi   fi
213  }  }
214    
215    ##
216    # create the server tarball
217    ##
218    create_server_tarball()
219    {
220     install -d ${LIVECDROOT}/server-temp
221     install -d ${CDISOROOT}/server
222    
223     mage-bootstrap \
224     --root ${LIVECDROOT}/server-temp \
225     --profile ${MAGE_PROFILE} \
226     --magerc ${MAGERC} \
227     --toolchain ${TOOLCHAIN} \
228     --update-tarball \
229     --basesystem serversystem || die "bootstrapping target system failed!"
230    
231     # generate a new machine-id on first-boot
232     :> ${LIVECDROOT}/server-temp/etc/machine-id
233    
234     # enable getty1
235     install -d ${LIVECDROOT}/server-temp/etc/systemd/system/getty.target.wants
236     ln -snf /usr/lib/systemd/system/getty@.service ${LIVECDROOT}/server-temp/etc/systemd/system/getty.target.wants/getty@tty1.service
237    
238     # be more verbose
239     sed -i 's:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1"rd.info":' ${LIVECDROOT}/server-temp/etc/conf.d/grub
240    
241     # fix localtime symlink
242     ln -snf ../usr/share/zoneinfo/Europe/Berlin ${LIVECDROOT}/server-temp/etc/localtime
243    
244     # activate timeserver via dhcp (NTP - option 42)
245     CDCHROOTDIR=${LIVECDROOT}/server-temp custom_services add systemd-timesyncd.service
246    
247     # empty root password
248     chroot ${LIVECDROOT}/server-temp passwd -d root
249    
250     # empty user password
251     chroot ${LIVECDROOT}/server-temp passwd -d station
252    
253     if [ -x ${LIVECDROOT}/server-temp/usr/bin/mcorepasswd ] ||
254     [ -L ${LIVECDROOT}/server-temp/usr/bin/mcorepasswd ]
255     then
256     # add mcored default user
257     ( echo "foobar"; sleep 0.1; echo "foobar" ) | chroot ${LIVECDROOT}/server-temp /usr/bin/mcorepasswd mcore
258     fi
259    
260     # remove phpmyadmin configuration directory
261     if [ -d ${LIVECDROOT}/server-temp/usr/share/phpmyadmin/config ]
262     then
263     rm -r ${LIVECDROOT}/server-temp/usr/share/phpmyadmin/config
264     fi
265    
266     # fix hostname and hosts file
267     echo "alx-svr-i486" > ${LIVECDROOT}/server-temp/etc/hostname
268     echo "127.0.0.1 localhost alx-svr-i486.magellan-linux.de alx-svr-i486" > ${LIVECDROOT}/server-temp/etc/hosts
269     # fix certificate issues with mcored (common name of cert issuer) and >php-5.4
270     echo "127.0.0.1 mcored" >> ${LIVECDROOT}/server-temp/etc/hosts
271     cat >> ${LIVECDROOT}/server-temp/etc/hosts << EOF
272    ::1             ip6-localhost   ip6-loopback
273    fe00::0         ip6-localnet
274    ff00::0         ip6-mcastprefix
275    ff02::1         ip6-allnodes
276    ff02::2         ip6-allrouters
277    ff02::3         ip6-allhosts
278    EOF
279    
280     # create tarball
281     [[ -f ${CDISOROOT}/server/alx-svr-i486.tar.bz2 ]] && rm ${CDISOROOT}/server/alx-svr-i486.tar.bz2
282     ( cd ${LIVECDROOT}/server-temp; tar cvjpf ${CDISOROOT}/server/alx-svr-i486.tar.bz2 ./ | tee log)
283    
284     # create images.conf
285     echo "CDIMAGENAME=alx-svr-i486.tar.bz2" > ${CDISOROOT}/server/images.conf
286     echo "TOTALLINES=$(wc -l ${LIVECDROOT}/server-temp/log | cut -d' ' -f1)" >> ${CDISOROOT}/server/images.conf
287    
288     # clean up
289     if [[ -d ${LIVECDROOT}/server-temp ]]
290     then
291     rm -rf ${LIVECDROOT}/server-temp
292     fi
293    }
294    
295  # set an empty root password  # set an empty root password
296  chroot ${CDCHROOTDIR} passwd -d root  chroot ${CDCHROOTDIR} passwd -d root
297    
# Line 195  chroot ${CDCHROOTDIR} passwd -d root Line 299  chroot ${CDCHROOTDIR} passwd -d root
299  install -d ${CDCHROOTDIR}/var/lib/plymouth || die  install -d ${CDCHROOTDIR}/var/lib/plymouth || die
300  install -m 0644 $(get_profile boot-duration.livecd) ${CDCHROOTDIR}/var/lib/plymouth/boot-duration || die  install -m 0644 $(get_profile boot-duration.livecd) ${CDCHROOTDIR}/var/lib/plymouth/boot-duration || die
301    
 # install mnt-cdrom mount service, should be provided by alxinstall-ng  
 #install -m 0644 $(get_profile mnt-cdrom.mount) ${CDCHROOTDIR}/usr/lib/systemd/system/mnt-cdrom.mount || die  
 #ln -snf ../mnt-cdrom.mount ${CDCHROOTDIR}/usr/lib/systemd/system/local-fs.target.wants/mnt-cdrom.mount || die  
   
 # disable splash X11 vt change and set splash to be always verbose  
 #if [[ -f ${CDCHROOTDIR}/etc/splash/splash.conf ]]  
 #then  
 # sed -i -e 's:^\(SPLASH_X11_TTY=.*\):#\1:' \  
 # -e 's:^\(SPLASH_MODE=\).*:\1\"verbose\":' \  
 # ${CDCHROOTDIR}/etc/splash/splash.conf  
 #fi  
   
302  # setup de keymap and locales  # setup de keymap and locales
303  if [ -f ${CDCHROOTDIR}/etc/vconsole.conf ]  if [ -f ${CDCHROOTDIR}/etc/vconsole.conf ]
304  then  then
# Line 226  fi Line 318  fi
318  # 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
319  [[ -n ${SKIP_CREATE_INSTALL_TARBALL} ]] || create_install_tarball  [[ -n ${SKIP_CREATE_INSTALL_TARBALL} ]] || create_install_tarball
320    
321    # stop here if the user don't want to create the server tarball
322    [[ -n ${SKIP_CREATE_SERVER_TARBALL} ]] || create_server_tarball
323    
324  # install usb-install script  # install usb-install script
325  [ ! -d ${CDISOROOT}/usb-install ] && mkdir ${CDISOROOT}/usb-install  [ ! -d ${CDISOROOT}/usb-install ] && mkdir ${CDISOROOT}/usb-install
326  [ -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
327  [ -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
328  [ -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
329    
330    # add installer-server script
331    cat > ${CDCHROOTDIR}/usr/bin/installer-server << EOF
332    #!/bin/bash
333    /usr/bin/installer --imageroot /run/initramfs/live/server
334    EOF
335    chmod 0755 ${CDCHROOTDIR}/usr/bin/installer-server

Legend:
Removed from v.2873  
changed lines
  Added in v.3064