summaryrefslogtreecommitdiffstats
path: root/config/build.cfg
blob: 816394847a53fa865bde6060f33b391980500fcd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
#!/usr/bin/perl -cw

use MDK::Common;

my $distro          = $build->{settings}{distro};
my $version         = $build->{settings}{version};
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 $use_modules     = to_bool($build->{settings}{pack});
my @user_config_dirs = ('/etc/skel', if_($default_user, '/home/' . $default_user));

sub build_label {
    my ($build) = @_;

    join('-', $distro, $version, $product, $desktops[0], $arch);
}

sub build_title {
    my ($build) = @_;

    join(' ', $distro, $version, $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 $_l = {
    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),
                if_($has_gnome,  qw(GNOME)),
                if_($has_lxde,   qw(LXDE)),
                if_($has_plasma, qw(PLASMA5)),
                if_($has_xfce,   qw(XFCE)),
            ))
        ],
        compssListLevel => 5,

        include_packages => [
            if_($has_lxde, "mageia-lxde-config-Default"),

            # utils wanted
            'mc', 'btrfs-progs', 'hdparm', 'patch',
            'bind-utils', 'mdadm', 'dmraid',
            'vim-enhanced', # full ediitor
            'dnf', 'dnf-plugins-core', # some users want dnf
            'manatools', # just the ncurses version
            'simple-scan', # s-c-p wants this if it detects a combined printer/scanner
            'Xdialog', # provides nicer UI for lxcontrol

            # mageia specific
            'mageia-doc-mcc-en', # some nice docs

            # Gnome specific stuff
            if_($has_gnome,
                'task-gnome',
                'gparted', # provides some options not currently supported in diskdrake
                'hexchat', # alternative IRC client
                'adwaita-gtk2-theme',
            ),

            # Plasma specific stuff
            if_($has_plasma,
                'task-plasma5',
            ),

            # Xfce specific stuff
            if_($has_xfce,
                'task-xfce4',
                'gparted', # provides some options not currently supported in diskdrake
            ),
        ],
        exclude_packages => [
            # i586 arch specific
            if_($arch eq 'i586',
                '/^kernel-desktop-/', '/^vboxadditions-kernel-.*-desktop-/',
            ),

            # no server kernels
            '/^kernel-server-/', '/^vboxadditions-kernel-.*-server-/',

            # No bootloaders, but we need to keep one to satisfy basesystem requirements.
            # We will zap it later. The grub2 bootloaders are needed for install, so we
            # add them to the local repo, which means they are automatically excluded.
            'grub',

            # old stuff
            'efax',

            # not wanted
            'manatools-gui',

            #- no distribution license
            'flash-player-plugin',

            # Gnome specific stuff
            if_($has_gnome,
                'gnome-builder',
                'inkscape', # ???
                'polkit-kde-agent-1',
            ),
        ],
        preferred_packages => [
            if_($has_plasma, 'sddm'),
            'gdm',
        ],
        local_repo_packages => [
            # core
            'broadcom-bcma-config',
            'broadcom-ssb-config',
            'dkms',
            'efibootmgr', 'efivar',
            'grub2', 'grub2-efi', 'grub2-mageia-theme', 'os-prober',
            if_($arch eq 'i586',   'kernel-desktop586-devel-latest'),
            if_($arch eq 'x86_64', 'kernel-desktop-devel-latest'),
            # nonfree
            'dkms-broadcom-wl',
            'dkms-nvidia304', 'x11-driver-video-nvidia304',
            'dkms-nvidia340', 'x11-driver-video-nvidia340',
            'dkms-nvidia-current', 'x11-driver-video-nvidia-current',
        ],

        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",

            # have inittab match systemd defaulting to init 5
            "perl -pi -e 's/^id:3:initdefault:/id:5:initdefault:/' /etc/inittab",
        ),

        langs_always => [ 'en_US' ],

#       additional_media => [
#           {
#               name => '',
#               path => '',
#               packages => [
#               ],
#           },
#         ),
#       ],
#       rpms => [
#       ],
#       erase_rpms => [
#       ],
        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 => [
            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 } ],
            ),
            # 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
            [ 'files/blacklist_ide.conf', '/etc/modprobe.d/blacklist_ide.conf', { mode => 0644 } ],

            # clean live files
            [ 'files/live.51-mageia-resume.conf', '/etc/dracut.conf.d/51-mageia-resume.conf', { mode => 0644 } ],
            [ 'files/live.modprobe.conf', '/etc/modprobe.conf', { mode => 0644 } ],

            # 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 eject medium before 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 } ],

            # live media specific initrd
            [ 'files/live-dracut.conf', '/etc/dracut.conf.d/60-live.conf', { mode => 0644, no_install => 1 } ],

            #- disable first boot wizard at live boot
            [ 'files/firstboot', '/etc/sysconfig/firstboot', { mode => 0644 } ],

            #- enable drakx-finish-install at live boot
            [ "files/finish-install", '/etc/sysconfig/finish-install', { mode => 0644 } ],

            # fix for sometimes wrong permissions
            [ 'files/draklive-install.d/run.d/home-live-permissions.sh', '/etc/draklive-install.d/run.d/home-live-permissions.sh', { mode => 755 } ],

            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 } ],
                [ 'files/draklive-install.d/remove.d/clear-sddm-state', '/etc/draklive-install.d/remove.d/clear-sddm-state', { mode => 0644 } ],
            ),

            #- sysconfig files for first boot
            [ 'files/draklive-install.d/finish-install', '/etc/draklive-install.d/sysconfig/finish-install', { mode => 0644 } ],
            [ 'files/draklive-install.d/firstboot', '/etc/draklive-install.d/sysconfig/firstboot', { mode => 0644 } ],
            [ 'files/draklive-install.d/services', '/etc/draklive-install.d/services', { mode => 0644 } ],

            [ 'files/korgacrc', '/etc/kde/korgacrc', { mode => 0644 } ],
            (map { [ 'files/mgaonlinerc', $_ . '/.MgaOnline/mgaonline', { mode => 0644, no_install => 1 } ] } @user_config_dirs),
        ],
        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(';',
            if_($default_user,
                "echo $default_user > /etc/draklive-install.d/user",
                "perl -pi -e 's,<DEFAULT_USER>,$default_user,' /etc/draklive-install.d/sysconfig/finish-install",
            ),
            if_($has_xfce && $default_user,
                # 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",
            ),

            #- fix user perms for copied files
            if_($default_user,
                "chown -R $default_user.$default_user /home/$default_user"
            ),

            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",
            ),

            # disable HPLIP systray startup
            "echo 'Hidden=true' >> /etc/xdg/autostart/hplip-systray.desktop",

            # allow draklive-install to spawn subtasks that access the display
            "echo 'session    optional     pam_xauth.so # for draklive-install' >> /etc/pam.d/polkit-1",

            # 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 => {
            type => 'squashfs',
            files => [
                { path => '/root/drakx' },
            ],
        },
        if_($use_modules, modules  => [
            { type => 'squashfs', source => '/root/drakx/i18n-*.lst', rooted => 1 },
        ]),
    },
    regions => {
        #- the "all" region has a magical behavior and selects all langs
        int => [qw(en)],
    },
    packs => {
        int => [ map { "i18n-$_" } qw(en) ],
    },
    copy_from_repo => [
        'autorun.inf'       => 'files/autorun.inf',
        'dosutils'          => 'files/dosutils',
        'isolinux/memtest'  => "boot/memtest",
    ],
    media => {
        storage             => 'iso',
        label               => build_label($build),
        bootloader_title    => build_title($build),
        bootloader_theme    => 'bootloader/maggy',
        bootloader_font     => 'bootloader/unicode.pf2',
        bootloader_langs    => 'bootloader/lang-names.txt',
        bootloader_kbds     => 'bootloader/kbd-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 => '' },
        ],
        mbr_boot_img        => 'bootloader/images/boot_hybrid.img',
        eltorito_img        => 'bootloader/images/eltorito.img',
        if_($arch eq 'i586',
            boot_efi        => 'bootloader/images/bootia32.efi'
        ),
        if_($arch eq 'x86_64',
            boot_efi        => 'bootloader/images/bootx64.efi'
        ),
    },
    mount => MGA::DrakISO::Mounts::volatile_squash_union($use_modules),
};