diff options
author | Martin Whitaker <mageia@martin-whitaker.me.uk> | 2018-01-04 15:46:13 +0000 |
---|---|---|
committer | Martin Whitaker <mageia@martin-whitaker.me.uk> | 2018-01-04 15:46:13 +0000 |
commit | 16661d2a7ced798f3dec7a52759ab6840911cba4 (patch) | |
tree | 5ec10c50dec57711e5773d493dfd0c04ace0833a /lib | |
parent | 04e2b14c395ede7933addb7c4c68e1eca35468c8 (diff) | |
download | drakiso-16661d2a7ced798f3dec7a52759ab6840911cba4.tar drakiso-16661d2a7ced798f3dec7a52759ab6840911cba4.tar.gz drakiso-16661d2a7ced798f3dec7a52759ab6840911cba4.tar.bz2 drakiso-16661d2a7ced798f3dec7a52759ab6840911cba4.tar.xz drakiso-16661d2a7ced798f3dec7a52759ab6840911cba4.zip |
Further simplification.
Remove some features inherited from draklive we no longer need.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/MGA/DrakISO/BuildRoot.pm | 4 | ||||
-rw-r--r-- | lib/MGA/DrakISO/Config.pm | 11 | ||||
-rw-r--r-- | lib/MGA/DrakISO/CustomMedia.pm | 35 | ||||
-rw-r--r-- | lib/MGA/DrakISO/ISOBuild.pm | 12 | ||||
-rw-r--r-- | lib/MGA/DrakISO/Media.pm | 61 |
5 files changed, 15 insertions, 108 deletions
diff --git a/lib/MGA/DrakISO/BuildRoot.pm b/lib/MGA/DrakISO/BuildRoot.pm index 8710043..616e3a6 100644 --- a/lib/MGA/DrakISO/BuildRoot.pm +++ b/lib/MGA/DrakISO/BuildRoot.pm @@ -146,11 +146,11 @@ sub customise_live_system { $modules_conf->write; } - my $mount_options = $build->{media}->get_media_setting('mount_options') || "defaults"; + my $mount_options = $build->get_media_setting('mount_options') || "defaults"; output_with_perm($build->get_system_root . '/etc/fstab', 0644, $build->{mount}{overlay} ? "none / $build->{mount}{overlay} $mount_options 0 0\n" - : $build->{media}->get_media_setting('source') . " / " . $build->{media}->get_media_setting('fs') . " $mount_options 1 1\n" + : $build->get_media_setting('source') . " / " . $build->get_media_setting('fs') . " $mount_options 1 1\n" ) unless $build->{system}{skip_fstab}; #- interactive mode can lead to race in initscripts diff --git a/lib/MGA/DrakISO/Config.pm b/lib/MGA/DrakISO/Config.pm index c987bdf..d88df90 100644 --- a/lib/MGA/DrakISO/Config.pm +++ b/lib/MGA/DrakISO/Config.pm @@ -30,11 +30,8 @@ use MDK::Common; use Pod::Usage; use Cwd 'getcwd'; -#- we bless Media objects here -use MGA::DrakISO::Media; #- these modules can be used from config files use MGA::DrakISO::Mounts; -use MGA::DrakISO::CustomMedia; sub read_config { my ($build, $config_root, $config_path, $settings_path) = @_; @@ -63,7 +60,7 @@ sub check_config { #- check for minimum requirements $build->{settings}{arch} or die "ERROR: you must specify an architecture\n"; - ref $build->{media} && $build->{media}{storage} + $build->{media}{storage} or die "ERROR: you must specify the media storage type.\n"; $build->{media}{label} or die "ERROR: you must supply a media label\n"; @@ -76,12 +73,6 @@ sub complete_config { $build->{settings}{arch} ||= chomp_(`rpm --eval '%{_target_cpu}'`); - $_ = MGA::DrakISO::Media::new($_) foreach ( - $build->{media}, - ($build->{replicator} ? $build->{replicator}{media} : ()), - ($build->{oem_rescue} ? $build->{oem_rescue}{media} : ()), - ); - mkdir_p($build->get_builddir); mkdir_p($build->get_system_root); $build->{mnt} ||= $build->get_builddir('/mnt'); diff --git a/lib/MGA/DrakISO/CustomMedia.pm b/lib/MGA/DrakISO/CustomMedia.pm deleted file mode 100644 index d2cc7d8..0000000 --- a/lib/MGA/DrakISO/CustomMedia.pm +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright (C) 2005 Mandriva -# Olivier Blin <oblin@mandriva.com> -# Copyright (C) 2017 Mageia -# Martin Whitaker <mageia@martin-whitaker.me.uk> -# -# This program 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, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA. - -package MGA::DrakISO::CustomMedia; - -use strict; - -sub nfs_media { - my ($module, $client, $path) = @_; - ( - fs => 'nfs', - modules => 'nfs', - extra_modules => [ $module ], - pre => "ifconfig eth0 $client up", - source => $path, - ); -} - -1; diff --git a/lib/MGA/DrakISO/ISOBuild.pm b/lib/MGA/DrakISO/ISOBuild.pm index b9a17d5..edc91c1 100644 --- a/lib/MGA/DrakISO/ISOBuild.pm +++ b/lib/MGA/DrakISO/ISOBuild.pm @@ -31,6 +31,8 @@ use strict; use MDK::Common; +use MGA::DrakISO::Storage; + sub new { my ($class) = @_; bless {}, $class; @@ -66,4 +68,14 @@ sub get_absolute_path { } } +sub get_media_setting { + my ($build, $setting) = @_; + $build->{media}{$setting} || $build->get_storage_setting($setting); +} + +sub get_storage_setting { + my ($build, $setting) = @_; + $MGA::DrakISO::Storage::storage_types{$build->{media}{storage}}{$setting}; +} + 1; diff --git a/lib/MGA/DrakISO/Media.pm b/lib/MGA/DrakISO/Media.pm deleted file mode 100644 index 2bc4d1b..0000000 --- a/lib/MGA/DrakISO/Media.pm +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright (C) 2005 Mandriva -# Olivier Blin <oblin@mandriva.com> -# Copyright (C) 2017 Mageia -# Martin Whitaker <mageia@martin-whitaker.me.uk> -# -# This program 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, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA. - -package MGA::DrakISO::Media; - -use strict; - -use MDK::Common; -use POSIX; -use common; - -use MGA::DrakISO::Storage; - -sub new { - my ($media) = @_; - - bless $media, 'MGA::DrakISO::Media'; - - $media->{partitions} ||= [ { mntpoint => '/' } ]; - - foreach my $mntpoint (qw(/ OEM_RESCUE)) { - my $part = find { $_->{mntpoint} eq $mntpoint } @{$media->{partitions}}; - $part->{fs_type} ||= $media->get_media_setting('fs'); - if (my $label = $mntpoint eq '/' && $media->{label}) { - $part->{device_LABEL} ||= $label; - } - } - - $media->{boot_entries} ||= [ '' => '' ]; - - $media; -} - -sub get_storage_setting { - my ($media, $setting) = @_; - $MGA::DrakISO::Storage::storage_types{$media->{storage}}{$setting}; -} - -#- for user-customisable media setting, that can override storage setting -sub get_media_setting { - my ($media, $setting) = @_; - $media->{$setting} || $media->get_storage_setting($setting); -} - -1; |