summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/MGA/DrakISO/BuildISO.pm15
-rw-r--r--lib/MGA/DrakISO/BuildLoop.pm75
-rw-r--r--lib/MGA/DrakISO/BuildRoot.pm31
-rw-r--r--lib/MGA/DrakISO/Config.pm7
-rw-r--r--lib/MGA/DrakISO/ISOBuild.pm12
-rw-r--r--lib/MGA/DrakISO/Loopback.pm194
-rw-r--r--lib/MGA/DrakISO/Mounts.pm125
-rw-r--r--lib/MGA/DrakISO/Storage.pm39
-rw-r--r--lib/MGA/DrakISO/Utils.pm28
9 files changed, 32 insertions, 494 deletions
diff --git a/lib/MGA/DrakISO/BuildISO.pm b/lib/MGA/DrakISO/BuildISO.pm
index 09096a7..5ba55d0 100644
--- a/lib/MGA/DrakISO/BuildISO.pm
+++ b/lib/MGA/DrakISO/BuildISO.pm
@@ -28,11 +28,8 @@ use strict;
use MDK::Common;
use MGA::DrakISO::ISOBuild;
-use MGA::DrakISO::Loopback;
use MGA::DrakISO::Utils;
-use MGA::DrakISO::BuildLoop;
-
use Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw(build_iso);
@@ -57,9 +54,7 @@ sub build_iso {
'/EFI=' . $build->get_build_dir('EFI'),
),
if_(-d $loopbacks,
- map {
- '/loopbacks' . $_ . '=' . $loopbacks . $_;
- } list_selected_loopbacks($build)
+ '/loopbacks=' . $loopbacks
),
if_(-d $files,
map {
@@ -69,14 +64,6 @@ sub build_iso {
);
}
-sub list_selected_loopbacks {
- my ($build) = @_;
- my @pack = $build->{settings}{pack} ? @{$build->{packs}{$build->{settings}{pack}} || []} : ();
- my @pack_modules = grep { member($_->{name}, @pack) } list_loopback_modules($build);
- (map { $loop_types{$_->{type}}{is_loopback} && $_->{path} ? $_->{path} . $loop_types{$_->{type}}{extension} : () } @{$build->{mount}{dirs} || []}),
- (map { '/modules/' . $_->{name} . $loop_types{$_->{type}}{extension} } @pack_modules);
-}
-
# This function builds a hybrid ISO capable of both legacy and UEFI boot. The
# ISO contains a primary iso9660 partition (which is the only thing visible
# when booting from DVD) and a secondary ESP partition (which is only used
diff --git a/lib/MGA/DrakISO/BuildLoop.pm b/lib/MGA/DrakISO/BuildLoop.pm
index 8a83e03..ebaef11 100644
--- a/lib/MGA/DrakISO/BuildLoop.pm
+++ b/lib/MGA/DrakISO/BuildLoop.pm
@@ -19,8 +19,8 @@
# SYNOPSIS
# --------
-# This package provides a function to build the compressed images that will
-# be mounted as loopback filesystems when booting a Live system.
+# This package provides a function to build the compressed image that will
+# be mounted as a loopback filesystem when booting a Live system.
package MGA::DrakISO::BuildLoop;
@@ -31,17 +31,16 @@ use MDK::Common;
use File::Temp qw(tmpnam);
use MGA::DrakISO::LiveBuild;
-use MGA::DrakISO::Loopback;
use MGA::DrakISO::Utils;
use Exporter;
our @ISA = qw(Exporter);
-our @EXPORT = qw(build_live_loopback_files list_loopback_modules);
+our @EXPORT = qw(build_live_loopback_file);
-# This is the top-level function called to build the loopback images. The Live
+# This is the top-level function called to build the loopback image. The Live
# root filesystem must have been prepared before calling this function.
#
-sub build_live_loopback_files {
+sub build_live_loopback_file {
my ($build) = @_;
my $root = $build->get_live_root;
@@ -49,22 +48,32 @@ sub build_live_loopback_files {
# make sure no external filesystems are mounted before creating the loopback
umount_all_in_root($root);
+ my $total = directory_usage($root);
+ print "Have to process " . int($total/1000000) . " MB\n" if $::verbose;
+
+ my $dest = $build->get_build_dir('loopbacks') . '/distrib.sqfs';
+ mkdir_p(dirname($dest));
+
+ my $exclude_list = tmpnam();
my @excluded_files = expand_file_list($build, @{$build->{loopbacks}{exclude} || []});
- my @modules_files = expand_file_list($build, @{$build->{loopbacks}{modules} || []});
-
- foreach (grep { exists $loop_types{$_->{type}}{build} } @{$build->{mount}{dirs} || []}) {
- local $_->{exclude} = [ @excluded_files, @modules_files ];
- $loop_types{$_->{type}}{build}->($build, $_);
- }
-
- foreach my $module (list_loopback_modules($build)) {
- my $copy_tree = $root . "/tmp/draklive/loop/$module->{name}";
- run_as_root('rm', '-rf', $copy_tree);
- hardlink_filtered($root, $copy_tree, $module->{files});
- my $loop = $loop_types{$module->{type}};
- $loop->{build}->($build, { path => "/modules/$module->{name}", root => $copy_tree, exclude => \@excluded_files });
- run_as_root('rm', '-rf', $copy_tree);
- }
+ output_p($exclude_list, map { $root . "$_\n" } grep { run_as_root('test', '-e', $root . $_) } @excluded_files);
+
+ my $sort = $build->{settings}{config_root} . '/config/distrib.sort';
+ run_as_root(join(' ',
+ 'mksquashfs',
+ $root, $dest,
+ '-noappend',
+ '-comp', 'xz',
+ '-b', '1048576',
+ '-ef', $exclude_list,
+ if_(-f $sort, '-sort', $sort),
+ if_($::verbose > 2, '-info', '-progress'),
+ if_($::verbose < 2, '-no-progress'),
+ # due to lack of a -quiet option
+ if_($::verbose < 2, '> /dev/null'),
+ )) or die "ERROR: unable to run mksquashfs\n";
+
+ unlink $exclude_list;
}
sub expand_file_list {
@@ -76,28 +85,4 @@ sub expand_file_list {
} @files;
}
-#- hardlink recursively file list to a directory
-sub hardlink_filtered {
- my ($src, $dest, $files) = @_;
- mkdir_p($dest);
- my $list_file = tmpnam();
- output_p($list_file, map { "$_\n" } grep { -e $src . $_ } @$files);
- #- cpio -pldm won't copy recursively, use rsync -r instead
- run_as_root('rsync', '-ar', '--files-from=' . $list_file, '--link-dest=' . $src, $src, $dest);
- unlink $list_file;
-}
-
-sub list_loopback_modules {
- my ($build) = @_;
- map {
- my $l = $_;
- map {
- my $list = $_;
- my $name = basename($list);
- $name =~ s/\.[^.]+$//;
- { type => $l->{type}, name => $name, files => [ expand_file_list($build, { source => $list }) ] };
- } glob(($_->{rooted} && $build->get_live_root) . $_->{source});
- } @{$build->{loopbacks}{modules}};
-}
-
1;
diff --git a/lib/MGA/DrakISO/BuildRoot.pm b/lib/MGA/DrakISO/BuildRoot.pm
index d1f4531..1b3ed34 100644
--- a/lib/MGA/DrakISO/BuildRoot.pm
+++ b/lib/MGA/DrakISO/BuildRoot.pm
@@ -35,7 +35,6 @@ use urpm::media;
use urpm::select;
use MGA::DrakISO::LiveBuild;
-use MGA::DrakISO::Loopback;
use MGA::DrakISO::Utils;
use Exporter;
@@ -570,20 +569,11 @@ sub customise_live_system {
}
# Create fstab.
- my $mount_options = $build->get_media_setting('mount_options') || 'defaults';
- my $fstab_entry;
- if ($build->{mount}{overlay}) {
- $fstab_entry = "none / $build->{mount}{overlay} $mount_options 0 0";
- } else {
- $fstab_entry = $build->get_media_setting('source') . " / " . $build->get_media_setting('fs') . " $mount_options 1 1";
- }
- output_to_root($root, '/etc/fstab', 0644, $fstab_entry);
+ output_to_root($root, '/etc/fstab', 0644, 'none / overlay defaults 0 0');
# Interactive mode can lead to race in initscripts.
run_as_root('sed', '-i', 's/^PROMPT=.*/PROMPT=no/', $root . '/etc/sysconfig/init');
- configure_draklive_resize($build);
-
print "..copying additional files\n" if $::verbose > 1;
# Copy extra files as requested by the user.
@@ -635,25 +625,6 @@ sub customise_live_system {
defined $error_message && die $error_message;
}
-sub configure_draklive_resize {
- my ($build) = @_;
-
- my $resizable_loopback = find { $_->{min_size} } @{$build->{mount}{dirs} || []};
- if ($resizable_loopback) {
- my $ext = $loop_types{$resizable_loopback->{type}}{extension};
- my @text = (
- "DRAKLIVE_RESIZE=yes",
- "LOOPBACK=/live/media/loopbacks$resizable_loopback->{path}$ext",
- "TYPE=$resizable_loopback->{fs}",
- "MIN_SIZE=$resizable_loopback->{min_size}",
- "MOUNT=/live$resizable_loopback->{mountpoint}_resized",
- "OLD_MOUNT=/live$resizable_loopback->{mountpoint}",
- "UNION=/",
- );
- output_to_root($build->get_live_root, '/etc/sysconfig/draklive-resize', undef, @text);
- }
-}
-
sub clean_system_conf_file {
my ($file) = @_;
diff --git a/lib/MGA/DrakISO/Config.pm b/lib/MGA/DrakISO/Config.pm
index 5995bda..32c18cf 100644
--- a/lib/MGA/DrakISO/Config.pm
+++ b/lib/MGA/DrakISO/Config.pm
@@ -30,9 +30,6 @@ use MDK::Common;
use Pod::Usage;
use Cwd qw(abs_path);
-#- these modules can be used from config files
-use MGA::DrakISO::Mounts;
-
use Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw(read_config check_config complete_config dump_config);
@@ -72,8 +69,6 @@ sub check_config {
#- check for minimum requirements
$build->{settings}{arch}
or die "ERROR: you must specify an architecture\n";
- $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";
}
@@ -83,8 +78,6 @@ sub complete_config {
$build->{settings}{workdir} = abs_path($build->{settings}{workdir} || '.');
- $build->{mount} ||= volatile_squash_union();
-
mkdir_p($build->get_build_dir);
mkdir_p($build->get_chroot_dir);
}
diff --git a/lib/MGA/DrakISO/ISOBuild.pm b/lib/MGA/DrakISO/ISOBuild.pm
index 32ac4fe..7566c0c 100644
--- a/lib/MGA/DrakISO/ISOBuild.pm
+++ b/lib/MGA/DrakISO/ISOBuild.pm
@@ -31,8 +31,6 @@ use strict;
use MDK::Common;
-use MGA::DrakISO::Storage;
-
sub new {
my ($class) = @_;
bless {}, $class;
@@ -68,14 +66,4 @@ 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/Loopback.pm b/lib/MGA/DrakISO/Loopback.pm
deleted file mode 100644
index cf127c2..0000000
--- a/lib/MGA/DrakISO/Loopback.pm
+++ /dev/null
@@ -1,194 +0,0 @@
-# Copyright (C) 2005 Mandriva
-# Olivier Blin <oblin@mandriva.com>
-# Copyright (C) 2017-2018 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.
-
-# SYNOPSIS
-# --------
-# This package defines a set of alternative methods for creating the images
-# that will be mounted as loopback filesystems when booting a Live system.
-# 'squashfs' is the only method that has been tested with drakiso. The other
-# methods were inherited from the original draklive and are most likely no
-# longer needed.
-
-package MGA::DrakISO::Loopback;
-
-use strict;
-
-use MDK::Common;
-
-use File::Temp;
-
-use MGA::DrakISO::Mounts;
-use MGA::DrakISO::Utils;
-
-use Exporter;
-our @ISA = qw(Exporter);
-our @EXPORT = qw(%loop_types);
-
-my $loop_number = 0;
-our %loop_types;
-%loop_types = (
- squashfs => {
- read_only => 1,
- is_loopback => 1,
- modules => sub { "loop", best_squashfs4_compression($_[0]) ? "squashfs" : "squashfs_lzma" },
- extension => '-lzma.sqfs',
- build => sub {
- my ($build, $dir) = @_;
- my $dest = $build->get_build_dir('loopbacks') . $dir->{path} . $loop_types{squashfs}{extension};
- mkdir_p(dirname($dest));
- my $root = $dir->{root} || $build->get_live_root;
- my $src = $root . $dir->{build_from};
- my $total = directory_usage($src);
- print "Have to process " . int($total/1000000) . " MB\n" if $::verbose;
- my $exclude_file = tmpnam();
- output_p($exclude_file, map { $root . "$_\n" } grep { run_as_root('test', '-e', $root . $_) } @{$dir->{exclude} || []});
- my $sort = $build->{settings}{config_root} . '/' . $dir->{sort};
- my $squashfs4_comp = best_squashfs4_compression($build);
- run_as_root(join(' ',
- $squashfs4_comp ? 'mksquashfs' : 'mksquashfs3',
- $src, $dest,
- $squashfs4_comp ? ('-comp', $squashfs4_comp) : '-lzma',
- '-noappend', '-b', '1048576',
- #'-processors', 1,
- '-ef', $exclude_file,
- if_(-f $sort, '-sort', $sort),
- if_($::verbose > 2, '-info', '-progress'),
- if_($::verbose < 2, '-no-progress'),
- # due to lack of a -quiet option
- if_($::verbose < 2, '> /dev/null'),
- )) or die "ERROR: unable to run mksquashfs\n";
- unlink $exclude_file;
- },
- mount => sub {
- my ($dir) = @_;
- $dir->{loop} = "/dev/loop" . $loop_number++;
- my $extension = $dir->{path} . $loop_types{squashfs}{extension};
- my $mountpoint = $dir->{mountpoint};
- (
- "/bin/losetup $dir->{loop} /live/media/loopbacks$extension",
- "nash-mount -o ro -t squashfs $dir->{loop} /live$mountpoint",
- );
- },
- },
- modules => {
- read_only => 1,
- delay_mount => 1,
- mount => sub {
- my ($dir) = @_;
- my $path = $dir->{path};
- my $mountpoint = $dir->{mountpoint};
- "sh -c 'modules=;"
- . "for m in /live/media/loopbacks$path/*; do"
- . "n=\$(basename \$m);"
- . "n=\${n%.sqfs};"
- . "d=/live$mountpoint/\$n;"
- . "mkdir -p \$d;"
- . "mount -n -o loop,ro -t squashfs \$m \$d && modules=\$modules\$d=ro:;"
- . "done;"
- . "echo \$modules | sed -e s/:\$// > /live/$dir->{list}'";
- },
- pivot_clean => sub {
- my ($dir, $initrdroot) = @_;
- my $list = $dir->{list};
- my $mountpoint = $dir->{mountpoint};
- (
- "sh -c 'cd $initrdroot/live$mountpoint;"
- . "for i in `ls -1`; do"
- . "mkdir -p /live$mountpoint/\$i;"
- . "mount -n --move \$i /live$mountpoint/\$i;"
- . "rmdir \$i;"
- . "done;"
- . "rmdir $initrdroot/live$mountpoint'",
- "sh -c 'mv $initrdroot/live/$list /live/'",
- );
- },
- },
- loopfs => {
- is_loopback => 1,
- modules => [],
- extension => '.loop',
- build => sub {
- my ($build, $dir) = @_;
- my $dest = $build->get_build_dir('loopbacks') . $dir->{path} . $loop_types{loopfs}{extension};
- mkdir_p(dirname($dest));
- MGA::DrakISO::Utils::device_allocate_file($dest, $dir->{pre_allocate});
- MGA::DrakISO::Utils::device_mkfs($dest, $dir->{fs}) if !defined $dir->{min_size};
- },
- mount => sub {
- my ($dir) = @_;
- $dir->{loop} = "/dev/loop" . $loop_number++;
- my $sqfs = $MGA::DrakISO::Mounts::dir_distrib_sqfs->{mountpoint};
- my $fsck = "chroot </dev/tty1 /live/$sqfs /sbin/fsck $dir->{loop}";
- my $extension = $dir->{path} . $loop_types{loopfs}{extension};
- my $mountpoint = $dir->{mountpoint};
- (
- "losetup $dir->{loop} /live/media/loopbacks$extension",
- qq(sh -c "$fsck -a || $fsck -y"),
- "nash-mount -t $dir->{fs} $dir->{loop} /live$mountpoint",
- );
- },
- },
- plain => {
- skip_mkdir => 1,
- mount => sub {
- my ($dir) = @_;
- my $mountpoint = $dir->{mountpoint};
- qq(sh -c "mkdir -p /live$mountpoint");
- },
- },
- partition => {
- files => [ '/sbin/fsck', '/sbin/blkid' ],
- mount => sub {
- my ($dir) = @_;
- my $fsck = "/bin/fsck";
- my $path = $dir->{path};
- my $mountpoint = $dir->{mountpoint};
- (
- qq(sh -c 'dev=`blkid -l -t $path -o device`; [ -z "\$dev" ] || $fsck -a \$dev || $fsck -y \$dev'),
- "nash-mount -t $dir->{fs} $path /live$mountpoint",
- );
- },
- },
- tmpfs => {
- mount => sub {
- my ($dir) = @_;
- my $mnt = '/live' . $dir->{mountpoint};
- my $mount_opts = $dir->{mount_opts} ? "-o $dir->{mount_opts}" : "";
- my $cmd = "mount -t tmpfs $mount_opts $mnt $mnt";
- $dir->{fallback} ? qq(sh -c 'if ! grep -q " $mnt " /proc/mounts; then $cmd; fi') : $cmd;
- },
- },
-);
-
-sub has_squashfs4_with {
- my ($build, $comp) = @_;
- my $ucomp = uc($comp);
- cat_($build->get_live_root . "/boot/config-" . $build->find_kernel->{version}) =~ /^CONFIG_SQUASHFS_$ucomp=y$/m;
-}
-
-sub mksquashfs4_compressors() {
- map { /^Compressors available/ .. /^$/ ? if_(/^\t(\w+)/, chomp_($1)) : () } `mksquashfs 2>&1`;
-}
-
-sub best_squashfs4_compression {
- my ($build) = @_;
- find { has_squashfs4_with($build, $_) } intersection([ mksquashfs4_compressors() ], [ qw(xz lzma) ]);
-}
-
-1;
diff --git a/lib/MGA/DrakISO/Mounts.pm b/lib/MGA/DrakISO/Mounts.pm
deleted file mode 100644
index a374a9e..0000000
--- a/lib/MGA/DrakISO/Mounts.pm
+++ /dev/null
@@ -1,125 +0,0 @@
-# Copyright (C) 2005 Mandriva
-# Olivier Blin <oblin@mandriva.com>
-# Copyright (C) 2017-2018 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.
-
-# SYNOPSIS
-# --------
-# This package defines a set of alternative methods for mounting the loopback
-# filesystems when booting a Live system. 'volatile_squash_union' is the only
-# method that has been tested with drakiso. The other methods were inherited
-# from the original draklive and may no longer be needed.
-
-package MGA::DrakISO::Mounts;
-
-use strict;
-
-use MDK::Common;
-
-use Exporter;
-our @ISA = qw(Exporter);
-our @EXPORT = qw(simple_union, squash_rw_union, squash_union, volatile_squash_union);
-
-our $dir_distrib_sqfs = {
- mountpoint => '/distrib',
- type => 'squashfs',
- path => '/distrib',
- # perl -MMDK::Common -e 'print map_index { (32767 - $::i) . " $_" } grep { !m,^/(?:dev|proc|sys|live/distrib), } uniq(<>)' < bootlog.list > config/distrib.sort
- sort => "config/distrib.sort",
- build_from => '/',
-};
-my $dir_memory = {
- mountpoint => '/memory',
- type => 'tmpfs',
- mount_opts => 'mode=755',
-};
-
-my $dir_modules = {
- mountpoint => '/modules',
- type => 'modules',
- path => '/modules',
- list => 'modules.lst',
-};
-
-#- use distro default
-our $default = {
- dirs => [],
-};
-
-our $simple_union = {
- root => '/union',
- overlay => 'overlay',
- dirs => [
- {
- mountpoint => '/media',
- type => 'plain',
- },
- $dir_memory,
- ],
- };
-
-our $squash_rw_union = {
- root => '/union',
- overlay => 'overlay',
- dirs => [
- $dir_distrib_sqfs,
- {
- mountpoint => '/media/system',
- type => 'plain',
- },
- ],
- };
-
-sub volatile_squash_union {
- my ($o_modules) = @_;
- {
- root => '/union',
- overlay => 'overlay',
- dirs => [
- $dir_distrib_sqfs,
- if_($o_modules, $dir_modules),
- $dir_memory,
- ],
- };
-}
-
-sub squash_union {
- my ($default_size, $o_min_size, $o_modules) = @_;
- {
- root => '/union',
- overlay => 'overlay',
- dirs => [
- $dir_distrib_sqfs,
- if_($o_modules, $dir_modules),
- {
- mountpoint => '/system',
- type => 'loopfs',
- pre_allocate => $default_size,
- if_(defined $o_min_size, min_size => $o_min_size),
- fs => 'ext2',
- path => '/system'
- },
- {
- mountpoint => '/system',
- type => 'tmpfs',
- fallback => 1,
- },
- ],
- };
-}
-
-1;
diff --git a/lib/MGA/DrakISO/Storage.pm b/lib/MGA/DrakISO/Storage.pm
deleted file mode 100644
index 4a477b1..0000000
--- a/lib/MGA/DrakISO/Storage.pm
+++ /dev/null
@@ -1,39 +0,0 @@
-# Copyright (C) 2005 Mandriva
-# Olivier Blin <oblin@mandriva.com>
-# Copyright (C) 2017-2018 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.
-
-# SYNOPSIS
-# --------
-# This package defines a set of alternative storage types. This abstraction
-# is inherited from the original draklive, which supported the creation of
-# Live systems on different types of media. drakiso currently only supports
-# creation of ISO images, but this abstraction has been preserved in case
-# the additional functionality is added in the future.
-
-package MGA::DrakISO::Storage;
-
-use strict;
-
-our %storage_types = (
- iso => {
- fs => 'iso9660',
- read_only => 1,
- },
-);
-
-1;
diff --git a/lib/MGA/DrakISO/Utils.pm b/lib/MGA/DrakISO/Utils.pm
index f5d83a7..cb2702d 100644
--- a/lib/MGA/DrakISO/Utils.pm
+++ b/lib/MGA/DrakISO/Utils.pm
@@ -26,10 +26,6 @@ package MGA::DrakISO::Utils;
use strict;
use MDK::Common;
-use common qw(removeXiBSuffix);
-use fs;
-use IPC::Open3;
-use IO::Select;
use Exporter;
our @ISA = qw(Exporter);
@@ -85,30 +81,6 @@ sub run_in_root {
system(@cmd) == 0;
}
-sub device_allocate_file {
- my ($device, $size) = @_;
- run_('dd', "of=$device", 'count=0', 'bs=1', "seek=" . removeXiBSuffix($size));
-}
-
-#- format $device as type $type
-# FIXME: use fs::format
-sub device_mkfs {
- my ($device, $type, $o_label, $o_inode_size) = @_;
- if ($type eq 'vfat') {
- run_('mkfs.vfat', if_(defined $o_label, '-n', $o_label), $device);
- } elsif (member($type, 'ext2', 'ext3', 'ext4')) {
- run_("mkfs.$type", "-m", 0,
- if_(defined $o_label, '-L', $o_label),
- if_($o_inode_size, '-I', $o_inode_size),
- if_(!-b $device, '-F'),
- $device);
- } elsif ($type eq 'swap') {
- run_('mkswap', if_(defined $o_label, '-L', $o_label), $device);
- } else {
- die "ERROR: unable to mkfs for unsupported media type $type\n";
- }
-}
-
sub copy_or_link {
my ($src_file, $dst_file) = @_;
mkdir_p(dirname($dst_file));