From d505471b655a775c531de93a3e6d72af9d03eb4c Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Thu, 14 Feb 2013 17:04:30 -0800 Subject: [PATCH] Add some general utilities and move files to files/ --- aliases => files/etc/aliases | 0 bashrc => files/etc/bashrc | 0 csh.cshrc => files/etc/csh.cshrc | 0 csh.login => files/etc/csh.login | 0 exports => files/etc/exports | 0 filesystems => files/etc/filesystems | 0 group => files/etc/group | 0 host.conf => files/etc/host.conf | 0 hosts => files/etc/hosts | 0 hosts.allow => files/etc/hosts.allow | 0 hosts.deny => files/etc/hosts.deny | 0 inputrc => files/etc/inputrc | 0 motd => files/etc/motd | 0 passwd => files/etc/passwd | 0 printcap => files/etc/printcap | 0 profile => files/etc/profile | 0 files/etc/profile.d/alias.bash | 3 + protocols => files/etc/protocols | 0 securetty => files/etc/securetty | 0 services => files/etc/services | 0 shells => files/etc/shells | 0 files/run/utmp | 0 files/usr/bin/chkconfig | 836 +++++++++++++++++++++++++++++++ files/usr/bin/filesize | 5 + files/usr/bin/mkinfodir | 373 ++++++++++++++ files/usr/bin/old | 41 ++ files/usr/bin/rpmlocate | 12 + files/usr/bin/safe-rm | 47 ++ files/usr/bin/safe-rmdir | 1 + files/usr/sbin/service | 192 +++++++ files/usr/sbin/setDefaultJava | 14 + files/usr/sbin/smart_agetty | 107 ++++ files/usr/sbin/sysconf_addword | 137 +++++ files/usr/share/man/man1/smart_agetty.1 | 52 ++ files/usr/share/man/man5/defaultdomain.5 | 55 ++ files/usr/share/man/man5/route.conf.5 | 32 ++ files/usr/share/man/man7/init.d.7 | 295 +++++++++++ files/usr/share/man/man8/chkconfig.8 | 233 +++++++++ files/usr/share/man/man8/quick_halt.8 | 21 + files/usr/share/man/man8/resolv+.8 | 152 ++++++ files/usr/share/man/man8/safe-rm.8 | 32 ++ files/usr/share/man/man8/safe-rmdir.8 | 1 + files/usr/share/man/man8/service.8 | 39 ++ files/var/log/btmp | 0 files/var/log/faillog | 0 files/var/log/lastlog | 0 files/var/log/wtmp | 0 packaging/setup.spec | 32 +- shadowconvert.sh | 6 +- 49 files changed, 2698 insertions(+), 20 deletions(-) rename aliases => files/etc/aliases (100%) rename bashrc => files/etc/bashrc (100%) rename csh.cshrc => files/etc/csh.cshrc (100%) rename csh.login => files/etc/csh.login (100%) rename exports => files/etc/exports (100%) rename filesystems => files/etc/filesystems (100%) rename group => files/etc/group (100%) rename host.conf => files/etc/host.conf (100%) rename hosts => files/etc/hosts (100%) rename hosts.allow => files/etc/hosts.allow (100%) rename hosts.deny => files/etc/hosts.deny (100%) rename inputrc => files/etc/inputrc (100%) rename motd => files/etc/motd (100%) rename passwd => files/etc/passwd (100%) rename printcap => files/etc/printcap (100%) rename profile => files/etc/profile (100%) create mode 100644 files/etc/profile.d/alias.bash rename protocols => files/etc/protocols (100%) rename securetty => files/etc/securetty (100%) rename services => files/etc/services (100%) rename shells => files/etc/shells (100%) create mode 100644 files/run/utmp create mode 100755 files/usr/bin/chkconfig create mode 100755 files/usr/bin/filesize create mode 100755 files/usr/bin/mkinfodir create mode 100755 files/usr/bin/old create mode 100755 files/usr/bin/rpmlocate create mode 100755 files/usr/bin/safe-rm create mode 120000 files/usr/bin/safe-rmdir create mode 100755 files/usr/sbin/service create mode 100755 files/usr/sbin/setDefaultJava create mode 100755 files/usr/sbin/smart_agetty create mode 100755 files/usr/sbin/sysconf_addword create mode 100644 files/usr/share/man/man1/smart_agetty.1 create mode 100644 files/usr/share/man/man5/defaultdomain.5 create mode 100644 files/usr/share/man/man5/route.conf.5 create mode 100644 files/usr/share/man/man7/init.d.7 create mode 100644 files/usr/share/man/man8/chkconfig.8 create mode 100644 files/usr/share/man/man8/quick_halt.8 create mode 100644 files/usr/share/man/man8/resolv+.8 create mode 100644 files/usr/share/man/man8/safe-rm.8 create mode 120000 files/usr/share/man/man8/safe-rmdir.8 create mode 100644 files/usr/share/man/man8/service.8 create mode 100644 files/var/log/btmp create mode 100644 files/var/log/faillog create mode 100644 files/var/log/lastlog create mode 100644 files/var/log/wtmp diff --git a/aliases b/files/etc/aliases similarity index 100% rename from aliases rename to files/etc/aliases diff --git a/bashrc b/files/etc/bashrc similarity index 100% rename from bashrc rename to files/etc/bashrc diff --git a/csh.cshrc b/files/etc/csh.cshrc similarity index 100% rename from csh.cshrc rename to files/etc/csh.cshrc diff --git a/csh.login b/files/etc/csh.login similarity index 100% rename from csh.login rename to files/etc/csh.login diff --git a/exports b/files/etc/exports similarity index 100% rename from exports rename to files/etc/exports diff --git a/filesystems b/files/etc/filesystems similarity index 100% rename from filesystems rename to files/etc/filesystems diff --git a/group b/files/etc/group similarity index 100% rename from group rename to files/etc/group diff --git a/host.conf b/files/etc/host.conf similarity index 100% rename from host.conf rename to files/etc/host.conf diff --git a/hosts b/files/etc/hosts similarity index 100% rename from hosts rename to files/etc/hosts diff --git a/hosts.allow b/files/etc/hosts.allow similarity index 100% rename from hosts.allow rename to files/etc/hosts.allow diff --git a/hosts.deny b/files/etc/hosts.deny similarity index 100% rename from hosts.deny rename to files/etc/hosts.deny diff --git a/inputrc b/files/etc/inputrc similarity index 100% rename from inputrc rename to files/etc/inputrc diff --git a/motd b/files/etc/motd similarity index 100% rename from motd rename to files/etc/motd diff --git a/passwd b/files/etc/passwd similarity index 100% rename from passwd rename to files/etc/passwd diff --git a/printcap b/files/etc/printcap similarity index 100% rename from printcap rename to files/etc/printcap diff --git a/profile b/files/etc/profile similarity index 100% rename from profile rename to files/etc/profile diff --git a/files/etc/profile.d/alias.bash b/files/etc/profile.d/alias.bash new file mode 100644 index 0000000..e1e8a81 --- /dev/null +++ b/files/etc/profile.d/alias.bash @@ -0,0 +1,3 @@ + + +alias rehash='hash -r' diff --git a/protocols b/files/etc/protocols similarity index 100% rename from protocols rename to files/etc/protocols diff --git a/securetty b/files/etc/securetty similarity index 100% rename from securetty rename to files/etc/securetty diff --git a/services b/files/etc/services similarity index 100% rename from services rename to files/etc/services diff --git a/shells b/files/etc/shells similarity index 100% rename from shells rename to files/etc/shells diff --git a/files/run/utmp b/files/run/utmp new file mode 100644 index 0000000..e69de29 diff --git a/files/usr/bin/chkconfig b/files/usr/bin/chkconfig new file mode 100755 index 0000000..6da8ad0 --- /dev/null +++ b/files/usr/bin/chkconfig @@ -0,0 +1,836 @@ +#!/usr/bin/perl + +use strict; +use Getopt::Long; +use File::Temp 'tempfile'; + +my $initdir = '/etc/init.d'; +my $inetddir = '/etc/inetd.d'; +my $xinetddir = '/etc/xinetd.d'; +my @systemd_paths = ('/usr/lib/systemd/system', '/run/systemd/system', '/etc/systemd/system'); +my $systemd_binary_path = '/bin/systemd'; + +my %to_d = ( + '0' => 'rc0.d', '1' => 'rc1.d', '2' => 'rc2.d', '3' => 'rc3.d', + '4' => 'rc4.d', '5' => 'rc5.d', 'S' => 'rcS.d', 'B' => 'boot.d' +); + +# which files to skip in $initdir +my %skips_rc = map {$_ => 1} qw {rc rx skeleton powerfail boot halt reboot single boot.local halt.local}; + +# which services are known +my %known_rc = (); +my %known_inetd = (); +my %known_xinetd = (); +my %known_all = (); + +# +# get the contents of a directory +# +sub ls { + my $dir = shift; + + local *D; + return () unless opendir(D, $dir); + my @ret = grep {$_ ne '.' && $_ ne '..'} readdir(D); + closedir D; + return @ret; +} + +# +# unify an array +# +sub unify { + my %h = map {$_ => 1} @_; + return grep {delete $h{$_}} @_; +} + + +################################################################## +# runlevel part +################################################################## + +# which services are currently on? this is a cache to speed things up +# initialized by initlinks_rc(), used in getreal_rc() +my %links = (); +my %links_unknown = (); + +# +# +# calculate the default runlevels of a service by reading the +# insserv header. regexes taken from insserv.c +# +my %getdef_rc_cache = (); + +sub getdef_rc { + my $s = shift; + + return $getdef_rc_cache{$s} if exists $getdef_rc_cache{$s}; + my $file = "$initdir/$s"; + local *F; + if (!open(F, "<$file")) { + print STDERR "$file: $!\n"; + $getdef_rc_cache{$s} = undef; + return undef; + } + while () { + chomp; + if (/^#[[:blank:]]*default[-_]?start:[[:blank:]]*([[:print:][:blank:]]*)/i) { + my $ret = $1; + close F; + $ret =~ s/[[:blank:]]+//g; + my @ret = split('', $ret); + $ret = ''; + for (sort @ret) { + $_ = uc($_); + $ret .= $_ if /[0123456SB]/; + } + $getdef_rc_cache{$s} = $ret; + return $ret; + } + } + $getdef_rc_cache{$s} = '35'; + return '35'; +} + +# +# calculate the required services by reading the insserv header. +# regexes taken from insserv.c +# +sub getdeps_rc { + my $s = shift; + + my $file = "$initdir/$s"; + local *F; + open(F, "<$file") || return undef; + while () { + chomp; + if (/^#[[:blank:]]*required[-_]?start:[[:blank:]]*([[:print:][:blank:]]*)/i) { + my $ret = $1; + close F; + $ret =~ s/\s+$//; + return $ret; + } + } + return ''; +} + +# +# calculate the active runlevels of a service. Uses global %links +# hash. +# +sub getreal_rc { + my $s = shift; + + my $start = ''; + my $l; + initlinks_rc() if $links_unknown{$s}; + for $l (sort keys %links) { + $start .= $l if $links{$l}->{$s}; + } + return $start; +} + +# +# initializes global %links hash by scanning the link directories +# for each runlevel. +# +sub initlinks_rc { + my $l; + for $l (keys %to_d) { + my @links = grep {s/^S\d\d//} ls("$initdir/$to_d{$l}"); + $links{$l} = { map {$_ => 1} @links }; + } + %links_unknown = (); +} + +my $force; +my $allservices; + +# +# run insserv +# +sub insserv { + my @i = ("/sbin/insserv"); + push @i, "-f" if $force; + my $r = system(@i, @_); + if ($r == -1) { + printf STDERR "/sbin/insserv: $!\n"; + return undef; + } elsif ($r) { + printf STDERR "/sbin/insserv failed, exit code %d\n", $? >> 8; + return undef; + } + return 1; +} + + +################################################################## +# xinetd part +################################################################## + +# +# get the state of a xinetd service +# +sub getreal_xinetd { + my $s = shift; + + my $file = "$xinetddir/$s"; + local *F; + open(F, "<$file") || return undef; + my $dis = 1; + while () { + if (/^\s*service\s*\S/) { + if (!$dis) { + close F; + return 'X'; + } + $dis = 0; + } + if (/^\s*disable\s*=\s*yes/) { + $dis = 1; + next; + } + } + close F; + return $dis ? '' : 'X'; +} + +# +# change the state of a xinetd service +# +sub set_xinetd { + my $s = shift; + my $state = shift; + + if (!$known_xinetd{$s}) { + print STDERR "$s: not a xinetd service\n"; + return; + } + local *F; + local *N; + my $file = "$xinetddir/$s"; + if (!open(F, "<$file")) { + print STDERR "$file: $!\n"; + return; + } + if (!open(N, ">$file.chkconfig~")) { + print STDERR "$file.chkconfig~: $!\n"; + return; + } + while () { + if (/^\s*service\s*\S/) { + if (!/{/) { #} + print N $_; + $_ = ; + } + print N $_; + print N "\tdisable = yes\n" unless $state; + next; + } + print N $_ unless /^\s*disable\s*=\s*yes/; + } + close F; + if (!close N) { + print STDERR "$file.chkconfig~: $!\n"; + unlink("$file.chkconfig~"); + return; + } + if (!rename("$file.chkconfig~", "$file")) { + print STDERR "rename $file.chkconfig~ $file: $!\n"; + unlink("$file.chkconfig~"); + return; + } + return 1; +} + + +################################################################## +# inetd part +################################################################## + +# +# get the state of a inetd service +# +sub getreal_inetd { + my $s = shift; + + my $file = "$inetddir/$s"; + local *F; + open(F, "<$file") || return undef; + while () { + chomp; + next if /^\s*#/; + next if /^\s*$/; + close F; + return 'T'; + } + close F; + return ''; +} + +# +# does the line look like a inetd service? +# +sub looks_ok_inetd { + return 1 if $_[0] =~ /^![\|<]/; + my @x = split(' ', $_[0]); + my %oktype = map {$_ => 1} qw{stream dgram raw rdm seqpacket}; + return 0 unless $oktype{$x[1]}; + return 0 unless $x[3] =~ /^(no)?wait/; + return 1; +} + +# +# change the state of a inetd service +# +sub set_inetd { + my $s = shift; + my $state = shift; + + if (!$known_inetd{$s}) { + print STDERR "$s: not an inetd service\n"; + return; + } + local *F; + local *N; + my $file = "$inetddir/$s"; + if (!open(F, "<$file")) { + print STDERR "$file: $!\n"; + return; + } + if (!open(N, ">$file.chkconfig~")) { + print STDERR "$file.chkconfig~: $!\n"; + return; + } + while () { + chomp; + if (/^#\s*(.*)/) { + my $l = $1; + if (looks_ok_inetd($l)) { + print N $state ? "$l\n" : "## $l\n"; + next; + } + } + if (!$state && looks_ok_inetd($_)) { + print N "# $_\n"; + next; + } + print N "$_\n"; + } + if (!close N) { + print STDERR "$file.chkconfig~: $!\n"; + unlink("$file.chkconfig~"); + return; + } + if (!rename("$file.chkconfig~", "$file")) { + print STDERR "rename $file.chkconfig~ $file: $!\n"; + unlink("$file.chkconfig~"); + return; + } + return 1; +} + + +################################################################## +# common functions +################################################################## + +# +# calculate current status +# +sub getcurrent { + my $s = shift; + + if (!$known_all{$s}) { + print STDERR "$s: unknown service\n"; + return undef; + } + my $start = ''; + $start .= getreal_rc($s) if $known_rc{$s}; + $start .= getreal_inetd($s) if $known_inetd{$s}; + $start .= getreal_xinetd($s) if $known_xinetd{$s}; + return $start; +} + + +# +# return all services we know about by scanning $initdir for init +# scripts. +# +sub findknown { + for (ls($initdir)) { + next unless -f "$initdir/$_"; + next if /^README/ || /^core/; + next if /~$/ || /^[\d\$\.#_\-\\\*]/ || /\.(rpm|ba|old|new|save|swp|core)/; + $known_rc{$_} = 1; + $known_all{$_} = 1; + } + for (ls($xinetddir)) { + next unless -f "$xinetddir/$_"; + next if /~$/ || /\./; + $known_xinetd{$_} = 1; + $known_all{$_} = 1; + } + return unless -d $inetddir; + return unless -f "/etc/inetd.conf"; + local *F; + my $gotinetd = 0; + if (!open(F, ") { + chomp; + if (/^!\|\s*\/usr\/lib\/inetd\/includedir\s+\Q$inetddir\E\s*$/) { + $gotinetd = 1; + last; + } + } + close F; + return unless $gotinetd; + for (ls($inetddir)) { + next unless -f "$inetddir/$_"; + next if /~$/ || /\./; + $known_inetd{$_} = 1; + $known_all{$_} = 1; + } +} + +# +# normalize runlevel +# +my $level; # overwrite on with $level + +sub normalize { + my $s = shift; + my $rl = shift; + + $rl = lc($rl); + return '' if $rl eq 'off' || $rl eq ''; + my $def = '35'; + $def = 'inetd' if $known_inetd{$s}; + $def = 'xinetd' if $known_xinetd{$s}; + $def = getdef_rc($s) if $known_rc{$s}; + return undef unless defined $def; + $rl = ",$rl,"; + $rl =~ s/,on,/,$level,/g if defined $level; + $rl =~ s/,on,/,$def,/g; + $rl =~ s/,xinetd,/,X,/g; + $rl =~ s/,inetd,/,T,/g; + $rl =~ s/s/S/g; + $rl =~ s/b/B/g; + $rl =~ s/,//g; + $rl = join('', sort unify(split('', $rl))); + if ($rl =~ /([^0123456SBTX])/) { + print STDERR "illegal runlevel specified for $s: $1\n"; + return undef; + } + return $rl; +} + +# +# convert runlevels into a nice human readable form +# +sub readable { + my $s = shift; + my $rl = shift; + + return 'off' if $rl eq ''; + my $def = ''; + $def = getdef_rc($s) if $known_rc{$s}; + return undef unless defined $def; + $rl = ",$rl,"; + $rl =~ s/T/,inetd,/g; + $rl =~ s/X/,xinetd,/g; + $rl =~ s/,\Q$def\E,/,on,/ if $def ne ''; + $rl =~ s/,,+/,/g; + $rl =~ s/^,//; + $rl =~ s/,$//; + return $rl; +} + +# +# check if systemd is active +# +sub is_systemd_active { + my $cgroup_dev; + my $systemd_dev; + my $st; + + use File::stat; + $st = lstat("/sys/fs/cgroup") or return 0; + $cgroup_dev = $st->dev; + $st = lstat("/sys/fs/cgroup/systemd") or return 0; + $systemd_dev = $st->dev; + return 0 if ($cgroup_dev == $systemd_dev); + -e $systemd_binary_path or return 0; + return 1; +} + +sub is_overriden_by_systemd { + my $service = shift; + my $root = shift; + for my $path (@systemd_paths) { + return $path if -e "$root/$path/$service.service"; + } + return undef; +} + +sub systemd_get_enabled { + my $service = shift; + my $root = shift; + my $unit = "$service.service"; + my $ret; + my $root_option; + $root_option = "--root $root" if $root ne "/" ; + #print STDERR "Note: Forwarding request to 'systemctl is-enabled $unit'.\n"; + $ret = system ("systemctl -q $root_option is-enabled $unit"); + return $ret==0?'on':'off'; +} + +sub forward_to_systemd { + my $service = shift; + my $verb = shift; + my $root = shift; + + return unless is_overriden_by_systemd ($service,$root); + + my $unit = "$service.service"; + my $ret; + my $root_option; + #print STDERR "Note: Forwarding request to 'systemctl $verb $unit'.\n"; + $root_option = "--root $root" unless $root eq "/" ; + $ret = system ("systemctl $root_option $verb $unit"); + return $ret == 0; +} + + + +################################################################## +# main program +################################################################## + +my $mode = ''; +my $printdeps; +my $root = '/'; + +sub addmode { + die("Please specify only one mode.\n") if $mode; + $mode = substr($_[0], 0, 1); +} + +sub usage { + print < ... use as the root file system +EOF +} + +Getopt::Long::Configure('no_ignore_case'); + +if (!GetOptions('list|l' => \&addmode, + 'terse|t' => \&addmode, + 'add|a' => \&addmode, + 'del|d' => \&addmode, + 'edit|e' => \&addmode, + 'help|h' => \&addmode, + 'set|s' => \&addmode, + 'check|c' => \&addmode, + 'level=s' => \$level, + 'force|f' => \$force, + 'allservices|A' => \$allservices, + 'deps' => \$printdeps, + 'root=s' => \$root + + )) { + usage(); + exit 1; +} +if ($mode eq 'h') { + usage(); + exit 0; +} +my (@services, $s); +my (@remove, $s); +my (@enable, $s); + +$initdir = "$root/etc/init.d"; +$inetddir = "$root/etc/inetd.d"; +$xinetddir = "$root/etc/xinetd.d"; + +findknown(); + +if (@ARGV) { + @services = @ARGV; + $mode = @services == 1 ? 't' : 's' if $mode eq ''; +} else { + die("Please specify a service\n") if $mode eq 'c' || $mode eq 'a' || $mode eq 'd'; + @services = sort grep {!$skips_rc{$_}} keys %known_all if $mode ne 's'; +} +$mode = 't' if $mode eq ''; + +initlinks_rc() if $mode eq 'e' || $mode eq 't' || $mode eq 's' || $mode eq 'c' || $mode eq 'l'; + +if (!@ARGV && !$allservices) { + my $l; + my %ison; + for $l (0, 1, 2, 3, 4, 5, 6) { + $ison{$_} = 1 for keys %{$links{$l}}; + } + @services = grep {!/^boot\./ || $ison{$_}} @services; +} + +my %current = (); + +if ($mode eq 'c') { + die("Please specify only one service to check\n") if @services > 2; + $s = $services[0]; + my $want; + if (@services == 1) { + $want = `/sbin/runlevel`; + chomp($want); + die("Can't determine current runlevel\n") unless $want =~ s/^. (.)$/$1/; + } else { + $want = $services[1]; + } + $want = normalize($s, $want); + exit 1 unless defined $want; + exit 0 if $want eq ''; + my $l; + for $l (split('', $want)) { + if ($l eq 'T') { + exit 1 unless getreal_inetd($s) ne ''; + next; + } + if ($l eq 'X') { + exit 1 unless getreal_xinetd($s) ne ''; + next; + } + exit 1 unless $links{$l}->{$s}; + } + exit 0; +} + +if ($mode eq 'e' || $mode eq 't') { + my ($fh, $tmpname); + my $maxlen = 0; + $maxlen >= length($_) or $maxlen = length($_) for @services; + if ($mode eq 'e') { + ($fh, $tmpname) = tempfile("chkconfig.XXXXX", DIR => '/tmp', UNLINK => 1); + die("Could not create temporary file\n") unless $tmpname ne ''; + } else { + $fh = *STDOUT; + } + for $s (@services) { + $current{$s} = getcurrent($s); + next unless defined $current{$s}; + my $r = readable($s, $current{$s}); + next unless defined $r; + if (is_overriden_by_systemd($s, $root)) { + $r = systemd_get_enabled($s, $root); + } + printf $fh "%-*s %s\n", $maxlen, $s, $r; + } + exit 0 unless $mode eq 'e'; + close $fh; + system("\${VISUAL:-vi} $tmpname"); + open(STDIN, "<$tmpname") or die("Could not open temporary file\n"); + $mode = 's'; + @services = (); +} + +if ($mode eq 's') { + my $status = 0; + my $usestdin = !@services; + my $ln = 0; + do { + if ($usestdin) { + while () { + $ln++; + chomp; + next if /^\s*#/; + next if /^\s*$/; + my @line = split(' ', $_); + if (@line != 2) { + print STDERR "parse error line $ln: $_\n"; + $status = 1; + next; + } + @services = @line; + last; + } + exit 1 unless @services; + } + if (@services & 1) { + printf("Usage: chkconfig -s service on|off|runlevels\n"); + exit 1; + } + @remove = (); + @enable = (); + while (@services) { + $s = shift @services; + my $want = shift @services; + $want = normalize($s, $want); + $status = 1, next unless defined $want; + if (is_overriden_by_systemd ($s,$root)) { + if ($want ne "") { + $status = 1 unless forward_to_systemd($s, 'enable', $root); + } else { + $status = 1 unless forward_to_systemd($s, 'disable', $root); + } + next; + } + $current{$s} = getcurrent($s) unless defined $current{$s}; + $status = 1, next unless defined $current{$s}; + my $current = $current{$s}; + next if $want eq $current; + delete $current{$s}; + if (($want =~ /T/) && ($current !~ /T/)) { + $status = 1 unless set_inetd($s, 1); + } elsif (($want !~ /T/) && ($current =~ /T/)) { + $status = 1 unless set_inetd($s, 0); + } + if (($want =~ /X/) && ($current !~ /X/)) { + $status = 1 unless set_xinetd($s, 1); + } elsif (($want !~ /X/) && ($current =~ /X/)) { + $status = 1 unless set_xinetd($s, 0); + } + $want =~ s/[TX]//g; + $current =~ s/[TX]//g; + next if $want eq $current; + + if (!$known_rc{$s}) { + print STDERR "$s: not a runlevel service\n"; + $status = 1; + next; + } + if ($want eq '') { + push @remove, $s; + } elsif ($want eq getdef_rc($s)) { + push @enable, $s; + } else { + push @remove, $s; + push @enable, "$s,start=".join(',', split('', $want)); + } + $links_unknown{$s} = 1; # check again for this service + } + if (scalar(@remove)) { + $status = 1 unless insserv('-r', '-d', '-p', "$initdir", @remove); + } + if (scalar(@enable)) { + $status = 1 unless insserv('-p', "$initdir", @enable); + } + } while ($usestdin); + exit $status; +} + +# +# compatibility section +# +my $status = 0; +if ($mode eq 'a' || $mode eq 'd') { + for $s (splice @services) { + if (!$known_all{$s}) { + print STDERR "$s: unknown service\n"; + $status = 1; + next; + } + if (!$known_rc{$s}) { + print STDERR "$s: not a runlevel service\n"; + $status = 1; + next; + } + push @services, $s; + } + if (!$status) { + for $s (splice @services) { + if (is_overriden_by_systemd($s,$root)) { + if ($mode eq 'a') { + forward_to_systemd($s, 'enable', $root); + } else { + forward_to_systemd($s, 'disable', $root); + } + } else { + push @services, $s; + } + } + if (scalar(@services)) { + if ($mode eq 'a') { + insserv('-p', "$initdir", @services) or $status = 1; + } else { + insserv('-p', "$initdir", '-r', @services) or $status = 1; + } + } + } + $mode = 'l'; + initlinks_rc(); +} +if ($mode eq 'l') { + my $usecolor = -t STDOUT; + if (is_systemd_active()) { + print STDERR <{$s}; + if ($usecolor) { + print $links{$l}->{$s} ? " \e[0;1;32m$l:on\e[m " : " $l:off"; + } else { + print $links{$l}->{$s} ? " $l:on " : " $l:off"; + } + } + print getdeps_rc($s) if $printdeps; + print "\n"; + } + my @inetd_services = grep {$known_inetd{$_}} @services; + if (@inetd_services) { + print "inetd based services:\n"; + for $s (@inetd_services) { + printf " %-19s ", "$s:"; + if (getreal_inetd($s) ne '') { + print $usecolor ? "\e[0;1;32mon\e[m\n" : "on\n"; + } else { + print "off\n"; + } + } + } + my @xinetd_services = grep {$known_xinetd{$_}} @services; + if (@xinetd_services) { + print "xinetd based services:\n"; + for $s (@xinetd_services) { + printf " %-19s ", "$s:"; + if (getreal_xinetd($s) ne '') { + print $usecolor ? "\e[0;1;32mon\e[m\n" : "on\n"; + } else { + print "off\n"; + } + } + } + exit($status); +} diff --git a/files/usr/bin/filesize b/files/usr/bin/filesize new file mode 100755 index 0000000..9cc676a --- /dev/null +++ b/files/usr/bin/filesize @@ -0,0 +1,5 @@ +#!/bin/sh +# +# Print the size of a file, in bytes. +# +stat -c %s "$1" diff --git a/files/usr/bin/mkinfodir b/files/usr/bin/mkinfodir new file mode 100755 index 0000000..7873b41 --- /dev/null +++ b/files/usr/bin/mkinfodir @@ -0,0 +1,373 @@ +#!/usr/bin/perl +# Copyright (c) 1996-2003 SuSE Linux AG, Nuernberg, Germany. +# All rights reserved. +# +# Author: Werner Fink , 1996,1997,2003 +# +# MAKEDIR.perl --- Version 0.54 +# + +use bytes; + +if ( $#ARGV > 0 ) { + printf(STDERR "%s: Usage:\n", $0); + printf(STDERR " %s [info_dir_file]\n", $0); exit(1); +} + +if ( length($ENV{'INFOPATH'}) > 0 ) { + @PATHS = split(/:/, $ENV{'INFOPATH'}); +} +@PATHS=( +# +# /usr/share/info is the first in Path because it's our main info dir! +# + "/usr/share/info", + "/usr/info", +# +# Insert INFOPATH +# + @PATHS, + "/usr/lib/info", +# +# TeTeX-Infos are looked in by symbolic links in /usr/info. +# +# "/usr/lib/teTeX/info", + "/usr/local/info", + "/usr/local/lib/info", + "/usr/X11R6/info", + "/usr/X11R6/lib/info", +# +# xemacs has big problems handling nodes of the same name but +# different paths ... it's really buggy. +# + "/usr/X11R6/lib/xemacs/info", + "/usr/share/xemacs/xemacs-packages/info", + "/usr/share/xemacs/mule-packages/info", + "/usr/share/xemacs/info", +); +# +# Special: flushing file descriptor for speed, smothing, and big results +# +sub flush { + local($old) = select(shift); + $| = 1; + print ""; + $| = 0; + select($old); +} + +# +# Open the main dir file +# +$rand = int(rand(32767)); +if ( $#ARGV == 0 ) { + $mdir = "$ARGV[0]"; + $mdirbak = "$ARGV[0].bak"; + $mdirtmp = "$ARGV[0].tmp$$.$rand"; +} else { + $mdir = "$PATHS[0]/dir"; + $mdirbak = "$PATHS[0]/dir.bak"; + $mdirtmp = "$PATHS[0]/dir.tmp$$.$rand"; +} + +sub cleanup { + unlink $mdirtmp; + exit(1); +} +$SIG{'INT'} = "cleanup"; +$SIG{'TERM'} = "cleanup"; +$SIG{'HUP'} = "cleanup"; +$SIG{'PIPE'} = 'IGNORE'; + +if ( !-e $mdir ) { `touch $mdir 2>&1 /dev/null`; } + +if ( -w $mdir ) { + # sysopen(FH, $mdirtmp, O_RDWR|O_CREAT|O_EXCL) or die "Cannot create $mdirtmp\n"; + # close(FH); + if ( -s $mdir && !-e $mdirbak ) { + `cp -p $mdir $mdirbak`; + if ( !-e $mdirbak ) { exit(1); } + } + `cp -p $mdir $mdirtmp`; + if ( !-e $mdirtmp ) { exit(1); } + $filehandle = ">$mdir" ; +} else { + printf(STDERR "%s: Warning, can not write to %s\n", $0, $mdir); + printf(STDERR " ... using STDOUT!\n"); + flush(STDERR); + sleep (2); + $filehandle = ">-"; +} + +## +## read info dir +## +@allinfo = (); +%found = (); +for ( @PATHS ) { + @info = (); + $found{$_}++; + if ( $found{$_} > 1 ) { + next; + } + (-e $_) && (@info = ( -d $_ ) ? ( <$_/*> ) : ( $_ )); + @info = grep(/[^0-9](|\.gz)$/, @info); + @info = grep(!/(dir|dir\.bak|localdir|\~|\,v|\.orig)(|\.gz)$/, @info); + @info = sort grep(!/-\d+\./, @info); + push(@allinfo, @info); +} + +sub basename { + local($name) = @_; + $name =~ s!.*/!!; + $name =~ s/\.gz//; + $name =~ s/\.info//; + $name =~ s/\+/\\\\+/g; + + return ($name); +} + +sub path { + local($name) = @_; + $name =~ s!\/[^/]*$!!; + + return ($name); +} + +## +## +## Global section titles used as keys +## +## +@sec = (); + +# +# Reformat if required +# +sub do_format { + local($node, @buf) = @_; + local($base) = basename($node); + local($path) = path($node); + local($name) = ""; + local($desc) = ""; + local($link) = ""; + local($l, $first, @ent); + + $node =~ s/\.gz$//; + $node =~ s/\.info$//; + $node =~ s!//!/!g; + + if ( $path =~ /^$PATHS[0]$/ ) { $node = $base; } + + @ent = (); + foreach $l (@buf) { + $first = index($l,"*"); + + $l =~ s/\($base\)/\($node\)/g; + $l =~ s/::/: \($node\)\./g; + + $name = ""; + $desc = ""; + $link = ""; + + ($name,$desc) = split(/\.\s+/,"$l"); + + $name =~ s/\n//g; + $name =~ s/\s+$//g; + $name =~ s/^\s+//g; + + $desc =~ s/\n//g; + $desc =~ s/\s+$//g; + $desc =~ s/^\s+//g; + + if ( $first == 0 ) { + $l =~ s/^(\s+)//g; + ($name, $link) = split(/:/, $name); + $name =~ s/\s+$//g; + $link =~ s/^\s+//g; + $link =~ s/\.$//g; + $name = $name . ':' . ' ' . $link . '.'; + if ( length($l) > 80 ) { + if ( length($name) < 16 && length($desc) < 62) { + $l = sprintf("%-16.18s%s", $name, $desc); + } else { + if ( length($desc) > 0 ) { + $l = sprintf("%s\n\t\t%s", $name, $desc); + } else { + $l = sprintf("%s", $name); + } + } + } + } + push(@ent, $l); + } + return join("\n", @ent); +} + +# +# No info for entry found, use old or make a new one +# +sub guess_missed { + local($node) = @_; + local($base) = basename($node); + local($path) = path($node); + local($cur) = "default"; + local($ldir); + local(@buf, $add, $lines); + + $node =~ s/\.gz$//; + $node =~ s/\.info$//; + $node =~ s!//!/!g; + + if ( $path =~ /^$PATHS[0]$/ ) { $node = $base; } + + if ( $path !~ /^$PATHS[0]$/ ) { + $ldir = "$path/dir"; + } else { + $ldir = $mdirtmp; + } + + @buf = (); + if ( -e $ldir && -r $ldir ) { + open(FILE, $ldir); + $add = 0; + while () { + # + # read next few lines if there is information ($add == 1) + # + if ( $add == 1 ) { + if ( /^\s+[^\:\*]+$/ ) { + push(@buf, $_); $lines++; + next; + } + last; + } + if ( /^\*\s+$base\:\s+\($base\)\.\s+\w/i ) { + $add = 1; push(@buf, $_); $lines = 1; + } elsif ( /^\*\s+$base\:\:\s+\w/i ) { + $add = 1; push(@buf, $_); $lines = 1; + } elsif ( /^\*\s+$base\:\s+\($base\)\.\s+$/i ) { + $add = 1; push(@buf, $_); $lines = 0; + } elsif ( /^\*\s+$base\:\:\s+$/i ) { + $add = 1; push(@buf, $_); $lines = 0; + } else { + next; + } + } + close(FILE); + } + + if ($lines > 0) { + $sec{$cur} = join("\n", $sec{$cur}, do_format($node, @buf)); + } else { + $base =~ s!(.*)!\L$1!; + $base =~ s!(.*)!\u$1!; + $base = '* ' . $base . ':'; + $sec{$cur} = join("\n", $sec{$cur}, + sprintf("%-0.80s %s\n", $base, '(' . $node . ').')); + } +} + +# +# read info file for entry in dir file +# +sub read_entry { + local($file) = @_; + local($add, $lines, @buf); + local($cur) = "default"; + local($source) = $file =~ /\.gz$/ ? "gunzip -q -d -c $file 2>/dev/null |" : "< $file"; + local(@buf); + + $add = 0; + $lines = 0; + @buf = (); + open(_FILE, $source) or warn "can't open $source\n"; + while (<_FILE>) { + chomp; + s/\s+$//; + last if ( /^($|File:)/ ); + next if ( /^$/ ); + if ( /^INFO-DIR-SECTION/o ) { + s/^INFO-DIR-SECTION\s+//; + $cur = $_; + next; + } + if ( /^START-INFO-DIR-ENTRY/o ) { + $add = 1; + push(@buf, "\n") if ( $cur =~ /default/ ); + next; + } + if ( /^END-INFO-DIR-ENTRY/o ) { + $add = 0; + $sec{$cur} = join("\n", $sec{$cur}, do_format($file, @buf)); + next; + } + if ( $add == 1 ) { + $lines++; + push(@buf, $_); + next; + } + } + close(_FILE); + + guess_missed($file) if ( $lines == 0 ); +} + +# +# Do all the stuff +# +foreach $elem (@allinfo) { + read_entry($elem) if ( -f $elem ); +} + +open(DIR, "$filehandle") or die "Cannot open $filehandle\n"; +binmode DIR; + +## +## define top format +## +format DIR = +-*- Text -*- +This is the file /usr/info/dir, which contains the topmost node of the +Info hierarchy. The first time you invoke Info you start off +looking at that node, which is (dir)Top. + +File: dir Node: Top This is the top of the INFO tree + + This (the Directory node) gives a menu of major topics. + + Usage in info-mode of EMACS: + Typing "d" returns here, typing "?" lists all INFO commands, + typing "q" exits, typing "h" gives a primer for first-timers, + pressing 2nd button on a highlighted word follows cross-reference. + + ---- AUTOCONFIGURED BY SuSEConfig: EDIT WITH CARE: ---- + ---- Only descriptive text for otherwise empty topics will survive ---- + +* Menu: The list of major topics begins on the next line. + +. +## +## end top format +## +write DIR; # write top format +flush(DIR); + +@sec = sort keys %sec; +@keys = keys %sec; + +while ($#keys >= 0) { + $cur = pop(@keys); + if ( $cur =~ /default/ ) { + printf(DIR "\nVarious Utilities"); + } else { + printf(DIR "\n%s", $cur); + } + printf(DIR "%s\n", $sec{$cur}); +} + +printf(DIR "\n* Locales:\n"); +close(DIR); + +unlink($mdirtmp) if ( -e $mdirtmp ); +exit 0; diff --git a/files/usr/bin/old b/files/usr/bin/old new file mode 100755 index 0000000..ef2e2b7 --- /dev/null +++ b/files/usr/bin/old @@ -0,0 +1,41 @@ +#!/bin/bash + +# +# This script simply renames files or directories to -[] +# +# Copyright (c) 1996-2002 SuSE Linux AG, Nuernberg, Germany. +# +# please send bugfixes or comments to http://www.suse.de/feedback. +# +# +# usage - tell user to use program +# + +usage() { + echo usage: "$0" file\|dir [file\|dir ...] +} + + +if [ $# -eq 0 ] ; then + usage + exit +fi + +DATESTRING=`date +"%Y%m%d"` + +for i in "$@" ; do + i=${i%%/} + if [ -e "$i" ] ; then + NEWNAME=$i-$DATESTRING + NUMBER=0 + while [ -e "$NEWNAME" ] ; do + NEWNAME=$i-$DATESTRING-$NUMBER + let NUMBER=$NUMBER+1 + done + echo moving "$i" to "$NEWNAME" + mv "$i" "$NEWNAME" + else + echo "$i" does not exist. + fi +done + diff --git a/files/usr/bin/rpmlocate b/files/usr/bin/rpmlocate new file mode 100755 index 0000000..cfb8c10 --- /dev/null +++ b/files/usr/bin/rpmlocate @@ -0,0 +1,12 @@ +#!/bin/sh +# +# Copyright (c) 1999 SuSE Linux AG, Nuernberg, Germany. All rights reserved. +# + +for i in $* ; do + echo Searching for "$i" in rpm db... + rpm -qal --qf "%{NAME}-%{VERSION}-%{RELEASE}:\n" | \ + grep "\(^[^/]\)\|\($i\)" | \ + awk '/^[^/]/ { pkg=$0; next } { if ( pkg ) { print "\n"pkg; pkg="" } print }' +done + diff --git a/files/usr/bin/safe-rm b/files/usr/bin/safe-rm new file mode 100755 index 0000000..ba200fc --- /dev/null +++ b/files/usr/bin/safe-rm @@ -0,0 +1,47 @@ +#!/bin/bash + +todo= +opts= +case "${0##*/}" in + safe-rm) todo=rm ; opts=-f ;; + safe-rmdir) todo=rmdir ; opts= ;; +esac + +set -o physical +test -n "$todo" || exit 2 +test -x /bin/$todo || exit 2 +test -x /bin/pwd || exit 2 + +for d; do + if [[ "$d" != /* ]] ; then + echo "usage: $0 _absolute_path_to_file" 1>&2 + exit 1 + fi + path=${d//\/.\//\/} + name=${path##*/} + + if test "/$name" = "$path" ; then + echo "$0: usage in root directory not allowed" 1>&2 + exit 1 + fi + path=${path%/*} + + if test -z "${path}" ; then + echo "$0: empty dirname not allowed" 1>&2 + exit 1 + fi + + if cd -P "${path}" && test "${path}" = "$(pwd -P)" ; then + + if test "$PWD" = "$(/bin/pwd)" ; then + /bin/$todo $opts -- "$name" + else + echo "$0: no symlinks allowed in the path of $d" 1>&2 + exit 1 + fi + + else + echo "$0: no symlinks allowed in the path of $d" 1>&2 + exit 1 + fi +done diff --git a/files/usr/bin/safe-rmdir b/files/usr/bin/safe-rmdir new file mode 120000 index 0000000..6517ab0 --- /dev/null +++ b/files/usr/bin/safe-rmdir @@ -0,0 +1 @@ +safe-rm \ No newline at end of file diff --git a/files/usr/sbin/service b/files/usr/sbin/service new file mode 100755 index 0000000..061b4b3 --- /dev/null +++ b/files/usr/sbin/service @@ -0,0 +1,192 @@ +#!/bin/bash +# +# /sbin/service Handle boot and runlevel services +# + +sd_booted() +{ + test -d /sys/fs/cgroup/systemd/ +} + +# +# Only root should do +# +if ! sd_booted && test "$(id -u)" -ne 0; then + echo "${0##*/}: only root can use ${0##*/}" 1>&2 + exit 1 +fi + +# +# Location of our service scripts +# +RCDIR="/etc/init.d" + +# +# Clean environment +# +PATH=/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin +test -n "$TERM" || TERM=raw +test -n "$SYSTEMD_NO_WRAP" && export SYSTEMD_NO_WRAP +LANG=POSIX +export PATH TERM LANG + +exec_rc () +{ + if sd_booted && test -z "$SYSTEMD_NO_WRAP"; then + case "$2" in + "") + echo "Usage: $0 "$1" {start|stop|reload|restart|try-restart|force-reload|status}" + return 1 + ;; + start|stop|reload|restart|try-restart|force-reload|status) + systemctl "$2" "$1.service" + return "$?" + ;; + esac + fi + local rc="${RCDIR}/$1" + shift + env -i LANG=$LANG PATH=$PATH TERM=$TERM SYSTEMD_NO_WRAP=$SYSTEMD_NO_WRAP "$rc" ${1+"$@"} +} + +check_rc () +{ + local rc="$1" + shift + if test -x ${RCDIR}/$rc; then + return 0 + fi + if sd_booted && systemctl --full --no-legend --no-pager --type=service --all list-units 2>/dev/null|grep -q "^$rc.service"; then + return 0 + fi + return 1 +} + +check_wrapper () +{ + local n="${0##*/}" + if test "${n#rc}" != "$n"; then + rc="${n#rc}" + return 0 + else + rc="$1" + return 1 + fi +} + +usage () +{ + echo "Usage: ${0##*/} [--help | --status-all | [| --full-restart]]" 1>&2 + exit 1 +} + +help () +{ + echo "Usage: ${0##*/} [ | [ | --full-restart]]" + echo "Available :" + echo " -h,--help This help." + echo " -s,--status-all List out status of all services." + echo "Usage for specific :" + echo " ${0##*/} service_name argument [option]" + echo " ${0##*/} service_name --full-restart" + echo " ${0##*/} --full-restart service_name" + exit 0 +} + + status_all=0 +full_restart=0 + args="" +while test $# -gt 0; do + opt= + if test "${1::1}" = "-"; then + if test ${#1} -gt 2 -a "${1::2}" = "--" ; then + opt="${1:2}" + else + opt="${1:1}" + fi + shift + else + args="${args:+$args }$1" + shift + continue + fi + + case "$opt" in + status-all|s) status_all=1 ;; + full-restart) full_restart=1 ;; + h*) help ;; + *) usage ;; + esac +done + +# +# Determine the status of all services +# +if test $status_all -gt 0 ; then + if test -n "$args" ; then + usage 1>&2 + exit 1 + fi + if sd_booted; then + systemctl --full --no-legend --no-pager --type=service list-units + else + for rc in ${RCDIR}/*; do + test ! -x "$rc" -o -d "$rc" && continue + rc=${rc##*/} + case "$rc" in + *.local|*.rpm*|*.ba*|*.old|*.new) continue ;; + *.dpkg|*.save|*.swp|*.core) continue ;; + *.disabled) continue ;; + boot|rc|single|halt|reboot) continue ;; + powerfail|rx|Makefile|README) continue ;; + skeleton|*.d) continue ;; + esac + exec_rc $rc status + done + fi + exit 0 +fi + +# +# Do a full restart of a few services +# +if test $full_restart -gt 0 ; then + if test -z "$args" ; then + usage 1>&2 + exit 1 + fi + for rc in $args; do + if check_rc $rc ; then + echo "${0##*/}: no such service $rc" 1>&2 + exit 1 + fi + done + status=0 + for rc in $args; do + exec_rc $rc stop + exec_rc $rc start + test $? -gt 0 && status=1 + done + exit $status +fi + + +# +# Execute single service with options +# +if test -z "${args}" ; then + usage 1>&2 + exit 1 +fi + +set -- $args +if ! check_wrapper "$@"; then + shift +fi +if ! check_rc "$rc" ; then + echo "${0##*/}: no such service $rc" 1>&2 + exit 1 +fi + +exec_rc $rc ${1+"$@"} +exit $? diff --git a/files/usr/sbin/setDefaultJava b/files/usr/sbin/setDefaultJava new file mode 100755 index 0000000..ff41056 --- /dev/null +++ b/files/usr/sbin/setDefaultJava @@ -0,0 +1,14 @@ +#!/bin/bash +# Copyright (c) 2000-2002 SuSE Linux AG, Nuernberg, Germany. +# All rights reserved. +# +# Author: Sonja Krause-Harder + +echo -e \ +'################################################################\n'\ +'# setDefaultJava is no longer supported. Please install the #\n'\ +'# package jpackage-utils and read the documentation in #\n'\ +'# /usr/share/doc/packages/jpackage-utils for information about #\n'\ +'# the new java packages on SUSE Linux. #\n'\ +'################################################################' + diff --git a/files/usr/sbin/smart_agetty b/files/usr/sbin/smart_agetty new file mode 100755 index 0000000..37ed0ba --- /dev/null +++ b/files/usr/sbin/smart_agetty @@ -0,0 +1,107 @@ +#!/bin/bash +# emulate: /sbin/agetty -L $speed console for console != vga/framebuffer console + +#echo "$0: called with '$*'" > /dev/kmsg + +stop_me () { + kill -STOP $$ + exit 1 +} + +kernel_console= +getty_options= +getty_device= +getty_speed= +getty_TERM= + +until [ "$#" = "0" ] ; do + case "$1" in + -i|-h|-L|-m|-n|-w) + getty_options="$getty_options $1" + shift + ;; + -*) + getty_options="$getty_options $1 $2" + shift 2 + ;; + *) + case "$1" in + [0-9]*) + getty_speed=$1 + getty_device=$2 + ;; + *) + getty_speed=$2 + getty_device=$1 + ;; + esac + getty_TERM=$3 + break + ;; + esac +done + +getty_speed=`stty speed < /dev/$getty_device` + +if test -z "$getty_speed" +then + echo "${0}: can not determine '$getty_device' speed" > /dev/kmsg + stop_me + exit 1 +fi + +guess_powerpc_autoconsole() { + local prop + if test -f /proc/device-tree/chosen/linux,stdout-path + then + prop=`cat /proc/device-tree/chosen/linux,stdout-path` + prop="${prop##*/}" + case "$prop" in + display@*) echo tty1 ;; + serial@3f8) echo ttyS0 ;; # maple + serial@i3f8) echo ttyS0 ;; + serial@i2f8) echo ttyS1 ;; + serial@i898) echo ttyS2 ;; + serial@i890) echo ttyS3 ;; + vty@0) echo hvc0 ;; + vty@30000000) echo hvsi0 ;; + vty@30000001) echo hvsi1 ;; + # some Exar and Jasmine PCI cards have serial@[0123] + # but since its pci, the ttyS# number cant be guessed + serial@0) echo ttyS0 ;; + *) echo "$0: unhandled stdout '$prop'" > /dev/kmsg ;; + esac + fi +} + +if test "$getty_device" = "console" +then + read kernel_cmdline < /proc/cmdline + for i in $kernel_cmdline '' + do + case "$i" in + console=*) + kernel_console="${i#*=}" + kernel_console="${kernel_console%%,*}" + ;; + esac + done + if test -z "$kernel_console" + then + # check SuSE TIOCGDEV, remove /dev/ + kernel_console="`showconsole < /dev/console`" + kernel_console="${kernel_console##*/}" + fi + if test -z "$kernel_console" + then + kernel_console="`guess_powerpc_autoconsole`" + fi + case "$kernel_console" in + tty[0-9]*) + stop_me + exit 1 + ;; + esac +fi + +exec /sbin/agetty $getty_options $getty_speed $getty_device $getty_TERM diff --git a/files/usr/sbin/sysconf_addword b/files/usr/sbin/sysconf_addword new file mode 100755 index 0000000..bdfcc3f --- /dev/null +++ b/files/usr/sbin/sysconf_addword @@ -0,0 +1,137 @@ +#!/bin/bash + +# Copyright 2005 Peter Poeml . All Rights Reserved. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + + +debug=false + +usage() { + cat <<-EOF + usage: $(basename $0) [-r] FILE VAR WORD + + Add word WORD to variable VAR in file FILE, or remove + it if the -r option is given. + + Example: + $(basename $0) /etc/sysconfig/apache2 APACHE_SERVER_FLAGS asdf + leads to the change: + -APACHE_SERVER_FLAGS="SSL STATUS ruby" + +APACHE_SERVER_FLAGS="SSL STATUS ruby asdf" + + If multiple lines matching ^VAR= are found (which happens to be a habit of + mine), only the last one is manipulated. + + It does not work for WORD starting with characters like a dash which + prevent word boundary matching. + + EOF +} + +find_last_occurrence () { + # takes two arguments, FILE and VAR + # and return the number of the last line where + # VAR occurs in FILE (not commented) + grep -n -- "^[[:space:]]*$1" $2 | tail -n 1 | cut -d: -f1 +} + +word_present () { + . $file + case " ${!var} " in + *" $word "*) true;; + *) false;; + esac +} + +add_word() { + local word=$1 + local word_quoted=$2 + if ! word_present; then + $debug && cp $file $tmpf + sed -i -e "${lineno} { + s/^[[:space:]]*\($var=\".*\)\(\".*\)/\1 $word_quoted\2/; + s/=\" /=\"/ + }" $file + $debug && diff -u $tmpf $file + else + echo \"$word\" already present + fi + # some balancing for vim"s syntax highlighting +} + +remove_word() { + local word=$1 + local word_quoted=$2 + if word_present; then + $debug && cp $file $tmpf + sed -i -e "${lineno} { + s/\(['\" ]\)$word_quoted\(['\" ]\)/\1 \2/g + s/ / /g + }" $file + $debug && diff -u $tmpf $file + else + echo \"$word\" not present + fi + # some balancing for vim"s syntax highlighting + +} + +# poor man's option parsing + +case "$1" in +-h) usage; exit 0;; +esac + +if [ $# -lt 3 ]; then + echo not enough arguments + echo + usage; exit 1 +fi + +action=add +case "$1" in +-r) action=remove; shift;; +esac + +file=$1; shift +var=$1; shift +word=$1 +word_quoted=${1//\//\\\/} + + +if $debug; then + echo FILE: $file + echo VAR: $var + echo WORD: $word + echo current content: + grep "^$var=" $file | tail -n 1 + echo +fi + + +if ! [ -r $file ]; then + echo ${0##*/}: file $file is not a readable file + exit 1 +fi + +lineno=$(find_last_occurrence $var $file) +if [ -z $lineno ]; then + echo ${0##*/}: variable $var does not occur in $file + exit 1 +fi + +$debug && tmpf=$(mktemp /tmp/$(basename $0).XXXXXX) + +if [ $action = add ]; then + add_word $word $word_quoted $lineno +else + remove_word $word $word_quoted $lineno +fi + +$debug && rm -f $tmpf + +exit 0 diff --git a/files/usr/share/man/man1/smart_agetty.1 b/files/usr/share/man/man1/smart_agetty.1 new file mode 100644 index 0000000..d1d952f --- /dev/null +++ b/files/usr/share/man/man1/smart_agetty.1 @@ -0,0 +1,52 @@ +.\" +.\" SuSE man page smart_agetty +.\" Copyright (c) 2010 SuSE Linux Products GmbH, Nuernberg, Germany. +.\" +.\" +.TH smart_agetty 1 "May 18th, 2010" "Version 0.0" "Emulate agetty console" +.\" +.UC 1 +.SH NAME +.\" +smart_agetty \- Emulate agetty for a non vga/framebuffer console +.B +.SH SYNOPSIS +.\" +.B smart_agetty [OPTIONS] +.\" +.SH DESCRIPTION +smart_agetty is a wrapper script around agetty. It accepts the following options: +.SH OPTIONS +.IP -i|-h|-L|-m|-n|-w| +Normal getty options. See +.RS +.B $ man 8 agetty +.RE +.RS +for more details. +.RE +.IP GETTYSPEED +The speed of the getty device. +.IP GETTYDEVICE +The used tty device - as listed in /dev. +.IP GETTYTERM +The value to be used for the TERM environment variable. This overrides whatever init(8) may have set, and is inherited by login and the shell. +.SH DIAGNOSTICS +The following diagnostics may be issued on kmsg: + +Can not determine 'getty device' speed. +.RS +stty speed could not autodetect the speed of the given device. +.RE +unhandled stdout +.RS +Autoconsole could not guess the right output console. +.RE +.SH BUGS +Please visit http://bugs.opensuse.org/ to get a guidance on how to submit bugreports. +.SH SEE ALSO +.BR agetty (8) +.SH COPYRIGHT +2010 SuSE Linux Products GmbH, Nuernberg, Germany. +.SH AUTHOR +Lars Vogdt diff --git a/files/usr/share/man/man5/defaultdomain.5 b/files/usr/share/man/man5/defaultdomain.5 new file mode 100644 index 0000000..6a902a7 --- /dev/null +++ b/files/usr/share/man/man5/defaultdomain.5 @@ -0,0 +1,55 @@ +.\" Copyright (c) 2002 SuSE Linux AG Nuernberg, Germany. +.\" +.\" Author: Thorsten Kukuk (http://www.suse.de/feedback) +.\" +.\" This is free documentation; you can redistribute it and/or +.\" modify it under the terms of the GNU General Public License +.\" version 2 as published by the Free Software Foundation. +.\" +.\" The GNU General Public License's references to "object code" +.\" and "executables" are to be interpreted as the output of any +.\" document formatting or typesetting system, including +.\" intermediate and printed output. +.\" +.\" This manual is distributed in the hope that it will be useful, +.\" but WITHOUT ANY WARRANTY; without even the implied warranty of +.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +.\" GNU General Public License for more details. +.\" +.\" You should have received a copy of the GNU General Public +.\" License along with this manual; if not, write to the Free +.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, +.\" USA. +.\" +.TH DEFAULTDOMAIN 5 2002-01-16 "SuSE Linux" "Linux Programmer's Manual" +.SH NAME +defaultdomain \- file which contains the NIS/YP domain name +.SH DESCRIPTION +\fB/etc/defaultdomain\fP is used by the boot scripts to set +the NIS/YP domain name for a system as returned by the +.BR getdomainname (2) +function. The file contains one line with the name of the domain. + +.LP +Unlike DNS hostnames and domain names, the NIS domain name is +case-sensitive! The NIS domain name must not be the same as the +DNS domain name, but for some services like NIS+ it should be the +same. + +.LP +Even if the domain name is often called NIS/YP domain name, it is +also used from other protocols, not only NIS/YP. +.SH FILES +/etc/defaultdomain +/etc/init.d/boot.localnet +.SH "SEE ALSO" +.BR domainname (1), +.BR init.d (7), +.BR init (8), +.BR nisdomainname (1), +.BR ypdomainname (1), +.BR ypbind (8), +.BR ypserv (8), +.BR ypwhich (1) +.SH COPYRIGHT +2002 SuSE Linux AG Nuernberg, Germany. diff --git a/files/usr/share/man/man5/route.conf.5 b/files/usr/share/man/man5/route.conf.5 new file mode 100644 index 0000000..30ffcb0 --- /dev/null +++ b/files/usr/share/man/man5/route.conf.5 @@ -0,0 +1,32 @@ +.\" +.\" SuSE man page route.conf +.\" Copyright (c) 2002 SuSE Linux AG, Nuernberg, Germany. +.\" please send bugfixes or comments to http://www.suse.de/feedback. +.\" +.\" +.TH ROUTE.CONF 5 "March 13th, 2002" "Version 0.0" "Configuration for routing table" +.\" +.UC 5 +.SH NAME +.\" +route.conf \- Configuration for routing table has +.B changed +.SH SYNOPSIS +.\" +.B /etc/route.conf -> /etc/sysconfig/network/routes +.\" +.SH DESCRIPTION +The file +.I /etc/route.conf +is no longer used starting with versions SuSE Linux 8.0. Please see +.I routes(5) +for the routing configuration. To do so issue +.PP +.RS +.B $ man routes +.SH SEE ALSO +.BR routes (5), +.SH COPYRIGHT +2002 SuSE Linux AG, Nuernberg, Germany. +.SH AUTHOR +Mads Martin Jørgensen diff --git a/files/usr/share/man/man7/init.d.7 b/files/usr/share/man/man7/init.d.7 new file mode 100644 index 0000000..f8b3458 --- /dev/null +++ b/files/usr/share/man/man7/init.d.7 @@ -0,0 +1,295 @@ +.\" +.\" SuSE man page for SuSE boot concept +.\" Copyright (c) 1997-2002 SuSE Linux AG, Nuernberg, Germany. +.\" please send bugfixes or comments to http://www.suse.de/feedback. +.\" +.\" Author: Werner Fink +.\" +.TH INIT.D 7 "Nov 15, 2000" "Version 0.4" "The SuSE boot concept" +.\" +.UC 7 +.OS SuSE Linux +.\" +.SH NAME +.\" +INIT.D \- The SuSE boot concept +.SH SYNOPSIS +.\" +.B /etc/init.d/* +.PP +.B /etc/sysconfig +.\" +.SH DESCRIPTION +The scripts for controlling the system are placed in +.IR /etc/init.d/ +(they have been moved according to the Linux Standard +Base (LSB) specification). +These scripts are executed directly or indirectly by +.BR /sbin/init , +the father of all processes. The configuration of +.B /sbin/init +is given by the file +.BR /etc/inittab " (see " inittab (5)). +.PP +At boot time, the boot level master script +.I /etc/init.d/boot +is called to initialise the system (e.g. file system check, ...). +It also executes some hardware init scripts linked into +.IR /etc/init.d/boot.d/ . +Then it calls +.IR /etc/init.d/boot.local , +which executes the local commands. +.PP +After system startup, +.B /sbin/init +will normally switch on the default run level given in +.BR /etc/inittab . +It calls the run level master script +.I /etc/init.d/rc +to start or stop services provided by the other scripts under +.IR /etc/init.d/ . +.PP +Both scripts, then boot level master script +.I /etc/init.d/boot +and the the run level master script +.I /etc/init.d/rc +starts all other boot or runlevel scripts either sequential +or partial parallel within their dependencies order. +.PP +To control the services of a run level, the corresponding scripts +are linked into run level directories +.IR /etc/init.d/rc.d/ , +where +.BR =0 , 1 , 2 , 3 , 4 , 5 , 6 , S +is the run level number. +.PP +There are two kinds of +.B symbolic +link: start links, which are called when entering a run level, and +stop links, which are called when leaving a run level. +Note that each service in the run levels 2, 3, 4, and 5 consists of +a start +.B and +a stop link. Within SuSE boot concept a +.I differential +link scheme is used to be able to +.B change +a runlevel in comparision with the former level. +.PP +If parallel executing of the boot scripts is enabled (see +.I /etc/sysconfig/boot +variable +.BR RUN_PARALLEL ) +then both master scripts uses the program +.BR startpar (8) +which starts or stops multiple services in parallel. +.BR Startpar (8) +will look for the files +.IR /etc/init.d/.depend.boot , +.IR /etc/init.d/.depend.start ,\ and +.I /etc/init.d/.depend.stop +to get the dependencies for each service. The files will +be written, beside the symbolic links in the boot and +runlevel directories, by the program +.BR insserv (8). +.PP +To avoid redundant starts when changing run levels, only those +services are started which have no start link in the previous run +level. And to avoid redundant stops when changing run levels, only +those services are stopped which have no start link in the current +level. To control this behaviour, the names of the scripts are added on +the names of the start and stop links. +.PP +To control the order of service starts and stops, the start +and stop links include a number in their link name. +.PP +The system configuration files in +.IR /etc/sysconfig +contain most of the variables used to configure the installed +services. +These variables can easily be changed by +.B YaST +or by using an editor. +.\" +.\" +.\" +.SS Some details +The script +.I /etc/init.d/lpd +starts or stops the line printer daemon for the printing service, +according to the flag used: +.PP +.RS +.B /etc/init.d/lpd start +.RE +and +.PP +.RS +.B /etc/init.d/lpd stop +.RE +.PP +To do this automatically in run level +.BR 3 , +this script is linked into +.I /etc/init.d/rc3.d/ +with these two symbolic links +.PP +.RS +.B /etc/init.d/rc3.d/S20lpd -> ../lpd +.RE +and +.PP +.RS +.B /etc/init.d/rc3.d/K20lpd -> ../lpd +.RE +.PP +The corresponding link with the letter +.B S +is used to start a service. For the printing service the number +between the letter +.B S +and the name should be greater than the number of the start link of +the network service. The corresponding link with the letter +.B K +is used to stop a service. The number of the stop link for the +printing service should be less than that of the stop link for +the network service so that the printer daemon is stopped before +shutting down the network service. +.\" +.\" +.\" +.SS Run levels and their services +.sp +.TP +.B 0 +This level is used for halting the system. The only valid service for +this level is the script +.BR halt , +which is linked into +.IR /etc/init.d/rc0.d/ . +The script +.B halt +executes +.IR /etc/init.d/halt.local . +Special system issues for halt or reboot should be added there. +.TP +.B 6 +This level is used for rebooting the system. The only valid service for +this level is the script +.BR reboot , +which is linked into +.IR /etc/init.d/rc6.d/ . +The script +.B reboot +executes +.IR /etc/init.d/halt.local . +Specials system issues for halt or reboot should be added there. +.TP +.B S +This mode is used to switch from boot phase into single user mode. +The last valid service for this mode is the script +.BR single , +which is linked into +.IR /etc/init.d/rcS.d/ . +In this mode you have only +.B one +console. +.TP +.B 1 +According to the Linux Standard Base (LSB) specification +this runlevel is used to switch from normal runlevel into +single user mode. +.B This is different from former SuSE Linux versions! +.TP +.B 2 +The run level 2 is without remote networking. Note that on some +other systems this is identical with the single user mode. +This run level can have more than one virtual console. +.TP +.B 3 +The run level 3 is with network. This run level is for +.B server stations +not automatically running +.IR X . +.TP +.B 5 +The level 5 is with network and +.BR xdm (1). +You should have a configured and perfectly running +.I X Window System +for this +.B work station +run level. +.TP +.BR 4 +The run level 4 is not (yet) used. +.TP +.B /etc/init.d/skeleton +This script is a model for writing your own. You can use +.BR insserv (8) +to include your own script into a run level. +.PP +.SH FILES +.I /etc/init.d/* +.br +.I /etc/init.d/boot +.br +.I /etc/init.d/boot.local +.br +.I /etc/init.d/halt +.br +.I /etc/init.d/halt.local +.br +.I /etc/init.d/rc +.br +.I /etc/init.d/reboot +.br +.I /etc/init.d/skeleton +.br +.I /etc/init.d/single +.br +.I /etc/init.d/boot.d/S[0-9][0-9]* +.br +.I /etc/init.d/rc0.d/{K,S}[0-9][0-9]* +.br +.I /etc/init.d/rc1.d/{K,S}[0-9][0-9]* +.br +.I /etc/init.d/rc2.d/{K,S}[0-9][0-9]* +.br +.I /etc/init.d/rc3.d/{K,S}[0-9][0-9]* +.br +.I /etc/init.d/rc4.d/{K,S}[0-9][0-9]* +.br +.I /etc/init.d/rc5.d/{K,S}[0-9][0-9]* +.br +.I /etc/init.d/rc6.d/{K,S}[0-9][0-9]* +.br +.I /etc/init.d/rcS.d/{K,S}[0-9][0-9]* +.br +.I /etc/init.d/.depend.boot +.br +.I /etc/init.d/.depend.start +.br +.I /etc/init.d/.depend.stop +.br +.I /etc/inittab +.br +.I /etc/sysconfig/boot +.br +.I /etc/sysconfig +.\" +.SH SEE ALSO +.BR insserv (8), +.BR startpar (8), +.BR init (8), +.BR inittab (5), +and the +.I SuSE Linux +handbook, chapter +.IR "The SuSE boot concept" . +.SH COPYRIGHT +1996-2005 SuSE Linux AG, Nuernberg, Germany. +.SH AUTHORS +Florian La Roche , +Werner Fink , +Burchard Steinbild . diff --git a/files/usr/share/man/man8/chkconfig.8 b/files/usr/share/man/man8/chkconfig.8 new file mode 100644 index 0000000..cc59462 --- /dev/null +++ b/files/usr/share/man/man8/chkconfig.8 @@ -0,0 +1,233 @@ +.\" +.\" SuSE man page for chkconfig +.\" Copyright (c) 2003-2006 SuSE Linux AG, Nuernberg, Germany. +.\" please send bugfixes or comments to http://www.suse.de/feedback. +.\" +.\" Author: Michael Schroeder +.\" +.TH CHKCONFIG 8 "Oct 2006" +.SH NAME +chkconfig \- enable or disable system services + +.SH SYNOPSIS +.B chkconfig +.B -t|--terse +.RI [ names ] +.br +.B chkconfig +.B -s|--set +.RI [ name +.IR state ] +.br +.B chkconfig +.B -e|--edit +.RI [ names ] +.br +.B chkconfig +.B -c|--check +.I name +.RI [ state ] +.br +.B chkconfig +.B -l|--list +.RB [ --deps ] +.RI [ names ] +.br +.B chkconfig +.B -A|--allservices +.br +.B chkconfig +.B -a|--add +.RI [ names ] +.br +.B chkconfig +.B -d|--del +.RI [ names ] + +.SH DESCRIPTION +chkconfig is used to manipulate the runlevel links at boot time +(see +.IR init.d (7)). +It can be thought of as a frontend to +.IR insserv (8). +Chkconfig can run in six different modes: terse list mode, set mode, +edit mode, list mode, add mode and delete mode. The last three modes +were added for compatiblity reasons. +.SH TERSE LIST MODE +This mode lists the state of the specified services, or all known +services if no service name was provided. Every printed line +consists of the name of the service and the runlevels the +service is configured for at the moment. If it is configured in +no runlevel, +.B off +is used instead, if it is configured in the runlevels defined +as a default by the start script, +.B on +is used. If the service is an enabled inetd or xinetd service, +.B inetd +and +.B xinetd +are used. Inetd/xinetd services are configured in +.I /etc/inetd.d +and +.IR /etc/xinetd.d , +respectively. You can use the +.B -A +or +.B --allservices +parameter to get all services (even the boot.*-services) listed. +.PP +If chkconfig is called without arguments, all services are listed +in terse mode. +.SH SET MODE +Set mode is used to configure at which runlevel a service should +be started. The arguments must be specified as pairs of +service name and new state. You can use +.B on +and +.B off +as special states to select the default set of runlevels or to disable +a service completely. You can use +.B inetd +or +.B xinetd +to configure a service managed by the inetd/xinetd daemons. +.PP +Insserv can calculate dependencies for only one service at the same +time. To work around this limitation imposed by insserv, chkconfig +uses the '-f' option of insserv when it reads the list of services from +standard input. Note that --force switches off all dependency checks +and could lead to depending services no longer working, use with care. +.PP +If no services are specified, chkconfig reads lines from standard +input. Each line must consist of a service/state pair. As this is +exactly the output of the terse list mode, this can be used to +reconfigure a service specification saved by a former run. + +If the option +.B -f +or +.B --force +is also given, insserv is called with a '-f' option. +.SH EDIT MODE +This mode is a combination of the terse list mode and set mode. +It writes the state of all specified services (or all known +services, if no service was provided) into a temporary file, +starts an editor and re-configures all services to reflect the +states of the changed temporary file. +.SH CHECK MODE +This mode can be used to check the state of a service. +chkconfig exits with a return code of '0' if the service is enabled +in all of the specified runlevels, otherwise the exit status +is '1'. If chkconfig is called with only a service name the +current runlevel of the system is used for checking. +.SH LIST MODE +List mode prints for each specified service a line that consists +of the service name and for runlevels zero to six +.B on +or +.B off +depending if the service will be started or not. +.B on +will be printed in bright green if the output is written to a +terminal. If the +.B --deps +option is given, the names of the services that must be started +before this service is appended to each line. The inetd/xinetd +services are listed in extra sections. + +You can use the +.B -A +or +.B --allservices +parameter to get all services (even the boot.*-services) listed. +.SH ADD MODE +Calls insserv +to enable a service and uses list mode to display the new +setting afterwards. +.SH DEL MODE +Same as add mode, but disable the service. +.SH OTHER OPTIONS +When no service names are given on the command line, chkconfig +defaults to all known services excluding those +that are not enabled in runlevels 1 to 6 and start with +.RB ' boot. '. +Use the +.B --allservices +or +.B -A +option if you want to see such services as well. +.SH EXAMPLES +.IP +chkconfig +.PP +list the runlevel configuration of all known services +.IP +chkconfig apache +.PP +list the runlevel configuration of the apache web server +.IP +chkconfig -t apache xntpd +.PP +list the runlevel configuration of the apache web server and +the network time protocol daemon. +.IP +chkconfig apache on +.PP +configure the apache web server to be started on next boot time. +.IP +chkconfig apache 5 +.PP +configure the apache web server to be started only if the +system reaches runlevel 5. +.IP +chkconfig apache 35 +.PP +configure the apache web server for runlevel 3 and 5. +.IP +chkconfig apache on xntpd off +.PP +configure two services +.IP +chkconfig finger xinetd +.PP +configure a xinetd service +.IP +chkconfig -A >~root/chkconfig.save +.PP +backup the current configuration +.IP +chkconfig -s <~root/chkconfig.save +.PP +restore the configuration +.IP +chkconfig -e apache xntpd +.PP +change the runlevel configuration interactively +.IP +chkconfig -e +.PP +change the runlevel configuration of all services interactively + +.SH FILES +.IP /etc/init.d/ +path to the boot script base directory as required by the Linux +Standard Base Specification (LSB). +.IP /etc/inetd.d/ +path to the inetd services. See the inetd manpage to find out +how to enable this feature. +.IP /etc/xinetd.d/ +path to the xinetd services. + +.SH SEE ALSO +.BR init.d (7), +.BR init (7), +.BR inetd (8) +.BR xinetd (8) +.BR insserv (8) + +.SH COPYRIGHT +2003 SuSE Linux AG, Nuernberg, Germany. + +.SH AUTHOR +Michael Schroeder diff --git a/files/usr/share/man/man8/quick_halt.8 b/files/usr/share/man/man8/quick_halt.8 new file mode 100644 index 0000000..d858ac2 --- /dev/null +++ b/files/usr/share/man/man8/quick_halt.8 @@ -0,0 +1,21 @@ +.\" Copyright (C) 2003 SuSE Linux AG +.\"$Id:$ +.TH quick_halt 8 +.SH NAME +quick_halt \- stop the system quickly +.SH SYNOPSIS +\fBquick_halt\fR, \fBquick_reboot\fR, \fBquick_poweroff\fR +.SH DESCRIPTION +Fast system shutdown, that does not carefully stop every single service +in the specified order, but just sends a TERM and KILL to everyone +and makes sure the filesystems get shut down properly prior to +reboot/halt/poweroff +.SH DIAGNOSTICS +If you're not the superuser, you will get the message +"You need to be root to execute quick_halt". +.BR +.SH "SEE ALSO" +.BR \fBshutdown\fR(8), \fBinit\fR(1), \fBhalt\fR(8), \fBpoweroff\fR(8), \fBreboot\fR(8), \fBfsck\fR(8) +.SH AUTHOR +Kurt Garloff +.BR diff --git a/files/usr/share/man/man8/resolv+.8 b/files/usr/share/man/man8/resolv+.8 new file mode 100644 index 0000000..3513cbe --- /dev/null +++ b/files/usr/share/man/man8/resolv+.8 @@ -0,0 +1,152 @@ +.\" +.\" man page for resolv+ +.\" manually regenerated from straycat +.\" +.TH RESOLV+ 8 "August 19, 1992" +.SH NAME +resolv+ \- enhanced DNS resolver library + +.SH DESCRIPTION +.IR Resolv+ +is a modified version of the standard Berkeley +BIND host resolver library. Enhancements include support +for host lookups via the Internet Domain Name System +(DNS), the +.IR /etc/hosts +file, and Sun's Network Information +Service (NIS). + +The programmer interface to the resolv+ routines is identical +to that of the standard resolver library. For further information +see the appropriate manual pages. + +.SH CONFIGURATION +As with the standard resolver library, the file +.IR /etc/resolv.conf +must be set up before the resolver can function. +In addition, the file +.IR /etc/host.conf +contains configuration information specific to resolv+. + +The +.IR host.conf +file should contain one configuration keyword per line, +followed by appropriate configuration information. +The keywords recognized are +.IR order , +.IR trim , +.IR multi , +.IR nospoof , +and +.IR reorder . +Each keyword is described seperately below. +.IP order +This keyword specifies how host lookups are to be performed. +It should be followed by one or more lookup methods, seperated +by commas. Valid methods are +.IR bind , +.IR hosts +and +.IR nis . +.IP trim +This keyword may be listed more than once. Each time it should +be followed by a single domain name, with the leading dot. +When set, the resolv+ library will automatically trim the given domain +name from the end of any hostname resolved via DNS. +This is intended for use with local hosts and +domains. (Related note: trim will not affect host- +names gathered via NIS or the hosts file. Care +should be taken to insure that the first hostname +for each entry in the hosts file is fully qualified +or non-qualified, as appropriate for the local +installation.) +.IP multi +Valid values are +.IR on +and +.IR off . +If set to "on," the resolv+ library will return all valid addresses +for a host that appears in the +.IR /etc/hosts +file, instead of only the first. This is off by default, as it +may cause a substantial performance loss at sites +with large hosts files. +.IP nospoof +Valid values are +.IR on +and +.IR off . +If set to "on," the +resolv+ library will attempt to prevent hostname +spoofing to enhance the security of +.IR rlogin +and +.IR rsh . +It works as follows: after performing a host +address lookup, resolv+ will perform a hostname +lookup for that address. If the two hostnames do +not match, the query will fail. +.IP alert +If this option is set to "on" and the +.IR nospoof +option is also set, resolv+ will log a warning of +the error via the +.IR syslog +facility. The default value is off. +.IP reorder +Valid values are +.IR on +and +.IR off . +If set to "on," resolv+ will attempt to reorder host addresses so +that local addresses (i.e., on the same subnet) are +listed first when a gethostbyname() is performed. +Reordering is done for all lookup methods. The +default value is off. +.SH ENVIRONMENT VARIABLES +The following environment variables may be set to override +resolv+'s configured behavior: +.IP RESOLV_HOST_CONF +If set, it will override the default filename +("/etc/host.conf") for the resolv+ configuration +file. +.IP RESOLV_SERV_ORDER +If set, will override the "order" keyword in the +host.conf file. +.IP RESOLV_SPOOF_CHECK +If set, will override the spoof check flag. Valid +values are "off" to disable checking, "warn" to +enable checking and warning, and "warn off" to +enable checking but not warning. +.IP RESOLV_ADD_TRIM_DOMAINS +If set, contains a list of domains to trim that +will augment, not supersede, the list in the +host.conf file. +.IP RESOLV_OVERRIDE_TRIM_DOMAINS +If set, contains a list of domains to trim that +will override those in the host.conf file. +.IP RESOLV_MULTI +If set, overrides the "multi" keyword in the +host.conf file. +.IP RESOLV_REORDER +If set, overrides the "reorder" keyword in the +host.conf file. +.SH FILES +/etc/host.conf, /etc/hosts +.SH BUGS +Quite possibly. +.SH AUTHOR +The original BIND resolver library comes from the University +of California at Berkeley's Computer Science Research Group. +The original resolv+ modifications were made by +Bill Wisner . +Bug fixes and enhancements were contributed by Patrick Gosling, +Chris Metcalf, John DiMarco and J. Porter Clark, John P. Rouillard, +Dan O'Neill and Tom Limoncelli. +.SH SEE ALSO +.BR resolver(3), +.BR resolver(5), +.BR hosts(5), +.BR hostname(7), +.BR named(8) + diff --git a/files/usr/share/man/man8/safe-rm.8 b/files/usr/share/man/man8/safe-rm.8 new file mode 100644 index 0000000..fa0edbf --- /dev/null +++ b/files/usr/share/man/man8/safe-rm.8 @@ -0,0 +1,32 @@ +.\" Copyright (C) 2003 SuSE Linux AG +.\"$Id:$ +.TH safe\-rm(dir) 8 +.SH NAME +safe\-rm \- delete files a bit more safely +.br +safe\-rmdir \- delete empty directories a bit more safely +.SH SYNOPSIS +\fBsafe\-rm\fR \fI/path/to/file\fR +.br +\fBsafe\-rmdir\fR \fI/path/to/directory\fR +.SH DESCRIPTION +.TP +\fBsafe\-rm\fR deletes files specified with an absolute path +name. Files specified with symbolic links in the +path name will not be erased. +.TP +\fBsafe\-rmdir\fR deletes directories specified with an absolute +path name. Directories specified with symbolic links in the +path name will not be erased. +.SH RETURNS +\fBsafe\-rm\fR and \fBsafe\-rmdir\fR returns a non zero return code +when it can not erase the file safely. +.br +.SH NOTE +These commands are used by the system cleanup cron jobs. +.br +.SH "SEE ALSO" +.BR rm (1), +.BR rmdir (1). +.SH AUTHOR +SuSE Linux AG diff --git a/files/usr/share/man/man8/safe-rmdir.8 b/files/usr/share/man/man8/safe-rmdir.8 new file mode 120000 index 0000000..e9c3dcc --- /dev/null +++ b/files/usr/share/man/man8/safe-rmdir.8 @@ -0,0 +1 @@ +safe-rm.8 \ No newline at end of file diff --git a/files/usr/share/man/man8/service.8 b/files/usr/share/man/man8/service.8 new file mode 100644 index 0000000..8dc30d3 --- /dev/null +++ b/files/usr/share/man/man8/service.8 @@ -0,0 +1,39 @@ +.\"$Id:$ +.TH service 8 "Jan 2006" +.SH NAME +service \- run a System V init script +.SH SYNOPSIS + service \fBSCRIPT\fR \fBCOMMAND\fR [\fBOPTIONS\fR] +.br + service --status-all +.br + service --help | -h | --version + +.SH DESCRIPTION +service runs a System V init script in as predictable environment as +possible, removing most environment variables and with current working +directory set to /. +.PP +The \fBSCRIPT\fR parameter specifies a System V init script, located in +/etc/init.d/\fBSCRIPT\fR. The supported values of \fBCOMMAND\fR depend on the +invoked script, service passes \fBCOMMAND\fR and \fBOPTIONS\fR it to the init +script unmodified. All scripts should support at least the start and +stop commands. As a special case, if \fBCOMMAND\fR is \-\-full-restart, the +script is run twice, first with the stop command, then with the start +command. + +service \-\-status-all runs all init scripts, in alphabetical order, with +the status command. +.SH FILES +/etc/init.d + The directory containing System V init scripts. +.BR +.SH ENVIRONMENT +LANG, +TERM + The only environment variables passed to the init scripts. +.BR +.SH "SEE ALSO" +chkconfig(8), +ntsysv(8) +.BR diff --git a/files/var/log/btmp b/files/var/log/btmp new file mode 100644 index 0000000..e69de29 diff --git a/files/var/log/faillog b/files/var/log/faillog new file mode 100644 index 0000000..e69de29 diff --git a/files/var/log/lastlog b/files/var/log/lastlog new file mode 100644 index 0000000..e69de29 diff --git a/files/var/log/wtmp b/files/var/log/wtmp new file mode 100644 index 0000000..e69de29 diff --git a/packaging/setup.spec b/packaging/setup.spec index 71388e6..5ae71d2 100644 --- a/packaging/setup.spec +++ b/packaging/setup.spec @@ -1,5 +1,5 @@ Name: setup -Version: 0.7 +Version: 0.8 Release: 1 License: Public Domain Summary: A set of system configuration and setup files @@ -17,36 +17,23 @@ setup files, such as passwd, group, and profile. %prep %setup -q +cp %{SOURCE1001} . ./shadowconvert.sh %build -cp %{SOURCE1001} . %check # Run any sanity checks. make check %install -mkdir -p %{buildroot}%{_sysconfdir}/profile.d -cp -ar * %{buildroot}/etc -rm -f %{buildroot}%{_sysconfdir}/uidgid -rm -f %{buildroot}%{_sysconfdir}/COPYING -mkdir -p %{buildroot}%{_localstatedir}/log -touch %{buildroot}%{_localstatedir}/log/lastlog +cp -ar files/* %{buildroot} touch %{buildroot}%{_sysconfdir}/environment chmod 0644 %{buildroot}%{_sysconfdir}/environment chmod 0400 %{buildroot}%{_sysconfdir}/{shadow,gshadow} -chmod 0644 %{buildroot}%{_localstatedir}/log/lastlog touch %{buildroot}%{_sysconfdir}/fstab touch %{buildroot}%{_sysconfdir}/mtab -# remove unpackaged files from the buildroot -rm -f %{buildroot}%{_sysconfdir}/Makefile -rm -f %{buildroot}%{_sysconfdir}/serviceslint -rm -f %{buildroot}%{_sysconfdir}/uidgidlint -rm -f %{buildroot}%{_sysconfdir}/shadowconvert.sh -rm -rf %{buildroot}%{_sysconfdir}/packaging -rm -rf %{buildroot}%{_sysconfdir}/*.manifest rm %{buildroot}/%{_sysconfdir}/filesystems @@ -81,6 +68,17 @@ end %config(noreplace) %{_sysconfdir}/csh.cshrc %dir %{_sysconfdir}/profile.d %config(noreplace) %verify(not md5 size mtime) %{_sysconfdir}/shells -%ghost %attr(0644,root,root) %verify(not md5 size mtime) %{_localstatedir}/log/lastlog +%ghost %attr(0644,root,root) %verify(not md5 size mtime) /var/log/lastlog +%ghost %attr(0600,root,root) %verify(not md5 size mtime) /var/log/faillog +%ghost %attr(0664,root,utmp) %verify(not md5 size mtime) /var/log/wtmp +%ghost %attr(0600,root,root) %verify(not md5 size mtime) /var/log/btmp +%ghost %attr(0664,root,utmp) %verify(not md5 size mtime) /run/utmp %ghost %verify(not md5 size mtime) %config(noreplace,missingok) %{_sysconfdir}/fstab %ghost %verify(not md5 size mtime) %config(noreplace,missingok) %{_sysconfdir}/mtab +%{_bindir}/* +%{_sbindir}/* +/run/* +/var/log/* +/etc/profile.d/* + +%docs_package diff --git a/shadowconvert.sh b/shadowconvert.sh index 4be13b6..9a7c6cf 100755 --- a/shadowconvert.sh +++ b/shadowconvert.sh @@ -6,13 +6,13 @@ then fi #make prototype for /etc/shadow -sed -e "s/:.*/:*:`expr $(date +%s) / 86400`:0:99999:7:::/" passwd >shadow +sed -e "s/:.*/:*:`expr $(date +%s) / 86400`:0:99999:7:::/" files/etc/passwd >files/etc/shadow #make prototype for /etc/gshadow -sed -e 's/:[0-9]\+:/::/g' group >gshadow +sed -e 's/:[0-9]\+:/::/g' files/etc/group >files/etc/gshadow #mark passwd and group files entries shadowed -sed -i -e 's/^\([^:]\+\):[^:]*:/\1:x:/' passwd group +sed -i -e 's/^\([^:]\+\):[^:]*:/\1:x:/' files/etc/passwd files/etc/group echo Converted successfully. exit 0 -- 2.7.4