diff --git a/etc/hook.d/20-setup-apt b/etc/hook.d/20-setup-apt index d9ec43a..b0954f0 100755 --- a/etc/hook.d/20-setup-apt +++ b/etc/hook.d/20-setup-apt @@ -9,6 +9,17 @@ prefix=$1 + +# +# If we're installing a distribution with rpmstrap then don't +# touch /etc/apt/sources.list +# +if [ "${rpmstrap}" ]; then + echo "APT not available for non-Debian distribution ${dist}" + exit; +fi + + cat < ${prefix}/etc/apt/sources.list # # /etc/apt/sources.list diff --git a/etc/hook.d/40-setup-networking b/etc/hook.d/40-setup-networking index 48bf770..bde41d2 100755 --- a/etc/hook.d/40-setup-networking +++ b/etc/hook.d/40-setup-networking @@ -10,6 +10,17 @@ prefix=$1 + +if [[ "${rpmstrap}" ]]; then + echo "TODO : Sort out networking for non-Debian distribution ${dist}." + exit; +fi + + +# +# OK now we're in Debian-only land. +# + if [[ -z "${dhcp}" ]]; then # diff --git a/etc/hook.d/55-create-dev b/etc/hook.d/55-create-dev index d60a732..42bc6e5 100755 --- a/etc/hook.d/55-create-dev +++ b/etc/hook.d/55-create-dev @@ -19,4 +19,10 @@ cd ${prefix}/dev # # Make the devices. # -./MAKEDEV generic \ No newline at end of file +if [ "${rpmstrap}" ]; then + ./MAKEDEV console + ./MAKEDEV null + ./MAKEDEV zero +else + ./MAKEDEV generic +fi \ No newline at end of file diff --git a/etc/hook.d/60-copy-host-files b/etc/hook.d/60-copy-host-files index 5cd4842..1bd59d3 100755 --- a/etc/hook.d/60-copy-host-files +++ b/etc/hook.d/60-copy-host-files @@ -37,7 +37,7 @@ my @files = ( "/etc/hosts", "/etc/gshadow", "/etc/group" ); - + foreach my $file ( @files ) { File::Copy::copy( $file, $prefix . "/etc/" ); @@ -47,7 +47,7 @@ foreach my $file ( @files ) # # Only copy the /etc/shadow file if --passwd is *not* specified. # -if ( !$ENV{'passwd'} ) +if ( !$ENV{'passwd'} ) { File::Copy::copy( "/etc/shadow", $prefix . "/etc/" ); } @@ -74,11 +74,11 @@ if ( ( -e "/etc/sudoers" ) && ( -x $prefix . "/usr/bin/apt-get" ) ) # if ( ! $ENV{'passwd'} ) { - open( ORIG, "<", "/etc/passwd" ) + open( ORIG, "<", "/etc/passwd" ) or die "Failed to open /etc/passwd - $!"; - open( NEW, ">>", $prefix . "/etc/passwd" ) + open( NEW, ">>", $prefix . "/etc/passwd" ) or die "Failed to open $prefix/etc/passwd - $!"; - + foreach my $line ( ) { chomp( $line ); @@ -87,7 +87,7 @@ if ( ! $ENV{'passwd'} ) my $user = $1; my $pass = $2; my $uid = $3; - + if ( ( $uid >= 1000 ) && ( $user ne "nobody" ) ) { diff --git a/etc/hook.d/65-copy-user-files b/etc/hook.d/65-copy-user-files index 0dccadf..2b88d24 100755 --- a/etc/hook.d/65-copy-user-files +++ b/etc/hook.d/65-copy-user-files @@ -8,10 +8,14 @@ prefix=$1 if [ -d /etc/xen-tools/skel ]; then + # # Copy everything from skel directory, even "dotfiles". # (cd /etc/xen-tools/skel; tar -cf - . ) | (cd ${prefix}/; tar -xpf -) + else + echo "skel directory not present, ignoring." + fi diff --git a/etc/hook.d/70-install-ssh b/etc/hook.d/70-install-ssh index a9bc785..2615b04 100755 --- a/etc/hook.d/70-install-ssh +++ b/etc/hook.d/70-install-ssh @@ -11,6 +11,11 @@ prefix=$1 +if [ "${rpmstrap}" ]; then + echo "ssh installation for non-Debian distribution ${dist} is not available." + exit; +fi + # # This function installs a package upon the guest image. # diff --git a/etc/hook.d/80-install-modules b/etc/hook.d/80-install-modules index df51dcd..87047b3 100755 --- a/etc/hook.d/80-install-modules +++ b/etc/hook.d/80-install-modules @@ -25,6 +25,9 @@ mkdir -p ${prefix}/lib/modules cp -R /lib/modules/*/ ${prefix}/lib/modules # -# Now install the 'module-init-tools'. +# Now install the 'module-init-tools', unless running under rpmstrap. # -DEBIAN_FRONTEND=noninteractive chroot ${prefix} /usr/bin/apt-get --yes --force-yes install module-init-tools +if [ -z "${rpmstrap}" ]; then + + DEBIAN_FRONTEND=noninteractive chroot ${prefix} /usr/bin/apt-get --yes --force-yes install module-init-tools +fi \ No newline at end of file diff --git a/etc/hook.d/90-make-fstab b/etc/hook.d/90-make-fstab index 0129711..7776598 100755 --- a/etc/hook.d/90-make-fstab +++ b/etc/hook.d/90-make-fstab @@ -22,8 +22,12 @@ function install_package { package=$1 - DEBIAN_FRONTEND=noninteractive chroot ${prefix} /usr/bin/apt-get --yes --force-yes install $package - + # + # Only install the package if we're not running under rpmstrap + # + if [ -z "${rpmstrap}" ]; then + DEBIAN_FRONTEND=noninteractive chroot ${prefix} /usr/bin/apt-get --yes --force-yes install $package + fi } diff --git a/etc/hook.d/99-clean-image b/etc/hook.d/99-clean-image index 45facbe..44dcf14 100755 --- a/etc/hook.d/99-clean-image +++ b/etc/hook.d/99-clean-image @@ -9,5 +9,12 @@ prefix=$1 -chroot ${prefix} /usr/bin/apt-get clean +# +# Don't run apt-get if we're running under rpmstrap. +# +if [ -z "${rpmstrap}" ]; then + + chroot ${prefix} /usr/bin/apt-get clean + +fi