def make_iso(project): print "Preparing ISO..." xterm_title("Preparing ISO") sort_cd_layout = False try: iso_dir = project.iso_dir(clean=True) iso_file = project.iso_file(clean=True) #image_dir = project.image_dir() image_file = project.image_file() additional_file = os.path.join(project.work_dir, "additional.tar.lzma") os.link(image_file, os.path.join(iso_dir, "pardus.img")) os.link(additional_file, os.path.join(iso_dir, "additional.tar.lzma")) def copy(src, dest): run('cp -PR "%s" "%s"' % (src, os.path.join(iso_dir, dest))) run('rm -rf "%s/.svn"' % os.path.join(iso_dir, dest)) if project.release_files: path = project.release_files for name in os.listdir(path): if name != ".svn": copy(os.path.join(path, name), name) # setup_grub(project) setup_isolinux(project) if project.type == "install": run('ln -s "%s" "%s"' % (project.install_repo_dir(), os.path.join(iso_dir, "repo"))) # Generate sort_list for mkisofs and YALI # Disabled for now if sort_cd_layout: sorted_list = generate_sort_list(iso_dir) if sorted_list: open("%s/repo/install.order" % iso_dir, "w").write("\n".join( ["%s %d" % (k, v) for (k, v) in sorted_list])) run('mkisofs -f -sort %s/repo/install.order -J -joliet-long -R -l -V "PardusLiveImage" -o "%s" -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table "%s"' % ( iso_dir, iso_file, iso_dir, )) else: run('mkisofs -f -J -joliet-long -R -l -V "PardusLiveImage" -o "%s" -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table "%s"' % ( iso_file, iso_dir, )) # convert iso to a hybrid one run("isohybrid -partok -offset 1 %s" % iso_file) except KeyboardInterrupt: print "Keyboard Interrupt: make_iso() cancelled." sys.exit(1)
def make(project): make_image(project) if project.type == "install": make_install_repo(project) make_iso(project) print "ISO is ready!" xterm_title("ISO is ready")
def check_repo_files(project): print "Checking image repo..." xterm_title("Checking image repo") try: repo = project.get_repo() repo_dir = project.image_repo_dir() if project.type == "install": imagedeps = repo.full_deps("yali4") else: imagedeps = project.all_packages i = 0 for name in imagedeps: i += 1 sys.stdout.write("\r%-70.70s" % "Checking %d of %s packages" % (i, len(imagedeps))) sys.stdout.flush() pak = repo.packages[name] check_file(repo_dir, pak.uri, pak.sha1sum) sys.stdout.write("\n") if project.type == "install": repo_dir = project.install_repo_dir() i = 0 for name in project.all_packages: i += 1 sys.stdout.write("\r%-70.70s" % "Checking %d of %s packages" % (i, len(project.all_packages))) sys.stdout.flush() pak = repo.packages[name] check_file(repo_dir, pak.uri, pak.sha1sum) sys.stdout.write("\n") except KeyboardInterrupt: print "Keyboard Interrupt: check_repo() cancelled." sys.exit(1)
def check_repo_files(project): print "Checking image repo..." xterm_title("Checking image repo") try: repo = project.get_repo() repo_dir = project.image_repo_dir() if project.type == "install": imagedeps = project.all_install_image_packages or repo.full_deps("yali") else: imagedeps = project.all_packages i = 0 for name in imagedeps: i += 1 sys.stdout.write("\r%-70.70s" % "Checking %d of %s packages" % (i, len(imagedeps))) sys.stdout.flush() pak = repo.packages[name] check_file(repo_dir, pak.uri, pak.sha1sum) sys.stdout.write("\n") if project.type == "install": repo_dir = project.install_repo_dir() i = 0 for name in project.all_packages: i += 1 sys.stdout.write("\r%-70.70s" % "Checking %d of %s packages" % (i, len(project.all_packages))) sys.stdout.flush() pak = repo.packages[name] check_file(repo_dir, pak.uri, pak.sha1sum) sys.stdout.write("\n") except KeyboardInterrupt: print "Keyboard Interrupt: check_repo() cancelled." sys.exit(1)
def install_desktop(project): print "Preparing desktop image..." xterm_title("Preparing desktop image") image_dir = project.image_dir() desktop_image_dir = project.desktop_image_dir(clean=True) run('mount -t aufs -o br=%s:%s=ro none %s' % (desktop_image_dir, image_dir, desktop_image_dir)) desktop_image_packages = " ".join(project.all_desktop_image_packages) run('pisi --yes-all --ignore-comar --ignore-dep --ignore-check -D"%s" it %s' % (desktop_image_dir, desktop_image_packages)) run('/bin/mount --bind /proc %s/proc' % desktop_image_dir) run('/bin/mount --bind /sys %s/sys' % desktop_image_dir) run("chroot \"%s\" /bin/service dbus start" % desktop_image_dir) run("chroot \"%s\" /usr/bin/pisi cp" % desktop_image_dir) run("chroot \"%s\" /bin/service dbus stop" % desktop_image_dir) run('umount %s/proc' % desktop_image_dir) run('umount %s/sys' % desktop_image_dir) run('/bin/umount -R %s' % desktop_image_dir) run("rm -rf %s/run/dbus/*" % desktop_image_dir) setup_live_sddm(project)
def setup_isolinux(project): print "Generating isolinux files..." xterm_title("Generating isolinux files") image_dir = project.image_dir() iso_dir = project.iso_dir() repo = project.get_repo() # Setup dir path = os.path.join(iso_dir, "isolinux") if not os.path.exists(path): os.makedirs(path) def copy(src, dest): run('cp -P "%s" "%s"' % (src, os.path.join(iso_dir, dest))) # Copy the kernel and initramfs path = os.path.join(image_dir, "boot") for name in os.listdir(path): if name.startswith("kernel") or name.startswith( "initramfs") or name.endswith(".img"): if name.startswith("kernel"): copy(os.path.join(path, name), "pisi/boot/x86_64/kernel") elif name.startswith("initramfs"): copy(os.path.join(path, name), "pisi/boot/x86_64/initrd.img") tmplpath = os.path.join(image_dir, "usr/share/gfxtheme/pisilinux/install") dest = os.path.join(iso_dir, "isolinux") for name in os.listdir(tmplpath): if name != "gfxboot.cfg": copy(os.path.join(tmplpath, name), dest) # copy config and gfxboot stuff generate_isolinux_conf(project) # we don't use debug anymore for the sake of hybrid copy(os.path.join(image_dir, "usr/lib/syslinux/bios/isolinux.bin"), "%s/isolinux.bin" % dest) copy(os.path.join(image_dir, "usr/lib/syslinux/bios/hdt.c32"), dest) #for boot new syslinux copy(os.path.join(image_dir, "usr/lib/syslinux/bios/ldlinux.c32"), dest) copy(os.path.join(image_dir, "usr/lib/syslinux/bios/libcom32.c32"), dest) copy(os.path.join(image_dir, "usr/lib/syslinux/bios/libutil.c32"), dest) copy(os.path.join(image_dir, "usr/lib/syslinux/bios/vesamenu.c32"), dest) copy(os.path.join(image_dir, "usr/lib/syslinux/bios/libmenu.c32"), dest) copy(os.path.join(image_dir, "usr/lib/syslinux/bios/libgpl.c32"), dest) copy(os.path.join(image_dir, "usr/lib/syslinux/bios/isohdpfx.bin"), dest) copy(os.path.join(image_dir, "usr/lib/syslinux/bios/gfxboot.c32"), dest) copy(os.path.join(image_dir, "usr/share/misc/pci.ids"), dest) kernel_version = open(os.path.join(image_dir, "etc/kernel/kernel")).read() #copy(os.path.join(image_dir, "lib/modules/%s/modules.pcimap" % kernel_version), dest) copy(os.path.join(image_dir, "boot/memtest"), os.path.join(iso_dir, "pisi/boot/x86_64"))
def make_iso(project): print "Preparing ISO..." xterm_title("Preparing ISO") try: iso_dir = project.iso_dir(clean=True) iso_file = project.iso_file(clean=True) work_dir = os.path.join(project.work_dir) configdir = os.path.join(project.config_files) efi_tmp = project.efi_tmp_path_dir(clean=True) image_path = os.path.join(iso_dir, "pisi") if not os.path.exists(image_path): os.makedirs(image_path) os.makedirs(os.path.join(image_path, "boot/x86_64")) os.makedirs(os.path.join(image_path, "x86_64")) make_EFI(project) run("cp -p %s/isomounts %s/." % (configdir, image_path)) run("cp -p %s/*sqfs %s/x86_64/." % (work_dir, image_path)) run("cp -p %s/pisi.img %s/EFI/pisi/." % (work_dir, iso_dir)) run("touch %s/.miso" % iso_dir) def copy(src, dest): dest = os.path.join(iso_dir, dest) if os.path.isdir(src): shutil.copytree(src, dest, ignore=shutil.ignore_patterns(".svn")) else: shutil.copy2(src, dest) setup_isolinux(project) publisher = "Pisi GNU/Linux https://pisilinux.org" application = "Pisi GNU/Linux Live Media" label = "pisiLive" cmd = 'xorriso -as mkisofs -quiet -iso-level 3 -rock -joliet -max-iso9660-filenames -omit-period -omit-version-number \ -relaxed-filenames -allow-lowercase -volid "%s" -publisher "%s" -appid "%s" \ -preparer "prepared by pisiman" -eltorito-boot isolinux/isolinux.bin \ -eltorito-catalog isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table \ -isohybrid-mbr "%s/isolinux/isohdpfx.bin" -eltorito-alt-boot -e EFI/pisi/pisi.img -isohybrid-gpt-basdat -no-emul-boot \ -output "%s" "%s/iso/"' % (label, publisher, application, iso_dir, iso_file, work_dir) run(cmd) except KeyboardInterrupt: print "Keyboard Interrupt: make_iso() cancelled." sys.exit(1)
def make_iso(project): print "Preparing ISO..." xterm_title("Preparing ISO") sort_cd_layout = False try: iso_dir = project.iso_dir(clean=True) iso_file = project.iso_file(clean=True) image_dir = project.image_dir() image_file = project.image_file() os.link(image_file, os.path.join(iso_dir, "pardus.img")) def copy(src, dest): run('cp -PR "%s" "%s"' % (src, os.path.join(iso_dir, dest))) if project.release_files: path = os.path.join(project.project_dir, project.release_files) copy(path, "RELEASE.txt") os.chmod(os.path.join(iso_dir, "RELEASE.txt"), 655) # setup_grub(project) setup_isolinux(project) if project.type == "install": run('ln -s "%s" "%s"' % (project.install_repo_dir(), os.path.join(iso_dir, "repo"))) # Generate sort_list for mkisofs and YALI # Disabled for now if sort_cd_layout: sorted_list = generate_sort_list(iso_dir) if sorted_list: open("%s/repo/install.order" % iso_dir, "w").write("\n".join( ["%s %d" % (k, v) for (k, v) in sorted_list])) run('mkisofs -f -sort %s/repo/install.order -J -joliet-long -R -l -V "Pardus" -o "%s" -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table "%s"' % ( iso_dir, iso_file, iso_dir, )) else: run('mkisofs -f -J -joliet-long -R -l -V "Pardus" -o "%s" -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table "%s"' % ( iso_file, iso_dir, )) except KeyboardInterrupt: print "Keyboard Interrupt: make_iso() cancelled." sys.exit(1)
def make_iso(project): print "Preparing ISO..." xterm_title("Preparing ISO") sort_cd_layout = False try: iso_dir = project.iso_dir(clean=True) iso_file = project.iso_file(clean=True) #image_dir = project.image_dir() image_file = project.image_file() os.link(image_file, os.path.join(iso_dir, "pardus.img")) def copy(src, dest): dest = os.path.join(iso_dir, dest) if os.path.isdir(src): shutil.copytree(src, dest, ignore=shutil.ignore_patterns(".svn")) else: shutil.copy2(src, dest) if project.release_files: # Allow ~ usage in project xml files path = os.path.expanduser(project.release_files) for name in os.listdir(path): if name != ".svn": copy(os.path.join(path, name), name) # setup_grub(project) setup_isolinux(project) if project.type == "install": run('ln -s "%s" "%s"' % (project.install_repo_dir(), os.path.join(iso_dir, "repo"))) # Generate sort_list for mkisofs and YALI # Disabled for now if sort_cd_layout: sorted_list = generate_sort_list(iso_dir) if sorted_list: open("%s/repo/install.order" % iso_dir, "w").write("\n".join(["%s %d" % (k,v) for (k,v) in sorted_list])) run('mkisofs -f -sort %s/repo/install.order -J -joliet-long -R -l -V "PardusLive" -o "%s" -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table "%s"' % (iso_dir, iso_file, iso_dir,)) else: run('mkisofs -f -J -joliet-long -R -l -V "PardusLive" -o "%s" -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table "%s"' % (iso_file, iso_dir,)) # convert iso to a hybrid one run("isohybrid -partok -offset 1 %s" % iso_file) except KeyboardInterrupt: print "Keyboard Interrupt: make_iso() cancelled." sys.exit(1)
def make_repos(project): print "Preparing image repo..." xterm_title("Preparing repo") try: repo = project.get_repo() repo_dir = project.image_repo_dir(clean=True) imagedeps = project.all_packages repo.make_local_repo(repo_dir, imagedeps) except KeyboardInterrupt: print "Keyboard Interrupt: make_repo() cancelled." sys.exit(1)
def setup_isolinux(project): print "Generating isolinux files..." xterm_title("Generating isolinux files") image_dir = project.image_dir() iso_dir = project.iso_dir() repo = project.get_repo() kernel = "" initramfs = "" # Setup dir path = os.path.join(iso_dir, "boot/isolinux") if not os.path.exists(path): os.makedirs(path) def copy(src, dest): run('cp -P "%s" "%s"' % (src, os.path.join(iso_dir, dest))) # Copy the kernel and initramfs path = os.path.join(image_dir, "boot") for name in os.listdir(path): if name.startswith("kernel") or name.startswith( "initramfs") or name.endswith(".bin"): if name.startswith("kernel"): copy(os.path.join(path, name), "boot/kernel") elif name.startswith("initramfs"): copy(os.path.join(path, name), "boot/initrd") tmplpath = os.path.join(image_dir, "usr/share/gfxtheme/pardus/install") dest = os.path.join(iso_dir, "boot/isolinux") for name in os.listdir(tmplpath): if name != "gfxboot.cfg": copy(os.path.join(tmplpath, name), dest) # copy config and gfxboot stuff generate_isolinux_conf(project) copy(os.path.join(image_dir, "usr/lib/syslinux/isolinux-debug.bin"), "%s/isolinux.bin" % dest) copy(os.path.join(image_dir, "usr/lib/syslinux/hdt.c32"), dest) copy(os.path.join(image_dir, "usr/lib/syslinux/gfxboot.com"), dest) copy(os.path.join(image_dir, "usr/share/misc/pci.ids"), dest) copy( os.path.join( image_dir, "lib/modules/%s-%s/modules.pcimap" % (repo.packages["kernel"].version, repo.packages["kernel"].release)), dest) copy(os.path.join(image_dir, "boot/memtest"), os.path.join(iso_dir, "boot"))
def make_iso(project): print "Preparing ISO..." xterm_title("Preparing ISO") sort_cd_layout = False try: iso_dir = project.iso_dir(clean=True) iso_file = project.iso_file(clean=True) image_dir = project.image_dir() image_file = project.image_file() os.link(image_file, os.path.join(iso_dir, "pardus.img")) def copy(src, dest): run('cp -PR "%s" "%s"' % (src, os.path.join(iso_dir, dest))) if project.release_files: path = os.path.join(project.project_dir, project.release_files) copy(path,"RELEASE.txt") os.chmod(os.path.join(iso_dir,"RELEASE.txt"),655) # setup_grub(project) setup_isolinux(project) if project.type == "install": run('ln -s "%s" "%s"' % (project.install_repo_dir(), os.path.join(iso_dir, "repo"))) # Generate sort_list for mkisofs and YALI # Disabled for now if sort_cd_layout: sorted_list = generate_sort_list(iso_dir) if sorted_list: open("%s/repo/install.order" % iso_dir, "w").write("\n".join(["%s %d" % (k,v) for (k,v) in sorted_list])) run('mkisofs -f -sort %s/repo/install.order -J -joliet-long -R -l -V "Pardus" -o "%s" -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table "%s"' % (iso_dir, iso_file, iso_dir,)) else: run('mkisofs -f -J -joliet-long -R -l -V "Pardus" -o "%s" -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table "%s"' % (iso_file, iso_dir,)) except KeyboardInterrupt: print "Keyboard Interrupt: make_iso() cancelled." sys.exit(1)
def install_desktop(project): global bus print "Preparing desktop image..." xterm_title("Preparing desktop image") image_dir = project.image_dir() configdir = os.path.join(project.config_files) desktop_image_dir = project.desktop_image_dir(clean=True) run('mount -t aufs -o br=%s:%s=ro none %s' % (desktop_image_dir, image_dir, desktop_image_dir)) desktop_image_packages = " ".join(project.all_desktop_image_packages) run('pisi --yes-all --ignore-comar --ignore-dep --ignore-check -D"%s" it %s' % (desktop_image_dir, desktop_image_packages)) run('/bin/mount --bind /proc %s/proc' % desktop_image_dir) run('/bin/mount --bind /sys %s/sys' % desktop_image_dir) chroot_comar(desktop_image_dir) run("chroot \"%s\" /usr/bin/pisi cp" % desktop_image_dir) #Mate KURULAN AYAR run("cp -rf %s/default-settings/etc/* %s/etc/" % (configdir, desktop_image_dir)) run("chroot \"%s\" /sbin/rc-update add xdm default" % desktop_image_dir) run("chroot \"%s\" /sbin/rc-update add networkmanager default" % desktop_image_dir) run('umount %s/proc' % desktop_image_dir) run('umount %s/sys' % desktop_image_dir) run('/bin/umount -R %s' % desktop_image_dir, ignore_error=True) run('/bin/umount -l %s' % desktop_image_dir, ignore_error=True) run("rm -rf %s/run/dbus/*" % desktop_image_dir, ignore_error=True) run("rm -rf %s/var/lib/pisi/info/files.ldb/LOCK" % desktop_image_dir, ignore_error=True) setup_live_lightdm(project)
def install_desktop(project): print "Preparing desktop image..." xterm_title("Preparing desktop image") image_dir = project.image_dir() configdir =os.path.join(project.config_files) desktop_image_dir = project.desktop_image_dir(clean=True) run('mount -t aufs -o br=%s:%s=ro none %s' % (desktop_image_dir,image_dir, desktop_image_dir)) desktop_image_packages = " ".join(project.all_desktop_image_packages) run('pisi --yes-all --ignore-comar --ignore-dep --ignore-check -D"%s" it %s' % (desktop_image_dir, desktop_image_packages)) run('/bin/mount --bind /proc %s/proc' % desktop_image_dir) run('/bin/mount --bind /sys %s/sys' % desktop_image_dir) run("chroot \"%s\" /bin/service dbus start" % desktop_image_dir) run("chroot \"%s\" /usr/bin/pisi cp" % desktop_image_dir) #KDE KURULAN AYAR run("cp -rf %s/default-settings/etc/* %s/etc/" % (configdir,desktop_image_dir)) run("cp -rf %s/default-settings/autostart %s/etc/skel/.config/" % (configdir,desktop_image_dir)) run("chroot \"%s\" /bin/service dbus stop" % desktop_image_dir) run('umount %s/proc' % desktop_image_dir) run('umount %s/sys' % desktop_image_dir) run('/bin/umount -R %s' % desktop_image_dir) run("rm -rf %s/run/dbus/*" % desktop_image_dir) run("rm -rf %s/var/cache/pisi/*" % desktop_image_dir) setup_live_sddm(project)
def setup_isolinux(project): print "Generating isolinux files..." xterm_title("Generating isolinux files") image_dir = project.image_dir() iso_dir = project.iso_dir() repo = project.get_repo() # Setup dir path = os.path.join(iso_dir, "boot/isolinux") if not os.path.exists(path): os.makedirs(path) def copy(src, dest): run('cp -P "%s" "%s"' % (src, os.path.join(iso_dir, dest))) # Copy the kernel and initramfs path = os.path.join(image_dir, "boot") for name in os.listdir(path): if name.startswith("kernel") or name.startswith("initramfs") or name.endswith(".bin"): if name.startswith("kernel"): copy(os.path.join(path, name), "boot/kernel") elif name.startswith("initramfs"): copy(os.path.join(path, name), "boot/initrd") tmplpath = os.path.join(image_dir, "usr/share/gfxtheme/pisilinux/install") dest = os.path.join(iso_dir, "boot/isolinux") for name in os.listdir(tmplpath): if name != "gfxboot.cfg": copy(os.path.join(tmplpath, name), dest) # copy config and gfxboot stuff generate_isolinux_conf(project) # we don't use debug anymore for the sake of hybrid copy(os.path.join(image_dir, "usr/lib/syslinux/isolinux.bin"), "%s/isolinux.bin" % dest) copy(os.path.join(image_dir, "usr/lib/syslinux/hdt.c32"), dest) copy(os.path.join(image_dir, "usr/lib/syslinux/gfxboot.c32"), dest) copy(os.path.join(image_dir, "usr/share/misc/pci.ids"), dest) kernel_version = open(os.path.join(image_dir, "etc/kernel/kernel")).read() #copy(os.path.join(image_dir, "lib/modules/%s/modules.pcimap" % kernel_version), dest) copy(os.path.join(image_dir, "boot/memtest"), os.path.join(iso_dir, "boot"))
def setup_isolinux(project): print "Generating isolinux files..." xterm_title("Generating isolinux files") image_dir = project.image_dir() iso_dir = project.iso_dir() repo = project.get_repo() kernel = "" initramfs = "" # Setup dir path = os.path.join(iso_dir, "boot/isolinux") if not os.path.exists(path): os.makedirs(path) def copy(src, dest): run('cp -P "%s" "%s"' % (src, os.path.join(iso_dir, dest))) # Copy the kernel and initramfs path = os.path.join(image_dir, "boot") for name in os.listdir(path): if name.startswith("kernel") or name.startswith("initramfs") or name.endswith(".bin"): if name.startswith("kernel"): copy(os.path.join(path, name), "boot/kernel") elif name.startswith("initramfs"): copy(os.path.join(path, name), "boot/initrd") tmplpath = os.path.join(image_dir, "usr/share/gfxtheme/pardus/install") dest = os.path.join(iso_dir, "boot/isolinux") for name in os.listdir(tmplpath): if name != "gfxboot.cfg": copy(os.path.join(tmplpath, name), dest) # copy config and gfxboot stuff generate_isolinux_conf(project) copy(os.path.join(image_dir, "usr/lib/syslinux/isolinux-debug.bin"), "%s/isolinux.bin" % dest) copy(os.path.join(image_dir, "usr/lib/syslinux/hdt.c32"), dest) copy(os.path.join(image_dir, "usr/lib/syslinux/gfxboot.com"), dest) copy(os.path.join(image_dir, "usr/share/misc/pci.ids"), dest) copy(os.path.join(image_dir, "lib/modules/%s-%s/modules.pcimap" % (repo.packages["kernel"].version, repo.packages["kernel"].release)), dest) copy(os.path.join(image_dir, "boot/memtest"), os.path.join(iso_dir, "boot"))
def generate_grub_conf(project, kernel, initramfs): print "Generating grub.conf files..." xterm_title("Generating grub.conf files") image_dir = project.image_dir() iso_dir = project.iso_dir() grub_dict = {} grub_dict["kernel"] = kernel grub_dict["initramfs"] = initramfs grub_dict["title"] = project.title grub_dict["exparams"] = project.extra_params or '' path = os.path.join(image_dir, "usr/share/grub/templates") dest = os.path.join(iso_dir, "boot/grub") for name in os.listdir(path): if name.startswith("menu"): data = file(os.path.join(path, name)).read() f = file(os.path.join(dest, name), "w") f.write(data % grub_dict) f.close()
def make_repos(project): print "Preparing image repo..." xterm_title("Preparing image repo") try: repo = project.get_repo() repo_dir = project.image_repo_dir(clean=True) if project.type == "install": imagedeps = repo.full_deps("yali4") else: imagedeps = project.all_packages repo.make_local_repo(repo_dir, imagedeps) if project.type == "install": xterm_title("Preparing installination repo") print "Preparing installation repository..." repo_dir = project.install_repo_dir(clean=True) repo.make_local_repo(repo_dir, project.all_packages) except KeyboardInterrupt: print "Keyboard Interrupt: make_repo() cancelled." sys.exit(1)
def make_repos(project): print "Preparing image repo..." xterm_title("Preparing repo") try: repo = project.get_repo() repo_dir = project.image_repo_dir(clean=True) if project.type == "install": imagedeps = project.all_install_image_packages or repo.full_deps( "yali") xterm_title("Preparing image repo for installation") else: imagedeps = project.all_packages xterm_title("Preparing image repo for live") repo.make_local_repo(repo_dir, imagedeps) if project.type == "install": xterm_title("Preparing installination repo") print "Preparing installation repository..." repo_dir = project.install_repo_dir(clean=True) if project.package_collections: all_packages = [] for collection in project.package_collections: all_packages.extend(collection.packages.allPackages) # Making repos and index files per collection repo.make_local_repo(repo_dir, collection.packages.allPackages, collection._id) repo.make_local_repo(repo_dir, all_packages) repo.make_collection_index(repo_dir, project.package_collections, project.default_language) print "Preparing collections project file" else: repo.make_local_repo(repo_dir, project.all_packages) except KeyboardInterrupt: print "Keyboard Interrupt: make_repo() cancelled." sys.exit(1)
def make_repos(project): print "Preparing image repo..." xterm_title("Preparing repo") try: repo = project.get_repo() repo_dir = project.image_repo_dir(clean=True) if project.type == "install": imagedeps = project.all_install_image_packages or repo.full_deps("yali") xterm_title("Preparing image repo for installation") else: imagedeps = project.all_packages xterm_title("Preparing image repo for live") repo.make_local_repo(repo_dir, imagedeps) if project.type == "install": xterm_title("Preparing installination repo") print "Preparing installation repository..." repo_dir = project.install_repo_dir(clean=True) if project.package_collections: all_packages = [] for collection in project.package_collections: all_packages.extend(collection.packages.allPackages) # Making repos and index files per collection repo.make_local_repo(repo_dir, collection.packages.allPackages, collection._id) repo.make_local_repo(repo_dir, all_packages) repo.make_collection_index(repo_dir, project.package_collections, project.default_language) print "Preparing collections project file" else: repo.make_local_repo(repo_dir, project.all_packages) except KeyboardInterrupt: print "Keyboard Interrupt: make_repo() cancelled." sys.exit(1)
def make_repos(project): print "Preparing image repo..." xterm_title("Preparing repo") try: repo = project.get_repo() repo_dir = project.image_repo_dir(clean=True) if project.type == "install": imagedeps = repo.full_deps("yali4") xterm_title("Preparing image repo for installation") else: imagedeps = project.all_packages xterm_title("Preparing image repo for live") repo.make_local_repo(repo_dir, imagedeps) if project.type == "install": xterm_title("Preparing installination repo") print "Preparing installation repository..." repo_dir = project.install_repo_dir(clean=True) if project.package_collections: all_packages = [] for collection in project.package_collections: all_packages.extend(collection.packageSelection.allPackages) repo.make_local_repo(repo_dir, collection.packageSelection.allPackages, collection.uniqueTag) print "make_collection_index on repo_dir:%s" % repo_dir repo.make_local_repo(repo_dir, all_packages) repo.make_collection_index(repo_dir, project.package_collections) else: repo.make_local_repo(repo_dir, project.all_packages) except KeyboardInterrupt: print "Keyboard Interrupt: make_repo() cancelled." sys.exit(1)
def make_iso(project): print "Preparing ISO..." xterm_title("Preparing ISO") sort_cd_layout = False try: iso_dir = project.iso_dir(clean=True) iso_file = project.iso_file(clean=True) #image_dir = project.image_dir() image_file = project.image_file() image_path = os.path.join(iso_dir, "boot") if not os.path.exists(image_path): os.makedirs(image_path) os.link(image_file, os.path.join(iso_dir, "boot/pisi.sqfs")) def copy(src, dest): dest = os.path.join(iso_dir, dest) if os.path.isdir(src): shutil.copytree(src, dest, ignore=shutil.ignore_patterns(".svn")) else: shutil.copy2(src, dest) if project.release_files: # Allow ~ usage in project xml files path = os.path.expanduser(project.release_files) for name in os.listdir(path): if name != ".svn": copy(os.path.join(path, name), name) # setup_grub(project) setup_isolinux(project) if project.type == "install": run('ln -s "%s" "%s"' % (project.install_repo_dir(), os.path.join(iso_dir, "repo"))) publisher = "Pisi GNU/Linux http://www.pisilinux.org" application = "Pisi GNU/Linux Live Media" label = "PisiLive" the_sorted_iso_command = 'genisoimage -f -sort %s/repo/install.order -J -r -l -V "%s" -o "%s" -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat -boot-info-table \ -uid 0 -gid 0 -udf -allow-limited-size -iso-level 3 -input-charset utf-8 -no-emul-boot -boot-load-size 4 \ -publisher "%s" -A "%s" %s' % (iso_dir, label, iso_file, publisher, application, iso_dir) the_iso_command = 'genisoimage -f -J -r -l -V "%s" -o "%s" -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat -boot-info-table \ -uid 0 -gid 0 -udf -allow-limited-size -iso-level 3 -input-charset utf-8 -no-emul-boot -boot-load-size 4 \ -publisher "%s" -A "%s" %s' % (label, iso_file, publisher, application, iso_dir) # Generate sort_list for mkisofs and YALI # Disabled for now if sort_cd_layout: sorted_list = generate_sort_list(iso_dir) if sorted_list: open("%s/repo/install.order" % iso_dir, "w").write("\n".join( ["%s %d" % (k, v) for (k, v) in sorted_list])) run(the_sorted_iso_command) else: run(the_iso_command) # convert iso to a hybrid one run("isohybrid %s" % iso_file) except KeyboardInterrupt: print "Keyboard Interrupt: make_iso() cancelled." sys.exit(1)
def generate_isolinux_conf(project): print "Generating isolinux config files..." xterm_title("Generating isolinux config files") dict = {} dict["title"] = project.title dict["exparams"] = project.extra_params or '' dict["rescue_template"] = "" image_dir = project.image_dir() iso_dir = project.iso_dir() lang_default = project.default_language lang_all = project.selected_languages if project.type != "live": dict["rescue_template"] = """ label rescue kernel /boot/kernel append initrd=/boot/initrd yali=rescue splash=silent quiet %(exparams)s """ % dict isolinux_tmpl = """ prompt 1 timeout 200 ui gfxboot.com /boot/isolinux/init label pardus kernel /boot/kernel append initrd=/boot/initrd splash=silent quiet %(exparams)s %(rescue_template)s label harddisk localboot 0x80 label memtest kernel /boot/memtest label hardware kernel hdt.c32 """ # write isolinux.cfg dest = os.path.join(iso_dir, "boot/isolinux/isolinux.cfg") data = isolinux_tmpl % dict f = file(dest, "w") f.write(data % dict) f.close() # write gfxboot config for title data = file(os.path.join(image_dir, "usr/share/gfxtheme/pardus/install/gfxboot.cfg")).read() f = file(os.path.join(iso_dir, "boot/isolinux/gfxboot.cfg"), "w") f.write(data % dict) f.close() if len(lang_all) and lang_default != "": langdata = "" if not lang_default in lang_all: lang_all.append(lang_default) lang_all.sort() for i in lang_all: langdata += "%s\n" % i # write default language f = file(os.path.join(iso_dir, "boot/isolinux/lang"), "w") f.write("%s\n" % lang_default) f.close() # write available languages f = file(os.path.join(iso_dir, "boot/isolinux/languages"), "w") f.write(langdata) f.close()
def make_image(project): global bus print "Preparing install image..." xterm_title("Preparing install image") try: repo = project.get_repo() repo_dir = project.image_repo_dir() reposs = os.path.join(project.work_dir, "repo_cache") image_dir = project.image_dir() initrd_image_dir = project.initrd_image_dir() efi_tmp = project.efi_tmp_path_dir() configdir = os.path.join(project.config_files) #umount all mount dirs run('umount %s/proc' % image_dir, ignore_error=True) run('umount %s/sys' % image_dir, ignore_error=True) run('umount -R %s' % image_dir, ignore_error=True) run('umount %s/proc' % initrd_image_dir, ignore_error=True) run('umount %s/sys' % initrd_image_dir, ignore_error=True) run('umount -R %s' % initrd_image_dir, ignore_error=True) run("umount %s" % efi_tmp, ignore_error=True) run("umount -l %s" % efi_tmp, ignore_error=True) image_dir = project.image_dir(clean=True) run('pisi --yes-all -D"%s" ar pisilinux-install %s --ignore-check' % (image_dir, repo_dir + "/pisi-index.xml.bz2")) print "project type = ", project.type root_image_packages = " ".join(project.all_root_image_packages) run('pisi --yes-all --ignore-comar --ignore-dep --ignore-check --ignore-package-conflicts --ignore-file-conflicts -D"%s" it %s' % (image_dir, root_image_packages)) def chrun(cmd): run('chroot "%s" %s' % (image_dir, cmd)) os.mknod("%s/dev/null" % image_dir, 0666 | stat.S_IFCHR, os.makedev(1, 3)) os.mknod("%s/dev/console" % image_dir, 0666 | stat.S_IFCHR, os.makedev(5, 1)) os.mknod("%s/dev/random" % image_dir, 0666 | stat.S_IFCHR, os.makedev(1, 8)) os.mknod("%s/dev/urandom" % image_dir, 0666 | stat.S_IFCHR, os.makedev(1, 9)) path = "%s/usr/share/baselayout/" % image_dir path2 = "%s/etc" % image_dir for name in os.listdir(path): run('cp -p "%s" "%s"' % (os.path.join(path, name), os.path.join(path2, name))) run('/bin/mount --bind /proc %s/proc' % image_dir) run('/bin/mount --bind /sys %s/sys' % image_dir) chrun("/sbin/ldconfig") chrun("/sbin/update-environment") chroot_comar(image_dir) chrun("/usr/bin/pisi configure-pending baselayout") chrun("/usr/bin/pisi configure-pending") connectToDBus(image_dir) obj = bus.get_object("tr.org.pardus.comar", "/package/baselayout") obj.setUser(0, "", "", "", "live", "", dbus_interface="tr.org.pardus.comar.User.Manager") obj.addUser(1000, "pisilive", "livecd", "/home/pisilive", "/bin/bash", "live", [ "wheel", "users", "lp", "lpadmin", "cdrom", "floppy", "disk", "audio", "video", "power", "dialout" ], [], [], dbus_interface="tr.org.pardus.comar.User.Manager") # Make sure environment is updated regardless of the booting system, by setting comparison # files' atime and mtime to UNIX time 1 os.utime(os.path.join(image_dir, "etc/profile.env"), (1, 1)) ############################################################ run("chroot \"%s\" /bin/service dbus start" % image_dir) run("chroot \"%s\" /usr/bin/pisi cp" % image_dir) #KDE KURULAN AYAR #run("cp -rf %s/default-settings/etc/* %s/etc/" % (configdir,image_dir)) #run("cp -rf %s/default-settings/autostart %s/etc/skel/.config/" % (configdir,image_dir)) run("chroot \"%s\" /bin/service dbus stop" % image_dir) path = os.path.join(image_dir, "etc/calamares/modules") if not os.path.exists(path): os.makedirs(path) run("cp -p %s/calamares/modules/* %s/etc/calamares/modules/" % (configdir, image_dir), ignore_error=True) run("cp -p %s/calamares/* %s/etc/calamares/" % (configdir, image_dir), ignore_error=True) run("cp -p %s/live/sudoers/* %s/etc/sudoers.d/" % (configdir, image_dir), ignore_error=True) #PisiLive Config and chmod path = os.path.join(image_dir, "home/pisilive/.config") if not os.path.exists(path): os.makedirs(path) #KDE LİVE AYAR run("cp -rf %s/default-settings/etc/* %s/etc/" % (configdir, image_dir)) run("cp -rf %s/default-settings/autostart %s/etc/skel/.config/" % (configdir, image_dir)) run("cp -p %s/live/kde/.config/* %s/home/pisilive/.config/" % (configdir, image_dir), ignore_error=True) run("cp -rf %s/live/kde/autostart %s/home/pisilive/.config/" % (configdir, image_dir), ignore_error=True) os.system('/bin/chown 1000:wheel "%s/home/pisilive/.config"' % image_dir) os.chmod(path, 0777) run("chroot \"%s\" /bin/service dbus start" % image_dir) run("chroot \"%s\" /usr/bin/pisi cp" % image_dir) run("chroot \"%s\" /bin/service dbus stop" % image_dir) ################################################################# #chrun('killall comar') run('umount %s/proc' % image_dir) run('umount %s/sys' % image_dir) chrun("rm -rf /run/dbus/*") run("rm -rf %s/var/cache/pisi/*" % image_dir) #setup liveuser chrun("rm -rf /etc/sudoers") path1 = os.path.join(image_dir, "etc/sudoers.orig") path2 = os.path.join(image_dir, "etc/sudoers") run('cp "%s" "%s"' % (path1, path2)) run("/bin/echo 'pisilive ALL=(ALL) NOPASSWD: ALL' >> %s/etc/sudoers" % image_dir) run("/bin/chmod 440 %s/etc/sudoers" % image_dir) make_initrd(project) add_repo(project) setup_live_sddm(project) except KeyboardInterrupt: print "Keyboard Interrupt: make_image() cancelled." sys.exit(1)
def make_image(project): global bus print "Preparing install image..." xterm_title("Preparing install image") try: repo = project.get_repo() repo_dir = project.image_repo_dir() # image_file = project.image_file() image_dir = project.image_dir() run('umount %s/proc' % image_dir, ignore_error=True) run('umount %s/sys' % image_dir, ignore_error=True) image_dir = project.image_dir(clean=True) run('pisi --yes-all -D"%s" ar pardus-install %s' % (image_dir, repo_dir + "/pisi-index.xml.bz2")) if project.type == "install": if project.all_install_image_packages: install_image_packages = " ".join( project.all_install_image_packages) else: install_image_packages = " ".join(repo.full_deps("yali")) run('pisi --yes-all --ignore-comar -D"%s" it %s' % (image_dir, install_image_packages)) if project.plugin_package: plugin_package = project.plugin_package run('pisi --yes-all --ignore-comar -D"%s" it %s' % (image_dir, plugin_package)) else: install_packages(project) def chrun(cmd): run('chroot "%s" %s' % (image_dir, cmd)) # FIXME: we write static initramfs.conf for live systems for now, hopefully we will make it dynamic later on # Note that this must be done before configure pending for the mkinitramfs use it f = file(os.path.join(image_dir, "etc/initramfs.conf"), "w") f.write("liveroot=LABEL=PardusLiveImage\n") f.close() os.mknod("%s/dev/null" % image_dir, 0666 | stat.S_IFCHR, os.makedev(1, 3)) os.mknod("%s/dev/console" % image_dir, 0666 | stat.S_IFCHR, os.makedev(5, 1)) os.mknod("%s/dev/random" % image_dir, 0666 | stat.S_IFCHR, os.makedev(1, 8)) os.mknod("%s/dev/urandom" % image_dir, 0666 | stat.S_IFCHR, os.makedev(1, 9)) path = "%s/usr/share/baselayout/" % image_dir path2 = "%s/etc" % image_dir for name in os.listdir(path): run('cp -p "%s" "%s"' % (os.path.join(path, name), os.path.join(path2, name))) run('/bin/mount --bind /proc %s/proc' % image_dir) run('/bin/mount --bind /sys %s/sys' % image_dir) chrun("/sbin/ldconfig") chrun("/sbin/update-environment") chroot_comar(image_dir) chrun("/usr/bin/pisi configure-pending baselayout") chrun("/usr/bin/pisi configure-pending") # Disable Nepomuk in live CDs if project.type == "live": try: os.unlink( "%s/usr/kde/4/share/autostart/nepomukserver.desktop" % image_dir) except OSError: pass if project.type == "install": # FIXME: Do not hard code installer name dm_config = "DISPLAY_MANAGER=yali" # Write default display manager config image_dir = project.image_dir() dest = os.path.join(image_dir, "etc/default/xdm") f = file(dest, "w") f.write(dm_config) f.close() connectToDBus(image_dir) obj = bus.get_object("tr.org.pardus.comar", "/package/baselayout") obj.setUser(0, "", "", "", "pardus", "", dbus_interface="tr.org.pardus.comar.User.Manager") if project.type != "install": obj.addUser(1000, "pars", "Panter Pardus", "/home/pars", "/bin/bash", "pardus", [ "wheel", "users", "pnp", "pnpadmin", "removable", "disk", "audio", "video", "power", "dialout" ], [], [], dbus_interface="tr.org.pardus.comar.User.Manager") chrun( "/sbin/depmod -a %s-%s" % (repo.packages["kernel"].version, repo.packages["kernel"].release)) path1 = os.path.join(image_dir, "usr/share/baselayout/inittab.live") path2 = os.path.join(image_dir, "etc/inittab") os.unlink(path2) run('mv "%s" "%s"' % (path1, path2)) file(os.path.join(image_dir, "etc/pardus-release"), "w").write("%s\n" % project.title) if project.type != "install" and ("kdebase" in project.all_packages): setup_live_kdm(project) setup_live_policykit_conf(project) if project.type == "install": copyPisiIndex(project) # Make sure environment is updated regardless of the booting system, by setting comparison # files' atime and mtime to UNIX time 1 os.utime(os.path.join(image_dir, "etc/profile.env"), (1, 1)) run('umount %s/proc' % image_dir) run('umount %s/sys' % image_dir) except KeyboardInterrupt: print "Keyboard Interrupt: make_image() cancelled." sys.exit(1)
def make_image(project): global bus print "Preparing install image..." xterm_title("Preparing install image") try: repo = project.get_repo() repo_dir = project.image_repo_dir() reposs = os.path.join(project.work_dir, "repo_cache") image_dir = project.image_dir() desktop_image_dir = project.desktop_image_dir() initrd_image_dir = project.initrd_image_dir() livecd_image_dir = project.livecd_image_dir() efi_tmp = project.efi_tmp_path_dir() #umount all mount dirs run('umount %s/proc' % image_dir, ignore_error=True) run('umount %s/sys' % image_dir, ignore_error=True) run('umount -R %s' % image_dir, ignore_error=True) run('umount %s/proc' % desktop_image_dir, ignore_error=True) run('umount %s/sys' % desktop_image_dir, ignore_error=True) run('umount -R %s' % desktop_image_dir, ignore_error=True) run('umount %s/proc' % livecd_image_dir, ignore_error=True) run('umount %s/sys' % livecd_image_dir, ignore_error=True) run('umount -R %s' % livecd_image_dir, ignore_error=True) run('umount %s/proc' % initrd_image_dir, ignore_error=True) run('umount %s/sys' % initrd_image_dir, ignore_error=True) run('umount -R %s' % initrd_image_dir, ignore_error=True) run("umount %s" % efi_tmp, ignore_error=True) run("umount -l %s" % efi_tmp, ignore_error=True) image_dir = project.image_dir(clean=True) run('pisi --yes-all -D"%s" ar limelinux-install %s --ignore-check' % (image_dir, repo_dir + "/pisi-index.xml.bz2")) print "project type = ", project.type root_image_packages = " ".join(project.all_root_image_packages) run('pisi --yes-all --ignore-comar --ignore-dep --ignore-check --ignore-package-conflicts --ignore-file-conflicts -D"%s" it baselayout' % image_dir) run('pisi --yes-all --ignore-comar --ignore-dep --ignore-check --ignore-package-conflicts --ignore-file-conflicts -D"%s" it %s' % (image_dir, root_image_packages)) # if project.plugin_package: # plugin_package = project.plugin_package # run('pisi --yes-all --ignore-comar --ignore-check -D"%s" it %s' % (image_dir, plugin_package)) def chrun(cmd): run('chroot "%s" %s' % (image_dir, cmd)) os.mknod("%s/dev/null" % image_dir, 0666 | stat.S_IFCHR, os.makedev(1, 3)) os.mknod("%s/dev/console" % image_dir, 0666 | stat.S_IFCHR, os.makedev(5, 1)) os.mknod("%s/dev/random" % image_dir, 0666 | stat.S_IFCHR, os.makedev(1, 8)) os.mknod("%s/dev/urandom" % image_dir, 0666 | stat.S_IFCHR, os.makedev(1, 9)) path = "%s/usr/share/baselayout/" % image_dir path2 = "%s/etc" % image_dir for name in os.listdir(path): run('cp -p "%s" "%s"' % (os.path.join(path, name), os.path.join(path2, name))) run('/bin/mount --bind /proc %s/proc' % image_dir) run('/bin/mount --bind /sys %s/sys' % image_dir) chrun("/sbin/ldconfig") chroot_comar(image_dir) chrun("/usr/bin/pisi configure-pending baselayout") chrun("/usr/bin/pisi configure-pending") connectToDBus(image_dir) obj = bus.get_object("tr.org.pardus.comar", "/package/baselayout") obj.setUser(0, "", "", "", "live", "", dbus_interface="tr.org.pardus.comar.User.Manager") obj.addUser(1000, "limelive", "livecd", "/home/limelive", "/bin/bash", "live", [ "wheel", "users", "lp", "lpadmin", "cdrom", "floppy", "disk", "audio", "video", "power", "dialout" ], [], [], dbus_interface="tr.org.pardus.comar.User.Manager") chrun("/sbin/rc-update add udev default") chrun("/sbin/rc-update add consolekit default") chrun("/sbin/rc-update add dbus default") # Make sure environment is updated regardless of the booting system, by setting comparison # files' atime and mtime to UNIX time 1 # os.utime(os.path.join(image_dir, "etc/profile.env"), (1, 1)) #chrun('killall comar') run('umount %s/proc' % image_dir) run('umount %s/sys' % image_dir) run('/bin/umount -R %s' % image_dir, ignore_error=True) run("rm -rf %s/run/dbus/*" % image_dir, ignore_error=True) #setup liveuser chrun("rm -rf /etc/sudoers") path1 = os.path.join(image_dir, "etc/sudoers.orig") path2 = os.path.join(image_dir, "etc/sudoers") run('cp "%s" "%s"' % (path1, path2)) run("/bin/echo 'limelive ALL=(ALL) NOPASSWD: ALL' >> %s/etc/sudoers" % image_dir) run("/bin/chmod 440 %s/etc/sudoers" % image_dir) install_desktop(project) install_livecd_util(project) make_initrd(project) add_repo(project) except KeyboardInterrupt: print "Keyboard Interrupt: make_image() cancelled." sys.exit(1)
def make_image(project): global bus print "Preparing install image..." xterm_title("Preparing install image") try: repo = project.get_repo() repo_dir = project.image_repo_dir() # image_file = project.image_file() image_dir = project.image_dir() run('umount %s/proc' % image_dir, ignore_error=True) run('umount %s/sys' % image_dir, ignore_error=True) image_dir = project.image_dir(clean=True) run('pisi --yes-all -D"%s" ar pardus-install %s --ignore-check' % (image_dir, repo_dir + "/pisi-index.xml.bz2")) if project.type == "install": if project.all_install_image_packages: install_image_packages = " ".join(project.all_install_image_packages) else: install_image_packages = " ".join(repo.full_deps("yali")) run('pisi --yes-all --ignore-comar -D"%s" it %s' % (image_dir, install_image_packages)) if project.plugin_package: plugin_package = project.plugin_package run('pisi --yes-all --ignore-comar -D"%s" it %s' % (image_dir, plugin_package)) else: install_packages(project) def chrun(cmd): run('chroot "%s" %s' % (image_dir, cmd)) # FIXME: we write static initramfs.conf for live systems for now, hopefully we will make it dynamic later on # Note that this must be done before configure pending for the mkinitramfs use it f = file(os.path.join(image_dir, "etc/initramfs.conf"), "w") f.write("liveroot=LABEL=PardusLiveImage\n") f.close() os.mknod("%s/dev/null" % image_dir, 0666 | stat.S_IFCHR, os.makedev(1, 3)) os.mknod("%s/dev/console" % image_dir, 0666 | stat.S_IFCHR, os.makedev(5, 1)) os.mknod("%s/dev/random" % image_dir, 0666 | stat.S_IFCHR, os.makedev(1, 8)) os.mknod("%s/dev/urandom" % image_dir, 0666 | stat.S_IFCHR, os.makedev(1, 9)) path = "%s/usr/share/baselayout/" % image_dir path2 = "%s/etc" % image_dir for name in os.listdir(path): run('cp -p "%s" "%s"' % (os.path.join(path, name), os.path.join(path2, name))) run('/bin/mount --bind /proc %s/proc' % image_dir) run('/bin/mount --bind /sys %s/sys' % image_dir) chrun("/sbin/ldconfig") chrun("/sbin/update-environment") chroot_comar(image_dir) chrun("/usr/bin/pisi configure-pending baselayout") chrun("/usr/bin/pisi configure-pending") # Disable Nepomuk in live CDs if project.type == "live": try: os.unlink("%s/usr/kde/4/share/autostart/nepomukserver.desktop" % image_dir) except OSError: pass if project.type == "install": # FIXME: Do not hard code installer name dm_config = "DISPLAY_MANAGER=yali" # Write default display manager config image_dir = project.image_dir() dest = os.path.join(image_dir, "etc/default/xdm") f = file(dest, "w") f.write(dm_config) f.close() connectToDBus(image_dir) obj = bus.get_object("tr.org.pardus.comar", "/package/baselayout") obj.setUser(0, "", "", "", "pardus", "", dbus_interface="tr.org.pardus.comar.User.Manager") if project.type != "install": obj.addUser(1000, "pars", "Panter Pardus", "/home/pars", "/bin/bash", "pardus", ["wheel", "users", "pnp", "pnpadmin", "removable", "disk", "audio", "video", "power", "dialout"], [], [], dbus_interface="tr.org.pardus.comar.User.Manager") chrun("/sbin/depmod -a %s-%s" % (repo.packages["kernel"].version, repo.packages["kernel"].release)) path1 = os.path.join(image_dir, "usr/share/baselayout/inittab.live") path2 = os.path.join(image_dir, "etc/inittab") os.unlink(path2) run('mv "%s" "%s"' % (path1, path2)) file(os.path.join(image_dir, "etc/pardus-release"), "w").write("%s\n" % project.title) if project.type != "install" and ("kdebase" in project.all_packages): setup_live_kdm(project) setup_live_policykit_conf(project) if project.type == "install": copyPisiIndex(project) # Make sure environment is updated regardless of the booting system, by setting comparison # files' atime and mtime to UNIX time 1 os.utime(os.path.join(image_dir, "etc/profile.env"), (1, 1)) run('umount %s/proc' % image_dir) run('umount %s/sys' % image_dir) except KeyboardInterrupt: print "Keyboard Interrupt: make_image() cancelled." sys.exit(1)
def generate_isolinux_conf(project): print "Generating isolinux config files..." xterm_title("Generating isolinux config files") dict = {} dict["title"] = project.title dict["exparams"] = project.extra_params or '' image_dir = project.image_dir() iso_dir = project.iso_dir() lang_default = project.default_language lang_all = project.selected_languages isolinux_tmpl = """ default start implicit 1 ui gfxboot bootlogo prompt 1 timeout 200 label %(title)s kernel /pisi/boot/x86_64/kernel append initrd=/pisi/boot/x86_64/initrd.img misobasedir=pisi misolabel=pisilive overlay=free splash quiet %(exparams)s label harddisk localboot 0x80 label memtest kernel /pisi/boot/x86_64/memtest label hardware kernel hdt.c32 """ # write isolinux.cfg dest = os.path.join(iso_dir, "isolinux/isolinux.cfg") data = isolinux_tmpl % dict f = file(dest, "w") f.write(data % dict) f.close() # write gfxboot config for title data = file( os.path.join( image_dir, "usr/share/gfxtheme/pisilinux/install/gfxboot.cfg")).read() f = file(os.path.join(iso_dir, "isolinux/gfxboot.cfg"), "w") f.write(data % dict) f.close() if len(lang_all) and lang_default != "": langdata = "" if not lang_default in lang_all: lang_all.append(lang_default) lang_all.sort() for i in lang_all: langdata += "%s\n" % i # write default language f = file(os.path.join(iso_dir, "isolinux/lang"), "w") f.write("%s\n" % lang_default) f.close() # FIXME: this is the default language selection, make it selectable # when this file does not exist, isolinux pops up language menu if os.path.exists(os.path.join(iso_dir, "isolinux/lang")): os.unlink(os.path.join(iso_dir, "isolinux/lang")) # write available languages f = file(os.path.join(iso_dir, "isolinux/languages"), "w") f.write(langdata) f.close()
def generate_isolinux_conf(project): print "Generating isolinux config files..." xterm_title("Generating isolinux config files") dict = {} dict["title"] = project.title dict["exparams"] = project.extra_params or '' dict["rescue_template"] = "" image_dir = project.image_dir() iso_dir = project.iso_dir() lang_default = project.default_language lang_all = project.selected_languages if project.type != "live": dict["rescue_template"] = """ label rescue kernel /boot/kernel append initrd=/boot/initrd yali=rescue splash=silent quiet %(exparams)s """ % dict isolinux_tmpl = """ prompt 1 timeout 200 ui gfxboot.com /boot/isolinux/init label pardus kernel /boot/kernel append initrd=/boot/initrd splash=silent quiet %(exparams)s %(rescue_template)s label harddisk localboot 0x80 label memtest kernel /boot/memtest label hardware kernel hdt.c32 """ # write isolinux.cfg dest = os.path.join(iso_dir, "boot/isolinux/isolinux.cfg") data = isolinux_tmpl % dict f = file(dest, "w") f.write(data % dict) f.close() # write gfxboot config for title data = file( os.path.join(image_dir, "usr/share/gfxtheme/pardus/install/gfxboot.cfg")).read() f = file(os.path.join(iso_dir, "boot/isolinux/gfxboot.cfg"), "w") f.write(data % dict) f.close() if len(lang_all) and lang_default != "": langdata = "" if not lang_default in lang_all: lang_all.append(lang_default) lang_all.sort() for i in lang_all: langdata += "%s\n" % i # write default language f = file(os.path.join(iso_dir, "boot/isolinux/lang"), "w") f.write("%s\n" % lang_default) f.close() # write available languages f = file(os.path.join(iso_dir, "boot/isolinux/languages"), "w") f.write(langdata) f.close()
def make_iso(project): print "Preparing ISO..." xterm_title("Preparing ISO") sort_cd_layout = False try: iso_dir = project.iso_dir(clean=True) iso_file = project.iso_file(clean=True) #image_dir = project.image_dir() image_file = project.image_file() image_path = os.path.join(iso_dir, "boot") if not os.path.exists(image_path): os.makedirs(image_path) os.link(image_file, os.path.join(iso_dir, "boot/pisi.sqfs")) def copy(src, dest): dest = os.path.join(iso_dir, dest) if os.path.isdir(src): shutil.copytree(src, dest, ignore=shutil.ignore_patterns(".svn")) else: shutil.copy2(src, dest) if project.release_files: # Allow ~ usage in project xml files path = os.path.expanduser(project.release_files) for name in os.listdir(path): if name != ".svn": copy(os.path.join(path, name), name) # setup_grub(project) setup_isolinux(project) if project.type == "install": run('ln -s "%s" "%s"' % (project.install_repo_dir(), os.path.join(iso_dir, "repo"))) publisher="Pisi GNU/Linux http://www.pisilinux.org" application="Pisi GNU/Linux Live Media" label="PisiLive" the_sorted_iso_command='genisoimage -f -sort %s/repo/install.order -J -r -l -V "%s" -o "%s" -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat -boot-info-table \ -uid 0 -gid 0 -udf -allow-limited-size -iso-level 3 -input-charset utf-8 -no-emul-boot -boot-load-size 4 \ -publisher "%s" -A "%s" %s' % (iso_dir, label, iso_file, publisher, application, iso_dir) the_iso_command='genisoimage -f -J -r -l -V "%s" -o "%s" -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat -boot-info-table \ -uid 0 -gid 0 -udf -allow-limited-size -iso-level 3 -input-charset utf-8 -no-emul-boot -boot-load-size 4 \ -publisher "%s" -A "%s" %s' % (label, iso_file, publisher, application, iso_dir) # Generate sort_list for mkisofs and YALI # Disabled for now if sort_cd_layout: sorted_list = generate_sort_list(iso_dir) if sorted_list: open("%s/repo/install.order" % iso_dir, "w").write("\n".join(["%s %d" % (k,v) for (k,v) in sorted_list])) run(the_sorted_iso_command) else: run(the_iso_command) # convert iso to a hybrid one run("isohybrid %s" % iso_file) except KeyboardInterrupt: print "Keyboard Interrupt: make_iso() cancelled." sys.exit(1)