summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/vyatta-cfg-system.postinst.in2
-rwxr-xr-xscripts/install-system.in136
-rwxr-xr-xscripts/system/vyatta_update_resolv.pl30
-rw-r--r--templates/interfaces/tunnel/node.def11
-rw-r--r--templates/interfaces/tunnel/node.tag/address/node.def6
-rw-r--r--templates/interfaces/tunnel/node.tag/description/node.def2
-rw-r--r--templates/interfaces/tunnel/node.tag/disable/node.def3
-rw-r--r--templates/interfaces/tunnel/node.tag/encapsulation/node.def5
-rw-r--r--templates/interfaces/tunnel/node.tag/key/node.def4
-rw-r--r--templates/interfaces/tunnel/node.tag/local-ip/node.def3
-rw-r--r--templates/interfaces/tunnel/node.tag/mtu/node.def6
-rw-r--r--templates/interfaces/tunnel/node.tag/remote-ip/node.def2
-rw-r--r--templates/interfaces/tunnel/node.tag/tos/node.def5
-rw-r--r--templates/interfaces/tunnel/node.tag/ttl/node.def5
-rw-r--r--templates/system/domain-name/node.def10
15 files changed, 122 insertions, 108 deletions
diff --git a/debian/vyatta-cfg-system.postinst.in b/debian/vyatta-cfg-system.postinst.in
index 51caf80a..3ee762bd 100644
--- a/debian/vyatta-cfg-system.postinst.in
+++ b/debian/vyatta-cfg-system.postinst.in
@@ -46,7 +46,7 @@ if [ "$sysconfdir" != "/etc" ]; then
fi
# add temporary version
- echo "Version : eureka (beta)" > $sysconfdir/version
+ echo "Version : glendale (alpha 1)" > $sysconfdir/version
fi
# update crontab for logrotate
diff --git a/scripts/install-system.in b/scripts/install-system.in
index 5f7ccd74..e626a383 100755
--- a/scripts/install-system.in
+++ b/scripts/install-system.in
@@ -353,15 +353,10 @@ make_filesystem () {
create_partitions() {
ldrive=$1
root_part_size=$2
- config_part_size=$3
-
- total=$(($root_part_size + $config_part_size))
- head=$(($root_part_size))
- tail=$(($root_part_size + $config_part_size))
# Make sure there is enough space on drive
size=$(get_drive_size "$ldrive")
- if [ "$total" -gt "$size" ]; then
+ if [ "$root_part_size" -gt "$size" ]; then
echo "Error: $ldrive is only $size"MB" large."
exit 1
fi
@@ -384,27 +379,8 @@ create_partitions() {
sleep 1
done
- echo "Creating configuration partition on /dev/$ldrive" >> $INSTALL_LOG
- echo "parted /dev/$ldrive mkpart primary $root_part_size $config_part_size" >> $INSTALL_LOG
-
- output=$(parted /dev/$ldrive mkpart primary $head $tail)
- status=$?
- if [ "$status" != 0 ]; then
- echo -e "Error creating primary partition on $ldrive.\nPlease see $INSTALL_LOG for more details.\nExiting..."
- echo -e "Error creating primary partition on $ldrive.\nparted /dev/$ldrive mkpart primary $root_part_size $config_part_size\n$output"
- exit 1
- fi
-
- CONFIG_PARTITION=$ldrive"2"
- # udev takes time to re-add the device file, so wait for it
- while [ ! -b "/dev/$CONFIG_PARTITION" ]
- do
- sleep 1
- done
-
# make the root and config ext3 file systems.
make_filesystem "$ROOT_PARTITION"
- make_filesystem "$CONFIG_PARTITION"
}
# Install the root filesystem
@@ -458,24 +434,20 @@ install_root_filesystem () {
# make the dir for the boot files and copy em' over
mkdir -p $rootfsdir/boot
output=$(cp -pR /boot/* $rootfsdir/boot/)
- output+=$(cp /live/image/live/vmlinuz-* $rootfsdir/boot/)
status=$?
- output+=$(cp /live/image/live/initrd.img-* $rootfsdir/boot/initrd.img)
+ output+=$(cp /live/image/live/initrd1.img $rootfsdir/boot/initrd.img)
status=$status$?
if [ "$status" -ne 0 ]; then
- echo -e "Error trying to copy the bootfiles.\nPlease see install log for more details.\nExiting.
-.."
+ echo -e "Error trying to copy the bootfiles.\nPlease see install log for more details.\nExiting..."
echo -e "Error trying to copy the bootfiles.\ncp /boot/initrd.img $rootfsdir/boot/\n$output" >> $INSTALL_LOG
exit 1
fi
# create the fstab
- echo -e "/dev/$CONFIG_PARTITION\t$ofrconfdir\text3\tdefaults\t1 2" >> $rootfsdir/etc/fstab
echo -e "/dev/$ROOT_PARTITION\t/\text3\tdefaults\t0 1" >> $rootfsdir/etc/fstab
#setup the hostname file
- rm -f $rootfsdir/etc/hostname
- echo vyatta > $rootfsdir/etc/hostname
+ cp /etc/hostname $rootfsdir/etc/
cp /etc/hosts $rootfsdir/etc/
progress_indicator "stop"
@@ -492,14 +464,6 @@ copy_config () {
# create the config directory on the union file system
mkdir -p $rootfsdir$ofrconfdir
- output=$(mount -t ext3 /dev/$config_partition $rootfsdir$ofrconfdir)
- status=$?
-
- if [ "$status" != 0 ]; then
- echo -e "Error trying to mount the new config partition.\nPlease see $INSTALL_LOG for details.\nExiting..."
- echo -e "Error trying to mount the new config partition.\nmount -t ext3 /dev/$config_partition $rootfsdir$ofrconfdir\n$output" >> $INSTALL_LOG
- exit 1
- fi
# create the proper perms on the new config partition
chgrp quaggavty $rootfsdir$ofrconfdir
@@ -590,21 +554,48 @@ install_grub () {
root="(hd0,$part)"
fi
+ # Figure out whether we are running on the serial or KVM console:
+ if [ "`tty`" == "/dev/ttyS0" ]; then
+ # Since user is running on serial console, make that the default.
+ DEFAULT_CONSOLE="1"
+ else
+ # Since user is running on KVM console, make that the default
+ 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=0\ntimeout=5\n#splashimage=(hd0,0)/grub/splash.xpm.gz\nhiddenmenu" > $grub_file
+ 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 primary boot option
- echo -e "title Vyatta OFR\n\troot $root" >> $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 root password reset option
+ # 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 (serial console)" >> $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 init=$PWRESET" >> $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
echo "OK"
@@ -654,40 +645,9 @@ setup_method_manual() {
fi
done
- # Ask for the config partition and make sure it's valid
- # TODO: need to do better error checking here to insure
- # the user doesn't select the same part for both drives.
- while [ -z "$CONFIG_PARTITION" ]
- do
- while true
- do
- select_partition 5 "Which partition should I use for configurations?"
- # Note that PARTITION is defined in select partition
- if [ "$PARTITION" != "$ROOT_PARTITION" ]
- then
- break
- fi
- echo "The config partition cannot be the same as the root partition ($ROOT_PARTITION)!"
- echo
- done
-
- CONFIG_PARTITION=$PARTITION
- unmount "$CONFIG_PARTITION"
- vd=$(grep $CONFIG_PARTITION /proc/partitions | awk '{ print $4 }')
-
- if [ -z "$vd" ]; then
- echo
- echo "$CONFIG_PARTITION is an invalid partition. Please try again."
- CONFIG_PARTITION=""
- fi
- done
-
# create the ext3 fs on the part
make_filesystem "$ROOT_PARTITION"
- # Create the ext3 fs on the part
- make_filesystem $CONFIG_PARTITION
-
# We need to set the INSTALL_DRIVE if it wasn't set when the user ran parted
# We assume that we will use the boot sector of the same drive that the partition is on
# TODO: Allow different drives to function as the boot device
@@ -747,8 +707,6 @@ setup_method_auto() {
while [ $ROOT_MIN -gt $ROOT_PARTITION_SIZE ]; do
# Get the size of the drive
size=$(get_drive_size $INSTALL_DRIVE)
- # Subtract our minimum config part so the user doesn't fill the entire drive
- size=$(($size - $CONFIG_MIN))
echo -n "How big of a root partition should I create? ($ROOT_MIN"MB" - $size"MB") [$size]MB: "
response=$(get_response "$size")
# TODO: need to have better error checking on this value
@@ -760,27 +718,10 @@ setup_method_auto() {
fi
done
- # Enforce minimum partion size requirement.
- CONFIG_PARTITION_SIZE=0
- while [ $CONFIG_MIN -gt $CONFIG_PARTITION_SIZE ]; do
- # Get the size of the drive
- size=$(get_drive_size $INSTALL_DRIVE)
- # Subtract our minimum config part so the user doesn't fill the entire drive
- size=$(($size - $ROOT_PARTITION_SIZE))
- echo -n "How big of a config partition should I create? ($CONFIG_MIN"MB" - $size"MB") [$CONFIG_MIN]MB: "
- response=$(get_response "$CONFIG_MIN")
- CONFIG_PARTITION_SIZE=$(echo "$response" | sed 's/[^0-9]//g')
- if [ $CONFIG_PARTITION_SIZE -lt $CONFIG_MIN ] || [ $CONFIG_PARTITION_SIZE -gt $size ]; then
- echo "Config partion must be between $CONFIG_MIN"MB" and $size"MB""
- echo
- CONFIG_PARTITION_SIZE=0
- fi
- done
-
echo
# now take the data and create the partitions
- create_partitions "$INSTALL_DRIVE" "$ROOT_PARTITION_SIZE" "$CONFIG_PARTITION_SIZE"
+ create_partitions "$INSTALL_DRIVE" "$ROOT_PARTITION_SIZE"
}
unmount () {
@@ -910,7 +851,6 @@ install_grub
cp $INSTALL_LOG $rootfsdir/install.log
-umount $rootfsdir$ofrconfdir
umount $rootfsdir
echo "Done!"
diff --git a/scripts/system/vyatta_update_resolv.pl b/scripts/system/vyatta_update_resolv.pl
index 0255b256..a8d05cfd 100755
--- a/scripts/system/vyatta_update_resolv.pl
+++ b/scripts/system/vyatta_update_resolv.pl
@@ -47,9 +47,18 @@ if ($modify_dir ne '') {
}
+$vc->setLevel('system');
+
+my @domains = $vc->returnValues('domain-search domain');
+my $domain_name = $vc->returnValue('domain-name');
+
+if (@domains > 0 && $domain_name && length($domain_name) > 0) {
+ print STDERR "System configuration error. Both \'domain-name\' and \'domain-search\' are specified, but only one of these mutually exclusive parameters is allowed.\n";
+ print STDERR "System configuration commit aborted due to error(s).\n";
+ exit(1);
+}
+
my $doms = '';
-$vc->setLevel('system domain-search domain');
-my @domains = $vc->returnValues('.');
foreach my $domain (@domains) {
if (length($doms) > 0) {
$doms .= ' ';
@@ -62,9 +71,15 @@ if (length($doms) > 0) {
$search = "search\t\t$doms\t\t#line generated by $0\n";
}
+my $domain = '';
+if ($domain_name && length($domain_name) > 0) {
+ $domain = "domain\t\t$domain_name\t\t#line generated by $0\n";
+}
+
# The following will re-write '/etc/resolv.conf' line by line,
-# replacing the 'search' specifier with the latest values.
+# replacing the 'search' specifier with the latest values,
+# or replacing the 'domain' specifier with the latest value.
my @resolv;
if (-e '/etc/resolv.conf') {
@@ -75,6 +90,7 @@ if (-e '/etc/resolv.conf') {
my $foundSearch = 0;
+my $foundDomain = 0;
open (RESOLV, '>/etc/resolv.conf') or die("$0: Error! Unable to open '/etc/resolv.conf' for output: $!\n");
foreach my $line (@resolv) {
@@ -83,6 +99,11 @@ foreach my $line (@resolv) {
if (length($search) > 0) {
print RESOLV $search;
}
+ } elsif ($line =~ /^domain\s/) {
+ $foundDomain = 1;
+ if (length($domain) > 0) {
+ print RESOLV $domain;
+ }
} else {
print RESOLV $line;
}
@@ -90,6 +111,9 @@ foreach my $line (@resolv) {
if ($foundSearch == 0 && length($search) > 0) {
print RESOLV $search;
}
+if ($foundDomain == 0 && length($domain) > 0) {
+ print RESOLV $domain;
+}
close (RESOLV);
diff --git a/templates/interfaces/tunnel/node.def b/templates/interfaces/tunnel/node.def
new file mode 100644
index 00000000..8d8cc029
--- /dev/null
+++ b/templates/interfaces/tunnel/node.def
@@ -0,0 +1,11 @@
+tag:
+type: txt
+help: "Configure a tunnel interface"
+syntax: $(@) in "tun0", "tun1", "tun2", "tun3", "tun4", "tun5", "tun6", "tun7", "tun8", "tun9" ; "Must be (tun0 - tun9)"
+commit: $(./local-ip/) != "" ; "Must configure the tunnel local-ip"
+commit: $(./remote-ip/) != "" ; "Must configure the tunnel remote-ip"
+commit: $(./encapsulation/) != "" ; "Must configure the tunnel encapsulation"
+create: "sudo ip tunnel add $(@) local $(./local-ip/@) remote $(./remote-ip/@) mode $(./encapsulation/@)"
+create: "sudo ip link set $(@) up"
+delete: "sudo ip tunnel del $(@)"
+#comp_help: "Enter tunnel interface name (tun0 - tun9)"
diff --git a/templates/interfaces/tunnel/node.tag/address/node.def b/templates/interfaces/tunnel/node.tag/address/node.def
new file mode 100644
index 00000000..6cef105c
--- /dev/null
+++ b/templates/interfaces/tunnel/node.tag/address/node.def
@@ -0,0 +1,6 @@
+multi:
+type: txt
+help: "Set IPv4 address and prefix for this interface"
+syntax: exec "/opt/vyatta/sbin/vyatta-interfaces.pl --valid-addr $(@) --dev $(../@)"
+update: "sudo /opt/vyatta/sbin/vyatta-interfaces.pl --eth-addr-update $(@) --dev $(../@)"; "Error setting address $(@) on dev $(../@)"
+delete: "sudo /opt/vyatta/sbin/vyatta-interfaces.pl --eth-addr-delete $(@) --dev $(../@)"; "Error deleting address $(@) on dev $(../@)"
diff --git a/templates/interfaces/tunnel/node.tag/description/node.def b/templates/interfaces/tunnel/node.tag/description/node.def
new file mode 100644
index 00000000..e443734d
--- /dev/null
+++ b/templates/interfaces/tunnel/node.tag/description/node.def
@@ -0,0 +1,2 @@
+type: txt
+help: "Description of this tunnel interface"
diff --git a/templates/interfaces/tunnel/node.tag/disable/node.def b/templates/interfaces/tunnel/node.tag/disable/node.def
new file mode 100644
index 00000000..56199085
--- /dev/null
+++ b/templates/interfaces/tunnel/node.tag/disable/node.def
@@ -0,0 +1,3 @@
+help: "Disable interface"
+update: "sudo ip link set $(../@) down"; "Error disabling dev $(../@)"
+delete: "sudo ip link set $(../@) up"; "Error enabling dev $(../@)"
diff --git a/templates/interfaces/tunnel/node.tag/encapsulation/node.def b/templates/interfaces/tunnel/node.tag/encapsulation/node.def
new file mode 100644
index 00000000..b578c543
--- /dev/null
+++ b/templates/interfaces/tunnel/node.tag/encapsulation/node.def
@@ -0,0 +1,5 @@
+type: txt
+help: "Set the encapsulation of this tunnel interface"
+syntax: $(@) in "ipip", "gre", "sit"; "Must be (ipip, gre, sit)"
+#comp_help: "Select an encapsulation (gre, ipip, sit)"
+update: "sudo ip tunnel change $(../@) mode $(@)"
diff --git a/templates/interfaces/tunnel/node.tag/key/node.def b/templates/interfaces/tunnel/node.tag/key/node.def
new file mode 100644
index 00000000..3261229d
--- /dev/null
+++ b/templates/interfaces/tunnel/node.tag/key/node.def
@@ -0,0 +1,4 @@
+type: u32
+help: "Set the tunnel key"
+syntax: $(@) >= 0 && $(@) <= 999999; "Must be between 0-999999"
+update: "sudo ip tunnel change $(../@) key $(@)"
diff --git a/templates/interfaces/tunnel/node.tag/local-ip/node.def b/templates/interfaces/tunnel/node.tag/local-ip/node.def
new file mode 100644
index 00000000..6b306a3c
--- /dev/null
+++ b/templates/interfaces/tunnel/node.tag/local-ip/node.def
@@ -0,0 +1,3 @@
+type: ipv4
+help: "Enter the local IP address for this tunnel"
+
diff --git a/templates/interfaces/tunnel/node.tag/mtu/node.def b/templates/interfaces/tunnel/node.tag/mtu/node.def
new file mode 100644
index 00000000..80ea5b06
--- /dev/null
+++ b/templates/interfaces/tunnel/node.tag/mtu/node.def
@@ -0,0 +1,6 @@
+type: u32
+help: "Set the tunnel MTU"
+syntax: $(@) >= 64 && $(@) <= 8024; "Must be between 64-8024"
+update: "sudo ip link set $(../@) mtu $(@)"
+delete: "sudo ip link set $(../@) mtu 1476"
+
diff --git a/templates/interfaces/tunnel/node.tag/remote-ip/node.def b/templates/interfaces/tunnel/node.tag/remote-ip/node.def
new file mode 100644
index 00000000..b8713e46
--- /dev/null
+++ b/templates/interfaces/tunnel/node.tag/remote-ip/node.def
@@ -0,0 +1,2 @@
+type: ipv4
+help: "Enter the remote IP address for this tunnel"
diff --git a/templates/interfaces/tunnel/node.tag/tos/node.def b/templates/interfaces/tunnel/node.tag/tos/node.def
new file mode 100644
index 00000000..7e3d28ae
--- /dev/null
+++ b/templates/interfaces/tunnel/node.tag/tos/node.def
@@ -0,0 +1,5 @@
+type: u32
+help: "Set the tunnel type of service"
+syntax: $(@) >= 0 && $(@) <= 99; "Must be between 0-99"
+update: "sudo ip tunnel change $(../@) tos $(@)"
+delete: "sudo ip tunnel change $(../@) tos inherit"
diff --git a/templates/interfaces/tunnel/node.tag/ttl/node.def b/templates/interfaces/tunnel/node.tag/ttl/node.def
new file mode 100644
index 00000000..2cb09c73
--- /dev/null
+++ b/templates/interfaces/tunnel/node.tag/ttl/node.def
@@ -0,0 +1,5 @@
+type: u32
+help: "Set the tunnel time to live"
+syntax: $(@) >= 0 && $(@) <= 255; "Must be between 0-255"
+update: "sudo ip tunnel change $(../@) ttl $(@)"
+delete: "sudo ip tunnel change $(../@) ttl inherit"
diff --git a/templates/system/domain-name/node.def b/templates/system/domain-name/node.def
index 111061cd..4e3902dc 100644
--- a/templates/system/domain-name/node.def
+++ b/templates/system/domain-name/node.def
@@ -1,11 +1,9 @@
type: txt
help: "Configure system domain name"
syntax: pattern $(@) "^[-a-zA-Z0-9.]{0,63}$" ; "invalid domain name $(@)"
+
# also add localhost line into /etc/hosts (see host-name template)?
-update: "sudo sh -c \"if [ x$(@) == x ]; then exit 0; fi && \
-touch /etc/resolv.conf && \
-sed -i '/domain/d' /etc/resolv.conf && \
-echo \\\"domain\t $(@)\\\" >> /etc/resolv.conf\" "
+update: "sudo /opt/vyatta/sbin/vyatta_update_resolv.pl"
+
# also update localhost line in /etc/hosts (see host-name template)?
-delete: "sudo sh -c \"touch /etc/resolv.conf && \
-sed -i '/domain\\\\t $(@)/d' /etc/resolv.conf\" "
+delete: "sudo /opt/vyatta/sbin/vyatta_update_resolv.pl"