Revive code/hacks for building F15 images
To build F15 images we need to remove systemd and set up loader as init (see runtime-cleanup and runtime-postinstall). We also need to add a hack to dracut so loader won't freak out when it gets started by anaconda - see the file we're adding to the initramfs in treebuilder.py. (There's also an extra bonus hack for working around a bug in dracut if /proc/cmdline is empty - SEE IF YOU CAN SPOT IT!!!)
This commit is contained in:
parent
51060f07f6
commit
ba686350ef
@ -78,25 +78,36 @@ arch/x86/kvm
|
||||
%endfor
|
||||
remove /modules/*/{build,source,*.map}
|
||||
|
||||
## Clean up systemd
|
||||
removefrom ConsoleKit /lib/systemd/*
|
||||
removefrom avahi /lib/systemd/*
|
||||
removefrom chkconfig /sbin/chkconfig /usr/sbin/alternatives
|
||||
removefrom chkconfig /usr/sbin/update-alternatives /var/lib/alternatives
|
||||
removefrom initscripts /lib/systemd/system/fedora-readonly.service
|
||||
removefrom initscripts /lib/systemd/system/fedora-storage-init.service
|
||||
removefrom initscripts /lib/systemd/system/fedora-wait-storage.service
|
||||
removefrom systemd-units /lib/systemd/system/bluetooth.target
|
||||
removefrom systemd-units /lib/systemd/system/http-daemon.target
|
||||
removefrom systemd-units /lib/systemd/system/kexec*
|
||||
removefrom systemd-units /lib/systemd/system/local-fs.target.wants/media.mount
|
||||
removefrom systemd-units /lib/systemd/system/mail-transfer-agent.target
|
||||
removefrom systemd-units /lib/systemd/system/media.mount
|
||||
removefrom systemd-units /lib/systemd/system/printer*
|
||||
removefrom systemd-units /lib/systemd/system/*plymouth*
|
||||
removefrom systemd-units /lib/systemd/system/quota*
|
||||
removefrom systemd-units /lib/systemd/system/smartcard*
|
||||
removefrom systemd-units /lib/systemd/system/systemd-remount-api-vfs.service
|
||||
%if int(product.version) >= 15:
|
||||
## Clean up systemd
|
||||
removefrom ConsoleKit /lib/systemd/*
|
||||
removefrom avahi /lib/systemd/*
|
||||
removefrom chkconfig /sbin/chkconfig /usr/sbin/alternatives
|
||||
removefrom chkconfig /usr/sbin/update-alternatives /var/lib/alternatives
|
||||
removefrom initscripts /lib/systemd/system/fedora-readonly.service
|
||||
removefrom initscripts /lib/systemd/system/fedora-storage-init.service
|
||||
removefrom initscripts /lib/systemd/system/fedora-wait-storage.service
|
||||
removefrom systemd-units /lib/systemd/system/bluetooth.target
|
||||
removefrom systemd-units /lib/systemd/system/http-daemon.target
|
||||
removefrom systemd-units /lib/systemd/system/kexec*
|
||||
removefrom systemd-units /lib/systemd/system/local-fs.target.wants/media.mount
|
||||
removefrom systemd-units /lib/systemd/system/mail-transfer-agent.target
|
||||
removefrom systemd-units /lib/systemd/system/media.mount
|
||||
removefrom systemd-units /lib/systemd/system/printer*
|
||||
removefrom systemd-units /lib/systemd/system/*plymouth*
|
||||
removefrom systemd-units /lib/systemd/system/quota*
|
||||
removefrom systemd-units /lib/systemd/system/smartcard*
|
||||
removefrom systemd-units /lib/systemd/system/systemd-remount-api-vfs.service
|
||||
%else:
|
||||
## F15 - remove systemd init stuff
|
||||
remove /cgroup /var/cache /var/log
|
||||
removepkg chkconfig filesystem systemd-units
|
||||
removefrom NetworkManager /lib/systemd/*
|
||||
removefrom dbus /lib/systemd/*
|
||||
removefrom initscripts /lib/systemd/*
|
||||
removefrom systemd /bin/* /lib/systemd/* /usr/share/systemd/*
|
||||
removefrom util-linux /sbin/agetty
|
||||
%endif
|
||||
|
||||
## other package specific removals
|
||||
removefrom ConsoleKit /etc/ConsoleKit* /etc/init/* /usr/bin/* /usr/lib/*
|
||||
|
@ -29,13 +29,23 @@ move ${PYTHONDIR}/site-packages/pyanaconda/sitecustomize.py ${PYTHONDIR}/site-pa
|
||||
move etc/yum.repos.d etc/anaconda.repos.d
|
||||
|
||||
## misc_tree_modifications()
|
||||
symlink /sbin/init init
|
||||
remove etc/systemd/system/default.target
|
||||
symlink /lib/systemd/system/anaconda.target etc/systemd/system/default.target
|
||||
%if int(product.version) >= 15:
|
||||
## Configure systemd to start anaconda
|
||||
symlink /sbin/init init
|
||||
remove etc/systemd/system/default.target
|
||||
symlink /lib/systemd/system/anaconda.target etc/systemd/system/default.target
|
||||
append bin/login "#!/bin/bash"
|
||||
append bin/login "exec -l /bin/bash"
|
||||
%else:
|
||||
## Set up loader as init
|
||||
copy usr/${libdir}/anaconda/init sbin/init
|
||||
symlink init sbin/halt
|
||||
symlink init sbin/poweroff
|
||||
symlink init sbin/reboot
|
||||
remove sbin/runlevel sbin/shutdown sbin/telinit
|
||||
%endif
|
||||
install ${configdir}/network etc/sysconfig
|
||||
append etc/resolv.conf ""
|
||||
append bin/login "#!/bin/bash"
|
||||
append bin/login "exec -l /bin/bash"
|
||||
|
||||
## get_config_files(configdir)
|
||||
## gconf stuff
|
||||
|
@ -146,6 +146,8 @@ class TreeBuilder(object):
|
||||
dracut.append("--force")
|
||||
# Hush some dracut warnings. TODO: bind-mount proc in place?
|
||||
open(joinpaths(self.vars.inroot,"/proc/modules"),"w")
|
||||
# Add some extra bits to the dracut initramfs
|
||||
dracut += self.anaconda_dracut_hack()
|
||||
# XXX FIXME: add anaconda dracut module!
|
||||
for kernel in self.kernels:
|
||||
logger.info("rebuilding %s", kernel.initrd.path)
|
||||
@ -156,6 +158,19 @@ class TreeBuilder(object):
|
||||
dracut + [kernel.initrd.path, kernel.version])
|
||||
os.unlink(joinpaths(self.vars.inroot,"/proc/modules"))
|
||||
|
||||
def anaconda_dracut_hack(self):
|
||||
'''Hack to make F15 dracut able to boot F15 anaconda properly'''
|
||||
hookfile = "/tmp/99anaconda-umount.sh" # path relative to inroot
|
||||
with open(joinpaths(self.vars.inroot,hookfile), "w") as f:
|
||||
s = ['#!/bin/sh',
|
||||
'udevadm control --stop-exec-queue',
|
||||
'udevd=$(pidof udevd) && kill $udevd',
|
||||
'umount -l /proc /sys /dev/pts /dev',
|
||||
'echo "mustard=progress" > /proc/cmdline',
|
||||
'[ "$udevd" ] && kill -9 $udevd']
|
||||
f.writelines(line+"\n" for line in s)
|
||||
return ['--include', hookfile, "/lib/dracut/hooks/pre-pivot"]
|
||||
|
||||
def build(self):
|
||||
templatefile = templatemap[self.vars.arch.basearch]
|
||||
self._runner.run(templatefile, kernels=self.kernels)
|
||||
|
Loading…
Reference in New Issue
Block a user