From 6cb84b6e94f424afb9e25b392148fe679d4c7d51 Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Thu, 18 Jun 2009 14:27:20 +0100 Subject: Rename guestfs-supermin-helper -> libguestfs-supermin-helper. --- .gitignore | 2 +- appliance/Makefile.am | 6 +-- appliance/guestfs-supermin-helper.in | 80 --------------------------------- appliance/libguestfs-supermin-helper.in | 80 +++++++++++++++++++++++++++++++++ configure.ac | 4 +- src/guestfs.c | 2 +- 6 files changed, 87 insertions(+), 87 deletions(-) delete mode 100755 appliance/guestfs-supermin-helper.in create mode 100755 appliance/libguestfs-supermin-helper.in diff --git a/.gitignore b/.gitignore index 3e5ba214..b99ffbce 100644 --- a/.gitignore +++ b/.gitignore @@ -20,10 +20,10 @@ ChangeLog Makefile.in Makefile aclocal.m4 -appliance/guestfs-supermin-helper appliance/initramfs.*.img appliance/initramfs.*.supermin.hostfiles appliance/kmod.whitelist +appliance/libguestfs-supermin-helper appliance/make.sh appliance/supermin-make.sh appliance/supermin-split.sh diff --git a/appliance/Makefile.am b/appliance/Makefile.am index 2c8a0be7..883bda56 100644 --- a/appliance/Makefile.am +++ b/appliance/Makefile.am @@ -17,7 +17,7 @@ EXTRA_DIST = \ make.sh update.sh supermin-split.sh supermin-make.sh \ - guestfs-supermin-helper \ + libguestfs-supermin-helper \ kmod.whitelist \ kmod.whitelist.in @@ -38,7 +38,7 @@ fs_DATA = $(APPLIANCE_FILES) APPLIANCE_FILES = $(INITRAMFSIMG) $(VMLINUZ) if SUPERMIN APPLIANCE_FILES += $(SUPERMINIMG) $(SUPERMINFILES) kmod.whitelist -bin_SCRIPTS = guestfs-supermin-helper +bin_SCRIPTS = libguestfs-supermin-helper endif # Don't change these names - they must be the same as in '*.sh' scripts. @@ -92,7 +92,7 @@ endif cd .. && ./config.status appliance/$@ chmod +x $@ -guestfs-supermin-helper: guestfs-supermin-helper.in +libguestfs-supermin-helper: libguestfs-supermin-helper.in cd .. && ./config.status appliance/$@ chmod +x $@ diff --git a/appliance/guestfs-supermin-helper.in b/appliance/guestfs-supermin-helper.in deleted file mode 100755 index 87fb6882..00000000 --- a/appliance/guestfs-supermin-helper.in +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/bash - -# @configure_input@ -# Copyright (C) 2009 Red Hat Inc. -# -# 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 of the License, 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., 675 Mass Ave, Cambridge, MA 02139, USA. - -# Helper script which constructs the supermin appliance at runtime. - -unset CDPATH - -set -e - -# Source directory containing the supermin input files. -sourcedir=$(cd "$1" > /dev/null; pwd) - -# Output files. -kernel="$2" -initrd="$3" - -# Look for the kernel first. This is very unsophisticated: We -# just look for any kernel named vmlinuz-*.$host_cpu which has a -# corresponding /lib/modules/*.$host_cpu directory. - -for f in /boot/vmlinuz-*.@host_cpu@; do - b=$(basename "$f") - b=$(echo "$b" | sed 's,vmlinuz-,,') - modpath="/lib/modules/$b" - if [ -d "$modpath" ]; then - ln -sf "$f" "$kernel" - break - fi - modpath= -done - -if [ -z "$modpath" ]; then - echo "$0: failed to find a suitable kernel" >&2 - exit 1 -fi - -# The initrd consists of these components: -# (1) The base skeleton appliance that we constructed at build time. -# name = initramfs.@REPO@.@host_cpu@.supermin.img -# format = compressed cpio -# (2) The modules from modpath which are on the module whitelist. -# format = plain cpio -# (3) The host files which match wildcards in *.supermin.hostfiles. -# format = plain cpio - -cp "$sourcedir"/initramfs.@REPO@.@host_cpu@.supermin.img "$initrd" - -# Kernel modules (2). -exec 5<"$sourcedir"/kmod.whitelist -whitelist= -while read kmod 0<&5; do - whitelist="$whitelist -o -name $kmod" -done -exec 5<&- - -find "$modpath" \( -not -name '*.ko' $whitelist \) -a -print0 | - cpio --quiet -o -0 -H newc >> "$initrd" - -# Host files (3). - -(cd / && \ - ls -1df $( - cat "$sourcedir"/initramfs.@REPO@.@host_cpu@.supermin.hostfiles - ) 2>/dev/null | - cpio --quiet -o -H newc ) >> "$initrd" diff --git a/appliance/libguestfs-supermin-helper.in b/appliance/libguestfs-supermin-helper.in new file mode 100755 index 00000000..87fb6882 --- /dev/null +++ b/appliance/libguestfs-supermin-helper.in @@ -0,0 +1,80 @@ +#!/bin/bash - +# @configure_input@ +# Copyright (C) 2009 Red Hat Inc. +# +# 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 of the License, 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., 675 Mass Ave, Cambridge, MA 02139, USA. + +# Helper script which constructs the supermin appliance at runtime. + +unset CDPATH + +set -e + +# Source directory containing the supermin input files. +sourcedir=$(cd "$1" > /dev/null; pwd) + +# Output files. +kernel="$2" +initrd="$3" + +# Look for the kernel first. This is very unsophisticated: We +# just look for any kernel named vmlinuz-*.$host_cpu which has a +# corresponding /lib/modules/*.$host_cpu directory. + +for f in /boot/vmlinuz-*.@host_cpu@; do + b=$(basename "$f") + b=$(echo "$b" | sed 's,vmlinuz-,,') + modpath="/lib/modules/$b" + if [ -d "$modpath" ]; then + ln -sf "$f" "$kernel" + break + fi + modpath= +done + +if [ -z "$modpath" ]; then + echo "$0: failed to find a suitable kernel" >&2 + exit 1 +fi + +# The initrd consists of these components: +# (1) The base skeleton appliance that we constructed at build time. +# name = initramfs.@REPO@.@host_cpu@.supermin.img +# format = compressed cpio +# (2) The modules from modpath which are on the module whitelist. +# format = plain cpio +# (3) The host files which match wildcards in *.supermin.hostfiles. +# format = plain cpio + +cp "$sourcedir"/initramfs.@REPO@.@host_cpu@.supermin.img "$initrd" + +# Kernel modules (2). +exec 5<"$sourcedir"/kmod.whitelist +whitelist= +while read kmod 0<&5; do + whitelist="$whitelist -o -name $kmod" +done +exec 5<&- + +find "$modpath" \( -not -name '*.ko' $whitelist \) -a -print0 | + cpio --quiet -o -0 -H newc >> "$initrd" + +# Host files (3). + +(cd / && \ + ls -1df $( + cat "$sourcedir"/initramfs.@REPO@.@host_cpu@.supermin.hostfiles + ) 2>/dev/null | + cpio --quiet -o -H newc ) >> "$initrd" diff --git a/configure.ac b/configure.ac index 440a2b65..6e760171 100644 --- a/configure.ac +++ b/configure.ac @@ -497,7 +497,7 @@ AC_CONFIG_FILES([Makefile appliance/Makefile appliance/make.sh appliance/update.sh appliance/supermin-split.sh appliance/supermin-make.sh - appliance/guestfs-supermin-helper + appliance/libguestfs-supermin-helper images/Makefile capitests/Makefile regressions/Makefile @@ -513,7 +513,7 @@ AC_CONFIG_FILES([Makefile AC_OUTPUT dnl WTF? -chmod +x appliance/*.sh appliance/guestfs-supermin-helper +chmod +x appliance/*.sh appliance/libguestfs-supermin-helper dnl Produce summary. echo diff --git a/src/guestfs.c b/src/guestfs.c index 20fafc12..0b562537 100644 --- a/src/guestfs.c +++ b/src/guestfs.c @@ -1158,7 +1158,7 @@ build_supermin_appliance (guestfs_h *g, const char *path, snprintf (cmd, sizeof cmd, "PATH='%s':$PATH " - "guestfs-supermin-helper '%s' %s %s", + "libguestfs-supermin-helper '%s' %s %s", path, path, *kernel, *initrd); -- cgit