#!/bin/bash - # virt-efivars build script # @configure_input@ # (C) Copyright 2014-2015 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. # # Written by Richard W.M. Jones unset CDPATH set -e supermin="@SUPERMIN@" distro="@DISTRO@" output="$1" if [ -z "$output" ]; then echo "$0: do not run this script directly, use 'make'" exit 1 fi # Get the list of package names that are added to the appliance. # Dependencies are resolved automatically by supermin. This is # distro-specific. if [[ "$distro" =~ ^fedora- ]]; then packages=" bash coreutils efivar-libs systemd util-linux " else echo "$0: $distro not known." echo "You need to edit '$0.in' to add support for this distro." exit 1 fi # Run the prepare step. echo "Preparing the supermin appliance containing:" $packages "$supermin" --prepare $packages -o tmp-supermin.d # Add the init script and editor binary. tar cf tmp-supermin.d/init.tar init editor # Run the build step. echo "Building the full appliance ..." echo "If you see 'Permission denied' errors here, you can probably ignore" echo "them, but encourage your distro to stop using security-through-obscurity." "$supermin" --build --format ext2 tmp-supermin.d -o tmp-appliance.d # Copy out the kernel, initrd and disk image. mv tmp-appliance.d/kernel . mv tmp-appliance.d/initrd . qemu-img convert -f raw tmp-appliance.d/root -O qcow2 "$output" rm -rf tmp-supermin.d tmp-appliance.d