summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/install-system21
-rwxr-xr-xscripts/install/install-get-partition22
-rwxr-xr-xscripts/system/vyatta_update_console.pl3
-rwxr-xr-xscripts/system/vyatta_update_telnet84
-rwxr-xr-xscripts/vyatta-grub-setup65
5 files changed, 22 insertions, 173 deletions
diff --git a/scripts/install-system b/scripts/install-system
index 108153da..e8464951 100755
--- a/scripts/install-system
+++ b/scripts/install-system
@@ -399,7 +399,7 @@ check_for_new_raid () {
#
# Partition creation variables are in units of megabytes.
part_start_offset=2
- part_diag_size=60
+ data_dev=1
if [ $drivesize1 -lt $drivesize2 ]; then
root_size=$drivesize1
@@ -407,25 +407,6 @@ check_for_new_raid () {
root_size=$drivesize2
fi
- let min_size_with_diag=${MIN_ROOT}+${part_diag_size}
- if [ $root_size -ge $min_size_with_diag ]; then
- echo "Would you like me to create a $part_diag_size MB partition for diagnostics?"
- echo -n "(Yes/No) [No]: "
- diag_response=$(get_response "No" "Yes No Y N")
- if [ "$diag_response" == "yes" ] || [ "$diag_response" == "y" ]; then
- for drive in $drives
- do
- echo "Creating diag partition on drive $drive"
- create_partitions "$drive" $part_diag_size $part_start_offset "no"
- sfdisk --change-id /dev/$drive 1 0x6
- done
- data_dev=2
- let part_start_offset+=$part_diag_size
- else
- data_dev=1
- fi
- fi
-
let root_size-=$part_start_offset
for drive in $drives
diff --git a/scripts/install/install-get-partition b/scripts/install/install-get-partition
index 0ddbd443..f1b373ae 100755
--- a/scripts/install/install-get-partition
+++ b/scripts/install/install-get-partition
@@ -259,12 +259,12 @@ check_for_new_raid () {
done
# Need to leave space on both disks between the MBR and the start
- # of the first partition for grub. Grub needs to embed a large
+ # of the first partition for grub. Grub needs to embed a large
# boot image there when booting off RAID devices.
#
# Partition creation variables are in units of megabytes.
part_start_offset=2
- part_diag_size=60
+ data_dev=1
if [ $drivesize1 -lt $drivesize2 ]; then
root_size=$drivesize1
@@ -272,24 +272,6 @@ check_for_new_raid () {
root_size=$drivesize2
fi
- let min_size_with_diag=${MIN_ROOT}+${part_diag_size}
- if [ $root_size -ge $min_size_with_diag ]; then
- echo "Would you like me to create a $part_diag_size MB partition for diagnostics?"
- echo -n "(Yes/No) [No]: "
- diag_response=$(get_response "No" "Yes No Y N")
- if [ "$diag_response" == "yes" ] || [ "$diag_response" == "y" ]; then
- for drive in $drives; do
- echo "Creating diag partition on drive $drive"
- create_partitions "$drive" $part_diag_size $part_start_offset "no"
- sfdisk --change-id /dev/$drive 1 0x6
- done
- data_dev=2
- let part_start_offset+=$part_diag_size
- else
- data_dev=1
- fi
- fi
-
let root_size-=$part_start_offset
for drive in $drives; do
diff --git a/scripts/system/vyatta_update_console.pl b/scripts/system/vyatta_update_console.pl
index 93f6a232..19937060 100755
--- a/scripts/system/vyatta_update_console.pl
+++ b/scripts/system/vyatta_update_console.pl
@@ -16,8 +16,7 @@
#
# **** End License ****
-# Update console configuration in /etc/inittab and grub
-# based on Vyatta configuration
+# Update console configuration in systemd and grub based on Vyatta configuration
use strict;
use warnings;
diff --git a/scripts/system/vyatta_update_telnet b/scripts/system/vyatta_update_telnet
deleted file mode 100755
index f50eef79..00000000
--- a/scripts/system/vyatta_update_telnet
+++ /dev/null
@@ -1,84 +0,0 @@
-#! /bin/bash
-# Script to control telnet daemon parameters
-# and block changes when logged in over telnet
-
-# Block changes to telnet daemon when logged in over telnet
-pid=$(who -um | awk -F " " '{print $7}')
-if [ -n "$pid" ]; then
- if ps --pid $(ps --pid $pid -o ppid=) -o cmd= | grep -q telnetd
- then
- echo "Please configure telnet settings via ssh or console."
- exit 1
- fi
-fi
-
-usage() {
- echo "Usage: $0 enable <port>"
- echo " $0 disable"
- echo " $0 allow-root {true|false}"
- exit 1;
-}
-
-allow-root() {
- case "$1" in
- true) ;;
- false) ;;
- *) echo "Expect true or false"
- usage ;;
- esac
-
- sudo sed -i -e '/^# Pseudo-terminal (telnet)/,$d' /etc/securetty
-
- if [ $1 = "false" ]; then
- return
- fi
-
- sudo sh -c "cat >>/etc/securetty" <<EOF
-# Pseudo-terminal (telnet)
-pts/0
-pts/1
-pts/2
-pts/3
-pts/4
-pts/5
-pts/6
-pts/7
-pts/8
-pts/9
-pts/10
-pts/11
-pts/12
-pts/13
-pts/14
-pts/15
-pts/16
-pts/17
-pts/18
-pts/19
-EOF
-
-}
-
-case "$1" in
- allow-root)
- allow-root $2
- ;;
-
- enable)
- if [ -z "$2" ]
- then echo "Missing port number";
- usage
- fi
- exec sudo /opt/vyatta/sbin/telnetd.init restart $2 $3
- ;;
-
- disable)
- exec sudo /opt/vyatta/sbin/telnetd.init stop
- ;;
-
- *)
- echo "Unknown argument $1";
- usage
- ;;
-esac
-
diff --git a/scripts/vyatta-grub-setup b/scripts/vyatta-grub-setup
index f4c18f2c..ea4dc905 100755
--- a/scripts/vyatta-grub-setup
+++ b/scripts/vyatta-grub-setup
@@ -1,7 +1,7 @@
#!/bin/sh
#
# Module: grup-setup
-#
+#
# **** License ****
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
@@ -15,11 +15,11 @@
# This code was originally developed by Vyatta, Inc.
# Portions created by Vyatta are Copyright (C) 2006, 2007 Vyatta, Inc.
# All Rights Reserved.
-#
+#
# Author: Robert Bays
# Date: 2006
# Description:
-#
+#
# **** End License ****
#
# Vyatta grub customization setup script.
@@ -55,7 +55,7 @@ ROOT_PARTITION="$1"
GRUB_OPTIONS="$2"
ROOTFSDIR="$3"
-[ "$ROOT_PARTITION" ] || exit 1
+[ "$ROOT_PARTITION" ] || exit 1
# Grub options
if [ "$GRUB_OPTIONS" ]
@@ -114,7 +114,7 @@ if eval "$UNION"; then
2> /dev/null | grep -v xen \
| awk -F/ '{ print $6 }' | sed 's/vmlinuz//g' \
| sort -r)
-else
+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
uuid=$(dumpe2fs -h /dev/${ROOT_PARTITION} 2>/dev/null | awk '/^Filesystem UUID/ {print $3}')
@@ -133,11 +133,6 @@ if [ -n "$xen_kernel_version" ] || [ -n "$union_xen_kernel_version" ]; then
default_console=0
fi
-# Check for diagnostic partition residing in first partition of drive
-# holding the root partition.
-
-diag_drive_number=""
-
if [ ${ROOT_PARTITION:0:2} = "md" ]; then
# Select the first disk in the RAID group to look for diag partition on
root_disks=`echo /sys/block/$ROOT_PARTITION/slaves/*`
@@ -149,20 +144,6 @@ else
root_disk=${ROOT_PARTITION:0:${#ROOT_PARTITION}-1}
fi
-# If the root partition is not occupying the first partition, then we
-# can look for a diag partition there.
-if [ "$ROOT_PARTITION" != "${root_disk}1" ]; then
- first_part_fstype=`fdisk -l /dev/$root_disk | grep ^/dev/${root_disk}1 | awk '{ print $6 }'`
-
- if [ "$first_part_fstype" = "FAT16" -o "$first_part_fstype" = "Dell" ]; then
- # Translate the Linux drive letter (e.g. the "a" in "/dev/sda") into
- # a drive number that grub uses. i.e. "a" = 0, "b" = 1, etc.
- diag_drive_letter=${root_disk:2:1}
- diag_drive_number=`echo $diag_drive_letter | od -t u1 -N 1 | awk '{ print $2 }'`
- let diag_drive_number-=97
- fi
-fi
-
(
# create the grub.cfg file for grub
# The "default=" line selects which boot option will be used by default.
@@ -175,19 +156,17 @@ fi
echo "terminal_output --append serial"
if [ ${ROOT_PARTITION:0:2} = "md" ]; then
+ uuid_root_disk=`/sbin/tune2fs -l /dev/${root_disk}1 | grep UUID | awk '{print $3}'`
+ uuid_root_md=`/sbin/tune2fs -l /dev/md${ROOT_PARTITION#md} | grep UUID | awk '{print $3}'`
echo ""
- echo -e "insmod mdraid09"
+ echo -e "insmod part_msdos"
+ echo -e "insmod diskfilter"
+ echo -e "insmod ext2"
echo -e "insmod mdraid1x"
- echo -e "set root=(md/$ROOT_PARTITION)"
+ echo -e "set root='mduuid/${uuid_root_disk}'"
+ echo -e "search --no-floppy --fs-uuid --set=root ${uuid_root_md}"
fi
- echo ""
- echo "echo -n Press ESC to enter the Grub menu..."
- echo "if sleep --verbose --interruptible 5 ; then"
- echo -e "\tterminal_input console serial"
- echo "fi"
- echo ""
-
# create xen kernels if they exist
XEN_OPTS='dom0_mem=512M xenheap_megabytes=128'
if [ -n "$xen_kernel_version" ]; then
@@ -233,7 +212,7 @@ fi
echo -e "\tlinux /boot/$livedir/vmlinuz $GRUB_OPTIONS $usb_console"
echo -e "\tinitrd /boot/$livedir/initrd.img"
echo -e "}"
-
+
elif [ -n "$union_kernel_versions" ]; then
for kversion in $union_kernel_versions; do
echo
@@ -261,8 +240,8 @@ fi
echo -e "\tlinux /boot/vmlinuz $GRUB_OPTIONS $VGA_LOGO $vty_console"
echo -e "\tinitrd /boot/initrd.img"
echo -e "}"
-
- # Set the second system boot option.
+
+ # Set the second system boot option.
# Make the serial port be the default console in this one.
echo
echo -e "menuentry \"VyOS $version (Serial console)\" {"
@@ -295,19 +274,19 @@ fi
fi
fi
- # Set options for root password reset. Offer
+ # Set options for root password reset. Offer
# options for both serial and KVM console.
reset_boot_path=/boot
if eval "$UNION"; then
reset_boot_path=/boot/$livedir
fi
-
+
echo
echo -e "menuentry \"Lost password change $version (KVM console)\" {"
echo -e "\tlinux $reset_boot_path/vmlinuz $GRUB_OPTIONS $NOSELINUX $vty_console init=$pass_reset"
echo -e "\tinitrd $reset_boot_path/initrd.img"
echo -e "}"
-
+
echo
echo -e "menuentry \"Lost password change $version (Serial console)\" {"
echo -e "\tlinux $reset_boot_path/vmlinuz $GRUB_OPTIONS $NOSELINUX $serial_console init=$pass_reset"
@@ -320,14 +299,6 @@ fi
echo -e "\tinitrd $reset_boot_path/initrd.img"
echo -e "}"
- if [ -n "$diag_drive_number" ]; then
- echo
- echo -e "menuentry \"Diagnostics\" {"
- echo -e "\tchainloader (hd$diag_drive_number,1)+1"
- echo -e "}"
- fi
-
-
) >"$ROOTFSDIR"/boot/grub/grub.cfg
( [ -s /boot/grub/menu.lst ] &&