diff --git a/Makefile b/Makefile index c62a9d45..eab25a91 100644 --- a/Makefile +++ b/Makefile @@ -10,5 +10,8 @@ install: clean: -rm -rf build -test: +testlocal: /usr/bin/lorax -p FEDORA -v RAWHIDE -r 2010 -s /rawrepo /root/rawhide + +test: + /usr/bin/lorax -p FEDORA -v RAWHIDE -r 2010 -s http://download.englab.brq.redhat.com/pub/fedora/linux/development/rawhide/x86_64/os/ /root/rawhide diff --git a/share/config_files/.bash_history b/share/config_files/.bash_history new file mode 100644 index 00000000..74ef1bb6 --- /dev/null +++ b/share/config_files/.bash_history @@ -0,0 +1,7 @@ +kill -USR2 `cat /var/run/anaconda.pid` +kill -HUP `cat /var/run/anaconda.pid` +udevadm info --export-db | less +tail -f /tmp/storage.log +echo b > /proc/sysrq-trigger +dmsetup table +multipath -d diff --git a/share/config_files/anaconda.rules b/share/config_files/anaconda.rules new file mode 100644 index 00000000..e6e41ece --- /dev/null +++ b/share/config_files/anaconda.rules @@ -0,0 +1,42 @@ + + + + + + metacity/general/button_layout + /schemas/apps/metacity/general/button_layout + + : + + + + metacity/general/action_right_click_titlebar + /schemas/apps/metacity/general/action_right_click_titlebar + + none + + + + metacity/window_keybindings/close + /schemas/apps/metacity/window_keybindings/close + + disabled + + + + metacity/global_keybindings/run_command_window_screenshot + /metacity/global_keybindings/run_command_window_screenshot + + disabled + + + + metacity/global_keybindings/run_command_screenshot + /metacity/global_keybindings/run_command_screenshot + + disabled + + + + + diff --git a/share/config_files/rsyslog.conf b/share/config_files/rsyslog.conf new file mode 100644 index 00000000..e53ed473 --- /dev/null +++ b/share/config_files/rsyslog.conf @@ -0,0 +1,48 @@ +#### MODULES #### +$ModLoad imuxsock.so # provides support for local system logging +$ModLoad imklog.so # provides kernel logging support + +$ModLoad imfile +$InputFileName /tmp/X.log +$InputFileTag xserver: +$InputFileStateFile xserver-statefile +$InputFileFacility local1 +$InputRunFileMonitor +$InputFileName /tmp/anaconda-tb-all.log +$InputFileTag anaconda-tb: +$InputFileStateFile anaconda-tb-statefile +$InputFileFacility local1 +$InputRunFileMonitor + +#### GLOBAL DIRECTIVES #### +# Use default timestamp format +$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat + +#### TEMPLATES #### + +$template anaconda_tty4, "%syslogseverity-text:::uppercase% %programname%:%msg%\n" +$template anaconda_syslog, "%timestamp:8:$:date-rfc3164%,%timestamp:1:3:date-subseconds% %syslogseverity-text:::uppercase% %programname%:%msg%\n" +$template virtio_ForwardFormat, "<%PRI%>%TIMESTAMP:::date-rfc3339% %HOSTNAME% %syslogtag:1:32%%msg:::sp-if-no-1st-sp%%msg%\n" + +#### RULES #### +# log everything except anaconda-specific records from local1 (those are stored +# directly into files via python logging) +*.*;\ +authpriv.none;\ +local1.none /tmp/syslog;anaconda_syslog + & /dev/tty4;anaconda_tty4 + +# ### begin forwarding rule ### +# The statement between the begin ... end define a SINGLE forwarding +# rule. They belong together, do NOT split them. If you create multiple +# forwarding rules, duplicate the whole block! +# +# An on-disk queue is created for this action. If the remote host is +# down, messages are spooled to disk and sent when it is up again. +$ActionQueueMaxDiskSpace 1m # space limit (use as much as possible) +$ActionQueueSaveOnShutdown off # do not save messages to disk on shutdown +$ActionQueueType LinkedList # run asynchronously +$ActionResumeRetryCount -1 # infinite retries if host is down +# remote host is: name/ip:port, e.g. 192.168.0.1:514, port optional +# ### end of the forwarding rule ### + diff --git a/share/config_files/sshd_config.anaconda b/share/config_files/sshd_config.anaconda new file mode 100644 index 00000000..0c0404cc --- /dev/null +++ b/share/config_files/sshd_config.anaconda @@ -0,0 +1,17 @@ +Port 22 +HostKey /etc/ssh/ssh_host_key +HostKey /etc/ssh/ssh_host_rsa_key +HostKey /etc/ssh/ssh_host_dsa_key +PermitRootLogin yes +IgnoreRhosts yes +StrictModes yes +X11Forwarding yes +X11DisplayOffset 10 +PrintMotd yes +XAuthLocation /sbin/xauth +KeepAlive yes +SyslogFacility AUTHPRIV +RSAAuthentication yes +PasswordAuthentication yes +PermitEmptyPasswords yes +PermitUserEnvironment yes diff --git a/share/lorax-s1.ltmpl b/share/lorax-s1.ltmpl index 46371f71..798be36a 100644 --- a/share/lorax-s1.ltmpl +++ b/share/lorax-s1.ltmpl @@ -12,8 +12,9 @@ install "bind-libs-lite" install "bind-utils" install "bitmap-fangsongti-fonts" install "btrfs-progs" +install "bzip2-libs" install "cjkuni-uming-fonts" -install "dcbd" +install "dbus-libs" install "dejavu-sans-fonts" install "dejavu-sans-mono-fonts" install "dogtail" @@ -23,26 +24,28 @@ install "ethtool" install "fedora-gnome-theme" install "fedora-icon-theme" install "firstaidkit-engine" +install "firstaidkit-plugin-grub" install "ftp" install "gdk-pixbuf" -install "generic-logos" install "gfs2-utils" -install "gir-repository" install "glib" install "gnome-bluetooth-libs" install "gnome-keyring" install "gnome-python2-gconf" install "gnome-themes-legacy" +install "gobject-introspection" install "groff" install "grub" install "gtk+" install "hdparm" install "jfsutils" +install "kacst-farsi-fonts" +install "kacst-qurn-fonts" install "lcms-libs" install "libbonobo" +install "libgcc" install "libgnome-keyring" install "libgssglue" -install "libjpeg" install "libmlx4" install "libsemanage-python" install "libsysfs" @@ -61,6 +64,7 @@ install "lsof" install "lvm2-cluster" install "madan-fonts" install "man-db" +install "metacity" install "mt-st" install "mtr" install "network-manager-netbook" @@ -85,10 +89,12 @@ install "samba-winbind-clients" install "selinux-policy-targeted" install "smartmontools" install "smc-meera-fonts" +install "specspo" install "strace" install "systemd-sysvinit" install "tigervnc-server-minimal" install "tigervnc-server-module" +install "udev" install "un-core-dotum-fonts" install "usbutils" install "vim-minimal" @@ -141,10 +147,11 @@ install "xorg-x11-drv-void" install "xorg-x11-drv-voodoo" install "xorg-x11-drv-wacom" install "xorg-x11-fonts-ethiopic" +install "xorg-x11-fonts-misc" install "xorg-x11-server-Xorg" install "xorg-x11-server-utils" -##install "${product}-logos" -##install "${product}-release" +install "${product}-logos" +install "${product}-release" ## required firmware install "aic94xx-firmware" @@ -209,7 +216,6 @@ remove "file" remove "filesystem" remove "fipscheck" remove "firstaidkit" -remove "firstboot" remove "flac" remove "fontpackages-filesystem" remove "gamin" @@ -448,6 +454,21 @@ remove --path "/usr/share/doc" remove --path "/usr/share/info" remove --path "/usr/share/man" +remove --path "/usr/share/gnome" + +remove --path "/usr/share/mime/application" +remove --path "/usr/share/mime/audio" +remove --path "/usr/share/mime/image" +remove --path "/usr/share/mime/inode" +remove --path "/usr/share/mime/message" +remove --path "/usr/share/mime/model" +remove --path "/usr/share/mime/multipart" +remove --path "/usr/share/mime/packages" +remove --path "/usr/share/mime/text" +remove --path "/usr/share/mime/video" +remove --path "/usr/share/mime/x-content" +remove --path "/usr/share/mime/x-epoc" + remove --path "/boot" remove --path "/cgroup" remove --path "/home" @@ -456,10 +477,15 @@ remove --path "/mnt" remove --path "/opt" remove --path "/srv" +remove --path "/usr/etc" +remove --path "/usr/games" +remove --path "/usr/local" +remove --path "/usr/tmp" + remove --path "/var/cache" remove --path "/var/db" remove --path "/var/games" -remove --path "/var/lib/rpm" +remove --path "/var/lib/rpm/*" remove --path "/var/lib/yum" remove --path "/var/local" remove --path "/var/log" @@ -531,7 +557,10 @@ remove "db4" "/usr/*" remove "dbus" "/lib/systemd/*" remove "dbus-glib" "/usr/bin/*" remove "dbus-x11" "/etc/X11/*" -remove "dcbd" "/etc/*" +remove "dejavu-sans-fonts" "/usr/share/fonts/dejavu/DejaVuSans-BoldOblique*" +remove "dejavu-sans-fonts" "/usr/share/fonts/dejavu/DejaVuSans-ExtraLight*" +remove "dejavu-sans-fonts" "/usr/share/fonts/dejavu/DejaVuSans-Oblique*" +remove "dejavu-sans-fonts" "/usr/share/fonts/dejavu/DejaVuSansCondensed*" remove "device-mapper-multipath" "/etc/*" remove "dhclient" "/usr/*" remove "dmz-cursor-themes" "/usr/share/icons/dmz/*" @@ -550,14 +579,6 @@ remove "expat" "/usr/bin/*" remove "fcoe-utils" "/etc/rc.d/*" remove "fedora-gnome-theme" "/etc/gtk-3.0/*" remove "fedora-gnome-theme" "/usr/share/themes/*" -remove "fedora-logos" "/etc/*" -remove "fedora-logos" "/usr/share/firstboot/*" -remove "fedora-logos" "/usr/share/gnome-screensaver/*" -remove "fedora-logos" "/usr/share/icons/Bluecurve/*" -remove "fedora-logos" "/usr/share/icons/hicolor/*" -remove "fedora-logos" "/usr/share/icons/oxygen/*" -remove "fedora-logos" "/usr/share/pixmaps/*" -remove "fedora-logos" "/usr/share/plymouth/*" remove "file-libs" "/usr/share/*" remove "findutils" "/usr/share/*" remove "fontconfig" "/usr/bin/*" @@ -565,8 +586,6 @@ remove "gawk" "/usr/bin/*" remove "gawk" "/usr/libexec/*" remove "gawk" "/usr/share/*" remove "gdk-pixbuf2" "/usr/share/locale/*" -remove "generic-logos" "/usr/share/pixmaps/*" -remove "generic-logos" "/usr/share/plymouth/*" remove "gfs2-utils" "/usr/sbin/*" remove "glib2" "/etc/*" remove "glib2" "/usr/bin/*" @@ -576,6 +595,7 @@ remove "glibc" "/usr/libexec/*" remove "glibc" "/usr/sbin/*" remove "glibc-common" "/etc/*" remove "glibc-common" "/usr/libexec/*" +remove "glibc-common" "/usr/sbin/*" remove "glibc-common" "/usr/share/i18n/*" remove "gnome-bluetooth-libs" "/usr/share/*" remove "gnome-keyring" "/etc/xdg/*" @@ -641,7 +661,6 @@ remove "iproute" "/usr/*" remove "iputils" "/etc/*" remove "iputils" "/usr/sbin/*" remove "iscsi-initiator-utils" "/etc/rc.d/*" -remove "kbd" "/usr/bin/*" remove "kbd" "/usr/share/locale/*" remove "krb5-libs" "/usr/${libdir}/*" remove "less" "/etc/*" @@ -661,7 +680,6 @@ remove "libgpg-error" "/usr/share/locale/*" remove "libgssglue" "/etc/*" remove "libidn" "/usr/bin/*" remove "libidn" "/usr/share/locale/*" -remove "libjpeg" "/usr/bin/*" remove "libmlx4" "/etc/rdma/*" remove "libmlx4" "/usr/${libdir}/*" remove "libnotify" "/usr/bin/*" @@ -699,25 +717,18 @@ remove "module-init-tools" "/etc/*" remove "mt-st" "/etc/*" remove "mt-st" "/sbin/*" remove "mtools" "/etc/*" -remove "nettools" "/bin/*" -remove "nettools" "/etc/*" -remove "nettools" "/usr/share/locale/*" remove "network-manager-netbook" "/etc/*" remove "network-manager-netbook" "/usr/libexec/*" remove "network-manager-netbook" "/usr/share/dbus-1/*" remove "network-manager-netbook" "/usr/share/locale/*" remove "network-manager-netbook" "/usr/share/network-manager-netbook/*" remove "newt" "/usr/share/locale/*" -remove "nfsutils" "/etc/*" -remove "nfsutils" "/usr/sbin/*" -remove "nfsutils" "/var/lib/*" remove "notification-daemon" "/usr/${libdir}/*" remove "notification-daemon" "/usr/libexec/*" remove "notification-daemon" "/usr/share/locale/*" remove "nss" "/etc/pki/*" remove "nss-softokn" "/usr/${libdir}/nss/*" remove "ntfs-3g" "/usr/bin/*" -remove "ntfs-progs" "/sbin/*" remove "openldap" "/etc/openldap/*" remove "openssh" "/etc/ssh/*" remove "openssh" "/usr/libexec/*" @@ -766,8 +777,8 @@ remove "samba-common" "/usr/bin/*" remove "samba-common" "/usr/include/*" remove "samba-common" "/usr/${libdir}/*" remove "samba-common" "/usr/share/locale/*" -remove "samba-winbind-client" "/${libdir}/libnss_*" -remove "samba-winbind-client" "/usr/${libdir}/libnss_*" +remove "samba-winbind-clients" "/${libdir}/libnss_*" +remove "samba-winbind-clients" "/usr/${libdir}/libnss_*" remove "sed" "/usr/share/locale/*" remove "selinux-policy-targeted" "/usr/share/selinux/*" remove "smartmontools" "/etc/*" @@ -807,3 +818,10 @@ remove "yum" "/usr/share/locale/*" remove "yum" "/usr/share/yum-cli/*" remove "zenity" "/usr/share/gnome/help/*" remove "zenity" "/usr/share/omf/*" +remove "${product}-logos" "/etc/*" +remove "${product}-logos" "/usr/share/firstboot/*" +remove "${product}-logos" "/usr/share/gnome-screensaver/*" +remove "${product}-logos" "/usr/share/icons/Bluecurve/*" +remove "${product}-logos" "/usr/share/icons/oxygen/*" +remove "${product}-logos" "/usr/share/pixmaps/*" +remove "${product}-logos" "/usr/share/plymouth/*" diff --git a/src/pylorax/__init__.py b/src/pylorax/__init__.py index d0ffb04c..5c612662 100644 --- a/src/pylorax/__init__.py +++ b/src/pylorax/__init__.py @@ -235,8 +235,6 @@ class Lorax(BaseLoraxClass): # write buildstamp self.write_buildstamp(path=self.installtree.root) - - # remove locales logger.info("removing locales") self.installtree.remove_locales() @@ -272,6 +270,27 @@ class Lorax(BaseLoraxClass): logger.info("running depmod") self.installtree.run_depmod(kernel) + # create gconf + self.installtree.create_gconf() + + # move repos + self.installtree.move_repos() + + # create depmod conf + self.installtree.create_depmod_conf() + + # misc tree modifications + self.installtree.misc_tree_modifications() + + # get config files + config_dir = joinpaths(self.conf.get("lorax", "sharedir"), + "config_files") + + self.installtree.get_config_files(config_dir) + + # get loader + self.installtree.get_loader() + # set up output tree logger.info("setting up output tree") self.outputdir = outputdir or tempfile.mkdtemp(prefix="pylorax.out.") @@ -530,7 +549,7 @@ class Lorax(BaseLoraxClass): os.unlink(efiboot) # XXX calculate the size of the efi tree directory - overhead = 512 * 1024 + overhead = 256 * 1024 sizeinbytes = overhead for root, dnames, fnames in os.walk(efitree): @@ -843,6 +862,15 @@ class LoraxInstallTree(BaseLoraxClass): # required firmware firmware = set() + # XXX required firmware + firmware.add("atmel_at76c504c-wpa.bin") + firmware.add("iwlwifi-3945-1.ucode") + firmware.add("iwlwifi-3945.ucode") + firmware.add("zd1211/zd1211_uph") + firmware.add("zd1211/zd1211_uphm") + firmware.add("zd1211/zd1211b_uph") + firmware.add("zd1211/zd1211b_uphm") + # remove not needed modules for root, dnames, fnames in os.walk(moddir): for fname in fnames: @@ -941,6 +969,87 @@ class LoraxInstallTree(BaseLoraxClass): p = subprocess.Popen(cmd, stdout=subprocess.PIPE) + def create_gconf(self): + gconfdir = joinpaths(self.root, ".gconf/desktop") + os.makedirs(gconfdir) + touch(joinpaths(gconfdir, "%gconf.xml")) + + gconfdir = joinpaths(gconfdir, "gnome") + os.mkdir(gconfdir) + touch(joinpaths(gconfdir, "%gconf.xml")) + + gconfdir = joinpaths(gconfdir, "interface") + os.mkdir(gconfdir) + + text = """ + + + + +""" + + with open(joinpaths(gconfdir, "%gconf.xml"), "w") as fobj: + fobj.write(text) + + def move_repos(self): + src = joinpaths(self.root, "etc/yum.repos.d") + dst = joinpaths(self.root, "etc/anaconda.repos.d") + shutil.move(src, dst) + + def create_depmod_conf(self): + text = "search updates built-in\n" + + with open(joinpaths(self.root, "etc/depmod.d/dd.conf"), "w") as fobj: + fobj.write(text) + + # XXX + def misc_tree_modifications(self): + # init symlink + target = "/sbin/init" + name = joinpaths(self.root, "init") + os.symlink(target, name) + + # mtab symlink + target = "/proc/mounts" + name = joinpaths(self.root, "etc", "mtab") + os.symlink(target, name) + + # create resolv.conf + touch(joinpaths(self.root, "etc", "resolv.conf")) + + def get_config_files(self, src_dir): + # get gconf anaconda.rules + src = joinpaths(src_dir, "anaconda.rules") + dst = joinpaths(self.root, "etc", "gconf", "gconf.xml.defaults") + shutil.copy2(src, dst) + + cmd = [self.lcmds.GCONFTOOL, "--direct", + '--config-source="xml:readwrite:{0}"'.format(dst), + "--load", dst] + + p = subprocess.Popen(cmd, stdout=subprocess.PIPE) + p.wait() + + # get sshd config + src = joinpaths(src_dir, "sshd_config.anaconda") + dst = joinpaths(self.root, "etc", "ssh") + shutil.copy2(src, dst) + + # get rsyslog config + src = joinpaths(src_dir, "rsyslog.conf") + dst = joinpaths(self.root, "etc") + shutil.copy2(src, dst) + + # get .bash_history + src = joinpaths(src_dir, ".bash_history") + dst = joinpaths(self.root, "root") + shutil.copy2(src, dst) + + def get_loader(self): + src = joinpaths(self.root, "usr/share/anaconda", "loader.tr") + dst = joinpaths(self.root, "etc") + shutil.move(src, dst) + def create_install_img(self, paths, type="squashfs", workdir="/tmp"): tempdir = tempfile.mkdtemp(prefix="install.img.", dir=workdir) diff --git a/src/pylorax/constants.py b/src/pylorax/constants.py index 75a68995..1031cdbe 100644 --- a/src/pylorax/constants.py +++ b/src/pylorax/constants.py @@ -35,6 +35,7 @@ class LoraxRequiredCommands(dict): self["DEPMOD"] = "depmod" self["DMSETUP"] = "dmsetup" self["FIND"] = "find" + self["GCONFTOOL"] = "gconftool-2" self["ISOHYBRID"] = "isohybrid" self["LDCONFIG"] = "ldconfig" self["LOCALEDEF"] = "localedef" diff --git a/src/pylorax/sysutils.py b/src/pylorax/sysutils.py index 386b2b2e..619cc586 100644 --- a/src/pylorax/sysutils.py +++ b/src/pylorax/sysutils.py @@ -19,7 +19,8 @@ # Red Hat Author(s): Martin Gracik # -__all__ = ["joinpaths", "replace", "create_loop_dev", "remove_loop_dev", +__all__ = ["joinpaths", "touch", "replace", + "create_loop_dev", "remove_loop_dev", "create_dm_dev", "remove_dm_dev"] @@ -39,6 +40,11 @@ def joinpaths(*args, **kwargs): return path +def touch(fname): + with open(fname, "w") as fobj: + pass + + def replace(fname, find, replace): fin = fileinput.input(fname, inplace=1) pattern = re.compile(find) diff --git a/treediff.py b/treediff.py deleted file mode 100644 index b08cbb92..00000000 --- a/treediff.py +++ /dev/null @@ -1,77 +0,0 @@ -#! /usr/bin/env python - -import sys -import os - - -def main(src, dst, sort_by_size): - if src.endswith("/"): - src = src[:-1] - if dst.endswith("/"): - dst = dst[:-1] - - # parse the dst tree - dst_tree = {} - for root, dnames, fnames in os.walk(dst): - root = root.replace(dst, "", 1) - for fname in fnames: - path = os.path.join(root, fname) - try: - dst_tree[fname].add(path) - except KeyError: - dst_tree[fname] = set() - dst_tree[fname].add(path) - - # parse the src tree - filelist = [] - for root, dnames, fnames in os.walk(src): - root = root.replace(src, "", 1) - for fname in fnames: - path = os.path.join(root, fname) - paths = dst_tree.get(fname) - - if not paths: - # file not found - try: - size = os.path.getsize(os.path.join(src, path[1:])) - except OSError: - size = 0L - filelist.append((size, path)) - else: - # fname found - if path in paths: - # exact match - continue - else: - # partial match - # TODO - continue - - if sort_by_size: - filelist.sort(reverse=True) - - for size, path in filelist: - # convert size to human readable - human = "" - for base in ["KiB", "MiB", "GiB"]: - size /= 1024 - if size < 1024: - human = "{0:6.1f}{1}".format(size, base) - break - - print("{0} {1}".format(human, path)) - - -if __name__ == "__main__": - try: - src, dst = sys.argv[1], sys.argv[2] - except IndexError: - print("invalid arguments count") - sys.exit(1) - - try: - sort_by_size = sys.argv[3] - except IndexError: - sort_by_size = False - - main(src, dst, bool(sort_by_size))