my $distro = $build->{settings}{distro}; my $release = $build->{settings}{release}; my $product = $build->{settings}{product}; my $arch = $build->{settings}{arch}; my $default_user = $build->{settings}{default_user}; my @desktops = split(/\|/, $build->{settings}{desktop}); my $has_gnome = member('GNOME', @desktops); my $has_lxde = member('LXDE', @desktops); my $has_plasma = member('Plasma', @desktops); my $has_xfce = member('Xfce', @desktops); my @user_config_dirs = ('/etc/skel', '/home/' . $default_user); sub build_label { my ($build) = @_; my $short_release = $release =~ s/beta/b/r; join('-', $distro, $short_release, $product, $desktops[0], $arch); } sub build_title { my ($build) = @_; join(' ', $distro, $release, $product, $desktops[0]); } my $default_append = 'root=mgalive:LABEL=' . build_label($build) . ' splash quiet noiswmd audit=0 rd.luks=0 rd.lvm=0 rd.md=0 rd.dm=0'; my $config = { system => { enabled_media => [ 'Core Release', 'Core Updates', 'Nonfree Release', 'Nonfree Updates', ], rpmsrate_flags => [ 'LIVE', (map { "CAT_$_" } ( # office qw(OFFICE SPELLCHECK PIM ARCHIVING PRINTER), # multimedia qw(AUDIO VIDEO GRAPHICS), # internet qw(NETWORKING_WWW NETWORKING_MAIL NETWORKING_NEWS COMMUNICATIONS NETWORKING_CHAT), qw(NETWORKING_FILE_TRANSFER NETWORKING_IRC NETWORKING_INSTANT_MESSAGING NETWORKING_DNS), # network qw(NETWORKING_REMOTE_ACCESS NETWORKING_FILE), # config qw(CONFIG), # console qw(EDITORS TERMINALS TEXT_TOOLS SHELLS FILE_TOOLS), # system qw(SYSTEM MINIMAL_DOCS X ACCESSIBILITY THEMES), # desktop if_($has_gnome, qw(GNOME)), if_($has_lxde, qw(LXDE)), if_($has_plasma, qw(PLASMA5)), if_($has_xfce, qw(XFCE)), )) ], rpmsrate_level => 5, include_packages => [ # Satisfy the basesystem bootloader requirement. 'drakiso-null-bootloader', # Some extra admin tools. 'bind-utils', 'btrfs-progs', 'dmraid', 'gparted', 'hdparm', 'manatools', 'mc', 'mdadm', 'vim-enhanced', # Mageia docs. 'mageia-doc-mcc-en', 'mageia-doc-draklive-en', # Allow patching during customisation. 'patch', # s-c-p wants this if it detects a combined printer/scanner. 'simple-scan', # Provide a nicer UI for lxcontrol. 'Xdialog', # Need to patch this to prevent hang when probing ISO partition. 'os-prober', if_($has_gnome, 'task-gnome', 'adwaita-gtk2-theme', # Temporary fix for mga#20868. 'hexchat', # Alternative IRC client. ), if_($has_lxde, 'mageia-lxde-config-Default' ), if_($has_plasma, 'task-plasma5', ), if_($has_xfce, 'task-xfce', ), ], exclude_packages => [ if_($arch eq 'i586', # We want the desktop586 kernel for maximum hardware compatibility. '/^kernel-desktop-/', '/^vboxadditions-kernel-.*-desktop-/', ), # No server kernels. '/^kernel-server-/', '/^vboxadditions-kernel-.*-server-/', # No bootloaders. The GRUB2 bootloaders are needed for install, so we add # them to the local repo, which means they are automatically excluded. 'grub', 'lilo', # No distribution license. 'flash-player-plugin', # Unwanted stuff. 'efax', # Not yet ready. 'manatools-gui', if_($has_gnome, 'gnome-builder', 'gnome-boxes', # Conflicts with task-printing 'inkscape', 'polkit-kde-agent-1', ), ], preferred_packages => [ if_($has_gnome, 'gdm'), if_($has_plasma, 'sddm'), ], local_repo_packages => [ # core 'broadcom-bcma-config', 'broadcom-ssb-config', 'dkms', 'efibootmgr', 'efivar', 'refind', 'grub2', 'grub2-efi', 'grub2-mageia-theme', if_($arch eq 'i586', 'kernel-desktop586-devel-latest'), if_($arch eq 'x86_64', 'kernel-desktop-devel-latest'), # nonfree 'dkms-broadcom-wl', 'dkms-nvidia340', 'x11-driver-video-nvidia340', 'dkms-nvidia390', 'x11-driver-video-nvidia390', if_($arch eq 'x86_64', 'dkms-nvidia-current', 'x11-driver-video-nvidia-current', ), ], langs_always => [ 'en_US' ], post_install => join(";", # systemd boots by default to multiuser.target (old init 3), so change to graphical (old init 5). "ln -sf /lib/systemd/system/graphical.target /etc/systemd/system/default.target", ), disable_services => [ # Uncommon hardware. qw(bpalogin capi4linux cpqarrayd mdadm oki4daemon pcscd), # Unneeded software. qw(chronyd snmpd), if_($has_gnome, qw(ntpd)), # Slows down basic usage and install, reenabled after install. qw(crond msec), ], disable_timers => [ ], files => [ # Clean configuration files. [ 'files/empty.conf', '/etc/dracut.conf.d/51-mageia-resume.conf', { mode => 0644 } ], [ 'files/empty.conf', '/etc/modprobe.conf', { mode => 0644 } ], # Provide a noxorgconf boot command option to try to fix issues with nouveau driver on some hardware. [ 'files/10no-xorg-conf.xsetup', '/etc/X11/xsetup.d/10no-xorg-conf.xsetup', { mode => 0755 } ], # Blacklist pata_acpi (mga#3395). [ 'files/blacklist-ide.conf', '/etc/modprobe.d/blacklist-ide.conf', { mode => 0644 } ], # Live media specific initrd. [ 'files/dracut-live.conf', '/etc/dracut.conf.d/60-live.conf', { mode => 0644, no_install => 1 } ], # Enable drakx-finish-install at live boot. [ "files/finish-install", '/etc/sysconfig/finish-install', { mode => 0644 } ], # Disable mgaonline in live mode. (map { [ 'files/mgaonlinerc', $_ . '/.MgaOnline/mgaonline', { mode => 0644, no_install => 1 } ] } @user_config_dirs), # Disable suspend and hibernate in live mode. [ 'files/50-disable-suspend.pkla', '/etc/polkit-1/localauthority/50-local.d/50-disable-suspend.pkla', { mode => 0644, no_install => 1 } ], # sysconfig files for first boot after install. [ 'files/draklive-install.d/finish-install', '/etc/draklive-install.d/sysconfig/finish-install', { mode => 0644 } ], # Reenable services in installed system. [ 'files/draklive-install.d/services', '/etc/draklive-install.d/services', { mode => 0644 } ], # Fix for sometimes wrong permissions after install. [ 'files/draklive-install.d/run.d/home-live-permissions.sh', '/etc/draklive-install.d/run.d/home-live-permissions.sh', { mode => 755 } ], if_($has_gnome, # Add draklive-install icon to favourites in live mode and disable screen locking # (override files are processed in alphabetical order - make sure this one comes last). [ 'files/live.gschema.override', '/usr/share/glib-2.0/schemas/live.gschema.override', { mode => 0644, no_install => 1 } ], # Disable Wayland when we know it won't work (workaround for mga#20079). [ 'files/50gdm-disable-wayland.xsetup', '/etc/X11/xsetup.d/50gdm-disable-wayland.xsetup', { mode => 0755 } ], ), if_($has_plasma, [ 'files/draklive-install.d/run.d/generate-gtk-icon-cache.sh', '/etc/draklive-install.d/run.d/generate-gtk-icon-cache.sh', { mode => 755 } ], # Remove live user from SDDM greeter. [ 'files/draklive-install.d/remove.d/clear-sddm-state', '/etc/draklive-install.d/remove.d/clear-sddm-state', { mode => 0644 } ], # Disable Korganiser autostart. [ 'files/korgacrc', '/etc/kde/korgacrc', { mode => 0644 } ], ), ], remove_files => [ (map { "/etc/modprobe.preload.d/$_" } qw(cpufreq pcmcia rfswitch)), "/etc/udev/rules.d/70-persistent-*.rules", "/var/lib/dbus/machine-id", "/etc/ssh/ssh_host_*", ], patches => [ # When running from a USB stick, os-prober runs dmsetup on the protective # partition. This just failed in mga6, but in mga7 it hangs. As a workaround # this patch causes os-prober to skip any partition containing an is9660 # filesystem. 'patches/os-prober-hang-fix.patch', ], final_fixes => join(';', if_($has_gnome, # Modify and compile schema to get draklive-install and Firefox in menu. "sed -i 's/epiphany.desktop/firefox.desktop/' /usr/share/glib-2.0/schemas/glib2-branding.gschema.override", "glib-compile-schemas /usr/share/glib-2.0/schemas/", # Fix permissions to enable GDM to rerun if the user logs out. "chown -R gdm:gdm /var/lib/gdm", # Switch to NetworkManager. "systemctl -q disable network", "systemctl -q disable network-up", "systemctl -q enable NetworkManager.service", "systemctl -q enable NetworkManager-wait-online.service", "sed -i 's/NETWORK=yes/NETWORK=no/' /etc/draklive-install.d/sysconfig/finish-install", "echo 'AUTOSTART=FALSE' > /home/live/.net_applet", ), if_($has_plasma, "rm -f /usr/share/icons/*/icon-theme.cache", "cp -a /etc/akonadi/mysql-global.conf /etc/akonadi/mysql-global-standard.conf", "cp /etc/akonadi/mysql-global-mobile.conf /etc/akonadi/mysql-global.conf", "ak=/etc/draklive-install.d/run.d/restore-akonadi-config.sh; echo -e '#!/bin/sh\ncp /etc/akonadi/mysql-global-standard.conf /etc/akonadi/mysql-global.conf' > \$ak; chmod +x \$ak", ), if_($has_xfce, # Add a desktop icon to run draklive-install. "mkdir -p /home/$default_user/Desktop", "cp /usr/share/applications/mageia-draklive-install.desktop /home/$default_user/Desktop/draklive-install.desktop", "chmod 750 /home/$default_user/Desktop/draklive-install.desktop", ), # Fix permissions for copied files. "chown -R $default_user.$default_user /home/$default_user", # Set default user name for draklive-install. "echo $default_user > /etc/draklive-install.d/user", "sed -i s/DEFAULT_USER/$default_user/ /etc/draklive-install.d/sysconfig/finish-install", # Allow draklive-install to spawn subtasks that access the display. "echo 'session optional pam_xauth.so # for draklive-install' >> /etc/pam.d/polkit-1", # Disable HPLIP systray startup. "echo 'Hidden=true' >> /etc/xdg/autostart/hplip-systray.desktop", # Set the timestamp on the font directories to be a whole second # fc-cache looks at the nano second portion which may be non-zero # as we are on ext4, but then it will compare against the stamps # on the squashfs live image which have whole second resolution # (adapted from fix descrived in OpenMandriva bug 1764). "find /usr/share/fonts -type d -exec touch -t \$(date +%Y%m%d%H%M.%S) '{}' ';'", # Now update the cache for the new timestamps. "fc-cache -rf", # Set the initial wireless regulatory domain to "world", enabling # all possible wireless channels to be used. "sed -i -r 's/CRDA_DOMAIN=.*/CRDA_DOMAIN=00/' /etc/sysconfig/network", ), vga_mode => 788, }, loopbacks => { exclude => [ { path => '/root/drakx' }, ], }, regions => { int => [qw(en)], }, media => { label => build_label($build), overlay_label => 'mgalive-persist', bootloader_title => build_title($build), bootloader_theme => 'bootloader/maggy', bootloader_font => 'bootloader/unicode.pf2', bootloader_langs => 'bootloader/lang-names.txt', bootloader_messages => 'bootloader/messages', bootloader_default => 0, bootloader_timeout => 10, bootloader_entries => [ 'Boot Mageia Live' => { append => $default_append . ' xdriver=free' }, ' + use non-free video drivers (slower to boot)' => { append => $default_append . ' nokmsboot' }, 'Install Mageia Live' => { append => $default_append . ' xdriver=free install' }, ' + use non-free video drivers (slower to boot)' => { append => $default_append . ' nokmsboot install' }, 'Memory Test' => { command => 'linux16', image => '/boot/memtest', initrd => 'none' }, ], mbr_boot_img => 'bootloader/images/boot_hybrid.img', eltorito_img => 'bootloader/images/eltorito.img', if_($arch eq 'i586', iso_part_start => 1, iso_part_type => '0x17', efi_type => '32bit', boot32_efi => 'bootloader/images/bootia32.efi' ), if_($arch eq 'x86_64', efi_type => '64bit', boot64_efi => 'bootloader/images/bootx64.efi' ), copy_from_repo => [ 'autorun.inf' => 'files/autorun.inf', 'dosutils' => 'files/dosutils', 'isolinux/memtest' => "boot/memtest", ], }, };