summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscripts/grub-setup28
-rwxr-xr-xscripts/install-system96
2 files changed, 78 insertions, 46 deletions
diff --git a/scripts/grub-setup b/scripts/grub-setup
index b5f30647..a3ecffdf 100755
--- a/scripts/grub-setup
+++ b/scripts/grub-setup
@@ -27,10 +27,11 @@
#
UNION="false"
-while getopts u c
+while getopts u: c
do
case $c in
- u) UNION=true;;
+ u) UNION=true;
+ livedir=$OPTARG;;
esac
done
shift `expr $OPTIND - 1`
@@ -75,7 +76,7 @@ vga_logo="vga=785"
# get xen kernel info
xen_kernel_version=$(ls $ROOTFSDIR/boot/vmlinuz*xen 2> /dev/null | awk -F/ '{ print $5 }' | sed 's/vmlinuz//g' | sort -r)
- xen_version=$(ls $ROOTFSDIR/boot/xen-* | awk -F/ '{ print $5 }' | sort -r)
+ xen_version=$(ls $ROOTFSDIR/boot/xen-* 2> /dev/null | awk -F/ '{ print $5 }' | sort -r)
# Figure out whether we are running on the serial or KVM console:
if [ "`tty`" == "/dev/ttyS0" ]; then
@@ -87,7 +88,8 @@ vga_logo="vga=785"
fi
if eval "$UNION"; then
- GRUB_OPTIONS="boot=live live-media-path=/vyatta-live module=vc4 persistent noautologin nonetworking nouser hostname=vyatta"
+ GRUB_OPTIONS="boot=live live-media-path=/boot/$livedir module=$livedir quiet persistent noautologin nonetworking nouser hostname=vyatta"
+ union_kernel_versions=$(ls $ROOTFSDIR/boot/$livedir/vmlinuz-* 2> /dev/null | grep -v xen | awk -F/ '{ print $6 }' | sed 's/vmlinuz//g' | sort -r)
else
# Read UUID off of filesystem and use it to tell GRUB where to mount drive
# This allows device to move around and grub will still find it
@@ -144,7 +146,7 @@ vga_logo="vga=785"
done
fi
- if [ -f "$ROOTFSDIR/boot/vmlinuz" ]; then
+ if [ -f "$ROOTFSDIR/boot/vmlinuz" ] && [ ! eval $UNION ]; then
# Set first system boot option. Make KVM the default console in this one.
echo -e "menuentry \"Vyatta OFR (KVM console)\" {"
echo -e "\tlinux /boot/vmlinuz $GRUB_OPTIONS $vga_logo $vty_console"
@@ -160,6 +162,22 @@ vga_logo="vga=785"
echo -e "}"
fi
+ # create union kernels if they exist
+ if [ -n "$union_kernel_versions" ]; then
+ for kversion in $union_kernel_versions; do
+ echo
+ echo -e "menuentry \"Vyatta OFR linux$kversion (KVM console)\" {"
+ echo -e "\tlinux /boot/$livedir/vmlinuz$kversion $GRUB_OPTIONS $vga_logo $vty_console"
+ echo -e "\tinitrd /boot/$livedir/initrd.img$kversion"
+ echo -e "}"
+ echo
+ echo -e "menuentry \"Vyatta OFR linux$kversion (Serial console)\" {"
+ echo -e "\tlinux /boot/$livedir/vmlinuz$kversion $GRUB_OPTIONS $serial_console"
+ echo -e "\tinitrd /boot/$livedir/initrd.img$kversion"
+ echo -e "}"
+ done
+ fi
+
# create other kernels if they exist
if [ -n "$kernel_versions" ]; then
for kversion in $kernel_versions; do
diff --git a/scripts/install-system b/scripts/install-system
index c46ddf42..614cd063 100755
--- a/scripts/install-system
+++ b/scripts/install-system
@@ -713,12 +713,18 @@ install_root_filesystem () {
progress_indicator stop
echo "OK"
else
- mkdir -p $rootfsdir/vyatta-live/ $rootfsdir/boot
- echo Copying squashfs image...
- cp /live/image/live/filesystem.squashfs $rootfsdir/vyatta-live/vc4.squashfs
- echo Copying kernel and initrd images...
- cp -ar /boot/initrd.img-* $rootfsdir/boot/
- cp -ar /boot/vmlinuz-* $rootfsdir/boot
+ version=$(egrep -i version /opt/vyatta/etc/version | awk '{ print $3 }')
+ mkdir -p $rootfsdir/boot/$version
+ if [ -f /live/image/live/filesystem.squashfs ]; then
+ echo Copying squashfs image...
+ cp /live/image/live/filesystem.squashfs $rootfsdir/boot/$version/$version.squashfs
+ echo Copying kernel and initrd images...
+ cp -ar /boot/initrd.img-* $rootfsdir/boot/$version/
+ cp -ar /boot/vmlinuz-* $rootfsdir/boot/$version/
+ else
+ echo Copying image files...
+ cp -ar /live/image/boot/$version $rootfsdir/boot/
+ fi
fi
}
@@ -873,7 +879,8 @@ install_grub () {
# if union install tell grub-setup
if eval "$UNION"; then
- grub_args="-u"
+ version=$(egrep -i version /opt/vyatta/etc/version | awk '{ print $3 }')
+ grub_args="-u $version"
fi
if /opt/vyatta/sbin/grub-setup $grub_args "$ROOT_PARTITION" "$grub_options" /mnt/rootfs >>$INSTALL_LOG
then
@@ -1019,19 +1026,16 @@ setup_method_auto() {
setup_method_union() {
UNION=true
- echo "A union install requires an image partition and a root partition."
- echo "The image partition must be a minimum of 250mbs. To accomodate"
- echo "more than one image, the partition should be larger. Each image"
- echo "is roughly 200mbs. The root partition should be a minimum of"
- echo "50mbs for log files. If you plan on adding any other software"
- echo "or upgrading it, the root partition should be large enough to"
- echo "accomodate those packages"
+ echo "A union install requires an image partition of at least 250mbs."
+ echo "If you want to accomodate more than one image on the partition,"
+ echo "it should be larger. Each image is roughly 200mbs. This "
+ echo "partition will be the bootable partition for this machine."
echo
- # Ask for the root partition and make sure it's valid
+ # Ask for the image partition and make sure it's valid
while [ -z "$ROOT_PARTITION" ]
do
- select_partition 50 "Which partition should I install the writable root on?"
+ select_partition 250 "Which partition should I install the images on?"
# Note that PARTITION is defined in select partition
ROOT_PARTITION=$PARTITION
unmount "$ROOT_PARTITION"
@@ -1044,28 +1048,44 @@ setup_method_union() {
fi
done
- # Ask for the union partition and make sure it's valid
- while [ -z "$UNION_PARTITION" ]
- do
- select_partition 250 "Which partition should I install the binary images on?" "$ROOT_PARTITION"
- # Note that PARTITION is defined in select partition
- UNION_PARTITION=$PARTITION
- unmount "$UNION_PARTITION"
- vd=$(grep $UNION_PARTITION /proc/partitions | awk '{ print $4 }')
+ echo Creating filesystem on $ROOT_PARTITION
+ make_filesystem $ROOT_PARTITION
- if [ -z "$vd" ]; then
- echo
- echo "$UNION_PARTITION is an invalid partition. Please try again."
- UNION_PARTITION=""
- fi
- done
+ echo
+ echo "An optional writable persistent root partition may also"
+ echo "be created. This partition will allow you to store "
+ echo "files between reboots and upgrade packages."
+ echo
+ echo -n "Would you like to create a persistent root partition? (Yes/No) [Yes]: "
+ response=$(get_response "Yes" "Yes No Y N")
+ if [ "$response" == "yes" ] || [ "$response" == "y" ]; then
+ echo "The persistent root partition should be a minimum of 50mbs"
+ echo "for log files. If you plan on adding any other software or"
+ echo "upgrading it, the root partition should be large enough to"
+ echo "accomodate those packages"
+
+ # Ask for the union partition and make sure it's valid
+ while [ -z "$UNION_PARTITION" ]
+ do
+ select_partition 50 "Which partition should I install the binary images on?" "$ROOT_PARTITION"
+ # Note that PARTITION is defined in select partition
+ UNION_PARTITION=$PARTITION
+ unmount "$UNION_PARTITION"
+ vd=$(grep $UNION_PARTITION /proc/partitions | awk '{ print $4 }')
+
+ if [ -z "$vd" ]; then
+ echo
+ echo "$UNION_PARTITION is an invalid partition. Please try again."
+ UNION_PARTITION=""
+ fi
+ done
- echo Creating filesystems on $ROOT_PARTITION and $UNION_PARTITION
- make_filesystem $ROOT_PARTITION
- make_filesystem $UNION_PARTITION
+ echo Creating filesystems on $ROOT_PARTITION
+ make_filesystem $UNION_PARTITION
- echo Labeling $UNION_PARTITION
- e2label /dev/$UNION_PARTITION live-rw
+ echo Labeling $UNION_PARTITION
+ e2label /dev/$UNION_PARTITION live-rw
+ fi
}
unmount () {
@@ -1240,12 +1260,6 @@ if ! eval "$UNION"; then
sed -i 's/requisite[ \t][ \t]*pam_securetty.so/required pam_securetty.so/' $rootfsdir/etc/pam.d/login
fi
-# postinst hook
-if [ -e /opt/vyatta/etc/install-system/postinst ]; then
- echo "running post-install script"
- /opt/vyatta/etc/install-system/postinst $rootfsdir >>$INSTALL_LOG
-fi
-
cp $INSTALL_LOG $rootfsdir/install.log
umount $rootfsdir