3 Commits

Author SHA1 Message Date
Jay Larson
0b5d9e44bd The following changes were made:
* findutils added as dependency
  * modified cp command in mkinitramfs to prevent unnecessary errors
  * added 'all' option to mkinitramfs
2018-09-30 16:48:04 -05:00
Jay Larson
35668887a4 The following changes were made:
* Corrected zfs detection in init
  * Moved to use CONFIG rather than usher
2018-08-04 06:26:50 -05:00
Jay Larson
dcf90f69d6 The following changes were made:
* Added URL, REPO, and BRIEF to Makefile
  * usher now uses /bin/sh
  * Removed TARGET from usher
2018-04-04 14:20:41 -05:00
6 changed files with 43 additions and 44 deletions

View File

@@ -0,0 +1 @@
../default-bins

View File

@@ -0,0 +1 @@
../default-mods

View File

@@ -8,9 +8,11 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
DEPENDS = coreutils,cpio,eudev,gzip,perl,psmisc,sed,util-linux
DEPENDS = coreutils,cpio,dash,eudev,findutils,gzip,perl,psmisc,sed,util-linux
ARCH = x86_64
URL =
URL = http://snaplinux.org
REPO = core
BRIEF = Scripts to build initrd image
DESC = This package includes scripts to build an initrd image
SNAPVER = 0
@@ -35,5 +37,6 @@ clean:
@rm -rvf $(ROOT) \
$(SNAPINFO) \
$(MANIFEST) \
$(FILES)
$(FILES) \
$(CONFIG)

View File

@@ -1,26 +0,0 @@
#!/bin/bash
set -e
case $1 in
preinst)
exit 0
;;
postinst)
if [ ! -f ${TARGET}/usr/share/mkinitramfs/bins/default ]; then
cp ${TARGET}/usr/share/mkinitramfs/default-bins \
${TARGET}/usr/share/mkinitramfs/bins/default
fi
if [ ! -f ${TARGET}/usr/share/mkinitramfs/mods/default ]; then
cp ${TARGET}/usr/share/mkinitramfs/default-mods \
${TARGET}/usr/share/mkinitramfs/mods/default
fi
;;
prerm)
exit 0
;;
postrm)
exit 0
;;
esac

View File

@@ -77,7 +77,11 @@ udevadm settle
[ -f /etc/mdadm.conf ] && mdadm -As
[ -x /sbin/vgchange ] && /sbin/vgchange --sysinit -a y
[ -n "$zfs" ] && zpool import rpool -N || error "Failed importing rpool"
if [ -n "$zfs" ]; then
zpool import rpool -N || error "Failed importing rpool"
fi
[ -n "$rootdelay" ] && sleep "$rootdelay"
[ -n "$rootflags" ] && rootflags="$rootflags,$rorw" || rootflags="$rorw"

View File

@@ -6,7 +6,7 @@ use warnings;
use POSIX qw( uname );
use Data::Dumper;
use constant VERSION => '0.4';
use constant VERSION => '0.8';
sub build {
my $kernel = shift;
@@ -22,6 +22,12 @@ sub build {
mkdir( "$tmpdir/$_", 0755 ) || die( "mkdir(): $tmpdir/$_: $!" );
}
if ( -f '/etc/hostid' ) {
if ( system( "cp -p /etc/hostid $tmpdir/etc" ) ) {
die( "Failed copying hostid" );
}
}
symlink( 'lib', "$tmpdir/lib64" ) ||
die( "symlynk(): $tmpdir/lib64: $!" );
symlink( '/proc/mounts', "$tmpdir/etc/mtab" ) ||
@@ -64,18 +70,17 @@ sub build {
}
}
if ( system( "cp -rp /lib/firmware $tmpdir/lib/firmware" ) ) {
if ( system( "cp -a /lib/firmware $tmpdir/lib/firmware" ) ) {
die( "Failed copying firmware\n" );
}
if ( system( "cp -p /etc/modprobe.d/* $tmpdir/etc/modprobe.d" ) ) {
if ( system( "cp -a /etc/modprobe.d $tmpdir/etc/modprobe.d" ) ) {
die( "Failed copying data from modprobe.d\n" );
}
if ( system( "cp -rp /etc/udev/{rules.d,udev.conf}"
. " $tmpdir/etc/udev" ) ) {
if ( system( "cp -a /etc/udev $tmpdir/etc/udev" ) ) {
die( "Failed copying udev data\n" );
}
if ( system( "cp -rp /lib/udev $tmpdir/lib/udev" ) ) {
if ( system( "cp -a /lib/udev $tmpdir/lib/udev" ) ) {
die( "Failed copying udev lib data\n" );
}
@@ -87,8 +92,8 @@ sub build {
}
if ( system( "cp /lib/modules/$kernel->{'version'}/"
. "modules.{builtin,order} $tmpdir/lib/modules/"
. "$kernel->{'version'}" ) ) {
. "modules.builtin /lib/modules/$kernel->{'version'}/modules.order"
. " $tmpdir/lib/modules/$kernel->{'version'}" ) ) {
die( "Failed copying module data\n" );
}
if ( system( "depmod -b $tmpdir $kernel->{'version'}" ) ) {
@@ -219,11 +224,12 @@ for ( my $i = 0; $i <= $#ARGV; $i++ ) {
}
}
my $kernver = $ARGV[0] || ( uname() )[2];
my $arg = $ARGV[0] || ( uname() )[2];
my $kernels = getkern();
my $bins = readlines( 'bins' );
my $mods = readlines( 'mods' );
my $libs = [];
my $builds = [];
foreach my $bin ( @$bins ) {
my $ldd = ldd( $bin );
@@ -235,12 +241,22 @@ foreach my $bin ( @$bins ) {
}
}
if ( ! $kernels->{$kernver} ) {
print STDERR "Unable to locate kernel version $kernver\n";
if ( $arg eq 'all' ) {
foreach my $kernver ( keys( %$kernels ) ) {
push( @$builds, $kernels->{$kernver} );
}
}
elsif ( ! $kernels->{$arg} ) {
print STDERR "Unable to locate kernel version $arg\n";
exit 1;
}
else {
push( @$builds, $kernels->{$arg} );
}
print "Generating $kernels->{$kernver}{'initrd'}\n";
build( $kernels->{$kernver}, $bins, $mods, $libs );
print "Done\n";
foreach my $kernel ( @$builds ) {
print "Generating $kernel->{'initrd'}\n";
build( $kernel, $bins, $mods, $libs );
print "Done\n";
}