diff options
-rw-r--r-- | examples/minimal/config/build.cfg | 190 | ||||
-rw-r--r-- | examples/minimal/config/settings.cfg | 10 | ||||
-rwxr-xr-x | examples/minimal/files/50-disable-suspend.pkla | 6 | ||||
-rw-r--r-- | examples/minimal/files/blacklist-ide.conf | 2 | ||||
-rw-r--r-- | examples/minimal/files/dracut-live.conf | 16 | ||||
-rw-r--r-- | examples/minimal/files/empty.conf | 0 | ||||
-rw-r--r-- | examples/minimal/files/halt-local.service | 23 | ||||
-rwxr-xr-x | examples/minimal/files/halt.local | 24 | ||||
-rwxr-xr-x | examples/minimal/files/set-lang-kbd | 24 | ||||
-rw-r--r-- | examples/minimal/files/set-lang-kbd.service | 11 |
10 files changed, 306 insertions, 0 deletions
diff --git a/examples/minimal/config/build.cfg b/examples/minimal/config/build.cfg new file mode 100644 index 0000000..e731f08 --- /dev/null +++ b/examples/minimal/config/build.cfg @@ -0,0 +1,190 @@ +#!/usr/bin/perl -cw + +my $distro = $build->{settings}{distro}; +my $version = $build->{settings}{version}; +my $product = $build->{settings}{product}; +my $desktop = $build->{settings}{desktop}; +my $arch = $build->{settings}{arch}; +my $default_user = $build->{settings}{default_user}; + +my @user_config_dirs = ('/etc/skel', '/home/' . $default_user); + +sub build_label { + my ($build) = @_; + + join('-', $distro, $version, $product, $desktop, $arch); +} + +sub build_title { + my ($build) = @_; + + join(' ', $distro, $version, $product, $desktop); +} + +my $default_append = 'root=mgalive:LABEL=' . build_label($build) . ' noiswmd audit=0 rd.luks=0 rd.lvm=0 rd.md=0 rd.dm=0'; + +my $_l = { + system => { + enabled_media => [ + 'Core Release', +# 'Core Updates', + 'Nonfree Release', +# 'Nonfree Updates', + ], + + rpmsrate_flags => [ + 'LIVE', + (map { "CAT_$_" } ( + # internet + qw(NETWORKING_FILE_TRANSFER 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), + )) + ], + compssListLevel => 5, + + include_packages => [ + # Satisfy the basesystem bootloader requirement. + 'drakiso-null-bootloader', + + # Some extra admin tools. + 'bind-utils', 'btrfs-progs', 'dmraid', 'hdparm', 'mdadm', + + # Allow patching during customisation. + 'patch', + ], + 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 proprietary drivers + 'dkms-broadcom-wl', + 'dkms-nvidia304', 'x11-driver-video-nvidia304', + 'dkms-nvidia340', 'x11-driver-video-nvidia340', + 'dkms-nvidia-current', 'x11-driver-video-nvidia-current', + + # 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', + + # Needs X + 'apmd', 'draklive-install', 'drakx-finish-install', 'xterm', + + # Not wanted + 'hunspell-dictionary', + ], + preferred_packages => [ + ], + local_repo_packages => [ + # core + 'broadcom-bcma-config', + 'broadcom-ssb-config', + ], + + langs_always => [ 'en_US' ], + + disable_services => [ + # Uncommon hardware. + qw(bpalogin capi4linux cpqarrayd mdadm oki4daemon pcscd), + # Unneeded software. + qw(chronyd snmpd), + # 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 } ], + + # 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 } ], + + # Set language and keyboard + [ 'files/set-lang-kbd.service', '/etc/systemd/system/set-lang-kbd.service', { mode => 0644, no_install => 1 } ], + [ 'files/set-lang-kbd', '/sbin/set-lang-kbd', { mode => 0755, no_install => 1 } ], + + # 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 } ], + + # Eject medium before live system halt/reboot. + [ 'files/halt-local.service', '/etc/systemd/system/halt-local.service', { mode => 0644, no_install => 1 } ], + [ 'files/halt.local', '/sbin/halt.local', { mode => 0755, no_install => 1 } ], + ], + 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 => [ + ], + final_fixes => join(';', + # Enable the set-lang-kbd service. + "systemctl enable set-lang-kbd.service", + + # 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 => { + type => 'squashfs', + files => [ + { path => '/root/drakx' }, + ], + }, + }, + regions => { + # the "all" region has a magical behavior and selects all langs + }, + copy_from_repo => [ + 'isolinux/memtest' => "boot/memtest", + ], + media => { + storage => 'iso', + label => build_label($build), + bootloader_title => build_title($build), + bootloader_theme => '/usr/share/drakiso-bootloader/maggy', + bootloader_font => '/usr/share/drakiso-bootloader/unicode.pf2', + bootloader_langs => '/usr/share/drakiso-bootloader/lang-names.txt', + bootloader_kbds => '/usr/share/drakiso-bootloader/kbd-names.txt', + bootloader_messages => '/usr/share/drakiso-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 => '' }, + ], + mbr_boot_img => '/usr/share/drakiso-bootloader/images/boot_hybrid.img', + eltorito_img => '/usr/share/drakiso-bootloader/images/eltorito.img', + if_($arch eq 'i586', + boot_efi => '/usr/share/drakiso-bootloader/images/bootia32.efi' + ), + if_($arch eq 'x86_64', + boot_efi => '/usr/share/drakiso-bootloader/images/bootx64.efi' + ), + }, + mount => MGA::DrakISO::Mounts::volatile_squash_union(), +}; diff --git a/examples/minimal/config/settings.cfg b/examples/minimal/config/settings.cfg new file mode 100644 index 0000000..a843ac7 --- /dev/null +++ b/examples/minimal/config/settings.cfg @@ -0,0 +1,10 @@ +vendor=Custom +distro=Mageia +product=Live +desktop=Minimal +version=6 +arch=x86_64 +region=all +default_user=live +repository=ftp://192.168.1.10/mageia/distrib/6 +workdir=/home/draklive/var-data diff --git a/examples/minimal/files/50-disable-suspend.pkla b/examples/minimal/files/50-disable-suspend.pkla new file mode 100755 index 0000000..7c92300 --- /dev/null +++ b/examples/minimal/files/50-disable-suspend.pkla @@ -0,0 +1,6 @@ +[Disable Suspend] +Identity=unix-user:* +Action=org.freedesktop.upower.hibernate;org.freedesktop.upower.suspend +ResultAny=no +ResultInactive=no +ResultActive=no diff --git a/examples/minimal/files/blacklist-ide.conf b/examples/minimal/files/blacklist-ide.conf new file mode 100644 index 0000000..146e357 --- /dev/null +++ b/examples/minimal/files/blacklist-ide.conf @@ -0,0 +1,2 @@ +# temp fix for 3395 +blacklist pata_acpi diff --git a/examples/minimal/files/dracut-live.conf b/examples/minimal/files/dracut-live.conf new file mode 100644 index 0000000..42b3e24 --- /dev/null +++ b/examples/minimal/files/dracut-live.conf @@ -0,0 +1,16 @@ +# it is a live, build initrd to boot any hardware +hostonly="no" +# load mga livecd support +add_dracutmodules+=" mgalive " +# block some dracut modules we dont want / use +omit_dracutmodules+=" caps crypt dm dmraid mdraid lvm nfs i18n resume modsign " +# compress initrd with xz +compress_l="xz" +# whitelist only the filesystems needed by live CDs and live USB +filesystems="iso9660 vfat =fs/nls squashfs overlay" +# ensure drm drivers are available early in the boot sequence +add_drivers+=" amdgpu radeon nouveau i915 vboxvideo " +# fibre channel & iSCSI modules are unneeded on live CD/USB and pull 1MB+ of firmware files +omit_drivers+=" qla1280 qla2xxx qla4xxx " +# pata_acpi is not wanted on boot +omit_drivers+=" pata_acpi " diff --git a/examples/minimal/files/empty.conf b/examples/minimal/files/empty.conf new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/examples/minimal/files/empty.conf diff --git a/examples/minimal/files/halt-local.service b/examples/minimal/files/halt-local.service new file mode 100644 index 0000000..bc7f284 --- /dev/null +++ b/examples/minimal/files/halt-local.service @@ -0,0 +1,23 @@ +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +[Unit] +Description=/sbin/halt.local Compatibility +ConditionFileIsExecutable=/sbin/halt.local +DefaultDependencies=no +After=shutdown.target +Before=final.target + +[Service] +Type=oneshot +ExecStartPre=-/bin/kill -54 1 +ExecStartPre=-/usr/bin/plymouth quit +ExecStartPre=-/usr/bin/chvt 1 +ExecStart=/sbin/halt.local +TimeoutSec=0 +StandardOutput=tty +RemainAfterExit=yes diff --git a/examples/minimal/files/halt.local b/examples/minimal/files/halt.local new file mode 100755 index 0000000..e27ad1d --- /dev/null +++ b/examples/minimal/files/halt.local @@ -0,0 +1,24 @@ +#!/usr/bin/perl + +use lib qw(/usr/lib/libDrakX); +use MDK::Common; +use detect_devices; +use c; + +my ($device) = cat_("/proc/mounts") =~ m!(/dev/\S+)\s+/live/media\s+iso9660!; +$device or exit; + +# try to put halt/reboot in cache, if not called directly from them +# mount is also needed by end of /etc/init.d/halt +system("$_ --help &>/dev/null") foreach qw(halt mount reboot); + +my $f = detect_devices::tryOpen($device); +# see openCdromTray() from install::any +ioctl($f, c::CDROM_LOCKDOOR(), 0); # unlock door +ioctl($f, c::CDROMEJECT(), 0); + +system("clear"); +print "\n\n\nPlease press <Enter> (or <CTRL><J>) once the medium is removed.\n"; +system("read < /dev/console"); + +ioctl($f, c::CDROMCLOSETRAY(), 0); diff --git a/examples/minimal/files/set-lang-kbd b/examples/minimal/files/set-lang-kbd new file mode 100755 index 0000000..bcec647 --- /dev/null +++ b/examples/minimal/files/set-lang-kbd @@ -0,0 +1,24 @@ +#!/usr/bin/perl + +use lib qw(/usr/lib/libDrakX); + +use common; +use do_pkgs; +use lang; +use keyboard; + +my $do_pkgs = do_pkgs::do_pkgs; + +my $locale = lang::read(); +my ($lang) = cat_("/proc/cmdline") =~ /\blang=(\w+?)\b/; +my $h = lang::lang_to_ourlocale($lang); +if ($lang && member($h->{lang}, lang::list_langs(exclude_non_installed => 1))) { + put_in_hash($locale, $h); + lang::set($locale); +} +lang::write_and_install($locale, $do_pkgs); + +my $keyboard = $locale ? keyboard::lang2keyboard($locale->{lang}) : keyboard::read_or_default(); +my ($kbd) = cat_("/proc/cmdline") =~ /\bkbd=(\w+?)\b/; +$keyboard->{KEYBOARD} = $kbd if $kbd; +keyboard::configure_and_set_standalone($keyboard); diff --git a/examples/minimal/files/set-lang-kbd.service b/examples/minimal/files/set-lang-kbd.service new file mode 100644 index 0000000..dc4da7f --- /dev/null +++ b/examples/minimal/files/set-lang-kbd.service @@ -0,0 +1,11 @@ +[Unit] +Description=Set language and keyboard if specified on the boot command line +After=systemd-user-sessions.service + +[Service] +Type=oneshot +ExecStart=/sbin/set-lang-kbd +RemainAfterExit=yes + +[Install] +WantedBy=getty@.service |