summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/install/install-get-partition8
-rwxr-xr-xscripts/rl-system.init8
-rwxr-xr-xscripts/snmp/vyatta-snmp-v3.pl19
-rwxr-xr-xscripts/snmp/vyatta-snmp.pl15
-rwxr-xr-xscripts/system/vyatta_interface_rescan2
-rwxr-xr-xscripts/system/vyatta_update_console.pl102
-rwxr-xr-xscripts/vyatta_net_name2
7 files changed, 90 insertions, 66 deletions
diff --git a/scripts/install/install-get-partition b/scripts/install/install-get-partition
index b17aa563..0ddbd443 100755
--- a/scripts/install/install-get-partition
+++ b/scripts/install/install-get-partition
@@ -195,6 +195,14 @@ check_for_new_raid () {
drives=$(cat /proc/partitions | awk '{ if ($4!="name") { print $4 } }' \
| egrep -v "[0-9]$" | egrep -v "^$")
+ for instdrv in $drives
+ do
+ if mount | grep iso9660 | grep -q $instdrv
+ then
+ drives=${drives//"$instdrv"/}
+ fi
+ done
+
numdrives=`echo $drives | wc -w`
# Need at least two drives for RAID-1. We don't yet have the code
diff --git a/scripts/rl-system.init b/scripts/rl-system.init
index 6a2b8d25..62eac9e7 100755
--- a/scripts/rl-system.init
+++ b/scripts/rl-system.init
@@ -98,8 +98,8 @@ clear_or_override_config_files ()
}
update_interface_config () {
- if [ -d /dev/.udev/vyatta ]; then
- $vyatta_sbindir/vyatta_interface_rescan /dev/.udev/vyatta $BOOTFILE
+ if [ -d /run/udev/vyatta ]; then
+ $vyatta_sbindir/vyatta_interface_rescan /run/udev/vyatta $BOOTFILE
fi
}
@@ -116,6 +116,10 @@ create_ssh_host_keys () {
syslog "Creating ssh v1 host key."
ssh-keygen -q -N '' -t rsa1 -f /etc/ssh/ssh_host_key
fi;
+ if [ ! -f "/etc/ssh/ssh_host_ed25519_key" ]; then
+ syslog "Creating ssh ed25519 host key."
+ ssh-keygen -q -N '' -t ed25519 -f /etc/ssh/ssh_host_ed25519_key
+ fi;
}
set_ipv6_params ()
diff --git a/scripts/snmp/vyatta-snmp-v3.pl b/scripts/snmp/vyatta-snmp-v3.pl
index 5cd1ab87..a2d738eb 100755
--- a/scripts/snmp/vyatta-snmp-v3.pl
+++ b/scripts/snmp/vyatta-snmp-v3.pl
@@ -27,7 +27,10 @@ use Socket;
use Socket6;
my $snmp_v3_level = 'service snmp v3';
-my $snmp_init = 'invoke-rc.d snmpd';
+my $snmp_restart = 'systemctl restart snmpd.service';
+my $snmp_stop = 'systemctl stop snmpd.service';
+my $snmp_start = 'systemctl start snmpd.service';
+my $snmp_reload = 'systemctl reload snmpd.service';
my $snmpd_conf = '/etc/snmp/snmpd.conf';
my $snmpd_usr_conf = '/usr/share/snmp/snmpd.conf';
my $snmpd_var_conf = '/var/lib/snmp/snmpd.conf';
@@ -35,7 +38,7 @@ my $snmpd_conf_tmp = "/tmp/snmpd.conf.$$";
my $snmpd_usr_conf_tmp = "/tmp/snmpd.usr.conf.$$";
my $snmpd_var_conf_tmp = "/tmp/snmpd.var.conf.$$";
my $versionfile = '/opt/vyatta/etc/version';
-my $local_agent = 'unix:/var/run/snmpd.socket';
+my $local_agent = 'unix:/run/snmpd.socket';
my $oldEngineID = "";
my $setserialno = "";
@@ -53,7 +56,7 @@ sub randhex {
}
sub snmpd_running {
- open( my $pidf, '<', "/var/run/snmpd.pid" )
+ open( my $pidf, '<', "/run/snmpd.pid" )
or return;
my $pid = <$pidf>;
close $pidf;
@@ -77,9 +80,7 @@ sub check_snmp_exit_code {
}
sub snmpd_stop {
- system(
-"start-stop-daemon --stop --exec /usr/sbin/snmpd --oknodo -R 2 > /dev/null 2>&1"
- );
+ system("$snmp_stop > /dev/null 2>&1");
if ( check_snmp_exit_code($?) ) {
print "ERROR: Can not stop snmpd!\n";
exit(1);
@@ -87,7 +88,7 @@ sub snmpd_stop {
}
sub snmpd_start {
- system("$snmp_init start > /dev/null 2>&1");
+ system("$snmp_start > /dev/null 2>&1");
if ( check_snmp_exit_code($?) ) {
print "ERROR: Can not start snmpd!\n";
exit(1);
@@ -95,7 +96,7 @@ sub snmpd_start {
}
sub snmpd_update {
- system("$snmp_init reload > /dev/null 2>&1");
+ system("$snmp_reload > /dev/null 2>&1");
if ( check_snmp_exit_code($?) ) {
print "ERROR: Can not reload snmpd!\n";
exit(1);
@@ -103,7 +104,7 @@ sub snmpd_update {
}
sub snmpd_restart {
- system("$snmp_init restart > /dev/null 2>&1");
+ system("$snmp_restart > /dev/null 2>&1");
if ( check_snmp_exit_code($?) ) {
print "ERROR: Can not restart snmpd!\n";
exit(1);
diff --git a/scripts/snmp/vyatta-snmp.pl b/scripts/snmp/vyatta-snmp.pl
index a5d0d836..5c4ff1d0 100755
--- a/scripts/snmp/vyatta-snmp.pl
+++ b/scripts/snmp/vyatta-snmp.pl
@@ -36,20 +36,21 @@ use Socket;
use Socket6;
my $mibdir = '/opt/vyatta/share/snmp/mibs';
-my $snmp_init = 'invoke-rc.d snmpd';
+my $snmp_start = 'systemctl start snmpd.service';
+my $snmp_stop = 'systemctl stop snmpd.service';
my $snmp_conf = '/etc/snmp/snmpd.conf';
my $snmp_client = '/etc/snmp/snmp.conf';
my $snmp_tmp = "/tmp/snmpd.conf.$$";
my $snmp_snmpv3_user_conf = '/usr/share/snmp/snmpd.conf';
my $snmp_snmpv3_createuser_conf = '/var/lib/snmp/snmpd.conf';
my $versionfile = '/opt/vyatta/etc/version';
-my $local_agent = 'unix:/var/run/snmpd.socket';
+my $local_agent = 'unix:/run/snmpd.socket';
my $password_file = '/config/snmp/superuser_pass';
my $snmp_level = 'service snmp';
sub snmp_running {
- open (my $pidf, '<', "/var/run/snmpd.pid")
+ open (my $pidf, '<', "/run/snmpd.pid")
or return;
my $pid = <$pidf>;
close $pidf;
@@ -61,12 +62,12 @@ sub snmp_running {
}
sub snmp_stop {
- system("$snmp_init stop > /dev/null 2>&1");
+ system("$snmp_stop > /dev/null 2>&1");
}
sub snmp_start {
# we must stop snmpd first for creating vyatta user
- system("$snmp_init stop > /dev/null 2>&1");
+ system("$snmp_stop > /dev/null 2>&1");
open (my $fh, '>', $snmp_tmp)
or die "Couldn't open $snmp_tmp - $!";
@@ -151,12 +152,12 @@ sub snmp_get_constants {
unshift @addr, $local_agent;
print "# autogenerated by vyatta-snmp.pl on $now\n";
- print "sysDescr $version\n";
+ print "sysDescr VyOS $version\n";
print "sysObjectID 1.3.6.1.4.1.44641\n";
print "sysServices 14\n";
print "master agentx\n"; # maybe needed by lldpd
print "agentaddress ", join(',',@addr), "\n";
- print "agentXPerms 0755 0755 quagga quaggavty\n";
+ print "agentXPerms 0755 0755\n";
# add hook to read IF-MIB::ifAlias from sysfs
print "pass .1.3.6.1.2.1.31.1.1.1.18 /opt/vyatta/sbin/if-mib-alias\n";
diff --git a/scripts/system/vyatta_interface_rescan b/scripts/system/vyatta_interface_rescan
index eb45da60..2e8ad8ca 100755
--- a/scripts/system/vyatta_interface_rescan
+++ b/scripts/system/vyatta_interface_rescan
@@ -98,7 +98,7 @@ sub get_phy {
return $1;
}
-# vyatta_net_name leaves files in /dev/.udev/vyatta
+# vyatta_net_name leaves files in /run/udev/vyatta
# the filename is the interface and the contents are the hardware id
sub interface_rescan {
my ($VYATTAUDEV, $BOOTFILE) = @_;
diff --git a/scripts/system/vyatta_update_console.pl b/scripts/system/vyatta_update_console.pl
index 7c36ec7f..93f6a232 100755
--- a/scripts/system/vyatta_update_console.pl
+++ b/scripts/system/vyatta_update_console.pl
@@ -26,6 +26,7 @@ use lib "/opt/vyatta/share/perl5";
use Vyatta::Config;
use File::Compare;
use File::Copy;
+use experimental 'smartmatch';
die "$0 expects no arguments\n" if (@ARGV);
@@ -44,59 +45,68 @@ sub update {
}
}
-my $INITTAB = "/etc/inittab";
-my $TMPTAB = "/tmp/inittab.$$";
+sub update_getty{
+ my $directory = "/etc/systemd/system";
+ my $config = new Vyatta::Config;
+ $config->setLevel("system console device");
+ my @ttys;
+
+ foreach my $tty ($config->listNodes()) {
+ push(@ttys, "serial-getty\@$tty.service");
+ }
+
+ opendir DIR, $directory or die "Couldn't open dir '$directory': $!";
+ while (my $file = readdir(DIR)) {
+ next unless ($file =~ /^serial-getty/);
+ if ( not $file ~~ @ttys ) {
+ system("systemctl stop $file");
+ if (-e "$directory/getty.target.wants/$file") {
+ unlink "$directory/getty.target.wants/$file"
+ or die "Failed to remove file $file: $!\n";
+ }
+ if (-e "$directory/$file") {
+ unlink "$directory/$file"
+ or die "Failed to remove file $file: $!\n";
+ }
+ system("systemctl daemon-reload");
+ }
+ }
+ closedir DIR;
-sub update_inittab {
- open(my $inittab, '<', $INITTAB)
- or die "Can't open $INITTAB: $!";
+ foreach my $tty ($config->listNodes()) {
+ my $SGETTY = "/lib/systemd/system/serial-getty\@.service";
+ my $TMPGETTY = "/etc/systemd/system/serial-getty\@$tty.service";
+ my $SYMGETTY = "/etc/systemd/system/getty.target.wants/serial-getty\@$tty.service";
- open(my $tmp, '>', $TMPTAB)
- or die "Can't open $TMPTAB: $!";
+ open(my $sgetty, '<', $SGETTY)
+ or die "Can't open $SGETTY: $!";
- # Clone original inittab but remove all references to serial lines
- # and Xen consoles
- print {$tmp} grep {!/^T|^# Vyatta|^h/} <$inittab>;
- close $inittab;
+ open(my $tmp, '>', $TMPGETTY)
+ or die "Can't open $TMPGETTY: $!";
- my $config = new Vyatta::Config;
- $config->setLevel("system console device");
+ my $speed = $config->returnValue("$tty speed");
+ if ($tty =~ /^hvc\d/) {
+ $speed = 38400 unless $speed;
+ } else {
+ $speed = 9600 unless $speed;
+ }
- print {$tmp} "# Vyatta console configuration (do not modify)\n";
-
- my $serial_id = 0;
- my $xen_id = 0;
-
- foreach my $tty ($config->listNodes()) {
- my $speed = $config->returnValue("$tty speed");
- if ($tty =~ /^hvc\d/) {
- $speed = 38400 unless $speed;
- printf {$tmp} "h%d:23:respawn:", $xen_id;
- printf {$tmp} "/sbin/getty %d %s\n", $speed, $tty;
- $xen_id++;
- } else {
- $speed = 9600 unless $speed;
- printf {$tmp} "T%d:23:respawn:", $serial_id;
- if ($config->exists("$tty modem")) {
- printf {$tmp} "/sbin/mgetty -x0 -s %d %s\n", $speed, $tty;
- } else {
- printf {$tmp} "/sbin/getty -L %s %d vt100\n", $tty, $speed;
- }
-
- # id field is limited to 4 characters
- if (++$serial_id >= 1000) {
- warn "Ignoring $tty only 1000 serial devices supported\n";
- last;
- }
- }
+ while (<$sgetty>) {
+ if (/^ExecStart=/) {
+ $_ =~ s/115200,38400,9600/$speed/g;
+ }
+ print {$tmp} $_;
}
+ close $sgetty;
close $tmp;
-
- if (update($INITTAB, $TMPTAB)) {
-
- # This is same as telinit q - it tells init to re-examine inittab
- kill 1, 1;
+ symlink("$TMPGETTY","$SYMGETTY");
+ system("systemctl daemon-reload");
+ if ( system("systemctl status serial-getty\@$tty.service 2>&1 > /dev/null")) {
+ system("systemctl start serial-getty\@$tty.service");
+ } else {
+ system("systemctl restart serial-getty\@$tty.service");
}
+ }
}
my $GRUBCFG = "/boot/grub/grub.cfg";
@@ -135,7 +145,7 @@ sub update_grub {
update($GRUBCFG, $GRUBTMP);
}
-update_inittab;
+update_getty;
update_grub;
exit 0;
diff --git a/scripts/vyatta_net_name b/scripts/vyatta_net_name
index 90dd8615..53ae9fba 100755
--- a/scripts/vyatta_net_name
+++ b/scripts/vyatta_net_name
@@ -23,7 +23,7 @@ use Fcntl qw(:flock);
my $BOOTFILE = "/opt/vyatta/etc/config/config.boot";
my $VYATTACFG = "/opt/vyatta/config/active";
-my $UDEVDIR = "/dev/.udev/";
+my $UDEVDIR = "/run/udev/";
my $VYATTAUDEV = $UDEVDIR . "vyatta";
my $LOCKFILE = $UDEVDIR . ".vyatta-lock";
my $UDEVLOG = $UDEVDIR . "log/";