summaryrefslogtreecommitdiff
path: root/scripts/install-system
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/install-system')
-rwxr-xr-xscripts/install-system142
1 files changed, 71 insertions, 71 deletions
diff --git a/scripts/install-system b/scripts/install-system
index 2823746b..56803420 100755
--- a/scripts/install-system
+++ b/scripts/install-system
@@ -271,16 +271,6 @@ select_partition () {
PARTITION=$lpartition
}
-rename_old_config() {
- files=$(find /mnt/config -mindepth 1 -type f | grep -v pre-glendale)
- for f in $files; do
- if grep -q '/\*XORP Configuration File, v1.0\*/' $f >&/dev/null; then
- CURTIME=$(date +%F-%H%M%S)
- mv $f $f.pre-glendale.$CURTIME
- fi
- done
-}
-
## check_config_partition
# look to see if this partition contains a config file
# and back it up
@@ -291,34 +281,35 @@ check_config_partition() {
mkdir -p /mnt/tmp
output=$(mount /dev/$lpart /mnt/tmp 2>&1)
if [ $? != 0 ]; then
+ echo -e "Cannot mount /dev/$lpart"."\nPlease see $INSTALL_LOG for more details.\nExiting.."
echo -e "Cannot mount /dev/$lpart"."\nmount /dev/$ldrive$part /mnt/tmp\nExiting..." >> $INSTALL_LOG
echo "$output" >> $INSTALL_LOG
- else
- # Look to see if there is a config partition there
- if [ -f /mnt/tmp/opt/vyatta/etc/config/.vyatta_config ] || [ -f /mnt/tmp/.vyatta_config ]; then
- response=''
- while [ -z "$response" ]
- do
- echo "/dev/$lpart has an old configuration directory!"
- echo -ne "Would you like me to save the data on it\nbefore I delete it? (Yes/No) [Yes]: "
- response=$(get_response "Yes" "Yes No Y N")
- if [ "$response" == "yes" ] || [ "$response" == "y" ]; then
- mkdir -p /mnt/config
- if [ -d /mnt/tmp/opt/vyatta/etc/config ]; then
- output=$(cp -pR /mnt/tmp/opt/vyatta/etc/config/* /mnt/config)
- else
- output=$(cp -pR /mnt/tmp/* /mnt/config)
- fi
- if [ -n "$output" ]; then
- echo -e "Warning: error in copying the old config partition.\nSee $INSTALL_LOG for more details."
- echo -e "Warning: error in copying the old config partition.\ncp -pR /mnt/tmp/* /mnt/config\n$output\n" >> $INSTALL_LOG
- fi
- rename_old_config
+ exit 1
+ fi
+
+ # Look to see if there is a config partition there
+ if [ -f /mnt/tmp/opt/vyatta/etc/config/.vyatta_config ] || [ -f /mnt/tmp/.vyatta_config ]; then
+ response=''
+ while [ -z "$response" ]
+ do
+ echo "/dev/$lpart has an old configuration directory!"
+ echo -ne "Would you like me to save the data on it\nbefore I delete it? (Yes/No) [Yes]: "
+ response=$(get_response "Yes" "Yes No Y N")
+ if [ "$response" == "yes" ] || [ "$response" == "y" ]; then
+ mkdir -p /mnt/config
+ if [ -d /mnt/tmp/opt/vyatta/etc/config ]; then
+ output=$(cp -pR /mnt/tmp/opt/vyatta/etc/config/* /mnt/config)
+ else
+ output=$(cp -pR /mnt/tmp/* /mnt/config)
fi
- done
- fi
- umount /mnt/tmp
+ if [ -n "$output" ]; then
+ echo -e "Warning: error in copying the old config partition.\nSee $INSTALL_LOG for more details."
+ echo -e "Warning: error in copying the old config partition.\ncp -pR /mnt/tmp/* /mnt/config\n$output\n" >> $INSTALL_LOG
+ fi
+ fi
+ done
fi
+ umount /mnt/tmp
}
# Delete all existing partitions for an automated install
@@ -566,14 +557,13 @@ install_grub () {
# TODO: This needs to be changed to map to the correct drive
part=$(echo $ROOT_PARTITION | sed 's/[^0-9]//g')
- part=$(($part - 1))
if [ "$(cat /sys/block/$orig_install_drive/removable)" == 0 ]; then
root=$(grep $orig_install_drive $rootfsdir/boot/grub/device.map | /usr/bin/awk -F')' '{ print $1 }')
root="$root,$part)"
else
- echo "This looks like a removable device. Setting root grub device to (0,0)."
- echo "This looks like a removable device. Setting root grub device to (0,0)." >> $INSTALL_LOG
root="(hd0,$part)"
+ echo "This looks like a removable device. Setting root grub device to $root."
+ echo "This looks like a removable device. Setting root grub device to $root." >> $INSTALL_LOG
fi
# Figure out whether we are running on the serial or KVM console:
@@ -585,40 +575,50 @@ install_grub () {
DEFAULT_CONSOLE="0"
fi
- # create the menu.lst file for grub
- # The "default=" line selects which boot option will be used by default.
- # Numbering starts at 0 for the first option.
- grub_file="$rootfsdir/boot/grub/menu.lst"
- echo -e "default=$DEFAULT_CONSOLE\ntimeout=5\n#splashimage=(hd0,0)/grub/splash.xpm.gz\nhiddenmenu" > $grub_file
- # set serial console options
- echo -e "serial --unit=0 --speed=9600\nterminal --timeout=5 console serial\n\n" >> $grub_file
-
- # Set first system boot option. Make KVM the default console in this one.
- echo -e "title Vyatta OFR (KVM console)\n\troot $root" >> $grub_file
- echo -en "\tkernel /boot/vmlinuz root=/dev/$ROOT_PARTITION $ISCF console=ttyS0,9600 console=tty0 \n" >> $grub_file
- echo -e "\tinitrd /boot/initrd.img" >> $grub_file
-
- # Set the second system boot option. Make the serial port be the default
- # console in this one.
- echo >> $grub_file
- echo -e "title Vyatta OFR (Serial console)\n\troot $root" >> $grub_file
- echo -en "\tkernel /boot/vmlinuz root=/dev/$ROOT_PARTITION $ISCF console=tty0 console=ttyS0,9600 \n" >> $grub_file
- echo -e "\tinitrd /boot/initrd.img" >> $grub_file
-
- # Set third and fourth boot options for root password reset. Offer
- # options for both serial and KVM console.
-
- echo >> $grub_file
- echo -e "title Root password reset to factory (KVM console)" >> $grub_file
- echo -e "\troot $root" >> $grub_file
- echo -e "\tkernel /boot/vmlinuz root=/dev/$ROOT_PARTITION $ISCF console=ttyS0,9600 console=tty0 init=$PWRESET" >> $grub_file
- echo -e "\tinitrd /boot/initrd.img" >> $grub_file
-
- echo >> $grub_file
- echo -e "title Root password reset to factory (Serial console)" >> $grub_file
- echo -e "\troot $root" >> $grub_file
- echo -e "\tkernel /boot/vmlinuz root=/dev/$ROOT_PARTITION $ISCF console=tty0 console=ttyS0,9600 init=$PWRESET" >> $grub_file
- echo -e "\tinitrd /boot/initrd.img" >> $grub_file
+ (
+ # create the grub.cfg file for grub
+ # The "default=" line selects which boot option will be used by default.
+ # Numbering starts at 0 for the first option.
+ echo -e "set default=$DEFAULT_CONSOLE"
+ echo "set timeout=5"
+ #echo "#set splashimage=(hd0,0)/grub/splash.xpm.gz"
+ echo "hiddenmenu"
+ # set serial console options
+ echo -e "serial --unit=0 --speed=9600"
+ echo "terminal --timeout=5 console serial"
+ echo "set root=$root"
+ echo
+ echo
+
+ # Set first system boot option. Make KVM the default console in this one.
+ echo -e "menuentry \"Vyatta OFR (KVM console)\" {"
+ echo -en "\tlinux /boot/vmlinuz root=/dev/$ROOT_PARTITION $ISCF console=ttyS0,9600 console=tty0 \n"
+ echo -e "\tinitrd /boot/initrd.img"
+ echo -e "}"
+
+ # Set the second system boot option. Make the serial port be the default
+ # console in this one.
+ echo
+ echo -e "menuentry \"Vyatta OFR (Serial console)\" {"
+ echo -en "\tlinux /boot/vmlinuz root=/dev/$ROOT_PARTITION $ISCF console=tty0 console=ttyS0,9600 \n"
+ echo -e "\tinitrd /boot/initrd.img"
+ echo -e "}"
+
+ # Set third and fourth boot options for root password reset. Offer
+ # options for both serial and KVM console.
+
+ echo
+ echo -e "menuentry \"Root password reset to factory (KVM console)\" {"
+ echo -e "\tlinux /boot/vmlinuz root=/dev/$ROOT_PARTITION $ISCF console=ttyS0,9600 console=tty0 init=$PWRESET"
+ echo -e "\tinitrd /boot/initrd.img"
+ echo -e "}"
+
+ echo
+ echo -e "menuentry \"Root password reset to factory (Serial console)\" {"
+ echo -e "\tkernel /boot/vmlinuz root=/dev/$ROOT_PARTITION $ISCF console=tty0 console=ttyS0,9600 init=$PWRESET"
+ echo -e "\tinitrd /boot/initrd.img"
+ echo -e "}"
+ ) >"$rootfsdir/boot/grub/grub.cfg"
echo "OK"
}