From 12e7a5b1a4ca9c8f03ee66db198426770cc84300 Mon Sep 17 00:00:00 2001 From: Marcin Krol Date: Fri, 10 Jul 2015 12:29:16 +0000 Subject: [PATCH] - from PLD --- AUTHORS | 44 + COPYING | 340 ++++ DEVELOPMENT | 57 + INSTALL | 184 +++ Makefile.am | 50 + NEWS | 21 + README | 49 + TODO | 21 + acinclude.m4 | 68 + adjtime | 2 + autogen.sh | 149 ++ changelog.sh | 8 + configure.ac | 228 +++ crypttab | 7 + doc/Makefile.am | 12 + doc/make-html | 4 + doc/net-scripts.txt | 206 +++ doc/polski.dsl | 63 + doc/rc-scripts.docb | 35 + doc/sysconfig.docb | 438 ++++++ doc/sysconfig.txt | 207 +++ doc/sysvinitfiles | 187 +++ doc/template.init | 171 ++ dumb.sh | 188 +++ firmware-loader.sh | 57 + hwprofile | 331 ++++ inittab | 72 + isapnp/Makefile.am | 10 + isapnp/isapnp-kernel.conf | 12 + lang.csh | 33 + lang.sh | 74 + lib/Makefile.am | 41 + lib/functions | 1373 +++++++++++++++++ lib/functions.network | 690 +++++++++ lib/ifdown | 139 ++ lib/ifdown-br | 49 + lib/ifdown-irda | 74 + lib/ifdown-post | 47 + lib/ifdown-ppp | 54 + lib/ifdown-sl | 63 + lib/ifdown-vlan | 52 + lib/ifup | 266 ++++ lib/ifup-aliases | 80 + lib/ifup-br | 88 ++ lib/ifup-ipx | 51 + lib/ifup-irda | 61 + lib/ifup-iucv | 40 + lib/ifup-neigh | 19 + lib/ifup-plip | 39 + lib/ifup-plusb | 48 + lib/ifup-post | 76 + lib/ifup-ppp | 266 ++++ lib/ifup-routes | 54 + lib/ifup-sl | 116 ++ lib/ifup-vlan | 84 + lib/tnldown | 84 + lib/tnlup | 135 ++ make-tag.sh | 30 + man/Makefile.am | 20 + man/consoletype.1 | 39 + man/crypttab.5 | 125 ++ man/de/Makefile.am | 8 + man/de/start-stop-daemon.8 | 255 +++ man/doexec.1 | 12 + man/es/Makefile.am | 8 + man/es/start-stop-daemon.8 | 245 +++ man/fr/Makefile.am | 8 + man/fr/start-stop-daemon.8 | 234 +++ man/genhostid.1 | 12 + man/getkey.1 | 80 + man/initlog.1 | 84 + man/ipcalc.1 | 58 + man/ja/Makefile.am | 8 + man/ja/start-stop-daemon.8 | 257 +++ man/netreport.1 | 22 + man/ppp-watch.8 | 23 + man/ru/Makefile.am | 8 + man/ru/start-stop-daemon.8 | 243 +++ man/run-parts.8 | 130 ++ man/start-stop-daemon.8 | 261 ++++ man/sv/Makefile.am | 8 + man/sv/start-stop-daemon.8 | 231 +++ man/usernetctl.8 | 39 + man/usleep.1 | 50 + modules | 15 + modules.preudev | 21 + po/Makefile.am | 107 ++ po/de.po | 902 +++++++++++ po/makepot.pl | 83 + po/pl.po | 886 +++++++++++ ppp/Makefile.am | 21 + ppp/auth-down | 41 + ppp/auth-up | 41 + ppp/ip-down | 48 + ppp/ip-down.d/Makefile.am | 7 + ppp/ip-down.d/logger | 5 + ppp/ip-up | 48 + ppp/ip-up.d/Makefile.am | 7 + ppp/ip-up.d/logger | 5 + ppp/ipx-down | 61 + ppp/ipx-up | 66 + rc.d/Makefile.am | 14 + rc.d/init.d/Makefile.am | 25 + rc.d/init.d/allowlogin | 70 + rc.d/init.d/cpusets | 196 +++ rc.d/init.d/cryptsetup | 185 +++ rc.d/init.d/killall | 36 + rc.d/init.d/local | 37 + rc.d/init.d/netfs | 208 +++ rc.d/init.d/network | 418 +++++ rc.d/init.d/random | 88 ++ rc.d/init.d/single | 56 + rc.d/init.d/sys-chroots | 178 +++ rc.d/rc | 269 ++++ rc.d/rc.init | 26 + rc.d/rc.local | 5 + rc.d/rc.shutdown | 184 +++ rc.d/rc.sysinit | 1081 +++++++++++++ run-parts.sh | 80 + service | 189 +++ setsysfont | 51 + src/Makefile.am | 69 + src/consoletype.c | 66 + src/doexec.c | 19 + src/genhostid.c | 32 + src/getkey.c | 141 ++ src/initlog.c | 465 ++++++ src/initlog.conf | 23 + src/initlog.h | 20 + src/ipcalc.c | 361 +++++ src/loglevel.c | 25 + src/minilogd.c | 187 +++ src/netreport.c | 66 + src/ppp-watch.c | 786 ++++++++++ src/process.c | 324 ++++ src/process.h | 9 + src/resolvesymlink.c | 17 + src/run-parts.c | 655 ++++++++ src/setuidgid.c | 132 ++ src/shvar.c | 393 +++++ src/shvar.h | 103 ++ src/start-stop-daemon.c | 1367 ++++++++++++++++ src/testd.c | 9 + src/testdinit | 44 + src/usernetctl.c | 242 +++ src/usleep.c | 71 + sysconfig/Makefile.am | 21 + sysconfig/cpusets/Makefile.am | 7 + sysconfig/cpusets/cpuset-test | 25 + sysconfig/hwprof | 4 + sysconfig/hwprofiles/Makefile.am | 7 + sysconfig/hwprofiles/files | 15 + sysconfig/i18n | 10 + sysconfig/init-colors | 12 + sysconfig/init-colors.gentoo | 12 + sysconfig/interfaces/Makefile.am | 32 + sysconfig/interfaces/data/Makefile.am | 15 + sysconfig/interfaces/data/chat-ppp0.callback | 23 + sysconfig/interfaces/data/chat-ppp0.gprs-idea | 7 + .../interfaces/data/chat-ppp0.gprs-playmobile | 10 + .../interfaces/data/chat-ppp0.gprs-plusgsm | 10 + sysconfig/interfaces/data/chat-ppp0.kou | 8 + .../interfaces/data/chat-ppp0.kou-disconnect | 8 + sysconfig/interfaces/data/chat-ppp0.leased1 | 8 + sysconfig/interfaces/data/chat-ppp0.tpsa | 13 + sysconfig/interfaces/down.d/Makefile.am | 3 + sysconfig/interfaces/down.d/all/Makefile.am | 8 + sysconfig/interfaces/down.d/all/thetouch | 5 + sysconfig/interfaces/down.d/ip/Makefile.am | 7 + sysconfig/interfaces/down.d/ipx/Makefile.am | 7 + sysconfig/interfaces/down.d/ppp/Makefile.am | 7 + sysconfig/interfaces/down.d/ppp/logger | 5 + sysconfig/interfaces/down.d/tnl/Makefile.am | 7 + sysconfig/interfaces/ifcfg-bond0 | 23 + sysconfig/interfaces/ifcfg-br0 | 6 + sysconfig/interfaces/ifcfg-description | 240 +++ sysconfig/interfaces/ifcfg-eth0 | 40 + sysconfig/interfaces/ifcfg-eth0.1 | 9 + sysconfig/interfaces/ifcfg-irda0 | 10 + sysconfig/interfaces/ifcfg-irlan0 | 5 + sysconfig/interfaces/ifcfg-ppp0.callback | 26 + .../interfaces/ifcfg-ppp0.eagle-usb-neostrada | 14 + sysconfig/interfaces/ifcfg-ppp0.gprs-idea | 27 + .../interfaces/ifcfg-ppp0.gprs-playmobile | 24 + sysconfig/interfaces/ifcfg-ppp0.gprs-plusgsm | 25 + sysconfig/interfaces/ifcfg-ppp0.kou | 19 + sysconfig/interfaces/ifcfg-ppp0.leased1 | 30 + sysconfig/interfaces/ifcfg-ppp0.leased2 | 29 + sysconfig/interfaces/ifcfg-ppp0.pppoe | 29 + .../ifcfg-ppp0.speedtouch-neostrada | 24 + sysconfig/interfaces/ifcfg-ppp0.tpsa | 23 + .../interfaces/ifcfg-ppp0.ueagle-neostrada | 17 + .../interfaces/ifcfg-ppp0.ueagle4-neostrada | 24 + sysconfig/interfaces/ifcfg-sl0 | 12 + sysconfig/interfaces/tnlcfg-description | 41 + sysconfig/interfaces/tnlcfg-icm | 20 + sysconfig/interfaces/up.d/Makefile.am | 4 + sysconfig/interfaces/up.d/all/Makefile.am | 8 + sysconfig/interfaces/up.d/all/thetouch | 5 + sysconfig/interfaces/up.d/ip/Makefile.am | 7 + sysconfig/interfaces/up.d/ipx/Makefile.am | 7 + sysconfig/interfaces/up.d/ppp/Makefile.am | 7 + sysconfig/interfaces/up.d/ppp/logger | 5 + sysconfig/interfaces/up.d/tnl/Makefile.am | 7 + sysconfig/network | 68 + sysconfig/static-arp | 3 + sysconfig/static-nat | 3 + sysconfig/static-routes | 12 + sysconfig/static-routes6 | 14 + sysconfig/system | 137 ++ sysctl.conf | 210 +++ t/backtick-test.sh | 28 + t/status-pidfile.sh | 39 + 213 files changed, 22878 insertions(+) create mode 100644 AUTHORS create mode 100644 COPYING create mode 100644 DEVELOPMENT create mode 100644 INSTALL create mode 100644 Makefile.am create mode 100644 NEWS create mode 100644 README create mode 100644 TODO create mode 100644 acinclude.m4 create mode 100644 adjtime create mode 100755 autogen.sh create mode 100755 changelog.sh create mode 100644 configure.ac create mode 100644 crypttab create mode 100644 doc/Makefile.am create mode 100755 doc/make-html create mode 100644 doc/net-scripts.txt create mode 100644 doc/polski.dsl create mode 100644 doc/rc-scripts.docb create mode 100644 doc/sysconfig.docb create mode 100644 doc/sysconfig.txt create mode 100644 doc/sysvinitfiles create mode 100644 doc/template.init create mode 100644 dumb.sh create mode 100755 firmware-loader.sh create mode 100755 hwprofile create mode 100644 inittab create mode 100644 isapnp/Makefile.am create mode 100644 isapnp/isapnp-kernel.conf create mode 100755 lang.csh create mode 100755 lang.sh create mode 100644 lib/Makefile.am create mode 100644 lib/functions create mode 100644 lib/functions.network create mode 100755 lib/ifdown create mode 100755 lib/ifdown-br create mode 100755 lib/ifdown-irda create mode 100755 lib/ifdown-post create mode 100755 lib/ifdown-ppp create mode 100755 lib/ifdown-sl create mode 100755 lib/ifdown-vlan create mode 100755 lib/ifup create mode 100644 lib/ifup-aliases create mode 100755 lib/ifup-br create mode 100755 lib/ifup-ipx create mode 100755 lib/ifup-irda create mode 100755 lib/ifup-iucv create mode 100644 lib/ifup-neigh create mode 100755 lib/ifup-plip create mode 100755 lib/ifup-plusb create mode 100755 lib/ifup-post create mode 100755 lib/ifup-ppp create mode 100644 lib/ifup-routes create mode 100755 lib/ifup-sl create mode 100755 lib/ifup-vlan create mode 100755 lib/tnldown create mode 100755 lib/tnlup create mode 100755 make-tag.sh create mode 100644 man/Makefile.am create mode 100644 man/consoletype.1 create mode 100644 man/crypttab.5 create mode 100644 man/de/Makefile.am create mode 100644 man/de/start-stop-daemon.8 create mode 100644 man/doexec.1 create mode 100644 man/es/Makefile.am create mode 100644 man/es/start-stop-daemon.8 create mode 100644 man/fr/Makefile.am create mode 100644 man/fr/start-stop-daemon.8 create mode 100644 man/genhostid.1 create mode 100644 man/getkey.1 create mode 100644 man/initlog.1 create mode 100644 man/ipcalc.1 create mode 100644 man/ja/Makefile.am create mode 100644 man/ja/start-stop-daemon.8 create mode 100644 man/netreport.1 create mode 100644 man/ppp-watch.8 create mode 100644 man/ru/Makefile.am create mode 100644 man/ru/start-stop-daemon.8 create mode 100644 man/run-parts.8 create mode 100644 man/start-stop-daemon.8 create mode 100644 man/sv/Makefile.am create mode 100644 man/sv/start-stop-daemon.8 create mode 100644 man/usernetctl.8 create mode 100644 man/usleep.1 create mode 100644 modules create mode 100644 modules.preudev create mode 100644 po/Makefile.am create mode 100644 po/de.po create mode 100755 po/makepot.pl create mode 100644 po/pl.po create mode 100644 ppp/Makefile.am create mode 100755 ppp/auth-down create mode 100755 ppp/auth-up create mode 100755 ppp/ip-down create mode 100644 ppp/ip-down.d/Makefile.am create mode 100644 ppp/ip-down.d/logger create mode 100755 ppp/ip-up create mode 100644 ppp/ip-up.d/Makefile.am create mode 100644 ppp/ip-up.d/logger create mode 100755 ppp/ipx-down create mode 100755 ppp/ipx-up create mode 100644 rc.d/Makefile.am create mode 100644 rc.d/init.d/Makefile.am create mode 100755 rc.d/init.d/allowlogin create mode 100755 rc.d/init.d/cpusets create mode 100755 rc.d/init.d/cryptsetup create mode 100755 rc.d/init.d/killall create mode 100755 rc.d/init.d/local create mode 100755 rc.d/init.d/netfs create mode 100755 rc.d/init.d/network create mode 100755 rc.d/init.d/random create mode 100755 rc.d/init.d/single create mode 100755 rc.d/init.d/sys-chroots create mode 100755 rc.d/rc create mode 100755 rc.d/rc.init create mode 100644 rc.d/rc.local create mode 100755 rc.d/rc.shutdown create mode 100755 rc.d/rc.sysinit create mode 100755 run-parts.sh create mode 100755 service create mode 100755 setsysfont create mode 100644 src/Makefile.am create mode 100644 src/consoletype.c create mode 100644 src/doexec.c create mode 100644 src/genhostid.c create mode 100644 src/getkey.c create mode 100644 src/initlog.c create mode 100644 src/initlog.conf create mode 100644 src/initlog.h create mode 100644 src/ipcalc.c create mode 100644 src/loglevel.c create mode 100644 src/minilogd.c create mode 100644 src/netreport.c create mode 100644 src/ppp-watch.c create mode 100644 src/process.c create mode 100644 src/process.h create mode 100644 src/resolvesymlink.c create mode 100644 src/run-parts.c create mode 100644 src/setuidgid.c create mode 100644 src/shvar.c create mode 100644 src/shvar.h create mode 100644 src/start-stop-daemon.c create mode 100644 src/testd.c create mode 100755 src/testdinit create mode 100644 src/usernetctl.c create mode 100644 src/usleep.c create mode 100644 sysconfig/Makefile.am create mode 100644 sysconfig/cpusets/Makefile.am create mode 100644 sysconfig/cpusets/cpuset-test create mode 100644 sysconfig/hwprof create mode 100644 sysconfig/hwprofiles/Makefile.am create mode 100644 sysconfig/hwprofiles/files create mode 100644 sysconfig/i18n create mode 100644 sysconfig/init-colors create mode 100644 sysconfig/init-colors.gentoo create mode 100644 sysconfig/interfaces/Makefile.am create mode 100644 sysconfig/interfaces/data/Makefile.am create mode 100644 sysconfig/interfaces/data/chat-ppp0.callback create mode 100644 sysconfig/interfaces/data/chat-ppp0.gprs-idea create mode 100644 sysconfig/interfaces/data/chat-ppp0.gprs-playmobile create mode 100644 sysconfig/interfaces/data/chat-ppp0.gprs-plusgsm create mode 100644 sysconfig/interfaces/data/chat-ppp0.kou create mode 100644 sysconfig/interfaces/data/chat-ppp0.kou-disconnect create mode 100644 sysconfig/interfaces/data/chat-ppp0.leased1 create mode 100644 sysconfig/interfaces/data/chat-ppp0.tpsa create mode 100644 sysconfig/interfaces/down.d/Makefile.am create mode 100644 sysconfig/interfaces/down.d/all/Makefile.am create mode 100755 sysconfig/interfaces/down.d/all/thetouch create mode 100644 sysconfig/interfaces/down.d/ip/Makefile.am create mode 100644 sysconfig/interfaces/down.d/ipx/Makefile.am create mode 100644 sysconfig/interfaces/down.d/ppp/Makefile.am create mode 100644 sysconfig/interfaces/down.d/ppp/logger create mode 100644 sysconfig/interfaces/down.d/tnl/Makefile.am create mode 100644 sysconfig/interfaces/ifcfg-bond0 create mode 100644 sysconfig/interfaces/ifcfg-br0 create mode 100644 sysconfig/interfaces/ifcfg-description create mode 100644 sysconfig/interfaces/ifcfg-eth0 create mode 100644 sysconfig/interfaces/ifcfg-eth0.1 create mode 100644 sysconfig/interfaces/ifcfg-irda0 create mode 100644 sysconfig/interfaces/ifcfg-irlan0 create mode 100644 sysconfig/interfaces/ifcfg-ppp0.callback create mode 100644 sysconfig/interfaces/ifcfg-ppp0.eagle-usb-neostrada create mode 100644 sysconfig/interfaces/ifcfg-ppp0.gprs-idea create mode 100644 sysconfig/interfaces/ifcfg-ppp0.gprs-playmobile create mode 100644 sysconfig/interfaces/ifcfg-ppp0.gprs-plusgsm create mode 100644 sysconfig/interfaces/ifcfg-ppp0.kou create mode 100644 sysconfig/interfaces/ifcfg-ppp0.leased1 create mode 100644 sysconfig/interfaces/ifcfg-ppp0.leased2 create mode 100644 sysconfig/interfaces/ifcfg-ppp0.pppoe create mode 100644 sysconfig/interfaces/ifcfg-ppp0.speedtouch-neostrada create mode 100644 sysconfig/interfaces/ifcfg-ppp0.tpsa create mode 100644 sysconfig/interfaces/ifcfg-ppp0.ueagle-neostrada create mode 100644 sysconfig/interfaces/ifcfg-ppp0.ueagle4-neostrada create mode 100644 sysconfig/interfaces/ifcfg-sl0 create mode 100644 sysconfig/interfaces/tnlcfg-description create mode 100644 sysconfig/interfaces/tnlcfg-icm create mode 100644 sysconfig/interfaces/up.d/Makefile.am create mode 100644 sysconfig/interfaces/up.d/all/Makefile.am create mode 100755 sysconfig/interfaces/up.d/all/thetouch create mode 100644 sysconfig/interfaces/up.d/ip/Makefile.am create mode 100644 sysconfig/interfaces/up.d/ipx/Makefile.am create mode 100644 sysconfig/interfaces/up.d/ppp/Makefile.am create mode 100644 sysconfig/interfaces/up.d/ppp/logger create mode 100644 sysconfig/interfaces/up.d/tnl/Makefile.am create mode 100644 sysconfig/network create mode 100644 sysconfig/static-arp create mode 100644 sysconfig/static-nat create mode 100644 sysconfig/static-routes create mode 100644 sysconfig/static-routes6 create mode 100644 sysconfig/system create mode 100644 sysctl.conf create mode 100755 t/backtick-test.sh create mode 100755 t/status-pidfile.sh diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..3c21bfe --- /dev/null +++ b/AUTHORS @@ -0,0 +1,44 @@ +MAINTAINERS + +Maintainer of development version +is Arkadiusz Miśkiewicz + +AUTHORS/CREDITS + +Arkadiusz Miśkiewicz + networking functions, iproute2 support, + national language support, scripts for + controling tunnels and bridges + +Artur Frysiak + automake/autoconf support, bug fixes + +Bartosz Waszak + fixes, devfsd support + +Grzegorz Stanislawski + ppp scripts, prefix/netmask converting + functions, bug fixes + +Jan Rękorajski + general, ipv6 and dhcp fixes + +Michał Kochanowicz + fixes, progress() + +Paweł Wilk + executing scripts on iface up/down + timezone setup & resolvesymlink + +Robert Ślaski + ATM support + +Sebastian Zagrodzki + many fixes + +Tomasz Kłoczko + automake/autoconf updates, bug fixes + +Mandrake Software +RedHat Software, Inc. + diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..60549be --- /dev/null +++ b/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + 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. + + This program 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 program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/DEVELOPMENT b/DEVELOPMENT new file mode 100644 index 0000000..b347b76 --- /dev/null +++ b/DEVELOPMENT @@ -0,0 +1,57 @@ + READ THIS BEFORE CHANGEING SOMETHING IN RC-SCRIPTS PACKAGE + Arkadiusz Miskiewicz + +1) + consult all major changes with people on pld-rc-scripts@pld-linux.org +mailing list. This is very important. + +2) + use 'local' for local variables in functions for example: + +function_ble () +{ +local qw er=0 +qw=$(tty) +er=/dev/console +echo "$qw $er" +} + +3) + use $() instead `` for command execution for example + +something=$(whoami) +instead of +something="`whoami`" + +Warning! The following snippet will not work, use `` in such cases: +There is one ')' too many there. + +interfaces_boot=$( + case $i in + *ifcfg-lo) continue ;; + esac +) + +4) don't use sed ! It only causes one more Requires. + Use awk ' { gsub(/pattern/,"replaced"); print $0; } ' for that. + Also try to replace grep calls with awk calls. + +5) + (PL) Tlumaczac komunikaty na PL nalezy uzywac formy bezosobowej np: + +uruchamianie uslugi +zamiast +uruchamiam usluge + + + +HOW TO MAKE A RELEASE + +- git checkout master +- git pull --rebase +- ./autogen.sh +- make distcheck +- update configure.ac release and commit it +- make dist +- ./make-tag.sh +- upload tarball to distfiles, update rc-scripts.spec:HEAD diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..0068d75 --- /dev/null +++ b/INSTALL @@ -0,0 +1,184 @@ + !! First read README file !! + +Basic Installation +================== + + These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, a file +`config.cache' that saves the results of its tests to speed up +reconfiguring, and a file `config.log' containing compiler output +(useful mainly for debugging `configure'). + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If at some point `config.cache' +contains results you don't want to keep, you may remove or edit it. + + The file `configure.in' is used to create `configure' by a program +called `autoconf'. You only need `configure.in' if you want to change +it or regenerate `configure' using a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes awhile. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. You can give `configure' +initial values for variables by setting them in the environment. Using +a Bourne-compatible shell, you can do that on the command line like +this: + CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure + +Or on systems that have the `env' program, you can do it like this: + env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not supports the `VPATH' +variable, you have to compile the package for one architecture at a time +in the source code directory. After you have installed the package for +one architecture, use `make distclean' before reconfiguring for another +architecture. + +Installation Names +================== + + By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/man', etc. You can specify an +installation prefix other than `/usr/local' by giving `configure' the +option `--prefix=PATH'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give `configure' the option `--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=PATH' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + + There may be some features `configure' can not figure out +automatically, but needs to determine by the type of host the package +will run on. Usually `configure' can figure that out, but if it prints +a message saying it can not guess the host type, give it the +`--host=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name with three fields: + CPU-COMPANY-SYSTEM + +See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the host type. + + If you are building compiler tools for cross-compiling, you can also +use the `--target=TYPE' option to select the type of system they will +produce code for and the `--build=TYPE' option to select the type of +system on which you are compiling the package. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Operation Controls +================== + + `configure' recognizes the following options to control how it +operates. + +`--cache-file=FILE' + Use and save the results of the tests in FILE instead of + `./config.cache'. Set FILE to `/dev/null' to disable caching, for + debugging `configure'. + +`--help' + Print a summary of the options to `configure', and exit. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--version' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`configure' also accepts some other, not widely useful, options. diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..aabcb6f --- /dev/null +++ b/Makefile.am @@ -0,0 +1,50 @@ +# +# + +SUBDIRS = src lib ppp isapnp sysconfig rc.d doc man po + +sysconf_DATA = \ + adjtime \ + inittab \ + modules \ + crypttab \ + sysctl.conf + +firmware_SCRIPTS = \ + firmware-loader.sh + +profiledir = @sysconfdir@/profile.d + +profile_DATA = \ + lang.sh \ + lang.csh + +bin_SCRIPTS = run-parts.sh +sbin_SCRIPTS = \ + setsysfont \ + hwprofile \ + service + +AM_DISTCHECK_CONFIGURE_FLAGS = \ + --prefix=/usr \ + --verbose + +EXTRA_DIST = \ + $(sysconf_DATA) \ + $(profile_DATA) \ + $(firmware_SCRIPTS) \ + $(sbin_SCRIPTS) \ + $(bin_SCRIPTS) + +install-data-hook: + install -d $(DESTDIR)$(localstatedir)/cache/$(PACKAGE) + [ -f $(DESTDIR)$(localstatedir)/cache/$(PACKAGE)/msg.cache ] || touch $(DESTDIR)$(localstatedir)/cache/$(PACKAGE)/msg.cache + +uninstall-hook: + [ -f $(DESTDIR)$(localstatedir)/cache/$(PACKAGE)/msg.cache ] && rm -f $(DESTDIR)$(localstatedir)/cache/$(PACKAGE)/msg.cache + +# make rpms +rpm: $(PACKAGE).spec + $(MAKE) dist + rpmbin=`LC_ALL=C rpm -ta 2>&1 | grep -q "unknown option" && echo rpmbuild || echo rpm` ; \ + $$rpmbin -ta --clean --rmsource $(PACKAGE)-$(VERSION).tar.gz diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..427c688 --- /dev/null +++ b/NEWS @@ -0,0 +1,21 @@ +Features of rc-scripts: + +- National Language Support; currently only english and polish + supported. Translators needed. +- LDAP support (for interfaces database). NYF. +- Full IPv6 support (including PPP). + +New in 0.3.0: + +- fourtun (v4 over v6) tunneling support. +- support for more dhcp clients (dhcpcd, dhclient, dhcpxd, pump) +- Logical Volume Manager (LVM) support. +- /etc/sysctl.conf support. +- queueing discipline support. +- IPv6 boot method (v4compat). +- bridge configuration support. +- rc.modules scipt and /etc/modules config +- new ifcfg- config syntax + +Note: +NYF - not yet finished. diff --git a/README b/README new file mode 100644 index 0000000..32b1911 --- /dev/null +++ b/README @@ -0,0 +1,49 @@ +rc-scripts is a derivative of the initscripts 3.78 release by +RedHat Software, but with bugs removed and newer features added. + +To use rc-scripts you need packages such as: mktemp, modutils +(at least 2.1.121), textutils, sh-utils, mawk (at least 1.3.3; +other awk implementations are not tested), procps, sed, e2fsprogs, +gettext. + +If you want to use networking with rc-scripts you need +compile few features such as: + +Networking options ---> + [*] Kernel/User netlink socket + [*] Routing messages + +into your kernel and install Alexey Kuznetsov iproute2 package. +To use IPv6 networking you should compile: + +Networking options ---> + <*/M> The IPv6 protocol (EXPERIMENTAL) + [*] IPv6: enable EUI-64 token format + [*] IPv6: disable provider based addresses + +too. + +Other required or suggested packages: + +| What? | Package | ++-------------+-------------------------------+ + IPX ncfps + fourtun fourtun and kernel module + bridge bridge-utils + wireless wireless-tools + IrDA irda-utils + serial/ppp ppp, dip, wvdial + serial/slip slattach + PPPoE pppd + rp-pppoe (plugin or userspace program) + +Also you should know that format of interface configuration +files is totally different from these used in RedHat/Mandrake +initscripts and even from stable rc-scripts branch. + +If you have some bug reports or suggestions please send email +to rc-scripts maintainers at or +use our Bug Tracking System ( http://bugs.pld-linux.org/ ). + +-- +PLD Linux Distribution rc-scripts Team + diff --git a/TODO b/TODO new file mode 100644 index 0000000..2504da4 --- /dev/null +++ b/TODO @@ -0,0 +1,21 @@ +Important: +- don't set any flags automatically; always follow user + suggestion (multicast, arp) +- merge baggins changes in atm-rc (added support for RFC1483/2684 Bridged + protocol) +- killproc() sucks and has no consistency, error reporting + you'll never know which side of PROCNAME you should add the --waitforname or -SIGNAL args + because if you put -SIGNAL at wrong side of PROGNAME it will enter infinitive loop: + killproc -TERM --waitforname slapd --waitfortime 300 slapd + if you put --waitforname at wrong side, it will just ignore them: + killproc slapd -TERM --waitforname slapd --waitfortime 300 + while correct would be: + killproc --waitforname slapd --waitfortime 300 slapd -TERM +- switch to use __umount_*loop instead of own umount loop when stopping system +- rc-scripts won't work if /dev/console is invalid (for example I made typo when configuring serial + console, console=ttys1,... instead of console=ttyS1) - rc.d/rc uses /dev/console a lot + +Other: +- maybe merge ATM rc scripts + +We are waiting for suggestions. diff --git a/acinclude.m4 b/acinclude.m4 new file mode 100644 index 0000000..83d9a8d --- /dev/null +++ b/acinclude.m4 @@ -0,0 +1,68 @@ +dnl DPKG_CACHED_TRY_COMPILE(,,,,,) +AC_DEFUN([DPKG_CACHED_TRY_COMPILE],[ + AC_MSG_CHECKING($1) + AC_CACHE_VAL($2,[ + AC_TRY_COMPILE([$3],[$4],[$2=yes],[$2=no]) + ]) + if test "x$$2" = xyes; then + true + $5 + else + true + $6 + fi +]) + +dnl DPKG_C_GCC_ATTRIBUTE(,,,,,,[],[]) +AC_DEFUN([DPKG_C_GCC_ATTRIBUTE],[ + DPKG_CACHED_TRY_COMPILE(__attribute__(($1)),dpkg_cv_c_attribute_$2,, + [extern int testfunction($3) __attribute__(($4))], + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_GNUC25_$5,,$6) + $7, + AC_MSG_RESULT(no) + $8) +]) + +dnl DPKG_C_GCC_TRY_WARNS(,) +AC_DEFUN([DPKG_C_GCC_TRY_WARNS],[ + AC_MSG_CHECKING([GCC warning flag(s) $1]) + if test "${GCC-no}" = yes + then + AC_CACHE_VAL($2,[ + if $CC $1 -c /dev/null 2>/dev/null; then + $2=yes + else + $2= + fi + ]) + if test "x$$2" = xyes; then + CWARNS="${CWARNS} $1" + AC_MSG_RESULT(ok) + else + AC_MSG_RESULT(no) + fi + else + AC_MSG_RESULT(no, not using GCC) + fi +]) +dnl DPKG_CACHED_TRY_COMPILE(,,,,,) + + +dnl Check if a #define is present in an include file +AC_DEFUN([DPKG_CHECK_DEFINE], + [AC_CACHE_CHECK(if $1 is defined in $2, + ac_cv_define_$1, + [AC_TRY_COMPILE([ +#include <$2> + ],[ +int i = $1; + ], + ac_cv_define_$1=yes, + ac_cv_define_$1=no) + ]) + if test "$ac_cv_define_$1" = yes ; then + AC_DEFINE(HAVE_$1,,[define if $1 is defined]) + fi +]) + diff --git a/adjtime b/adjtime new file mode 100644 index 0000000..3127bd0 --- /dev/null +++ b/adjtime @@ -0,0 +1,2 @@ +0.0 0 0.0 +0 diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..a7028c2 --- /dev/null +++ b/autogen.sh @@ -0,0 +1,149 @@ +#!/bin/sh +# Run this to generate all the initial makefiles, etc. + +srcdir=`dirname $0` +test -z "$srcdir" && srcdir=. + +PKG_NAME="PLD Linux Distribution rc-scripts" + +if [ -x ./changelog.sh ]; then + ./changelog.sh +else + echo "Error: missing script changelog.sh to generate ChangeLog" >&2 + exit 1 +fi + +cd "$srcdir" + + +(test -f $srcdir/configure.ac \ + && test -d $srcdir/src) || { + echo -n "**Error**: Directory "\`$srcdir\'" does not look like the" + echo " top-level rc-scripts directory" + + exit 1 +} + +DIE=0 + +(autoconf --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`autoconf' installed to compile $PKG_NAME." + echo "Download the appropriate package for your distribution," + echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" + DIE=1 +} + +(grep "^AM_PROG_LIBTOOL" $srcdir/configure.ac >/dev/null) && { + (libtoolize --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`libtool' installed to compile $PKG_NAME." + echo "Get ftp://alpha.gnu.org/gnu/libtool/libtool-1.4b.tar.gz" + echo "(or a newer version if it is available)" + DIE=1 + } +} + +grep "^AM_GNU_GETTEXT" $srcdir/configure.ac >/dev/null && { + grep "sed.*POTFILES" $srcdir/configure.ac >/dev/null || \ + (gettextize --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`gettext' installed to compile $PKG_NAME." + echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.38.tar.gz" + echo "(or a newer version if it is available)" + DIE=1 + } +} + +(automake --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`automake' installed to compile $PKG_NAME." + echo "Get ftp://sourceware.cygnus.com/pub/automake/automake-1.4-p4.tar.gz" + echo "(or a newer version if it is available)" + DIE=1 + NO_AUTOMAKE=yes +} + + +# if no automake, don't bother testing for aclocal +test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: Missing \`aclocal'. The version of \`automake'" + echo "installed doesn't appear recent enough." + echo "Get ftp://sourceware.cygnus.com/pub/automake/automake-1.4-p4.tar.gz" + echo "(or a newer version if it is available)" + DIE=1 +} + +if test "$DIE" -eq 1; then + exit 1 +fi + +if test -z "$*"; then + echo "**Warning**: I am going to run \`configure' with no arguments." + echo "If you wish to pass any to it, please specify them on the" + echo \`$0\'" command line." + echo +fi + +case $CC in +xlc ) + am_opt=--include-deps;; +esac + +for coin in `find $srcdir -name configure.ac -print` +do + dr=`dirname $coin` + if test -f $dr/NO-AUTO-GEN; then + echo skipping $dr -- flagged as no auto-gen + else + echo processing $dr + macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < $coin` + ( cd $dr + aclocalinclude="$ACLOCAL_FLAGS" + for k in $macrodirs; do + if test -d $k; then + aclocalinclude="$aclocalinclude -I $k" + ##else + ## echo "**Warning**: No such directory \`$k'. Ignored." + fi + done + if grep "^AM_GNU_GETTEXT" configure.ac >/dev/null; then + if grep "sed.*POTFILES" configure.ac >/dev/null; then + : do nothing -- we still have an old unmodified configure.ac + else + echo "Creating $dr/aclocal.m4 ..." + test -r $dr/aclocal.m4 || touch $dr/aclocal.m4 + echo "Running gettextize... Ignore non-fatal messages." + echo "no" | gettextize --force --copy + echo "Making $dr/aclocal.m4 writable ..." + test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4 + fi + fi + if grep "^AM_PROG_LIBTOOL" configure.ac >/dev/null; then + echo "Running libtoolize..." + libtoolize --force --copy + fi + echo "Running aclocal $aclocalinclude ..." + aclocal $aclocalinclude + if grep "^A[CM]_CONFIG_HEADER" configure.ac >/dev/null; then + echo "Running autoheader..." + autoheader + fi + echo "Running autoconf ..." + autoconf + echo "Running automake --gnu $am_opt ..." + automake --add-missing --gnu $am_opt + ) + fi +done + +conf_flags="" #--enable-maintainer-mode --enable-compile-warnings --enable-iso-c + +if test x$NOCONFIGURE = x; then + echo Running $srcdir/configure $conf_flags "$@" ... + $srcdir/configure $conf_flags "$@" \ + && echo Now type \`make\' to compile $PKG_NAME +else + echo Skipping configure process. +fi diff --git a/changelog.sh b/changelog.sh new file mode 100755 index 0000000..54baf7d --- /dev/null +++ b/changelog.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# Run this to generate ChangeLog. + +[ -e .git/shallow ] && git fetch --unshallow +git log --format='%+ai [%h] %aN <%ae>%n%n%x09* %s' --stat | sed '1d' > ChangeLog + +# obfuscate emails and (user@domain) +sed -i -e 's,\([<(].*\)@\(.*[)>]\),\1/at/\2,g' ChangeLog diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..6e74a99 --- /dev/null +++ b/configure.ac @@ -0,0 +1,228 @@ + +AC_INIT([rc-scripts], [0.4.14], [pld-rc-scripts@lists.pld-linux.org], [rc-scripts]) +AM_INIT_AUTOMAKE + +ALL_LINGUAS="pl de" + +echo -n "Finding shell scripts" +SHSCRIPTS="" +for shfile in $(find ${srcdir}/rc.d ${srcdir}/sysconfig ${srcdir}/lib ! -path "*/\.*/*" ! -name "*~" -type f); do + echo -n "." + if (LC_ALL=C file ${shfile} | grep -q 'shell script'); then + SHSCRIPTS="${SHSCRIPTS} ${shfile}" + fi +done +echo "done" + +dnl Checks for programs. +AC_PROG_CC +AC_ISC_POSIX +AC_PROG_INSTALL +AC_PROG_LN_S +AC_PROG_MAKE_SET + +pppdir='${sysconfdir}/ppp' +sysconfigdir='${sysconfdir}/sysconfig' +updir='${sysconfigdir}/interfaces/up.d' +downdir='${sysconfigdir}/interfaces/down.d' +networkscriptsdir='${exec_prefix}/lib/${PACKAGE}' +rcdir='${sysconfdir}/rc.d' +initdir='${sysconfdir}/init' +firmwaredir='${exec_prefix}/lib/firmware' +docdir="${prefix}/doc/${PACKAGE}-${VERSION}" + +dnl i18n support +AC_PATH_PROGS(MSGMERGE, msgmerge) +AC_PATH_PROGS(GMSGFMT, gmsgfmt msgfmt) + +if test -z "$MSGMERGE" || test -z "$GMSGFMT"; then + AC_MSG_ERROR(install gettext-devel to be able to regenerate translations) +fi + +CATALOGS= +POTFILES= +for lang in $ALL_LINGUAS; do + CATALOGS="$CATALOGS $lang.gmo" + POTFILES="$POTFILES $lang.po" +done + +POTSRC= +for src in $SHSCRIPTS; do + POTSRC="$POTSRC \$(top_srcdir)/$src" +done +AC_ARG_WITH(localedir, + [ --with-localedir=PATH specify where the locale stuff should go ]) + +if test "x$LOCALEDIR" = "x"; then + if test "x$with_localedir" != "x"; then + LOCALEDIR=$with_localedir + else + LOCALEDIR='$(prefix)/share/locale' + fi +fi + +localedir=$LOCALEDIR +gnulocaledir=$LOCALEDIR + +if test "`eval echo $sysconfdir`" = "NONE/etc"; then + defaultdir="/usr/local/etc" +else + defaultdir="`eval echo $sysconfdir`" +fi + +AC_PATH_PROG(PKG_CONFIG, pkg-config, no) +if test "$PKG_CONFIG" = no; then + AC_MSG_ERROR(You need to install pkgconfig package) +fi + +GLIBDIR=none +AC_MSG_CHECKING([glib2]) +GLIB_LIBS="-Wl,-static `$PKG_CONFIG --libs --static glib-2.0` -Wl,-Bdynamic" +GLIB_CFLAGS="`$PKG_CONFIG --cflags-only-I glib-2.0`" +if test "x$GLIB_LIBS" = "x"; then + AC_MSG_ERROR(no) +fi +AC_MSG_RESULT(yes) + +DPKG_C_GCC_ATTRIBUTE([,,],supported,[int x],[,,],ATTRIB,[Define if function attributes a la GCC 2.5 and higher are available.], + DPKG_C_GCC_ATTRIBUTE(noreturn,noreturn,[int x],noreturn,NORETURN,[Define if nonreturning functions a la GCC 2.5 and higher are available.]) + DPKG_C_GCC_ATTRIBUTE(const,const,[int x],const,CONST,[Define if constant functions a la GCC 2.5 and higher are available.]) + DPKG_C_GCC_ATTRIBUTE(unused,unused,[int x],unused,UNUSED,[Define if unused variables la GCC 2.5 and higher are available.]) + DPKG_C_GCC_ATTRIBUTE(format...,format,[char *y, ...],[format(printf,1,2)],PRINTFFORMAT,[Define if printf-format argument lists a la GCC are available.])) + +AC_CHECK_TYPE(ptrdiff_t,int) +AC_CHECK_HEADERS([stddef.h sys/capability.h getopt.h]) + +dnl Output +AC_SUBST(BASHSCRIPTS) +AC_SUBST(CATALOGS) +AC_SUBST(POTFILES) +AC_SUBST(POTSRC) +AC_SUBST(localedir) +AC_SUBST(gnulocaledir) + +AC_SUBST(pppdir) +AC_SUBST(networkscriptsdir) +AC_SUBST(sysconfigdir) +AC_SUBST(updir) +AC_SUBST(downdir) +AC_SUBST(rcdir) +AC_SUBST(initdir) +AC_SUBST(docdir) +AC_SUBST(firmwaredir) +AC_SUBST(GLIB_LIBS) +AC_SUBST(GLIB_CFLAGS) + +AH_BOTTOM([ +#ifdef HAVE_STDDEF_H +#include +#endif + +/* Use the definitions: */ + +/* The maximum length of a #! interpreter displayed by dpkg-deb. */ +#ifdef PATH_MAX +#define INTERPRETER_MAX PATH_MAX +#else +#define INTERPRETER_MAX 1024 +#endif + +/* GNU C attributes. */ +#ifndef FUNCATTR +#ifdef HAVE_GNUC25_ATTRIB +#define FUNCATTR(x) __attribute__(x) +#else +#define FUNCATTR(x) +#endif +#endif + +/* GNU C printf formats, or null. */ +#ifndef ATTRPRINTF +#ifdef HAVE_GNUC25_PRINTFFORMAT +#define ATTRPRINTF(si,tc) format(printf,si,tc) +#else +#define ATTRPRINTF(si,tc) +#endif +#endif +#ifndef PRINTFFORMAT +#define PRINTFFORMAT(si,tc) FUNCATTR((ATTRPRINTF(si,tc))) +#endif + +/* GNU C nonreturning functions, or null. */ +#ifndef ATTRNORETURN +#ifdef HAVE_GNUC25_NORETURN +#define ATTRNORETURN noreturn +#else /* ! HAVE_GNUC25_NORETURN */ +#define ATTRNORETURN +#endif /* HAVE_GNUC25_NORETURN */ +#endif /* ATTRNORETURN */ + +#ifndef NONRETURNING +#define NONRETURNING FUNCATTR((ATTRNORETURN)) +#endif /* NONRETURNING */ + +/* Combination of both the above. */ +#ifndef NONRETURNPRINTFFORMAT +#define NONRETURNPRINTFFORMAT(si,tc) FUNCATTR((ATTRPRINTF(si,tc),ATTRNORETURN)) +#endif + +/* GNU C constant functions, or null. */ +#ifndef ATTRCONST +#ifdef HAVE_GNUC25_CONST +#define ATTRCONST const +#else +#define ATTRCONST +#endif +#endif +#ifndef CONSTANT +#define CONSTANT FUNCATTR((ATTRCONST)) +#endif + +/* GNU C unused functions, or null. */ +#ifndef ATTRUNUSED +#ifdef HAVE_GNUC25_UNUSED +#define ATTRUNUSED +#else +#define ATTRUNUSED +#endif +#endif +#ifndef UNUSED +#define UNUSED FUNCATTR((ATTRUNUSED)) +#endif +]) + +AC_CONFIG_HEADERS(src/config.h) +AC_CONFIG_FILES([Makefile \ + src/Makefile \ + lib/Makefile \ + doc/Makefile \ + man/Makefile \ + man/de/Makefile \ + man/es/Makefile \ + man/fr/Makefile \ + man/ja/Makefile \ + man/ru/Makefile \ + man/sv/Makefile \ + ppp/Makefile \ + isapnp/Makefile \ + sysconfig/Makefile \ + sysconfig/cpusets/Makefile \ + sysconfig/hwprofiles/Makefile \ + sysconfig/interfaces/Makefile \ + sysconfig/interfaces/data/Makefile \ + sysconfig/interfaces/up.d/Makefile \ + sysconfig/interfaces/up.d/all/Makefile \ + sysconfig/interfaces/up.d/ip/Makefile \ + sysconfig/interfaces/up.d/ipx/Makefile \ + sysconfig/interfaces/up.d/ppp/Makefile \ + sysconfig/interfaces/up.d/tnl/Makefile \ + sysconfig/interfaces/down.d/Makefile \ + sysconfig/interfaces/down.d/all/Makefile \ + sysconfig/interfaces/down.d/ip/Makefile \ + sysconfig/interfaces/down.d/ipx/Makefile \ + sysconfig/interfaces/down.d/ppp/Makefile \ + sysconfig/interfaces/down.d/tnl/Makefile \ + rc.d/Makefile rc.d/init.d/Makefile \ + po/Makefile \ + ]) +AC_OUTPUT diff --git a/crypttab b/crypttab new file mode 100644 index 0000000..536529a --- /dev/null +++ b/crypttab @@ -0,0 +1,7 @@ +# See crypttab(5) for this file format. +# +# NOTE: No options can be specified for LUKS encrypted partitions. + +# NAME DEVICE PASSWORD OPTIONS +#hda1 /dev/hda1 none verify +#hda1 /dev/hda1 diff --git a/doc/Makefile.am b/doc/Makefile.am new file mode 100644 index 0000000..6218f40 --- /dev/null +++ b/doc/Makefile.am @@ -0,0 +1,12 @@ +@SET_MAKE@ + +docdir = @docdir@ + +doc_DATA = +noinst_DATA = \ + template.init \ + net-scripts.txt \ + sysconfig.txt \ + sysvinitfiles + +EXTRA_DIST = $(doc_DATA) $(noinst_DATA) diff --git a/doc/make-html b/doc/make-html new file mode 100755 index 0000000..fa3f11f --- /dev/null +++ b/doc/make-html @@ -0,0 +1,4 @@ +#!/bin/sh + +jade -t sgml -d polski.dsl rc-scripts.docb +#jade -t sgml -d polski.dsl test-ogonki.docb diff --git a/doc/net-scripts.txt b/doc/net-scripts.txt new file mode 100644 index 0000000..ccc52b0 --- /dev/null +++ b/doc/net-scripts.txt @@ -0,0 +1,206 @@ +rc-scripts files: +======================================== + +/sbin/ifup: +/sbin/ifdown: + + These are the only two scripts "in" this directory that should + be called directly; these two scripts call all the other + scripts as needed. + + These scripts take one argument normally: the name of the device + (e.g. eth0). They are called with a second argument of "boot" + during the boot sequence so that devices that are not meant to + be brought up on boot (ONBOOT=no, see below) can be ignored at + that time. + +/sbin/network-scripts/network-functions: + + Not really a public file. Contains functions which the scripts use + for bringing interfaces up and down. In particular, it contains + most of the code for handling alternative interface configurations + and interface change notification through netreport. + +/lib/rc-scripts/ifup-post + + Called when any network device EXCEPT a SLIP (with dip) device comes + up. Calls /lib/rc-scripts/ifup-routes to + bring up static routes that depend on that device. Calls + /sbin/network-scripts/ifup-aliases to bring up + aliases for that device. Sets the hostname if it is not + already set and a hostname can be found for the IP for that + device. Sends SIGIO to any programs that have requested + notification of network events. + + Could be extended to fix up nameservice configuration, call + arbitrary scripts, etc, as needed. + +/lib/rc-scripts/ifup-routes + + Set up static routes for a device. + +/lib/rc-scripts/ifup-aliases + + Bring up aliases for a device. + +/lib/rc-scripts/ifdhcpc-done + + Called by dhcpcd once dhcp configuration is complete; sets + up /etc/resolv.conf from the version dhcpcd dropped in + /etc/dhcpc/resolv.conf + +Files in /etc/sysconfig/interfaces/ +======================================== + +/etc/sysconfig/interfaces/ifcfg- and +/etc/sysconfig/interfaces/ifcfg--: + + The first defines an interface, and the second contains + only the parts of the definition that are different in a + "clone" (or alternative) interface. For example, the + network numbers might be different, but everything else + might be the same, so only the network numbers would be + in the clone file, but all the device information would + be in the base ifcfg file. + + The items that can be defined in an ifcfg file depend on the + interface type. The really obvious ones I'm not going to + bother to define; you can figure out what "IPADDR" is, I + think... :-) + + Base items: + DEVICE= + LINESPEED= + DEFABORT=yes|no (tells netcfg whether or not to put default + abort strings in when creating/editing the chat script and/or + dip script for this interface) + + PPP-specific items + DEFROUTE=yes|no (set this interface as default route?) + ESCAPECHARS=yes|no (simplified interface here doesn't let people + specify which characters to escape; almost everyone can use + asyncmap 00000000 anyway, and they can set PPPOPTIONS to + asyncmap foobar if they want to set options perfectly) + HARDFLOWCTL=yes|no (yes imples "modem crtscts" options) + PPPOPTIONS= + PAPNAME=<"name $PAPNAME" on pppd command line> (note that + the "remotename" option is always specified as the logical + ppp device name, like "ppp0" (which might perhaps be the + physical device ppp1 if some other ppp device was brought + up earlier...), which makes it easy to manage pap/chap + files -- name/password pairs are associated with the + logical ppp device name so that they can be managed + together. + + In principal, I'm not aware of anything that would keep + the logical PPP device names from being "worldnet" or + "myISP" instead of ppp0-pppN) + REMIP= + REMIP6= + MTU= + MRU= + DISCONNECTTIMEOUT= + (time to wait before re-establishing the connection after + a successfully-connected session terminates before attempting + to establish a new connection.) + RETRYTIMEOUT= + (time to wait before re-attempting to establish a connection + after a previous attempt fails.) + INITSCRIPT= + string which initialises your modem. Usualy something like + AT&F0&C1&D2 + (PLD Linux rc-scripts specific option) + DATAFORCHAT= + List of variables which should be exported to chat script. + Used mostly for passing USERNAME and PASSWORD into it. (see below) + (PLD Linux rc-scripts specific option) + PEERDNS=yes|no + IPV6_PPP=yes|no + use IPv6 for ppp + IPV6_CP_USEV4=yes|no + use local IPv4 mapped addresses as IPv6 addresses + IPV6_CP_PERSISTENT=yes|no + use EUI-48 addresses as IPv6 addresses + or by default use address specified by IP6_PRIM_IF and REMIP6 + ENABLE_6TO4=yes|no + configure a 6to4 tunnel, if the interface has a public + (non-RFC1918) IPv4 address + = + Variable name and it's value for use by chat script. + Note: You don't have to define variables here, if they are defined + in parent process enviroment they will be used. + in.ex. USERNAME usualy is. + + IPIP/GRE/SIT tunnel-specific items + REMOTEIP= + address of the remote end of tunnel + LOCALIP= + address of the local end of tunnel + + + +/etc/sysconfig/interfaces/ifcfg--!: + + Template or backup file. This will not be interpreted + by net-scripts. + +/etc/sysconfig/interfaces/data/chat-: + + chat script for PPP or SLIP connection intended to establish + the connection. For SLIP devices, a DIP script is written + from the chat script; for PPP devices, the chat script is used + directly. + In PLD Linux version of rc-scripts, this file is parsed by shell + (actually by grep in firstplace to get rid of comments) before it + is passed to chat. + This allows you to substitute shell variables with their values + defined in or more generally in current env. + If You wonder about purbose, imagine one chat-script for all links + at ISP's border router or computer in home where all users have own IPS's + accounts and want to pay only for themselfes. + Unfortunetly this parsing have impact on chat script syntax. + All characters that have special meaning for shell have to be escaped. + + +/etc/sysconfig/interfaces/data/dip- + + A write-only script created from the chat script by netcfg. + Do not modify this. In the future, this file may disappear + by default and created on-the-fly from the chat script if + it does not exist. diff --git a/doc/polski.dsl b/doc/polski.dsl new file mode 100644 index 0000000..2429d24 --- /dev/null +++ b/doc/polski.dsl @@ -0,0 +1,63 @@ + +]> + + + + + + + ;;(define nochunks #t) + (define %no-make-index #t) + (define %generate-book-titlepage% #t) + (define %generate-book-toc% #t) + (define %generate-book-toc-on-titlepage% #f) + (define %generate-reference-toc% #f) + (define %generate-reference-toc-on-titlepage% #f) + (define %generate-reference-titlepage% #f) + (define %generate-chapter-toc% #f) + (define %generate-partintro-on-titlepage% #f) + ;;(define %generate--toc% #t) + (define %use-id-as-filename% #t) + (define %chapter-autolabel% #f) + (define %section-autolabel% #f) + (define %html-ext% ".html") + (define %gentext-nav-use-ff% #t) + (define %gentext-nav-use-tables% #t) + (define %force-chapter-toc% #f) + (define %gentext-nav-tblwidth% "100%") + (define %shade-verbatim% #t) + (define %annotate-toc% #t) + (define %html-pubid% "-//W3C//DTD HTML 4.0 Transitional//EN") + ;;(define %link-mailto-url% "mailto:ziembor@faq-bot.ziembor.waw.pl") + (define %stylesheet-type% "text/css") + (define %stylesheet% "pcwfaq.css") + (define %body-attr% (list (list "BGCOLOR" "#FFFFFF") (list "TEXT" "#000000"))) + ;;(define %titlepage-in-info-order% #t) + (define %html-header-tags% '(("META" ("NAME" "description") ("CONTENT" "taki sobie + teścik")) + ("META" ("HTTP-EQUIV" "content-type") ("content" "text/html; charset=UTF-8")))) + (define %spacing-paras% #f) + + + + + + + + diff --git a/doc/rc-scripts.docb b/doc/rc-scripts.docb new file mode 100644 index 0000000..6a510bd --- /dev/null +++ b/doc/rc-scripts.docb @@ -0,0 +1,35 @@ + + + + +]> + + + + + + 1998.10.19 + tytuł + podtytuł + + + + Opisy pakietów + + Opisy pakietów specyficznych dla PLD + + + + &sysconfig; + + + + + + + diff --git a/doc/sysconfig.docb b/doc/sysconfig.docb new file mode 100644 index 0000000..4906555 --- /dev/null +++ b/doc/sysconfig.docb @@ -0,0 +1,438 @@ + + + /etc/sysconfig/ + Basic system settings + + + <filename moreinfo="None">/etc/sysconfig/keyboard</filename> + + + KEYTABLE=<keytable file> + for example: + KEYTABLE="/usr/lib/kbd/keytables/us.map" + + + + + + + <filename moreinfo="None">/etc/sysconfig/mouse</filename> + + + MOUSETYPE=microsoft|mouseman|mousesystems|ps/2|msbm|logibm|atibm| + logitech|mmseries|mmhittab + + + + + XEMU3=yes|no + (emulate three buttons with two buttons whenever + necessary, most notably in X) + + + + In addition, /dev/mouse points to the mouse device. + + + <filename moreinfo="None">/etc/sysconfig/network</filename> + + NETWORKING=yes|no + IPV6NETWORKING=yes|no + + + HOSTNAME=$<whatever hostname you want> + for compatibility with some old software people might + install (like trn), the /etc/HOSTNAME file should contain the + same value as here. + + + IGNORE_ICMP_BCAST_IPV4=yes|no + (Please note that if you accept ICMP echo + requests with a broadcast/multicast destination address your network + may be used as an exploder for denial of service packet flooding attacks + to other hosts. + + + + SPOOFING_IPV4=yes|no + + (anti spoofing protection) + + + + GATEWAY=<gateway IP> + + + + + + + + + GATEWAYDEV=<gateway device> + + + (e.g. eth0) + + + + + NISDOMAIN=<nis domain name> + + + + + + + IPX=yes|no + + + + + + + + IPXAUTOPRIMARY=on|off + + + (note, that MUST be on|off, not yes|no) + + + + + IPXAUTOFRAME=on|off + + + (again, not yes|no) + + + + + IPXINTERNALNETNUM=<netnum> + + + + + + + + IPXINTERNALNODENUM=<nodenum> + + + + + + All the IPX stuff is optional, and should default to off. + + + + <filename>/etc/sysconfig/static-nat</filename> + + Configuration file for static Network Address Translation (NAT). + Contains lines of the form: + +<address> via <addressreal> + + NAT will translate address <address> to <addressreal>. + + + <filename>/etc/sysconfig/static-routes</filename> + Contains lines of the form: + <device> to [type] <network>/<prefix> via <gateway> + <device> may be a device name to have the route brought up and + down with the device, or "none" if the route is not to be bound to any specific + device. [type] is optional. RH style isn't supported ! + Also you can set few options after "<gateway>": + + tos <tos> + metric <number> + table <table> + src <address> + realm <realmid> + mtu <mtu> or mtu lock <mtu> + window <number> + rtt <number> + nexthop <nexthop> + scope <scope> + protocol <rtproto> + onlink + equalize + + + For more informations see iproute2 documentation . + + + + <filename>/etc/sysconfig/static-routes6</filename> + Same as /etc/sysconfig/static-routes but + for IPv6. + + + + <filename>/etc/sysconfig/routed</filename> + + SILENT=yes|no + EXPORT_GATEWAY=yes|no + + + + + <filename>/etc/sysconfig/pcmcia</filename> + + PCMCIA=yes|no + PCIC=i82365|tcic + PCIC_OPTS=<socket driver (i82365 or tcic) timing parameters> + CORE_OPTS=<pcmcia_core options> + CARDMGR_OPTS=<cardmgr options> + + + + + <filename>/etc/sysconfig/amd</filename> + + ADIR=/.automount + (normally never changed) + + MOUNTPTS='/net /etc/amd.conf' + (standard automount stuff) + + AMDOPTS= + (extra options for AMD) + + + + + + <filename moreinfo="None">/etc/sysconfig/tape</filename> + + DEV=/dev/nst0 + + + Tape device. Use the non-rewinding one for these scripts. + + For SCSI tapes this is /dev/nst#, where # is the number of the + tape drive you want to use. If you only have one then use + nst0. + + For IDE tapes you use /dev/ht#, where # is the number of the tape + drive you want to use (usually ht0). + + For floppy tape drives use /dev/ftape. + + + + ADMIN=root + Person to mail to if the backup fails for any reason + + + + + SLEEP=5 + + + Time to sleep between tape operations. Some drives need a bit + more than others, but 5 seems to work for 8mm, 4mm, and DLT + + + + + BLOCKSIZE=32768 + + + This worked fine for 8mm, then 4mm, and now DLT. An optimal + setting is probably however much data your drive writes at one + time. + + + + + SHORTDATE=$(date +%y:%m:%d:%H:%M) + + + A short date string, used in backup log filenames. + + + + + + DAY=$(date +log-%y:%m:%d) + + + This is used for the log file directory. + + + + + DATE=$(date) + + + Regular date string, used in log files. + + + + + LOGROOT=/var/log/backup + + + Root of the logging directory + + + + + LIST=$LOGROOT/incremental-list + + + This is the file name the incremental backup will use to store + the incremental list. It will be $LIST-{some number}. + + + + + + DOTCOUNT=$LOGROOT/.count + + + For counting as you go to know which incremental list to use + + + + + + + COUNTER=$LOGROOT/counter-file + + + For rewinding when done...might not use. + + + + + + BACKUPTAB=/etc/backuptab + + + The file in which we keep our list of backup(s) we want to make. + + + + + + + + <filename>/etc/sysconfig/sendmail</filename> + + + DAEMON=yes|no + + yes implies -bd + + + + QUEUE=1h + + given to sendmail as -q$QUEUE + -q option is not given to sendmail if /etc/sysconfig/sendmail + exists and QUEUE is empty or undefined. + + + + + + <filename>/etc/sysconfig/i18n</filename> + + LANG= can be any two letter ISO language code + + LC_ALL= is the setting of the localedata configuration (eg fr_CA) + + LINGUAS= can be a : separated list of language codes + + SYSTERM= use to set default TERM environment variable + + + The above three variables are used in rc.sysinit. + + + SYSFONT= any font that is legal when used as + + /usr/sbin/setfont $SYSFONT ... + (See kbd package for sysfont command) + + + + UNIMAP= any unicode font that is legal fodder for + + /usr/sbin/setfont $SYSFONT-u $UNIMAP + + + + + The above is used by the /sbin/setsysfont command (which is run + by rc.sysinit at boot time). + + + + + <filename>/etc/sysconfig/\<service\></filename> + + The following are used when starting service. + + + + SERVICE_LIMITS="-u unlimited -c 0" + + + System limits for this service. + + + + + SERVICE_CPUSET="name" + + + CPUSET to run this service in. + + + + + SERVICE_UMASK="022" + + + File creation mask for this service. + + + + + SERVICE_RUN_NICE_LEVEL="0" + + + Scheduling priority for this service. + + + + + + + + + + + + + diff --git a/doc/sysconfig.txt b/doc/sysconfig.txt new file mode 100644 index 0000000..635d054 --- /dev/null +++ b/doc/sysconfig.txt @@ -0,0 +1,207 @@ +Files in /etc/sysconfig +======================= + +/etc/sysconfig/system: + + AUTOSWAP=yes|no + Set to 'yes' to enable automatic swapon of all partitions with + the proper swap magic. This allows setting up swap without editing + /etc/fstab. + +/etc/sysconfig/keyboard: + + KEYTABLE= + for example: KEYTABLE="/usr/lib/kbd/keytables/us.map" + +/etc/sysconfig/mouse: + + MOUSETYPE=microsoft|mouseman|mousesystems|ps/2|msbm|logibm|atibm| + logitech|mmseries|mmhittab + XEMU3=yes|no (emulate three buttons with two buttons whenever + necessary, most notably in X) + + In addition, /dev/mouse points to the mouse device. + +/etc/sysconfig/network: + + NETWORKING=yes|no + IPV4_NETWORKING=yes|no + IPV6_NETWORKING=yes|no + HOSTNAME= + Note: for compatibility with some old software people might + install (like trn), the /etc/HOSTNAME file should contain the + same value as here. + NISDOMAIN= + Note: set this only if you use NIS system. DNS domainname + should be set in /etc/resolv.conf + IGNORE_ICMP_BCAST_IPV4=yes|no (Please note that if you accept ICMP echo + requests with a broadcast/multicast destination address your network + may be used as an exploder for denial of service packet flooding attacks + to other hosts. + SPOOFING_IPV4=yes|no (anti spoofing protection) + GATEWAY= + GATEWAYDEV= (e.g. eth0) + IPX=yes|no + IPXAUTOPRIMARY=on|off (note, that MUST be on|off, not yes|no) + IPXAUTOFRAME=on|off (again, not yes|no) + IPXINTERNALNETNUM= + IPXINTERNALNODENUM= + + All the IPX stuff is optional, and should default to off. + +/etc/sysconfig/static-nat + + Configuration file for static Network Address Translation (NAT). + Contains lines of the form: + +
via + + NAT will translate address
to . + +/etc/sysconfig/static-routes: + + Contains lines of the form: + + to [type] / via + + may be a device name to have the route brought up and + down with the device, or "any" to have the correct devices calculated + at run time. [type] is optional. RH style isn't supported! + + Also you can set few options after "": + tos + metric + table + src
+ realm + mtu or mtu lock + window + rtt + nexthop + scope + protocol + onlink + equalize + For more informations see iproute2 documentation. + +/etc/sysconfig/static-routes6: + + Same as /etc/sysconfig/static-routes but for IPv6. + +/etc/sysconfig/routed: + + SILENT=yes|no + EXPORT_GATEWAY=yes|no + +/etc/sysconfig/pcmcia: + + PCMCIA=yes|no + PCIC=i82365|tcic + PCIC_OPTS= + CORE_OPTS= + CARDMGR_OPTS= + +/etc/sysconfig/amd: + + ADIR=/.automount (normally never changed) + MOUNTPTS='/net /etc/amd.conf' (standard automount stuff) + AMDOPTS= (extra options for AMD) + +/etc/sysconfig/tape: + + DEV=/dev/nst0 + Tape device. Use the non-rewinding one for these scripts. + + For SCSI tapes this is /dev/nst#, where # is the number of the + tape drive you want to use. If you only have one then use + nst0. + + For IDE tapes you use /dev/ht#, where # is the number of the tape + drive you want to use (usually ht0). + + For floppy tape drives use /dev/ftape. + + ADMIN=root + Person to mail to if the backup fails for any reason + + SLEEP=5 + Time to sleep between tape operations. Some drives need a bit + more than others, but 5 seems to work for 8mm, 4mm, and DLT + + BLOCKSIZE=32768 + This worked fine for 8mm, then 4mm, and now DLT. An optimal + setting is probably however much data your drive writes at one + time. + + SHORTDATE=$(date +%y:%m:%d:%H:%M) + A short date string, used in backup log filenames. + + DAY=$(date +log-%y:%m:%d) + This is used for the log file directory. + + DATE=$(date) + Regular date string, used in log files. + + LOGROOT=/var/log/backup + Root of the logging directory + + LIST=$LOGROOT/incremental-list + This is the file name the incremental backup will use to store + the incremental list. It will be $LIST-{some number}. + + DOTCOUNT=$LOGROOT/.count + For counting as you go to know which incremental list to use + + COUNTER=$LOGROOT/counter-file + For rewinding when done...might not use. + + BACKUPTAB=/etc/backuptab + The file in which we keep our list of backup(s) we want to make. + +/etc/sysconfig/sendmail: + DAEMON=yes|no + yes implies -bd + QUEUE=1h + given to sendmail as -q$QUEUE + -q option is not given to sendmail if /etc/sysconfig/sendmail + exists and QUEUE is empty or undefined. + +/etc/sysconfig/i18n + + LANG= is the default setting of localedata configuration + (ISO-639-1 language code with ISO-3166-1 country code and optional + variant and/or encoding, eg. fr_CA, fr_CA.UTF-8); + LC_CTYPE=, LC_COLLATE=, LC_MESSAGES=, LC_NUMERIC=, LC_MONETARY=, LC_TIME= + are the individual category settings + LC_ALL= overrides all of the above LC_* + LANGUAGE= can be a : separated list of language codes + see locale(7) for details + SYSTERM= use to set default TERM environment variable + + The above variables are used in rc.sysinit. + + SYSFONT= any font that is legal when used as + /usr/sbin/setfont $SYSFONT ... + (See kbd package for sysfont command) + + UNIMAP= any unicode font that is legal fodder for + /usr/sbin/setfont $SYSFONT-u $UNIMAP + + The above is used by the /sbin/setsysfont command (which is run + by rc.sysinit at boot time). + +/etc/sysconfig/ + + The following are used when starting service. + + SERVICE_LIMITS="-u unlimited -c 0" + System limits for this service. + + SERVICE_CPUSET="name" + CPUSET to run this service in. + + SERVICE_UMASK="022" + File creation mask for this service. + + SERVICE_RUN_NICE_LEVEL="0" + Scheduling priority for this service. diff --git a/doc/sysvinitfiles b/doc/sysvinitfiles new file mode 100644 index 0000000..24b0c60 --- /dev/null +++ b/doc/sysvinitfiles @@ -0,0 +1,187 @@ +Writing System V init scripts for PLD Linux +=============================================== + +All System V init scripts are named /etc/rc.d/init.d/ +where is the name of the service. There must be no +".init" suffix. + + +Sample Script +============= + +#!/bin/sh +# +# /etc/rc.d/init.d/ +# +# +# +# +# + +# Source function library. +. /etc/rc.d/init.d/functions + +# Running service -- nice level. +if [ -f /etc/sysconfig/ ]; then + . /etc/sysconfig/ +fi + + + +case "$1" in + start) + show Starting services + + touch /var/lock/subsys/ + ;; + stop) + show Shutting down services + + rm -f /var/lock/subsys/ + ;; + status) + + ;; + restart) + + ;; + reload) + + ;; + probe) + + ;; + *) + echo "Usage: $0 {start|stop|status|reload|restart[|probe]" + exit 1 + ;; +esac + + +Notes: the restart and reload functions may be (and commonly are) +combined into one test, vis: + restart|reload) +You are not prohibited from adding other commands; list all commands +which you intend to be used interactively to the usage message. + + + +Functions in /etc/rc.d/init.d/functions +======================================= + +daemon [+/-nicelevel] program [arguments] [&] + + Obsoletes starts a daemon, if it is not already running. + Does other useful things like keeping the daemon from + dumping core if it terminates unexpectedly. + +killproc program [signal] + + Sends a signal to the program; by default it sends a SIGTERM, + and if the process doesn't die, it sends a SIGKILL a few + seconds later. + + It also tries to remove the pidfile, if it finds one. + +pidofproc program + + Tries to find the pid of a program; checking likely pidfiles, + using the pidof program, or even using ps. Used mainly from + within other functions in this file, but also available to + scripts. + +status program + + Prints status information. Assumes that the program name is + the same as the servicename. + + +Tags +==== + +# chkconfig: + + Required. is a list of levels in which + the service should be started by default. + and are priority numbers. For example: + # chkconfig: 2345 20 80 + Read 'man chkconfig' for more information. + + Unless there is a VERY GOOD, EXPLICIT reason to the + contrary, the should be equal to + 100 - + +# description: + + Required. Several lines of description, continued with '\' + characters. The initial comment and following whitespace + on the following lines is ignored. + +# description[ln]: + + Optional. Should be the description translated into the + specified language. + +# processname: + + Optional, multiple entries allowed. For each process name + started by the script, there should be a processname entry. + For example, the samba service starts two daemons: + # processname: smdb + # processname: nmdb + +# config: + + Optional, multiple entries allowed. For each static config + file used by the daemon, use a single entry. For example: + # config: /etc/httpd/httpd.conf + # config: /etc/httpd/srm.conf + + Optionally, if the server will automatically reload the config + file if it is changed, you can append the word "autoreload" to + the line: + # config: /etc/foobar.conf autoreload + +# pidfile: + + Optional, multiple entries allowed. Use just like the config + entry, except that it points at pidfiles. It is assumed that + the pidfiles are only updated at process creation time, and + not later. The first line of this file should be the ASCII + representation of the PID; a terminating newline is optional. + Any lines other than the first line are not examined. + +# probe: true + + Optional, used IN PLACE of processname, config, and pidfile. + If it exists, then a proper reload-if-necessary cycle may be + acheived by running these commands: + + command=$(/etc/rd.d/init.d/SCRIPT probe) + [ -n "$command" ] && /etc/rc.d/init.d/SCRIPT $command + + where SCRIPT is the name of the service's sysv init script. + + Scripts that need to do complex processing could, as an + example, return "run /var/tmp/ short service description +# +# chkconfig: 345 +# +# description: long service description +# +# processname: +# config: +# pidfile: +# + +# Source function library +. /etc/rc.d/init.d/functions + +# Get network config +. /etc/sysconfig/network + +# Check that networking is up. +if is_yes "${NETWORKING}"; then + if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then + msg_network_down "" + exit 1 + fi +else + exit 0 +fi + +# Set defaults +OPTION1="" # Strings +OPTION2="-q" # +OPTION3= # Values +OPTION4=5 # + +# Get service config - may override defaults +[ -f /etc/sysconfig/ ] && . /etc/sysconfig/ + +pidfile="/var/run/.pid" + +# configtest itself +# must return non-zero if check failed +# output is discarded if checkconfig is ran without details +configtest() { + /usr/sbin/ -t + return $? +} + +# wrapper for configtest +checkconfig() { + local details=${1:-0} + + if [ $details = 1 ]; then + # run config test and display report (status action) + show "Checking %s configuration" ""; busy + local out + out=$(configtest 2>&1) + RETVAL=$? + if [ $RETVAL = 0 ]; then + ok + else + fail + fi + [ "$out" ] && echo >&2 "$out" + else + # run config test and abort with nice message if failed + # (for actions checking status before action). + configtest >/dev/null 2>&1 + RETVAL=$? + if [ $RETVAL != 0 ]; then + show "Checking %s configuration" ""; fail + nls 'Configuration test failed. See details with %s "checkconfig"' $0 + exit $RETVAL + fi + fi +} + +start() { + # Check if the service is already running? + if [ -f /var/lock/subsys/ ]; then + msg_already_running "" + return + fi + + checkconfig + msg_starting "" + daemon /usr/sbin/ + RETVAL=$? + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ +} + +stop() { + if [ ! -f /var/lock/subsys/ ]; then + msg_not_running "" + return + fi + + # Stop daemons. + msg_stopping "" + killproc + killproc --pidfile $pidfile -TERM + rm -f /var/lock/subsys/ +} + +reload() { + if [ ! -f /var/lock/subsys/ ]; then + msg_not_running "" + RETVAL=7 + return + fi + + checkconfig + msg_reloading "" + killproc -HUP + killproc --pidfile $pidfile -HUP + RETVAL=$? +} + +condrestart() { + if [ ! -f /var/lock/subsys/ ]; then + msg_not_running "" + RETVAL=$1 + return + fi + + checkconfig + stop + start +} + +RETVAL=0 +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + checkconfig + stop + start + ;; + try-restart) + condrestart 0 + ;; +# include force-reload here if program allows reloading without restart +# otherwise remove reload action and support force-reload as restart if running + reload|force-reload) + reload + ;; +# use this one if program doesn't support reloading without restart + force-reload) + condrestart 7 + ;; + checkconfig|configtest) + checkconfig 1 + ;; + status) + status + status --pidfile $pidfile + status --pidfile $pidfile + RETVAL=$? + ;; + *) + msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|checkconfig|status}" + exit 3 +esac + +exit $RETVAL diff --git a/dumb.sh b/dumb.sh new file mode 100644 index 0000000..ba1fda1 --- /dev/null +++ b/dumb.sh @@ -0,0 +1,188 @@ +#!/bin/sh +# dump script used to generate .pot for translations + +. /etc/rc.d/init.d/functions + +nls "alarmwatch not configured (CHIPS not set), cannot start." +nls "No kernel APM support" +nls "(backgrounded)" +nls "Setting up sound card mixer" +nls "Sound card mixer is already set up" +nls "Saving sound card mixer's settings" +nls "Sound card mixer hasn't been set up" +nls "Modular sound card detected." +nls "Monolithic sound card detected." +nls "MIDI device present." +nls "MIDI device not detected." +nls "Sound card not configured." +nls "Configured Mount Points:" +nls "Active Mount Points:" +nls "Waiting for Coda server shutdown" +nls "Setting Text Mode" +nls "Loading console font and map" +nls "Loading keyboard table" +nls "Enabling SAK sequence" +nls "Setting terminals to default values" +nls "Missing service directory" +nls "Create %s first." "$1" +nls "no dictionaries found" +nls "Uploading em8300 microcode" +nls "Removing em8300 modules" +nls "exim.conf: queue_only = true is missing" +nls "Please edit /etc/sysconfig/frox !" +nls "Redirecting FTP traffic" +nls "Removing FTP traffic redirection" +nls "ipchains/iptables not found. Cannot continue" +nls "Generating %s" "$1" +nls "Setting filter rules" +nls "Flushing filter rules" +nls "%s not generated" "$1" +nls "%s outdated" "$1" +nls "%s not applied" "$1" +nls "filter rules applied" +nls "Frame buffer present." +nls "Frame buffer not present." +nls "Setting default video mode" +nls "Cannot start Pluto, system lacks /dev/random" +nls "Dumpdir \`%s' does not exist, ignored." "$1" +nls "Starting FreeS/WAN IPSEC" +nls "Stopping FreeS/WAN IPSEC" +nls "Please set %s in /etc/sysconfig/mouse" "$1" +nls "Setting parameters for drive %s" "$1" +nls "IP protocols logger" +nls "IRCd Server" +nls "Courier IMAP - Authdaemon" +nls "DHCP Server" +nls "Gnome Display Manager" +nls "OpenH323 gatekeeper" +nls "Jabber GaduGadu transport" +nls "Jabber ICQ transport daemon" +nls "KDE Display Manager" +nls "OpenLDAP Update Replication Daemon" +nls "Linux Infrared Remote Control daemon" +nls "Linux Infrared Remote Control mouse daemon" +nls "System logger" +nls "Kernel logger" +nls "KerberosV service" +nls "%s is missing" "$1" +nls "Starting Kerberos KDC" +nls "Starting Administration Server" +nls "Stopping Kerberos KDC" +nls "Stopping Administration Server" +nls "multicast routing daemon" +nls "Dynamic Route Daemon" +nls "%s config %s does not exist." "$1" "$2" +nls "MySQL datadir %s not configured properly" "$1" +nls "MySQL user not configured properly" +nls "Edit %s and configure it." "$1" +nls "MySQL database not initialized. Try \"%s init\" before start." "$1" +nls "Seems that database is initialized now. Remove by hand %s" "$1" +nls "before initializing database." +nls "Creating privilege mysql tables" +nls "Sorry, the host name is not configured." +nls "Please configure the 'hostname' command to return a hostname." +nls "Sorry, the host '%s' could not be looked up." "$1" +nls "Please configure the 'hostname' command to return a correct hostname." +nls "Initializing %s" "$1" +nls "pks database not initialized. Try \"%s init\" before start." "$1" +nls "Seems that database is initialized now." +nls "Initializing database for pks" +nls "No SSH host key found! You must run \"%s init\" first." "$1" +nls "Now the SSH host key will be generated. Please note, that if you" +nls "will use password for the key, you will need to type it on each" +nls "reboot." +nls "JAVA_HOME is not set! Edit /etc/sysconfig/tomcat" +nls "Mounting NFS filesystems" +nls "Unmounting NFS filesystems" +nls "Configured NFS mountpoints:" +nls "Active NFS mountpoints:" +nls "/proc filesystem unavailable" +nls "Registering %s" "$1" +nls "Unregistering %s" "$1" +nls "netsaint NSCA daemon" +nls "Stopping MARS: stopping all connections" +nls "Starting UPS drivers" +nls "Stopping UPS drivers" +nls "Reloading UPS drivers" +nls "UPS drivers and network daemon" +nls "UPS network daemon" +nls "Syncing time for ntp" +nls "Error: portmap isn't running" +nls "netsaint NRPE daemon" +nls "Name Switch Cache Daemon" +nls "No kupdate[d] found. Run bdflush-1.6 for sleep support." +nls "OpenH323 gatekeeper/proxy" +nls "omniNames for omniORB" +nls "No tunnels configured in /etc/sysconfig/openvpn" +nls "Starting OpenVPN tunnel %s" "$1" +nls "Stopping OpenVPN tunnel %s" "$1" +nls "Dynamic DNS daemon" +nls "Dynamic DNS Tools Server" +nls "Starting PIM-SM multicast routing daemon" +nls "Stopping PIM-SM multicast routing daemon" +nls "Parallel Virtual Machine" +nls "Killing PowerDNS without grace" +nls "PowerDNS (Powered DNS server)" +nls "PowerDNS (3 sec. timeout)" +nls "PowerDNS in foreground (testing mode)" +nls "PCIC not defined in /etc/sysconfig/pcmcia" +nls "Unloading PCMCIA modules" +nls "protolog TCP daemon" +nls "protolog UDP daemon" +nls "protolog ICMP daemon" +nls "Error: /etc/sysconfig/postgresql not found" +nls " PostgreSQL can't be run." +nls "Error: PG_DB_CLUSTERS not found or is empty" +nls "Note: this is only simple init action for convenience." +nls "If you want some non-standard options, consider using initdb(1)." +nls "Skipping existing cluster %s" "$1" +nls "Initializing cluster %s" "$1" +nls "REMEMBER to setup password for user \"postgres\"" +nls "PPPoE Relay Server" +nls "PPPoE Server" +nls "Radius-Cistron Server" +nls "Starting Resin JSP Server" +nls "Stopping Resin JSP Server" +nls "NFS quota daemon" +nls "NFS quotas" +nls "Setting time from remote server(s): %s" "$1" +nls "Remote time: " +nls "Local time: " +nls "Local machine hardware clock: " +nls "Syncing hardware clock" +nls " Please correct your /etc/sysconfig/rawdevices:" +nls " rawdevices are now located in the directory /dev/raw/ " +nls " If the command 'raw' still refers to /dev/raw as a file." +nls " You'll have to upgrade your util-linux package" +nls "You need to be root to use this command ! " +nls "WARNING: RADVD can work only in IPv6 networks" +nls "SAP DB WebServer" +nls "SAP DB WebServer on port %s" "$1" +nls "Put license file in /etc/sipd/license" +nls "sensors daemon" +nls "BUS or CHIP not configured in /etc/sysconfig/sensors" +nls "SAPDB communication server" +nls "SAPDB instance %s" "$1" +nls "Prepare sendmail db" +nls "system activity data collector" +nls "Cannot find configuration file: %s" "$1" +nls "Waiting %s seconds..." "$1" +nls "done." +nls "Toshiba fan daemon" +nls "X Display Manager" +nls "NIS map server" +nls "Setup /etc/sysconfig/network::NISDOMAIN before use %s." "$1" +nls "X Font Server" +nls "NIS server" +nls "Binding to the NIS domain" +nls "Listening for a NIS domain server" +nls "Try \"%s init\" before start." "$1" +nls "Login name [admin]: " +nls "Login password: " +nls "Password again: " +nls "ERROR: Passwords don't match" +nls "Loading zebra configuration" +nls "Starting Athlon Cooling" +nls "Stoping Athlon Cooling" +nls "Error: /etc/nessus/nessusd.conf not found" +nls " Nessus daemon can't be run." diff --git a/firmware-loader.sh b/firmware-loader.sh new file mode 100755 index 0000000..14a161c --- /dev/null +++ b/firmware-loader.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# Firmware loader. +# See also: +# https://www.kernel.org/doc/Documentation/firmware_class/README +# https://www.kernel.org/doc/Documentation/firmware_class/hotplug-script +set -e + +# handle only firmware add requests +if [ "$SUBSYSTEM" != "firmware" ]; then + exit 0 +fi +if [ "$ACTION" != "add" ]; then + exit 0 +fi + +FIRMWARE_DIRS="/lib/firmware/updates/$(uname -r) /lib/firmware/updates \ + /lib/firmware/$(uname -r) /lib/firmware" + +# @param string message +# @param int loglevel. defaults to "6" (info) +# Log levels can be: +# Name String Meaning +# KERN_EMERG "0" Emergency messages, system is about to crash or is unstable +# KERN_ALERT "1" Something bad happened and action must be taken immediately +# KERN_CRIT "2" A critical condition occurred like a serious hardware/software failure +# KERN_ERR "3" An error condition, often used by drivers to indicate difficulties with the hardware +# KERN_WARNING "4" A warning, meaning nothing serious by itself but might indicate problems +# KERN_NOTICE "5" Nothing serious, but notably nevertheless. Often used to report security events. +# KERN_INFO "6" Informational message e.g. startup information at driver initialization +# KERN_DEBUG "7" Debug messages +# KERN_CONT "c" "continued" line of log printout (only done after a line that had no enclosing \n) +kmsg() { + local msg="$1" level=${2:-3} + echo "<$level>$msg" > /dev/kmsg +} + +err() { + echo >&2 "$*" + kmsg "${0##*/}[$$] $*" +} + +if [ ! -e /sys$DEVPATH/loading ]; then + err "firmware loader misses sysfs directory" + exit 1 +fi + +for DIR in $FIRMWARE_DIRS; do + [ -e "$DIR/$FIRMWARE" ] || continue + echo 1 > /sys$DEVPATH/loading + cat "$DIR/$FIRMWARE" > /sys$DEVPATH/data + echo 0 > /sys$DEVPATH/loading + exit 0 +done + +echo -1 > /sys$DEVPATH/loading +err "Cannot find firmware file '$FIRMWARE'" +exit 1 diff --git a/hwprofile b/hwprofile new file mode 100755 index 0000000..4f24a9e --- /dev/null +++ b/hwprofile @@ -0,0 +1,331 @@ +#!/bin/sh +# (C) 2001 Arkadiusz Miśkiewicz +# Hardware Profiles for rc-scripts TOTALNEW. + +PROFDIR="/etc/sysconfig/hwprofiles" +QUIET=0 + +. /etc/rc.d/init.d/functions +. /etc/sysconfig/hwprof + +[ -z "${EDITOR}" ] && EDITOR=vi + +if [ "$(id -u)" != "0" ]; then + echo "Need superuser privileges. Can't continue!" + exit 1 +fi + +checkprofdir() +{ + if [ ! -d ${PROFDIR} -o ! -d ${PROFDIR}/data ]; then + echo "${PROFDIR} or ${PROFDIR}/data not found. Can't continue!" + echo "Check /etc/sysconfig/hwprof and hwprofile -h." + exit 1 + fi +} + +myecho() +{ + if [ $QUIET -eq 0 ]; then + echo $@ + fi +} + +showhelp() +{ +echo ' +no opts - show help +-a - add profile +-d - delete profile +-r foo - run specified profile or "default" if such exist +-s - save/update running profile +-f - find proper profile and run it +-l - list configured profiles +-q - be quiet (used only in few modes) + +Please send all bug reports to: +pld-rc-scripts@pld-linux.org. +' +} + +# This function probably must be enhanced. +md5sumgen() +{ + ( \ + grep -v "MHz" /proc/cpuinfo 2> /dev/null \ + grep -v "Latency" /proc/pci 2> /dev/null \ + ) | md5sum | awk ' { gsub(/ .*$/,NIL); print $0 } ' +} + +while getopts adfhlsqr: opt "$@"; do + case "$opt" in + a) + checkprofdir + + echo "Adding new profile..." + + if [ -f /var/run/hwprofile ]; then + echo -n "Current profile is: " + cat /var/run/hwprofile + fi + + PROFILE= + while [ -z "${PROFILE}" ]; do + echo -n "Enter profile name: " + read PROFILE + + if [ -f ${PROFDIR}/${PROFILE}.md5 ]; then + echo "Profile ${PROFILE} exist. Try other name." + PROFILE= + fi + done + + rm -rf ${PROFDIR}/${PROFILE}.* ${PROFDIR}/data/${PROFILE}/ + md5sumgen > ${PROFDIR}/${PROFILE}.md5 + LANG=C LC_ALL=C date > ${PROFDIR}/${PROFILE}.date + mkdir -p ${PROFDIR}/data/${PROFILE}/ + chmod 700 ${PROFDIR}/data/${PROFILE}/ + + echo -n "Enter profile description (PROFDIR/${PROFILE}.desc): " + read DESCRIPTION + [ -z "${DESCRIPTION}" ] && DESCRIPTION="${PROFILE}" + echo "${DESCRIPTION}" > ${PROFDIR}/${PROFILE}.desc + echo "Now, editor will be started and you need to enter list of files" + echo "for this profile (later as ${EDITOR} ${PROFDIR}/${PROFILE}.files)." + echo "Press Enter." + read + + if [ -f ${PROFDIR}/files -o ! -f ${PROFDIR}/${PROFILE}.files ]; then + cat ${PROFDIR}/files > ${PROFDIR}/${PROFILE}.files; + fi + ${EDITOR} ${PROFDIR}/${PROFILE}.files + + FILES= + echo "Validating and copying valid files for this profile:" + for file in $(grep -v "^#" ${PROFDIR}/${PROFILE}.files); do + if [ ! -f ${file} -o "${file}" = "/etc/sysconfig/hwprof" ]; then + echo "${file}: invalid, skipping" + continue + fi + + bfile=$(basename ${file}) + echo "Copying ${file} to ${PROFDIR}/data/${PROFILE}/${file}..." + cp -dp --parents ${file} ${PROFDIR}/data/${PROFILE}/ + FILES="${file}\n${FILES}" + done + + echo -e "${FILES}" > ${PROFDIR}/${PROFILE}.files + rm -f ${PROFDIR}/${PROFILE}.*~ + + echo "New profile ready." + break + ;; + d) + checkprofdir + + echo "Deleting existing profile..." + + PROFILE= + while [ -z ${PROFILE} ]; do + echo -n "Enter profile name: " + read PROFILE + + if [ ! -f ${PROFDIR}/${PROFILE}.md5 ]; then + echo "Profile ${PROFILE} doesn't exist. Try other name." + PROFILE= + fi + done + + echo -n "Are you sure? [y/N]: " + read YN + case "${YN}" in + y | Y | t | T ) + # ok + ;; + *) + echo "Exiting then." + exit 1 + ;; + esac + + rm -rf ${PROFDIR}/${PROFILE}.* ${PROFDIR}/data/${PROFILE}/ + echo "Done." + break + ;; + r) + + checkprofdir + + PROFILE="${OPTARG}" + + if [ -z "${PROFILE}" -o ! -f ${PROFDIR}/${PROFILE}.files ]; then + echo "Can't setup ${PROFILE}. No required data." + exit 1 + fi + + echo -n "Setting up profile \"${PROFILE}\" " + myecho ""; + + for file in $(grep -v "^#" ${PROFDIR}/${PROFILE}.files); do + if [ ! -f ${file} -o "${file}" = "/etc/sysconfig/hwprof" ]; then + myecho "${file}: invalid, skipping" + continue + fi + echo -n "."; + + myecho "Copying ${PROFDIR}/data/${PROFILE}/${file} to ${file}..." + cp -dp ${PROFDIR}/data/${PROFILE}/${file} ${file} 2>/dev/null + done + + echo ${PROFILE} > /var/run/hwprofile + echo " Done."; + myecho "Profile \"${PROFILE}\" running." + break + ;; + f) + checkprofdir + + PROFILE= + PROFILEMD5=$(md5sumgen) + + myecho "Trying to find proper profile..." + for prof in $(ls -1 ${PROFDIR}/*.md5 2> /dev/null); do + prof=$(basename ${prof}) + CURRENTMD5="$(cat ${PROFDIR}/${prof} 2> /dev/null)" + # echo "$prof ${CURRENTMD5} ${PROFILEMD5}"; + [ -z "${CURRENTMD5}" ] && continue + + if [ "${CURRENTMD5}" = "${PROFILEMD5}" ]; then + PROFILE=$(echo ${prof} | awk ' { gsub(/\.md5/,NIL); print $0 } ') + break; + fi + done + + if [ -z "${PROFILE}" ]; then + if is_yes "${ASKFORPROFILE}"; then + echo "Available profiles:"; + PS3='Enter profile number: '; + LISTA=$(ls ${PROFDIR}/*.desc 2> /dev/null); + for i in ${LISTA}; do + a=$(basename $i .desc); + LISTA1="${a} ${LISTA1}"; + done + LISTA1="${LISTA1} Default"; + + select PROFILE in $LISTA1; do + if [ -n "${PROFILE}" ]; then + break + fi + done + + if [ "${PROFILE}" = "Default" ]; then + PROFILE= + fi + fi + fi + + if [ -z "${PROFILE}" ]; then + if [ ! -f ${PROFDIR}/default.md5 ]; then + echo "Valid profile not found. Starting with current files." + exit 0 + else + echo "Valid profile not found. Starting with \"default\" profile." + PROFILE=default + fi + fi + + if [ ! -z "${PROFILE}" ]; then + myecho "Found profile \"${PROFILE}\" with md5sum \"${PROFILEMD5}\"." + if [ $QUIET -eq 0 ]; then + $0 -r ${PROFILE}; + else + $0 -qr ${PROFILE}; + fi + fi + break + ;; + s) + checkprofdir + + PROFILE=$(cat /var/run/hwprofile 2> /dev/null) + + if [ -z "${PROFILE}" ]; then + echo "No profile currenty running." + exit 1 + fi + + if [ ! -f ${PROFDIR}/${PROFILE}.files ]; then + echo "${PROFILE}.files is missing. Can't continue." + exit 1 + fi + + echo -n "Saving/updating current [${PROFILE}] profile " + md5sumgen > ${PROFDIR}/${PROFILE}.md5 + myecho ""; + for file in $(grep -v "^#" ${PROFDIR}/${PROFILE}.files); do + echo -n "."; + + if [ ! -f ${file} -o "${file}" = "/etc/sysconfig/hwprof" ]; then + myecho "${file}: invalid, skipping" + continue + fi + + myecho "Copying ${file} to ${PROFDIR}/data/${PROFILE}/${file}" + cp -dp --parents ${file} ${PROFDIR}/data/${PROFILE}/ + done + echo " Done." + break + ;; + l) + echo "List of configured profiles:" + + for prof in $(ls -1 ${PROFDIR}/*.md5 2> /dev/null); do + prof=$(basename ${prof}) + profname=$(echo ${prof} | awk ' { gsub(/\.md5/,NIL); print $0 } ') + echo "Name : ${profname}" + echo -n "Desc : " + if [ -f ${PROFDIR}/${profname}.md5 ]; then + cat ${PROFDIR}/${profname}.desc + else + echo "MISSING" + fi + echo -n "Created : " + if [ -f ${PROFDIR}/${profname}.date ]; then + cat ${PROFDIR}/${profname}.date + else + echo "MISSING" + fi + echo -n "md5sum : " + if [ -f ${PROFDIR}/${profname}.md5 ]; then + cat ${PROFDIR}/${profname}.md5 + else + echo "MISSING" + fi + echo -n "Files : " + if [ -f ${PROFDIR}/${profname}.files ]; then + cat ${PROFDIR}/${profname}.files | xargs + else + echo "MISSING" + fi + echo + done + echo "End." + break + ;; + q) + QUIET=1; export QUIET; + ;; + *) + showhelp + exit 1 + break + ;; + esac +done + +if [ "$#" -le "0" -o "$OPTIND" -eq 1 ]; then + showhelp + exit 1 +fi + +exit 0 diff --git a/inittab b/inittab new file mode 100644 index 0000000..d8b4c94 --- /dev/null +++ b/inittab @@ -0,0 +1,72 @@ +# +# inittab This file describes how the INIT process should set up +# the system in a certain run-level. +# +# +# Author: Miquel van Smoorenburg, +# Modified for RHS Linux by Marc Ewing and Donnie Barnes +# + +# Default runlevel. The runlevels used by PLD Linux are: +# 0 - halt (Do NOT set initdefault to this) +# 1 - Single user mode +# 2 - Multiuser, without NFS (The same as 3, if you do not have networking) +# 3 - Full multiuser mode +# 4 - unused +# 5 - X11 +# 6 - reboot (Do NOT set initdefault to this) +# +id:3:initdefault: + +# System initialization. +si::sysinit:/etc/rc.d/rc.sysinit + +l0:0:wait:/etc/rc.d/rc 0 +l1:1:wait:/etc/rc.d/rc 1 +l2:2:wait:/etc/rc.d/rc 2 +l3:3:wait:/etc/rc.d/rc 3 +l4:4:wait:/etc/rc.d/rc 4 +l5:5:wait:/etc/rc.d/rc 5 +l6:6:wait:/etc/rc.d/rc 6 + +# Trap CTRL-ALT-DELETE +ca::ctrlaltdel:/sbin/shutdown -t3 -r now + +# Trap KeyboardSignal +#kb::kbrequest: + +# When our UPS tells us power has failed, assume we have a few minutes +# of power left. Schedule a shutdown for 2 minutes from now. +# This does, of course, assume you have powerd installed and your +# UPS connected and working correctly. +pf::powerfail:/sbin/shutdown -f -h +2 "Power Failure; System Shutting Down" + +# If power was restored before the shutdown kicked in, cancel it. +pr:12345:powerokwait:/sbin/shutdown -c "Power Restored; Shutdown Cancelled" + +# Run agetty on serial port +#s0:12345:respawn:/sbin/agetty 115200 ttyS0 vt100 +#s1:12345:respawn:/sbin/agetty 115200 ttyS1 vt100 + +# Run gettys in standard runlevels +1:12345:respawn:/sbin/mingetty --noclear tty1 +# spawn root login on tty1 without /etc/issue +#1:12345:respawn:/sbin/mingetty tty1 --noclear --autologin root --noissue +2:2345:respawn:/sbin/mingetty tty2 +3:2345:respawn:/sbin/mingetty tty3 +#4:2345:respawn:/sbin/mingetty tty4 +#5:2345:respawn:/sbin/mingetty tty5 +#6:2345:respawn:/sbin/mingetty tty6 +#7:2345:respawn:/sbin/mingetty tty7 +#8:2345:respawn:/sbin/mingetty tty8 +#9:2345:respawn:/sbin/mingetty tty9 +#10:2345:respawn:/sbin/mingetty tty10 +#11:2345:respawn:/sbin/mingetty tty11 +#12:2345:respawn:/sbin/mingetty tty12 + +# Examples +#9:2345:respawn:/sbin/mingetty --mono tty9 +#10:2345:respawn:/sbin/mingetty --remote-host=some.host.in.net.pl tty10 + +# Run xdm in runlevel 5 +#x:5:respawn:/usr/bin/X11/xdm -nodaemon diff --git a/isapnp/Makefile.am b/isapnp/Makefile.am new file mode 100644 index 0000000..ca15708 --- /dev/null +++ b/isapnp/Makefile.am @@ -0,0 +1,10 @@ +# +# + +isapnpdir = @sysconfigdir@/isapnp + +isapnp_DATA = \ + isapnp-kernel.conf + +EXTRA_DIST = \ + $(isapnp_DATA) diff --git a/isapnp/isapnp-kernel.conf b/isapnp/isapnp-kernel.conf new file mode 100644 index 0000000..bbecfed --- /dev/null +++ b/isapnp/isapnp-kernel.conf @@ -0,0 +1,12 @@ +# Example configuration for Sierra V.34 Data/Fax/Voice/VoiceView Speakerphone +# internal modem usable only on 2.4 kernels with ISAPNP support compiled in. +# Read /usr/src/linux/Documentation/isapnp.txt for more informations. + +#card 0 SSC0109 +#dev 0 SSC0000 +#deactivate +#card 0 SSC0109 +#dev 0 SSC0000 +#port 0 744 +#irq 0 3 +#activate diff --git a/lang.csh b/lang.csh new file mode 100755 index 0000000..dbbc520 --- /dev/null +++ b/lang.csh @@ -0,0 +1,33 @@ +#!/bin/csh +# +# +# FIXME: this file is broken, as you can see it does nothing (does not actually load i18n file) +# TODO: sync with lang.sh +# + +test -f /etc/sysconfig/i18n +if ($status == 0) then + if ($?LANG) then + setenv LANG + endif + if ($?LC_ALL) then + setenv LC_ALL + endif + if ($?LINGUAS) then + setenv LINGUAS + endif + if ($?SYSTERM) then + setenv TERM=$SYSTERM + endif + if ($?_XKB_CHARSET) then + setenv _XKB_CHARSET + endif + if ($?INPUTRC) then + setenv INPUTRC + endif + if ($?LESSCHARSET) then + setenv LESSCHARSET + else if ($TERM == linux-lat) then + setenv LESSCHARSET latin1 + endif +endif diff --git a/lang.sh b/lang.sh new file mode 100755 index 0000000..dfb0ddf --- /dev/null +++ b/lang.sh @@ -0,0 +1,74 @@ +#!/bin/sh +# +# + +if [ -f /etc/sysconfig/i18n ]; then + ORG_LANG=$LANG + ORG_LC_ADDRESS=$LC_ADDRESS + ORG_LC_COLLATE=$LC_COLLATE + ORG_LC_CTYPE=$LC_CTYPE + ORG_LC_IDENTIFICATION=$LC_IDENTIFICATION + ORG_LC_MEASUREMENT=$LC_MEASUREMENT + ORG_LC_MESSAGES=$LC_MESSAGES + ORG_LC_MONETARY=$LC_MONETARY + ORG_LC_NAME=$LC_NAME + ORG_LC_NUMERIC=$LC_NUMERIC + ORG_LC_PAPER=$LC_PAPER + ORG_LC_TELEPHONE=$LC_TELEPHONE + ORG_LC_TIME=$LC_TIME + ORG_LC_ALL=$LC_ALL + + . /etc/sysconfig/i18n + + # we prefer session settings (that came from ssh for example) + # instead of system one + + LANG=${ORG_LANG:-$LANG} + LC_ADDRESS=${ORG_LC_ADDRESS:-$LC_ADDRESS} + LC_COLLATE=${ORG_LC_COLLATE:-$LC_COLLATE} + LC_CTYPE=${ORG_LC_CTYPE:-$LC_CTYPE} + LC_IDENTIFICATION=${ORG_LC_IDENTIFICATION:-$LC_IDENTIFICATION} + LC_MEASUREMENT=${ORG_LC_MEASUREMENT:-$LC_MEASUREMENT} + LC_MESSAGES=${ORG_LC_MESSAGES:-$LC_MESSAGES} + LC_MONETARY=${ORG_LC_MONETARY:-$LC_MONETARY} + LC_NAME=${ORG_LC_NAME:-$LC_NAME} + LC_NUMERIC=${ORG_LC_NUMERIC:-$LC_NUMERIC} + LC_PAPER=${ORG_LC_PAPER:-$LC_PAPER} + LC_TELEPHONE=${ORG_LC_TELEPHONE:-$LC_TELEPHONE} + LC_TIME=${ORG_LC_TIME:-$LC_TIME} + LC_ALL=${ORG_LC_ALL:-$LC_ALL} + + unset ORG_LANG ORG_LC_ADDRESS ORG_LC_COLLATE ORG_LC_CTYPE ORG_LC_IDENTIFICATION ORG_LC_MEASUREMENT + unset ORG_LC_MESSAGES ORG_LC_MONETARY ORG_LC_NAME ORG_LC_NUMERIC ORG_LC_PAPER ORG_LC_TELEPHONE + unset ORG_LC_TIME ORG_LC_ALL + + [ "$LANG" ] && export LANG || unset LANG + [ "$LC_ADDRESS" ] && export LC_ADDRESS || unset LC_ADDRESS + [ "$LC_COLLATE" ] && export LC_COLLATE || unset LC_COLLATE + [ "$LC_CTYPE" ] && export LC_CTYPE || unset LC_CTYPE + [ "$LC_IDENTIFICATION" ] && export LC_IDENTIFICATION || unset LC_IDENTIFICATION + [ "$LC_MEASUREMENT" ] && export LC_MEASUREMENT || unset LC_MEASUREMENT + [ "$LC_MESSAGES" ] && export LC_MESSAGES || unset LC_MESSAGES + [ "$LC_MONETARY" ] && export LC_MONETARY || unset LC_MONETARY + [ "$LC_NAME" ] && export LC_NAME || unset LC_NAME + [ "$LC_NUMERIC" ] && export LC_NUMERIC || unset LC_NUMERIC + [ "$LC_PAPER" ] && export LC_PAPER || unset LC_PAPER + [ "$LC_TELEPHONE" ] && export LC_TELEPHONE || unset LC_TELEPHONE + [ "$LC_TIME" ] && export LC_TIME || unset LC_TIME + [ "$LC_ALL" ] && export LC_ALL || unset LC_ALL + [ "$LANGUAGE" ] && export LANGUAGE || unset LANGUAGE + [ "$LINGUAS" ] && export LINGUAS || unset LINGUAS + + [ "$_XKB_CHARSET" ] && export _XKB_CHARSET || unset _XKB_CHARSET + + if [ "$INPUTRC" ]; then + export INPUTRC + fi + + if [ "$LESSCHARSET" ]; then + export LESSCHARSET + elif [ "$TERM" = "linux-lat" ]; then + LESSCHARSET=latin1 + export LESSCHARSET + fi +fi diff --git a/lib/Makefile.am b/lib/Makefile.am new file mode 100644 index 0000000..22d17fb --- /dev/null +++ b/lib/Makefile.am @@ -0,0 +1,41 @@ +@SET_MAKE@ + +sbin_SCRIPTS = \ + ifdown \ + ifup \ + tnldown \ + tnlup + +#scriptsdir = @networkscriptsdir@ +scriptsdir = @exec_prefix@/lib/$(PACKAGE) + +scripts_SCRIPTS = \ + ifdown-br \ + ifdown-irda \ + ifdown-ppp \ + ifdown-post \ + ifdown-sl \ + ifdown-vlan \ + ifup-aliases \ + ifup-br \ + ifup-ipx \ + ifup-irda \ + ifup-iucv \ + ifup-neigh \ + ifup-plip \ + ifup-plusb \ + ifup-post \ + ifup-ppp \ + ifup-routes \ + ifup-sl \ + ifup-vlan + +scripts_DATA = \ + functions \ + functions.network + +EXTRA_DIST = \ + $(sbin_SCRIPTS) \ + $(scripts_SCRIPTS) \ + $(scripts_DATA) + diff --git a/lib/functions b/lib/functions new file mode 100644 index 0000000..bbdbd64 --- /dev/null +++ b/lib/functions @@ -0,0 +1,1373 @@ +#!/bin/sh - keep it for file(1) to get bourne shell script result +# functions This file contains functions to be used by most or all +# shell scripts in the /etc/rc.d/init.d directory. +# +# +# Author: Miquel van Smoorenburg, +# Hacked by: Greg Galloway and Marc Ewing +# Modified for PLD Linux by: +# Marek Obuchowicz +# Arkadiusz Miśkiewicz +# Michał Kochanowicz +# Łukasz Pawelczyk + +# First set up a default search path. +export PATH="/sbin:/usr/sbin:/bin:/usr/bin" + +# Set defaults +if [ -z "$COLUMNS" -o -z "$LINES" ]; then + _setterm() { + set -- $(stty size 2>/dev/null) + LINES=${LINES:-$1} + COLUMNS=${COLUMNS:-$2} + } + _setterm + unset _setterm +fi +[ -z "$LINES" ] || [ "$LINES" -le 0 ] && LINES=40 +[ -z "$COLUMNS" ] || [ "$COLUMNS" -le 0 ] && COLUMNS=80 +export LINES COLUMNS +INIT_COL=$((COLUMNS - 13)) + +# Set colors +RED=1 +GREEN=2 +YELLOW=3 +BLUE=4 +MAGENTA=5 +CYAN=6 +WHITE=7 +NORMAL=15 +# Bold definition (second parameter to termput setaf) +BOLD=1 +NOBOLD=0 +# Default colors +CBRACKETS="$CYAN" # brackets [ ] color +CDONE="$GREEN" # DONE and WORK color +CBUSY="$MAGENTA" # BUSY color +CFAIL="$RED" # FAIL and DIED color +CPOWEREDBY="$CYAN" # "Powered by" color +CPLD="$GREEN" # "PLD Linux Distribution" color +CI="$RED" # Capital I color (press I to enter interactive startup) +CRESMAN="$GREEN" # "Resource Manager" color +CHARS="" # Characters displayed on the beginning of show line +CCHARS="$NORMAL" # Color of these characters (look at /etc/sysconfig/init-colors.gentoo example) + +# Source configuration if available - may override default values +[ -r /etc/sysconfig/init-colors ] && . /etc/sysconfig/init-colors +[ -r /etc/sysconfig/system ] && . /etc/sysconfig/system +[ -r /etc/sysconfig/bootsplash ] && . /etc/sysconfig/bootsplash + +# if initscript is invoked via bash, enable RedHat/Fedora compatibility +# RC_FEDORA is "set" if enabled and "unset" when not, but it's "value" is always empty +# this is useful for inline constructs +if [ "${BASH_VERSION+set}" = "set" ]; then + RC_LOGGING=yes + FASTRC=no + RC_FEDORA= +else + unset RC_FEDORA || : +fi + +if [ -z "$VSERVER" -o "$VSERVER" = "detect" ]; then + { + while read _f _ctx; do + [ "$_f" = "VxID:" -o "$_f" = "s_context:" ] && break + done /dev/null + if [ -z "$_ctx" -o "$_ctx" = "0" ]; then + VSERVER=no + else + VSERVER=yes + fi + unset _f _ctx +fi + +# VSERVER_ISOLATION_NET = isolation only inside of vserver guests +if [ -z "$VSERVER_ISOLATION_NET" -o "$VSERVER_ISOLATION_NET" = "detect" ]; then + VSERVER_ISOLATION_NET=no + if [ "$VSERVER" = "yes" ]; then + if [ -f /proc/self/nsproxy ]; then + # older kernels + { + while read _t _data; do + [ "$_t" = "net:" ] && break + done < /proc/self/nsproxy + } 2> /dev/null + if [ "${_data##*\(}" = "I)" ]; then + VSERVER_ISOLATION_NET=yes + fi + elif [ -f /proc/self/ninfo ]; then + # newer kernels + { + while read _t _data; do + [ "$_t" = "NCaps:" ] && break + done < /proc/self/ninfo + } 2> /dev/null + if [ "${_t}" = "NCaps:" ]; then + VSERVER_ISOLATION_NET=yes + fi + else + # assume (very?) old kernel mode + VSERVER_ISOLATION_NET=yes + fi + unset _f _data + fi +fi + +# we need to know in functions if we were called from a terminal +if [ -z "$ISATTY" ]; then + [ -t ] && ISATTY=yes || ISATTY=no + export ISATTY +fi + +is_yes() { + # Test syntax + if [ $# = 0 ]; then + msg_usage " is_yes {value}" + return 2 + fi + + # Check value + case "$1" in + yes|Yes|YES|true|True|TRUE|on|On|ON|Y|y|1) + # true returns zero + return 0 + ;; + *) + # false returns one + return 1 + ;; + esac +} + +is_no() { + # Test syntax + if [ $# = 0 ]; then + msg_usage " is_no {value}" + return 2 + fi + + case "$1" in + no|No|NO|false|False|FALSE|off|Off|OFF|N|n|0) + # true returns zero + return 0 + ;; + *) + # false returns one + return 1 + ;; + esac +} + +# checks if file is empty +# empty lines and lines beginning with hash are ignored +is_empty_file() { + [ -s "$1" ] || return 0 + grep -vqE "^(#|[[:blank:]]*$)" "$1" && return 1 || return 0 +} + +# returns OK if $1 contains $2 +strstr() { + [ "${1#*$2*}" = "$1" ] && return 1 + return 0 +} + +# Apply sysctl settings, including files in /etc/sysctl.d +apply_sysctl() { + if [ -x /lib/systemd/systemd-sysctl ]; then + /lib/systemd/systemd-sysctl + return + fi + + local file + for file in /usr/lib/sysctl.d/*.conf; do + [ -f /run/sysctl.d/${file##*/} ] && continue + [ -f /etc/sysctl.d/${file##*/} ] && continue + test -f "$file" && sysctl -q -e -p "$file" + done + for file in /run/sysctl.d/*.conf; do + [ -f /etc/sysctl.d/${file##*/} ] && continue + test -f "$file" && sysctl -q -e -p "$file" + done + for file in /etc/sysctl.d/*.conf; do + test -f "$file" && sysctl -q -e -p "$file" + done + sysctl -q -e -p /etc/sysctl.conf +} + +if is_yes "$FASTRC" || is_yes "$IN_SHUTDOWN"; then + RC_LOGGING=no +fi + +if is_no "$RC_LOGGING"; then + initlog() { + RESULT=0 + while [ "$1" != "${1##-}" ]; do + case $1 in + -c) + shift + $1 + RESULT=$? + break + ;; + *) + shift + ;; + esac + done + return $RESULT + } +fi + +kernelver() { + local _x _y _z v v1 old_IFS ver + { + read _x _y v _z + old_IFS=$IFS + # strip _* or -* from versions like: "2.6.25_vanilla-1", "2.6.25-1" + IFS='_-' + set -- $v + v1=${1} + IFS='.' + set -- $v1 + IFS=$old_IFS + + ver=${3} + while [ ${#ver} -lt 3 ]; do ver="0$ver"; done + ver="$2$ver" + while [ ${#ver} -lt 6 ]; do ver="0$ver"; done + ver="$1$ver" + while [ ${#ver} -lt 9 ]; do ver="0$ver"; done + echo $ver + } < /proc/version +} + +kernelverser() { + local _x _y _z v v1 old_IFS ver + { + read _x _y v _z + old_IFS=$IFS + # strip _* or -* from versions like: "2.6.25_vanilla-1", "2.6.25-1" + IFS='_-' + set -- $v + v1=${1} + IFS='.' + set -- $v1 + IFS=$old_IFS + ver=$2 + while [ ${#ver} -lt 3 ]; do ver="0$ver"; done + ver="$1$ver" + while [ ${#ver} -lt 6 ]; do ver="0$ver"; done + echo $ver + } &2 +} + +msg_starting() { + show "Starting %s service" "$1" +} + +msg_already_running() { + nls "%s service is already running." "$1" +} + +msg_stopping() { + show "Stopping %s service" "$1" +} + +msg_not_running() { + nls "%s service is not running." "$1" +} + +msg_reloading() { + show "Reloading %s service" "$1" +} + +msg_usage() { + nls "Usage: %s" "$*" +} + +# Some functions to handle PLD Linux-style messages +show() { + local text len time + + if is_yes "$RC_UPTIME"; then + time=$(awk '{printf("[%8.2f] ", $1)}' /proc/uptime) + fi + + if is_no "$FASTRC" && is_yes "$GETTEXT"; then + text=$time$(nls -n "$@") + else + text=$time$(printf "$@") + fi + len=${#text} + while [ $((len++)) -lt $INIT_COL ]; do + text="$text." + done + if [ -n "$CHARS" ]; then + termput setaf $CCHARS + echo -n "$CHARS" + termput op + fi + echo -n "$text" +} + +deltext() { + termput hpa $INIT_COL +} + +# Displays message in square brackests ("[ DONE ]"). Takes two arguments. +# First is the text to display, second is color number to use (argument to +# tput setaf). If second argument is not given, default (2, green) will be +# used). +progress() { + local COLOR + if [ -n "$2" ]; then + COLOR="$2" + else + COLOR="$CDONE" + fi + deltext + echo -n "$(termput setaf $CBRACKETS)[$(termput setaf $COLOR) $(nls --nls-domain rc-scripts "$1") $(termput setaf $CBRACKETS)]$(termput op)" +} + +busy() { + echo -n "$_busy" +} + +ok() { + echo -ne "$_ok${RC_FEDORA+\\r}${RC_FEDORA-\\n}" +} + +started() { + echo "$_started" +} + +fail() { + echo -ne "$_fail${RC_FEDORA+\\r}${RC_FEDORA-\\n}" + return 1 +} + +died() { + echo "$_died" + return 1 +} + +# Check if $pid (could be plural) are running +checkpid() { + while [ "$1" ]; do + [ -d "/proc/$1" ] && return 0 + shift + done + return 1 +} + +# - outside chroot get only those processes, which are outside chroot. +# - inside chroot get only those processes, which are inside chroot. +# - don't filter out pids which do not have corresponding running processes (process died etc) +# (note: some processes like named are chrooted but run outside chroot) +# - do nothing inside vserver +filter_chroot() { + # no pids, exit early + [ $# -eq 0 ] && return + + # filter by pid namespace if such dir exists for current process + # we do filter in containers as stacked containers are possible with LXC + if [ -d /proc/$$/ns ]; then + local pids + pids=$(filter_ns "$@") && set -- "$pids" + fi + + if is_yes "$VSERVER"; then + echo $@ + return + fi + + if [ $# -lt 1 -o ! -d /proc/1 ]; then + echo $@ + return + fi + + local root_dir good_pids="" good_add_pid + for root_pid in $@; do + root_dir=$(resolvesymlink /proc/${root_pid}/root) + if [ -n "$root_dir" ]; then + good_add_pid=1 + if [ -n "${SYSTEM_CHROOTS}" ]; then + for r_dir in ${SYSTEM_CHROOTS}; do + echo "$root_dir" | grep -q "^${r_dir}" && good_add_pid=0 + done + fi + [ "$good_add_pid" -eq 1 ] && good_pids="$good_pids $root_pid" + elif [ ! -d "/proc/$root_pid" ]; then + good_pids="$good_pids $root_pid" + fi + done + echo $good_pids +} + +# similar to filter_chroot, but filter based on /proc/PID/ns/pid value +filter_ns() { + local cur_ns=$(resolvesymlink /proc/$$/ns/pid) + [ "$cur_ns" ] || return 1 + + local pid ns pids="" + # add pids if it matches current pid namespace + # we should add pids what do not exist (dead processes), + # but not add pids whose namespace does not match + # (processes belonging to different NS do exist in /proc) + for pid in "$@"; do + if [ ! -d /proc/$pid ]; then + pids="$pids $pid" + continue + fi + ns=$(resolvesymlink /proc/$pid/ns/pid) + if [ "$ns" = "$cur_ns" ]; then + pids="$pids $pid" + fi + done + echo $pids + return 0 +} + +# Usage: +# run_cmd Message command_to_run +# run_cmd -a Message command_to_run +# run_cmd --user "username" "Message" command_to_run +run_cmd() { + local force_err=0 exit_code=0 errors user + while [ $# -gt 0 ]; do + case "$1" in + -a) + force_err=1 + ;; + --user) + shift + user=$1 + ;; + *) + break + esac + shift + done + + local message=$1; shift + show "$message"; busy + + if errors=$( + cd / + export HOME=/tmp TMPDIR=/tmp + if is_no "$RC_LOGGING"; then + ${user:+setuidgid -s $user} "$@" 2>&1 + else + ${user:+setuidgid -s $user} initlog -c "$*" 2>&1 + fi + ); then + ok + log_success "$1 $message" + else + fail + log_failed "$1 $message" + exit_code=1 + fi + [ -n "$errors" ] && [ $exit_code -eq 1 -o $force_err -eq 1 ] && echo "$errors" + return $exit_code +} + +_daemon_set_ulimits() { + local opt val ksh=${KSH_VERSION:+1} + set -- ${SERVICE_LIMITS:-$DEFAULT_SERVICE_LIMITS} + while [ $# -gt 0 ]; do + opt=$1 + val=$2 + if [ "$ksh" ]; then + case "$opt" in + -Hu) + opt=-Hp + ;; + -Su) + opt=-Sp + ;; + -u) + opt=-p + ;; + esac + fi + ulimit $opt $val + shift 2 + done +} + +# A function to start a program (now it's useful on read-only filesystem too) +daemon() { + local errors="" prog="" end="" waitname="" waittime="" + local exit_code=0 + local nice=$SERVICE_RUN_NICE_LEVEL + local fork user closefds redirfds pidfile makepid chdir=/ + + # NOTE: if you wonder how the shellish (by syntax) $prog works in ssd mode, + # then the answer is: it totally ignores $prog and uses "$@" itself. + + while [ $# -gt 0 ]; do + case $1 in + '') + msg_usage " daemon [--check] [--user user] [--fork] [--chdir directory] [--closefds] [--redirfds] [--waitforname procname] [--waitfortime seconds] [--pidfile file] [--makepid] [+/-nicelevel] {program} " + return 2 + ;; + --check) + # for compatibility with redhat/mandrake + nls "warning: --check option is ignored!" + shift + ;; + --user) + shift + user=$1 + ;; + --fork) + fork=1 + end='&' + ;; + --chdir) + shift + chdir=$1 + ;; + --closefds) + closefds=1 + ;; + --redirfds) + redirfds=1 + ;; + --waitforname) + shift + waitname="$1" + ;; + --waitfortime) + shift + waittime="$1" + ;; + --pidfile=?*) + pidfile="${1#--pidfile=}" + case "$pidfile" in /*);; *) pidfile="/var/run/$pidfile";; esac + ;; + --pidfile) + shift + pidfile="$1" + case "$pidfile" in /*);; *) pidfile="/var/run/$pidfile";; esac + ;; + --makepid) + makepid=1 + ;; + -*|+*) + nice=$1 + shift + break + ;; + *) + break + ;; + esac + shift + done + if [ -n "$user" -a "$user" != "root" ]; then + prog="/bin/su $user -s /bin/sh -c \"" + fi + if [ "$fork" = "1" ]; then + prog="/usr/bin/setsid ${prog:-sh -c \"}" + fi + # If command to execute ends with quotation mark, add remaining + # arguments and close quotation. + if [ "$prog" != "${prog%\"}" ]; then + prog="$prog $*$end\"" + else + prog="$prog $*$end" + fi + + _daemon_set_ulimits + + [ -z "$DEFAULT_SERVICE_UMASK" ] && DEFAULT_SERVICE_UMASK=022 + [ -z "$DEFAULT_SERVICE_RUN_NICE_LEVEL" ] && DEFAULT_SERVICE_RUN_NICE_LEVEL=0 + + # And start it up. + busy + cd $chdir + [ -n "$SERVICE_CPUSET" ] && is_yes "$CPUSETS" && echo $$ > "/dev/cpuset/${SERVICE_CPUSET}/tasks" + if errors=$( + umask ${SERVICE_UMASK:-$DEFAULT_SERVICE_UMASK}; + export USER=root HOME=/tmp TMPDIR=/tmp + + nice=${nice:-$DEFAULT_SERVICE_RUN_NICE_LEVEL} + nice=${nice:-0} + + # make nice level absolute, not to be dependant of nice level of shell where service started + nice=$(($nice - $(nice))) + + if [ "$closefds" = 1 ]; then + exec 1>&- + exec 2>&- + exec 0<&- + elif [ "$redirfds" = 1 ]; then + exec 1>/dev/null + exec 2>/dev/null + exec 0&1 + exec 0&1 &2 "$errors" + fi + return $exit_code +} + +# wait (in seconds) for process (or pidfile) to be created +# example: waitproc 30 httpd /var/run/httpd.pid +waitproc() { + local waittime=$1 procname=$2 pidfile=$3 + local pid + local now=$(date +%s) + local maxtime=$(($now + $waittime)) + + if [ -z "$procname" -a -z "$pidfile" ]; then + msg_usage "waitproc: procname or pidfile must be specified" + return 2 + fi + + while [ "$(date +%s)" -lt "$maxtime" ]; do + pid=$(pidofproc "$procname" "$pidfile") + [ -n "$pid" ] && break + + # start-stop-daemon uses same delay + usleep 20000 + done +} + +# A function to stop a program. +killproc() { + local notset killlevel base pid pidfile result delay=3 try + # Test syntax. + if [ $# = 0 ]; then + msg_usage " killproc [--pidfile|-p PIDFILE] [-d DELAY] {program} [-SIGNAME]" + return 2 + fi + + while [ "$1" != "${1##-}" ]; do + case $1 in + -d) + delay="$2" + shift 2 + ;; + --pidfile|-p) + pidfile="$2" + case "$pidfile" in /*);; *) pidfile="/var/run/$pidfile";; esac + shift 2 + ;; + --waitforname) + waitname="$2" + shift 2 + ;; + --waitfortime) + waittime="$2" + shift 2 + ;; + esac + done + + busy + + local notset=0 + # check for second arg to be kill level + if [ -n "$2" ]; then + killlevel=$2 + else + notset=1 + fi + + # experimental start-stop-daemon based killing. + # works only with pidfile + if is_no "$RC_LOGGING" && [ "$pidfile" ]; then + local sig=${killlevel:--TERM} retry + # do not retry if signal is specified, + # as otherwise impossible to send HUP if process pid stays in pidfile. + # however, do retry if --waitfortime was specified + if [ "${killlevel+set}" = "set" ] && [ -z "$waittime" ]; then + # if we send HUP it's ok if process does not die + retry="--oknodo" + else + local waitretry + : ${waittime=10} + : ${waitretry=$(($waittime * 2))} + + # 1. kill with $sig, wait $delay + # 2. kill with $sig, wait $waittime + # 3. kill with KILL, wait $waitretry + retry="--retry ${sig#-}/${delay}/${sig#-}/${waittime}/KILL/${waitretry}" + fi + /sbin/start-stop-daemon -q --stop \ + $retry \ + ${waitname:+--name $waitname} \ + -s ${sig#-} \ + ${pidfile:+--pidfile $pidfile} + result=$? + if [ "$result" -eq 0 ]; then + ok + else + fail + fi + return $result + fi + + + # Save basename. + base=${1##*/} + + # Find pid. + pid=$(pidofproc "$1" "$pidfile") + [ -z "$pid" ] && pid=$(pidofproc "$base" "$pidfile") + + # Kill it. + if [ -n "$pid" -a "$pid" != "$$" ] && checkpid $pid 2>&1; then + if [ "$notset" = "1" ]; then + if checkpid $pid 2>&1; then + # TERM first, then KILL if not dead + kill -TERM $pid + usleep 50000 + + try=0 + while [ $try -lt $delay ]; do + checkpid $pid || break + sleep 1 + try=$((try+1)) + done + if checkpid $pid; then + # XXX: SIGKILL is sent already on 4th second! + # HARMFUL for example to mysqld (which is already workarounded) + kill -KILL $pid + usleep 50000 + fi + fi + checkpid $pid + result=$? + if [ "$result" -eq 0 ]; then + fail + log_failed "$1 shutdown" + else + ok + log_success "$1 shutdown" + fi + result=$(( ! $result )) + else + # use specified level only + if checkpid $pid > /dev/null 2>&1; then + kill $killlevel $pid + result=$? + if [ "$result" -eq 0 ]; then + ok + log_success "$1 got $killlevel" + else + result=7 + fail + log_failed "$1 didn't get $killlevel" + fi + else + result=7 + died + log_failed "$1 shutdown" + fi + fi + else + died + log_failed "$1 shutdown" + result=7 + fi + + if [ -n "$waitname" -a -n "$waittime" ]; then + # Save basename. + base=${waitname##*/} + # Find pid. + pid=$(pidofproc "$waitname" "$pidfile") + [ -z "$pid" ] && pid=$(pidofproc "$base" "$pidfile") + i=0 + while [ "$i" -lt "$waittime" ]; do + i=$(( i + 1 )) + checkpid $pid && sleep 1 || break + done + fi + + # Remove pid file if any. + if [ "$notset" = "1" ]; then + rm -f /var/run/${base}.pid + fi + + return $result +} + +# A function to find the pid of a program. +pidofproc() { + local pid pidfile base=${1##*/} + pidfile="$base.pid" + [ -n "$2" ] && pidfile="$2" + + # Test syntax. + if [ $# = 0 ]; then + msg_usage " pidofproc {program}" + return 2 + fi + + # First try pidfile or "/var/run/*.pid" + case "$pidfile" in + /*)pidfile="${pidfile}";; + *) pidfile="/var/run/$pidfile";; + esac + if [ -f "${pidfile}" ]; then + local p + for p in $(< "${pidfile}"); do + [ -z "$(echo "$p" | awk '{gsub(/[0-9]/,"");print;}')" ] && pid="$pid $p" + done + fi + + # Next try "pidof" if pidfile is not specified + if [ -z "$pid" ] && [ -z "$pidfile" ]; then + pid=$(pidof -o $$ -o $PPID -o %PPID -x "$1") + fi + + pid=$(filter_chroot $pid) + echo $pid +} + +# status [--pidfile PIDFILE] {subsys} [{daemon}]" +status() { + local pid subsys daemon cpuset_msg pidfile + if [ "$1" = "--pidfile" -o "$1" = "-p" ]; then + pidfile=$2 + case "$pidfile" in /*);; *) pidfile="/var/run/$pidfile";; esac + shift 2 + fi + + subsys=$1 + daemon=${2:-$subsys} + + # Test syntax. + if [ $# = 0 ]; then + msg_usage " status [--pidfile PIDFILE] {subsys} [{daemon}]" + return 2 + fi + + # if pidfile specified, pid must be there + if [ "$pidfile" ]; then + [ -f "$pidfile" ] && read pid < $pidfile + # filter_chroot does not filter out dead pids, so this extra check, see t/status-pidfile.sh + if [ ! -d "/proc/$pid" ]; then + pid= + fi + else + pid=$(pidof -o $$ -o $PPID -o %PPID -x $daemon) + fi + pid=$(filter_chroot $pid) + + if [ "$pid" ]; then + cpuset_msg="..." + if [ -n "$SERVICE_CPUSET" ] && is_yes "$CPUSETS"; then + if grep -q "$pid" "/dev/cpuset/${SERVICE_CPUSET}/tasks"; then + cpuset_msg=$(nls " in cpuset %s..." "$SERVICE_CPUSET") + else + cpuset_msg=$(nls " outside of configured cpuset %s..." "$SERVICE_CPUSET") + fi + fi + nls "%s (pid %s) is running%s" "$daemon" "$pid" "$cpuset_msg" + return 0 + fi + + # Next try "/var/run/*.pid" files; if pidfile is not set + local base=${daemon##*/} + if [ -z "$pidfile" -a -f /var/run/${base}.pid ]; then + read pid < /var/run/${base}.pid + pid=$(filter_chroot $pid) + if [ "$pid" ]; then + nls "%s dead but pid file (%s) exists" "$subsys" /var/run/${base}.pid + return 1 + fi + fi + + # See if /var/lock/subsys/$subsys exists + if [ -f /var/lock/subsys/$subsys ]; then + nls "daemon %s dead but subsys (%s) locked" "$daemon" "$subsys" + return 2 + fi + nls "%s is stopped" "$subsys" + return 3 +} + +# Confirm whether we really want to run this service +confirm() { + local answer + nls -n "Start service %s (Y)es/(N)o/(C)ontinue? [Y] " "$1" + read answer + case $answer in + y|Y|t|T|j|J|"") + return 0 + ;; + c|C|k|K|w|W) + return 2 + ;; + n|N) + return 1 + ;; + *) + confirm $1 + return $? + ;; + esac +} + +# module is needed (ie. is requested, is available and isn't loaded already) +is_module() { + # module name without .o at end + if ! lsmod | grep -q "$1"; then + if ls -1R /lib/modules/$(uname -r)/ 2> /dev/null | grep -q "^${1}.\(\|k\)o\(\|.gz\)"; then + # true + return 0 + fi + fi + # false + return 1 +} + +_modprobe() { + local parsed single die args foo result + parsed=no + while is_no "$parsed"; do + case "$1" in + "single") + single=yes + shift + ;; + "die") + die=yes + shift + ;; + -*) + args="$args $1" + shift + ;; + *) + parsed=yes + ;; + esac + done + if is_yes "${single}"; then + foo="$@" + show "Loading %s kernel module(s)" "$foo" + busy + fi + if [ -x /sbin/modprobe ]; then + /sbin/modprobe -s $args "$@" + result=$? + else + deltext; fail + result=1 + fi + if is_yes "${single}"; then + deltext + if [ $result = "0" ]; then + is_yes "$single" && ok + else + fail + if is_yes "$die"; then + nls "Could not load %s kernel module(s)" "$@" + exit 1 + fi + fi + fi +} + +if is_no "$RC_LOGGING"; then + log_success() { + : + } + + log_failed() { + : + } +else + log_success() { + initlog -n $0 -s "$1 $2" -e 1 + } + + log_failed() { + initlog -n $0 -s "$1 $2" -e 2 + } +fi + +# Check if any flavor of portmapper is running +check_portmapper() { + if [ -x /usr/sbin/rpcinfo ]; then + if /usr/sbin/rpcinfo -p localhost >/dev/null 2>/dev/null; then + return 0 + else + return 1 + fi + elif [ -z "$(pidof portmap)" -a -z "$(pidof rpcbind)" ]; then + return 1 + fi + return 0 +} + +# is_fsmounted fstype mntpoint +# Check if filesystem fstype is mounted on mntpoint +is_fsmounted() { + local fstype=$1 + local mntpoint=$2 + + [ -n "$fstype" -a -n "$mntpoint" ] || return 1 + + if [ -r /proc/mounts ]; then + grep -qE "[[:blank:]]$mntpoint[[:blank:]]+$fstype[[:blank:]]" /proc/mounts + return $? + else + if [ "$(stat -L -f -c %T $mntpoint 2>/dev/null)" = "$fstype" ]; then + return 0 + else + return 1 + fi + fi +} + +# __umount_loop awk_program fstab_file first_msg retry_msg umount_args +# awk_program should process fstab_file and return a list of fstab-encoded +# paths; it doesn't have to handle comments in fstab_file. +__umount_loop() { + local remaining sig= + local retry=3 count + + remaining=$(LC_ALL=C awk "/^#/ {next} $1" "$2" | sort -r) + while [ -n "$remaining" -a "$retry" -gt 0 ]; do + if [ "$retry" -eq 3 ]; then + run_cmd "$3" fstab-decode umount $5 $remaining + else + run_cmd "$4" fstab-decode umount $5 $remaining + fi + count=4 + remaining=$(LC_ALL=C awk "/^#/ {next} $1" "$2" | sort -r) + while [ "$count" -gt 0 ]; do + [ -z "$remaining" ] && break + count=$(($count-1)) + usleep 500000 + remaining=$(LC_ALL=C awk "/^#/ {next} $1" "$2" | sort -r) + done + [ -z "$remaining" ] && break + fstab-decode /bin/fuser -k -m $sig $remaining >/dev/null + sleep 3 + retry=$(($retry -1)) + sig=-9 + done +} + +# Similar to __umount loop above, specialized for loopback devices +__umount_loopback_loop() { + local remaining devremaining sig= + local retry=3 + + remaining=$(awk '$1 ~ /^\/dev\/loop/ && $2 != "/" {print $2}' /proc/mounts) + devremaining=$(awk '$1 ~ /^\/dev\/loop/ && $2 != "/" {print $1}' /proc/mounts) + while [ -n "$remaining" -a "$retry" -gt 0 ]; do + if [ "$retry" -eq 3 ]; then + run_cmd "Unmounting loopback filesystems: " \ + fstab-decode umount $remaining + else + run_cmd "Unmounting loopback filesystems (retry):" \ + fstab-decode umount $remaining + fi + for dev in $devremaining ; do + losetup $dev > /dev/null 2>&1 && \ + run_cmd "Detaching loopback device $dev: " \ + losetup -d $dev + done + remaining=$(awk '$1 ~ /^\/dev\/loop/ && $2 != "/" {print $2}' /proc/mounts) + devremaining=$(awk '$1 ~ /^\/dev\/loop/ && $2 != "/" {print $1}' /proc/mounts) + [ -z "$remaining" ] && break + fstab-decode /bin/fuser -k -m $sig $remaining >/dev/null + sleep 3 + retry=$(($retry -1)) + sig=-9 + done +} + +rc_cache_init() { + # If we have cachefile, use it. + # If we don't, create memory variables and try to save silently, + local cachefile='/var/cache/rc-scripts/msg.cache' + + local term + if is_yes "$ISATTY"; then + term=$TERM + else + term=dumb + fi + + # We create $check variable which is used to invalidate the cache. + # The $check contains user locale and terminal. + local check="$term.$LC_MESSAGES.$INIT_COL" + + if [ -f "$cachefile" -a "$cachefile" -nt /etc/sysconfig/system -a "$cachefile" -nt /etc/sysconfig/init-colors ]; then + if . "$cachefile" 2>/dev/null; then + if [ "$check" = "$_check" ]; then + return + fi + fi + fi + + # primitive caching + _busy=$(progress "BUSY" "$CBUSY") + _ok=$(progress "DONE") + _started=$(progress "WORK") + _fail=$(progress "FAIL" "$CFAIL") + _died=$(progress "DIED" "$CFAIL") + + # we don't use heredoc, as ksh attempts to create tempfile then + (> "$cachefile" ) 2>/dev/null || return + echo "_busy='$_busy';" >> "$cachefile" + echo "_ok='$_ok';" >> "$cachefile" + echo "_started='$_started';" >> "$cachefile" + echo "_fail='$_fail';" >> "$cachefile" + echo "_died='$_died';" >> "$cachefile" + echo "_check='$check';" >> "$cachefile" +} + +rc_gettext_init() { + if [ -z "$GETTEXT" ]; then + if [ -x /bin/gettext -o -x /usr/bin/gettext ]; then + GETTEXT=yes + else + GETTEXT=no + fi + fi + + if [ -z "$TPUT" ]; then + if [ -d /usr/share/terminfo ] && [ -x /usr/bin/tput -o -x /bin/tput ]; then + TPUT=yes + # check if we are on proper terminal + tput longname >/dev/null 2>&1 || TPUT=no + else + TPUT=no + fi + fi +} + +use_upstart () { + return 1 +} +emit () { + return 0 +} +is_upstart_task() { + return 1 +} +is_upstart_running() { + return 1 +} +upstart_start() { + return 1 +} +upstart_stop() { + return 1 +} +upstart_reload() { + return 0 +} +upstart_status() { + return 1 +} +_upstart_controlled() { + return 0 +} +alias upstart_controlled='_upstart_controlled $0 "$@"' + +rc_gettext_init +rc_cache_init + +#/* +# * Local variables: +# * mode: sh +# * indent-tabs-mode: notnil +# * End: +# * +# */ diff --git a/lib/functions.network b/lib/functions.network new file mode 100644 index 0000000..a68ed76 --- /dev/null +++ b/lib/functions.network @@ -0,0 +1,690 @@ +#!/bin/sh - keep it for file(1) to get bourne shell script result +# +# +# This is not a shell script; it provides functions to network scripts +# that source it. + +source_config () +{ + local foundconfig=0 + + DEVNAME=${CONFIG##*/} + DEVNAME=${DEVNAME##ifcfg-} + DEVNAME=${DEVNAME##tnlcfg-} + + if [[ "$CONFIG" = /* ]]; then + if [ -f "$CONFIG" ]; then + . "$CONFIG" + foundconfig=1 + fi + elif [ -f "/etc/sysconfig/interfaces/$CONFIG" ]; then + . "/etc/sysconfig/interfaces/$CONFIG" + foundconfig=1 + fi + + # This is sanity check so that if you've copied ifcfg-eth0 to ifcfg-eth1 + # and forgot to alter DEVICE= line you won't accidentally bring down eth0 + # while executing ifdown eth1. We do that only if configuration file exists + # (sometimes ifcfg-xyz isn't needed at all like server-side pppoe pppX interfaces) + if [ "$foundconfig" -eq "1" -a "$DEVICE" -a "$DEVNAME" != "$DEVICE" ]; then + echo >&2 "$0: DEVICE specified in $CONFIG does not match filename. Aborting!" + exit 1 + fi + + if [ "${PREFIX}" ] && [[ "$IPADDR" != */* ]]; then + IPADDR="$IPADDR/$PREFIX" + fi +} + +do_netreport () +{ + # Notify programs that have requested notification + ( cd /var/run/netreport || exit + for i in *; do + [ -f $i ] && kill -SIGIO $i >/dev/null 2>&1 || \ + rm -f $i >/dev/null 2>&1 + done + ) +} + +need_hostname() +{ + local hostname=$(hostname) + if [ "$hostname" = "(none)" -o "$hostname" = "localhost" -o "$hostname" = "localhost.localdomain" ]; then + NEEDHOSTNAME=yes + else + unset NEEDHOSTNAME + fi +} + +set_hostname() +{ + local hostname domain + + hostname=$(echo $1 | awk ' { gsub(/\..*$/,NIL); print $0; } ') + domain=$(echo $1 | awk ' { sub(/^[^\.]*\./,NIL); print $0; } ') + + if [ "$hostname" ]; then + echo "$hostname" > /etc/HOSTNAME + hostname $hostname + fi + + if [ "$domain" ]; then + # XXX umask and possible /etc/resolv.conf symlink breakage + > /etc/resolv.conf.new + if ! grep -Fq "search $domain" /etc/resolv.conf; then + echo "search $domain" >> /etc/resolv.conf.new + fi + echo "domain $domain" >> /etc/resolv.conf.new + grep -v "^domain " /etc/resolv.conf >> /etc/resolv.conf.new + mv -f /etc/resolv.conf.new /etc/resolv.conf + fi +} + +set_dhcpclient() +{ + if [ "$BOOTPROTO" = "bootp" -o "$BOOTPROTO" = "pump" ]; then + DHCP_CLIENT=/sbin/pump + fi + + if [ -z "$DHCP_CLIENT" ]; then + if [ "$BOOTPROTO" = "zeroconf" -a -x /usr/sbin/avahi-autoipd ]; then + DHCP_CLIENT=/usr/sbin/avahi-autoipd + elif [ -x /sbin/dhcpcd ]; then + DHCP_CLIENT=/sbin/dhcpcd + elif [ -x /sbin/dhclient ]; then + DHCP_CLIENT=/sbin/dhclient + elif [ -x /sbin/dhcpxd ]; then + DHCP_CLIENT=/sbin/dhcpxd + elif [ -x /sbin/pump ]; then + DHCP_CLIENT=/sbin/pump + elif [ "$BOOTPROTO" = "auto" -a -x /usr/sbin/avahi-autoipd ]; then + DHCP_CLIENT=/usr/sbin/avahi-autoipd + else + nls "Can't find a DHCP client." + exit 1 + fi + fi +} + +# Setup Network Address Translation (NAT) +setup_nat() +{ + local src via dst + + if [ -r /etc/sysconfig/static-nat ]; then + if [ "$1" = "on" ]; then + grep "^[0-9]" /etc/sysconfig/static-nat | while read src via dst; do + /sbin/ip route add nat $dst via $src + /sbin/ip rule add from $src nat $dst + done + elif [ "$1" = "off" ]; then + LC_ALL=C /sbin/ip route show table all | grep -E "^nat[[:blank:]]" | while read nat dst via src args; do + /sbin/ip rule del from $src nat $dst + /sbin/ip route del nat $dst via $src + done + fi + fi +} + +# Setup static ARP +static_arp() +{ + local rc arpdev host hwaddr flags neflags + + if is_yes "$STATIC_ARP" && [ -r /etc/ethers ]; then + if [ -x /sbin/arp ]; then + run_cmd "Setting static ARP entries" /sbin/arp -f /etc/ethers + else + show "Setting static ARP entries"; busy + rc=0 + arpdev=$(ip link show | awk -F':' '(/UP/) && ! (/NOARP/) && ! (/lo:/) && ! (/NONE:/) { print $2; exit }') + if [ -z "$arpdev" ]; then + rc=1 + else + # ip supports only ip addresses + grep "^[0-9]" /etc/ethers | \ + while read host hwaddr flags; do + case "$flags" in + *temp*) + neflags="nud stale" + ;; + *) + neflags="nud permanent" + ;; + esac + if ! /sbin/ip neigh add $host lladdr $hwaddr $neflags dev $arpdev; then + rc=1 + fi + done + fi + if [ "$rc" -gt 0 ]; then + fail + fi + fi + fi +} + +static_rarp() +{ + if is_yes "$STATIC_RARP"; then + if [ ! -e /proc/net/rarp ]; then + _modprobe single rarp + fi + if [ -r /etc/ethers -a -x /sbin/rarp ]; then + run_cmd "Setting static RARP entries" /sbin/rarp -f /etc/ethers + fi + fi +} + +# Set up all IP && IP parameter variables +setup_ip_param () +{ + # detect network device type (ie. dummy, eth for dummy0, eth0 ..) + if [ -z "$DEVICETYPE" ]; then + # If there's a dot, it's a vlan + if echo ${DEVICE} | LC_ALL=C grep -qE '^[a-z0-9]+\.[0-9]+$'; then + DEVICETYPE=vlan + else + DEVICETYPE=$(echo $DEVICE | awk ' { gsub(/[\.:]?[0-9]*[\.:]?[0-9]*$/,NUL); print $0 } ') + fi + fi + + + # real name of device (ie. is eth0 for eth0,eth0:1,eth0:alias) + SUBDEVICE=$(echo "$DEVICE" | grep -E "([0-9]+:[0-9]+)") + DEVICE=$(echo $DEVICE | awk ' { gsub(/:.*$/,NUL); print $0 } ') + + eval IP4ADDR="\$IPADDR${IP4_PRIM_IF:-}" + # check if ipaddr doesn't contain network length -- use $NETMASK then + if [[ "$IP4ADDR" != */* ]] && [ "$NETMASK" ]; then + IP4ADDR=$IP4ADDR/$(calcprefix $NETMASK) + fi + + # check if we have ipv6 or ipv4 address + if [[ "${IP4ADDR}" = *:* ]]; then + IP6ADDR=${IP4ADDR} + IP4ADDR="" + else + eval IP4ADDROPT="\$IP_AOPTS${IP4_PRIM_IF:-}" + eval IP4ROUTEOPT="\$IP_ROPTS${IP4_PRIM_IF:-}" + fi + if [ "${IP6_PRIM_IF}" ]; then + eval IP6ADDR="\$IPADDR${IP6_PRIM_IF:-}" + eval IP6ADDROPT="\$IPV6_AOPTS${IP6_PRIM_IF:-}" + eval IP6ADDRLABEL="\$IP_LABEL${IP6_PRIM_IF:-}" + fi + if [ "${IP4_SRC_IF}" ]; then + eval IP4SRCADDR="\$IPADDR${IP4_SRC_IF}" + IP4SRCADDR=$(echo ${IP4SRCADDR} | awk ' { gsub(/\/.*/,NIL); print "src " $0; } ') + fi + + # new rc-scripts 0.4.x option + if [ -z "$HANDLING" ]; then + HANDLING=0 + fi + + # set handling for bridge + case "$DEVICETYPE" in + br|atm|lec|irda|vlan) + HANDLING=1 + ;; + esac + + # Multicast ready devices + if is_yes "$MULTICAST"; then + MULTICAST="on" + else + case "$DEVICETYPE" in + eth|br) + MULTICAST="on" + ;; + *) + MULTICAST="off" + ;; + esac + fi + + # ARP ready devices + if [ "$ARP" ]; then + if is_yes "$ARP"; then + ARP="arp on" + else + ARP="arp off" + fi + fi +} + +check_device_down () +{ + if LC_ALL=C ip link show dev ${DEVICE} 2> /dev/null | grep -Fq UP; then + return 1 + else + return 0 + fi +} + +setup_ip_gw_ro () +{ + # IPv4 gateway + if is_yes "$IPV4_NETWORKING"; then + if [ -z "${GATEWAYDEV}" -o "${GATEWAYDEV}" = "${DEVICE}" ]; then + # set up default gateway + if [ "${GATEWAY}" ]; then + ip -4 route add default via ${GATEWAY} dev ${DEVICE} ${IP4SRCADDR} onlink 2>/dev/null + if [ $? = 0 ]; then + DEFGW=${GATEWAY} + else + # The default gateway could be set via eth0, while bringing up eth1 we shouldn't set default gateway again. + # To prevent this message just set GATEWAYDEV=eth0 in /etc/sysconfig/network. + nls "Warning: Default gateway already set proably via other interface. Do you need to setup GATEWAYDEV?" + fi + elif [ "${GATEWAYDEV}" = "${DEVICE}" ]; then + ip -4 route add default dev ${DEVICE} ${IP4SRCADDR} + fi + fi + fi + + # IPv6 gateway && IPv6 globalroute + if is_yes "$IPV6_NETWORKING"; then + if [ -z "${GATEWAY6DEV}" -o "${GATEWAY6DEV}" = "${DEVICE}" ]; then + # set up default gateway + if [ "${GATEWAY6}" ]; then + ip -6 route add default via ${GATEWAY6} dev ${DEVICE} ${IP6SRCADDR} onlink + DEFGW6=${GATEWAY6} + elif [ "${GATEWAY6DEV}" = "${DEVICE}" ]; then + ip -6 route add default dev ${DEVICE} ${IP6SRCADDR} + fi + fi + if [ -z "${IPV6_GLOBALROUTEDEV}" -o "${IPV6_GLOBALROUTEDEV}" = "${DEVICE}" ]; then + # set up default route + if [ "${IPV6_GLOBALROUTEGW}" ]; then + ip -6 route add 2000::/3 via ${IPV6_GLOBALROUTEGW} dev ${DEVICE} ${IP6SRCADDR} onlink + elif [ "${IPV6_GLOBALROUTEDEV}" = "${DEVICE}" ]; then + ip -6 route add 2000::/3 dev ${DEVICE} ${IP6SRCADDR} + fi + fi + fi +} + +# +# following function sets up routes not associated to any device +# eg. unreachable or blackhole routes +# (c) 1999 Jacek Konieczny +# +setup_routes() +{ + local args + + if [ -f /etc/sysconfig/static-routes ]; then + if [ "$1" = "on" -o "$1" = "yes" ]; then + grep -E "^(none|any)[[:blank:]]" /etc/sysconfig/static-routes | while read device args; do + /sbin/ip route add $args + done + else + grep -E "^(none|any)[[:blank:]]" /etc/sysconfig/static-routes | while read device args; do + /sbin/ip route del $args 2>/dev/null + done + fi + fi + is_no "$IPV6_NETWORKING" && return + if [ -f /etc/sysconfig/static-routes6 ]; then + if [ "$1" = "on" -o "$1" = "yes" ]; then + grep -E "^(none|any)[[:blank:]]" /etc/sysconfig/static-routes6 | while read device args; do + /sbin/ip -6 route add $args + done + else + grep -E "^(none|any)[[:blank:]]" /etc/sysconfig/static-routes6 | while read device args; do + /sbin/ip -6 route del $args 2>/dev/null + done + fi + fi +} + +# Add ONLY IPv4 address (IPv6 address is added automaticly) +set_up_loopback() +{ + if is_yes "$IPV4_NETWORKING"; then + ip addr add 127.0.0.1/8 dev lo + fi + ip link set dev lo up + + grep -E "^(lo|any)[[:blank:]]" /etc/sysconfig/static-routes | while read device args; do + if [[ "$args" = *:* ]]; then + is_no "$IPV6_NETWORKING" && continue + else + is_no "$IPV4_NETWORKING" && continue + fi + /sbin/ip route add $args dev lo + done + is_no "$IPV6_NETWORKING" && return + grep -E "^(lo|any)[[:blank:]]" /etc/sysconfig/static-routes6 | while read device args; do + /sbin/ip -6 route add $args dev lo + done +} + +set_down_loopback() +{ + LC_ALL=C ip addr flush dev lo 2>&1 | grep -v "Nothing to flush" + ip link set dev lo down +} + +modprobe_net() +{ + if is_yes "$IPV6_NETWORKING" && is_module "ipv6"; then + _modprobe single ipv6 + fi + + if is_yes "$IPX" && is_module "ipx"; then + _modprobe single ipx + fi +} + +# calculate network prefix from given network mask +calcprefix() +{ + local old_IFS netmask prefix endp + + old_IFS=$IFS + IFS='.' + netmask=$(echo $1) + IFS=$old_IFS + + prefix=0 + endp=0 + for n in $netmask; do + for i in 128 64 32 16 8 4 2 1; do + if [ $(($n & $i)) -ne 0 ]; then + if [ $endp -eq 0 ]; then + prefix=$(($prefix + 1)) + else + echo "32" + return + fi + else + endp=1 + fi + done + done + echo $prefix +} + +# calculate network mask from given prefix +# (c) 1999 Grzegorz Stanislawski +calcnetmask() +{ + local prefix a MASK + + MASK="" + if [ "${1##[0-9]*}" ]; then + prefix=32 + else + prefix=$1 + fi + for i in 1 2 3 4; do + case $prefix in + 7) a=254;; + 6) a=252;; + 5) a=248;; + 4) a=240;; + 3) a=224;; + 2) a=192;; + 1) a=128;; + *) + [ $prefix -ge 8 ] && a=255 + [ $prefix -le 0 ] && a=0 + ;; + esac + + prefix="$(( $prefix - 8))" + if [ -z "$MASK" ]; then + MASK=$a + else + MASK=$MASK.$a + fi + done + + echo $MASK + return +} + +# Retrievies PPPD PID and real interface name from /var/run/ppp-*.pid +get_ppp_device_and_pid () +{ + if [ -f "/var/run/ppp-$DEVNAME.pid" ]; then + eval $( + { + read PID; echo "PID='$PID'" + read REALDEVICE; echo "REALDEVICE=$REALDEVICE" + } < "/var/run/ppp-$DEVNAME.pid") + fi + + if [ -z "$REALDEVICE" ]; then + REALDEVICE=$DEVICE + fi +} + +# following function setups advanced routing rules +# Olgierd Pieczul +setup_ip_rules () +{ + local args prio from src i prio + + if [ -f /etc/sysconfig/static-routes ]; then + if is_yes "$1"; then + i=10000 + grep -E "^(from|to|iif|tos|fwmark|dev|pref|priority|prio)[[:blank:]]" /etc/sysconfig/static-routes | while read args; do + prio="" + if [ "${args##* prio }" = "$args" ]; then + # no "prio" used in rule, use own prio + prio="prio $i" + i=$((i + 5)) + fi + /sbin/ip rule add $args $prio + done + elif is_no "$1"; then + LC_ALL=C /sbin/ip rule show | grep -vE -e "from all lookup (main|default|local|253|254|255) \$" -e " map-to " | while read prio from src args; do + [ "$src" = "all" ] && /sbin/ip rule delete $args || /sbin/ip rule delete $from $src $args + done + fi + fi + is_no "$IPV6_NETWORKING" && return + if [ -f /etc/sysconfig/static-routes6 ]; then + if is_yes "$1"; then + i=10000 + grep -E "^(from|to|iif|tos|fwmark|dev|pref|priority|prio)[[:blank:]]" /etc/sysconfig/static-routes6 | while read args; do + prio="" + if [ "${args##* prio }" = "$args" ]; then + # no "prio" used in rule, use own prio + prio="prio $i" + i=$((i + 5)) + fi + /sbin/ip -6 rule add $args $prio + done + elif is_no "$1"; then + LC_ALL=C /sbin/ip -6 rule show | grep -vE -e "from all lookup (main|default|local|253|254|255) \$" -e " map-to " | while read prio from src args; do + [ "$src" = "all" ] && /sbin/ip -6 rule delete $args || /sbin/ip -6 rule delete $from $src $args + done + fi + fi +} + +is_wireless_device () +{ + if [ -x /sbin/iwconfig ]; then + LC_ALL=C iwconfig "${1}" 2>&1 | grep -Fq "no wireless extensions" || return 0 + fi + return 1 +} + +wireless_param() +{ + device="$1" + if [ "$2" = "br" ]; then + prefix="${device}_" + else + prefix="" + fi + + local val wlan_mode + + # wlan mode needs to be first + wlan_mode="$(eval echo \$${prefix}WLAN_MODE)" && [ "$wlan_mode" ] && \ + iwconfig ${device} mode "$wlan_mode" + + val="$(eval echo \$${prefix}WLAN_NICKNAME)" && [ "$val" ] && \ + iwconfig ${device} nick "$val" + + val="$(eval echo \$${prefix}WLAN_NWID)" && [ "$val" ] && \ + iwconfig ${device} nwid "$val" + + if [ "$wlan_mode" != "Managed" -a "$wlan_mode" != "managed" ]; then + if val="$(eval echo \$${prefix}WLAN_FREQ)" && [ "$val" ]; then + iwconfig ${device} freq "$val" + elif val="$(eval echo \$${prefix}WLAN_CHANNEL)" && [ "$val" ]; then + iwconfig ${device} channel "$val" + fi + fi + + val="$(eval echo \$${prefix}WLAN_SENS)" && [ "$val" ] && \ + iwconfig ${device} sens "$val" + val="$(eval echo \$${prefix}WLAN_AP)" && [ "$val" ] && \ + iwconfig ${device} ap "$val" + val="$(eval echo \$${prefix}WLAN_BITRATE)" && [ "$val" ] && \ + iwconfig ${device} rate "$val" + val="$(eval echo \$${prefix}WLAN_RTS_THRESHOLD)" && [ "$val" ] && \ + iwconfig ${device} rts "$val" + val="$(eval echo \$${prefix}WLAN_FRAGMENTATION_THRESHOLD)" && [ "$val" ] && \ + iwconfig ${device} frag "$val" + + local wlan_encryption="$(eval echo \$${prefix}WLAN_ENCRYPTION)" + local wlan_key="$(eval echo \$${prefix}WLAN_KEY)" + # TODO: well, actually shouldn't set WLAN_KEY if other keys than current are set + if [ "$wlan_key" ]; then + # wlan key can contain index of key to set + # to set other than current keys suffix with 1-4: + local idx + for idx in 1 2 3 4; do + val="$(eval echo \$${prefix}WLAN_KEY_$idx)" + [ "$val" ] || continue + iwconfig ${device} key "[$idx]" "$val" + done + if val="$(eval echo \$${prefix}WLAN_KEY_CURRENT)" && [ "$val" ]; then + iwconfig ${device} key "[$val]" + else + iwconfig ${device} key "$wlan_key" + fi + + [ "$wlan_encryption" ] && iwconfig ${device} key "$wlan_encryption" + fi + + if is_no "$wlan_encryption"; then + iwconfig ${device} key off + fi + val="$(eval echo \$${prefix}WLAN_POWER)" && [ "$val" ] && \ + iwconfig ${device} power "$val" + val="$(eval echo \$${prefix}WLAN_TXPOWER)" && [ "$val" ] && \ + iwconfig ${device} txpower "$val" + val="$(eval echo \$${prefix}WLAN_RETRY)" && [ "$val" ] && \ + iwconfig ${device} retry "$val" + + # essid should be last due to network rescanning by wlan devices + val="$(eval echo \$${prefix}WLAN_ESSID)" && [ "$val" ] && \ + iwconfig ${device} essid "$val" + + if is_yes "$(eval echo \$${prefix}WLAN_COMMIT)"; then + iwconfig ${device} commit + fi +} + +# returns +# 0 - no link +# 1 - link ok +# 2 - unsupported, unknown return +check_mii_tool () +{ + [ -x /sbin/mii-tool ] || return 2 + local output=$(LC_ALL=C mii-tool $1 2>&1) + echo $output | grep -Fq "link ok" && return 1 + echo $output | grep -Fq "no link" && return 0 + return 2 +} + +# returns +# 0 - link off +# 1 - link on +# 2 - unsupported, unknown return +check_ethtool () +{ + [ -x /sbin/ethtool ] || return 2 + local output=$(LC_ALL=C ethtool $1 2>&1) + echo $output | grep -Fq "Link detected: yes" && return 1 + echo $output | grep -Fq "Link detected: no" && return 0 + return 2 +} + +# returns +# 0 - radio off +# 1 - radio on +# 2 - unsupported +check_iwconfig () +{ + local output + # rfkill state (are there devices with multiple rfkill buttons?) + output=$(cat /sys/class/net/${1}/device/rfkill*/state 2> /dev/null) + # 1 is rfkill not active + [ "$output" = "1" ] && return 1 + [ "$output" = "0" -o "$output" = "2" ] && return 0 + [ -x /sbin/iwconfig ] || return 2 + output=$(LC_ALL=C iwconfig "$1" 2>&1) + # "radio off" is ipwxxx only "feature" (and there is no "radio on") + echo "$output" | grep -Fq "radio off" && return 0 + # XXX: need more generic checks for wifi + return 2 +} + +# returns +# 0 - link down +# 1 - link up +# 2 - unknown/unsupported +check_link_down () +{ + local e i m timeout device max_timeout + device="$1" + max_timeout="$2" + + if [ ! -x /sbin/mii-tool -a ! -x /sbin/ethtool -a ! -x /sbin/iwconfig ]; then + return 2 + fi + + [ -z "$max_timeout" ] && max_timeout=10 + + if ! LC_ALL=C ip link show dev $device 2>/dev/null | grep -Fq UP; then + ip link set dev $device up >/dev/null 2>&1 + fi + timeout=0 + while [ $timeout -le $max_timeout ]; do + check_ethtool $device + e=$? + check_iwconfig $device + i=$? + # trust ethtool and iwconfig + if [ $i -eq 1 ] || [ $e -eq 1 ]; then + return 1 + fi + # use mii check only if all other check are unsupported + # (mii check lies too often) + check_mii_tool $device + m=$? + if [ $m -eq 1 ] && [ $i -eq 2 ] && [ $e -eq 2 ]; then + return 1 + fi + usleep 500000 + timeout=$((timeout+1)) + done + # do not abort dhclient if all the checks are unsupported + if [ $m -eq 2 ] && [ $i -eq 2 ] && [ $e -eq 2 ]; then + return 2 + fi + return 0 +} diff --git a/lib/ifdown b/lib/ifdown new file mode 100755 index 0000000..73df490 --- /dev/null +++ b/lib/ifdown @@ -0,0 +1,139 @@ +#!/bin/sh +# +# +PATH=/sbin:/usr/sbin:/bin:/usr/bin + +. /etc/sysconfig/network +. /etc/rc.d/init.d/functions +. /lib/rc-scripts/functions.network + +# Will be removed in the future +if is_yes "$NETWORKING" ; then + if [ -z "$IPV4_NETWORKING" ] ; then + echo "NETWORKING is set to YES, but IPV4_NETWORKING is empty!" + echo "Please upgrade your config" + echo "Assuming you want IPv4 networking" + IPV4_NETWORKING=yes + fi +fi + +DEV=$1 + +[ -z "$DEV" ] && { + nls "Usage: %s " "ifdown" >&2 + exit 1 +} + +if [ -f "/etc/sysconfig/interfaces/ifcfg-$DEV" ] ; then + CONFIG="/etc/sysconfig/interfaces/ifcfg-$DEV" +else + CONFIG="$DEV" +fi + +if [ "$(id -u)" != "0" ]; then + if [ -x /sbin/usernetctl ]; then + exec /sbin/usernetctl $CONFIG down + fi + echo "Users cannot control this device." >&2 + exit 1 +fi + +source_config + +# set all major variables +setup_ip_param + +OTHERSCRIPT="/lib/rc-scripts/ifdown-${DEVICETYPE}" + +# shutdown tleds software +if [ "$TLEDS_DEV" = "$DEVICE" -a -x /usr/bin/tleds ]; then + /usr/bin/tleds -qk "$DEVICE" +fi + +if [ -x $OTHERSCRIPT ]; then + if [ "$HANDLING" = "0" ]; then + exec $OTHERSCRIPT $CONFIG $2 + elif [ "$HANDLING" = "1" ]; then + $OTHERSCRIPT $CONFIG $2 + fi +fi + +if is_yes "$ENABLE_6TO4"; then + tun6to4=tun6to4_$DEVICE + /sbin/ip -6 route flush dev $tun6to4 2>/dev/null + if [ $? = 0 ]; then # the tunnel has been set up in ifup + /sbin/ip link set dev $tun6to4 down + /sbin/ip tunnel del $tun6to4 + fi +fi + +if [ -n "$BOOTPROTO" -a "$BOOTPROTO" != "none" -a "$BOOTPROTO" != "static" ]; then + if is_yes "$IPV4_NETWORKING"; then + set_dhcpclient + + case ${DHCP_CLIENT##*/} in + pump) + $DHCP_CLIENT -r -i ${DEVICE} + RESULT=$? + ;; + dhcpcd) + $DHCP_CLIENT -k ${DEVICE} + RESULT=$? + sleep 1 + ;; + dhcpxd) + $DHCP_CLIENT -k ${DEVICE} + RESULT=$? + ;; + dhclient) + if [ -f "/var/run/dhclient.$DEVICE.pid" ] ; then + $DHCP_CLIENT -r -pf /var/run/dhclient.$DEVICE.pid -lf /var/lib/dhclient/dhclient.$DEVICE.leases 2>/dev/null + RESULT=$? + elif [ -f /var/run/dhclient.pid ]; then + # may be left by older rc-scripts + PID=$(cat /var/run/dhclient.pid) + if kill -0 $PID 2>/dev/null; then + kill $PID + RESULT=$? + fi + fi + ;; + avahi-autoipd) + $DHCP_CLIENT -k ${DEVICE} + RESULT=$? + ;; + esac + fi +fi + +if is_yes "${WLAN_WPA}"; then + killproc --pidfile "wpa_supplicant-${DEVICE}.pid" wpa_supplicant > /dev/null 2>&1 + rm -f "/var/run/wpa_supplicant-${DEVICE}.pid" +fi + +# Check to make sure the device is actually up +check_device_down && exit 0 + +if [ -n "${SUBDEVICE}" ]; then + ip addr del ${IP4ADDR} label ${SUBDEVICE} dev ${DEVICE} +else + LC_ALL=C ip addr flush dev ${DEVICE} 2>&1 | grep -v "Nothing to flush" + + if is_yes "$SLAVE"; then + ip link set ${DEVICE} nomaster + fi + + ip link set ${DEVICE} down +fi + +if [ "$HANDLING" = "4" ]; then + exit 0 +fi + +if [ -n "$RESULT" ] ; then + if [ "$RESULT" -ne "0" ]; then + exit $RESULT + fi +fi + +exec /lib/rc-scripts/ifdown-post $CONFIG diff --git a/lib/ifdown-br b/lib/ifdown-br new file mode 100755 index 0000000..d5f8607 --- /dev/null +++ b/lib/ifdown-br @@ -0,0 +1,49 @@ +#!/bin/sh +# +# ifdown-br - bridge configuration script +# Copyright (C) 2000 Arkadiusz Miśkiewicz +# +# 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. +# +# This program 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 program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# +PATH=/sbin:/usr/sbin:/bin:/usr/bin + +. /etc/sysconfig/network +. /etc/rc.d/init.d/functions +. /lib/rc-scripts/functions.network + +CONFIG=$1 +source_config + +if [ "foo$2" = "fooboot" ] && is_no "${ONBOOT}"; then + exit +fi + +if [ ! -x /sbin/brctl ]; then + nls "%s is missing. Can't continue." "/sbin/brctl" + exit 1 +fi + +# set all major variables +setup_ip_param + +# set device down and forget all addresses +for device in ${BRIDGE_DEVS}; do + LC_ALL=C ip addr flush dev ${device} 2>&1 | grep -v "Nothing to flush" + brctl delif ${DEVICE} ${device} +done + +ip link set ${DEVICE} down +brctl delbr ${DEVICE} diff --git a/lib/ifdown-irda b/lib/ifdown-irda new file mode 100755 index 0000000..0fff3dc --- /dev/null +++ b/lib/ifdown-irda @@ -0,0 +1,74 @@ +#!/bin/sh +# +# ifdown-irda - IrDA configuration script +# Copyright (C) 2001 Arkadiusz Miśkiewicz +# +# 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. +# +# This program 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 program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# +PATH=/sbin:/usr/sbin:/bin:/usr/bin + +cd /lib/rc-scripts +. /etc/sysconfig/network +. /etc/rc.d/init.d/functions +. /lib/rc-scripts/functions.network + +CONFIG=$1 +source_config + +if [ "foo$2" = "fooboot" ] && is_no "${ONBOOT}"; then + exit +fi + +. /etc/sysconfig/network + +# set all major variables +setup_ip_param + +ip link set ${DEVICE} down +ip addr flush dev ${DEVICE} 2>&1 | grep -v "Nothing to flush" + +PID=$(pidof irattach) +for x in $PID; do + if grep -q "$MODEMPORT" /proc/$x/cmdline; then + logger -p daemon.info -t ifdown-sl "signal TERM send to \"$(ps -o cmd=$x)\" - this should be irattach" + kill -TERM $x + PID=$x + fi +done + +if [ -z "$PID" ]; then + exit 1 +fi + +kill $PID > /dev/null 2>&1 +if [ ! -d /proc/$PID ]; then + /lib/rc-scripts/ifdown-post $1 + exit 0 +fi +sleep 2 +if [ ! -d /proc/$PID ]; then + /lib/rc-scripts/ifdown-post $1 + exit 0 +fi + +kill -KILL $PID > /dev/null 2>&1 +if [ -d /proc/$PID ]; then + logger -p daemon.info -t ifdown-irda "$(nls 'ifdown-%s unable to kill %s for %s' "irda" "irattach" "$DEVICE")" & +else + /lib/rc-scripts/ifdown-post $1 +fi + +exit 1 diff --git a/lib/ifdown-post b/lib/ifdown-post new file mode 100755 index 0000000..53462f8 --- /dev/null +++ b/lib/ifdown-post @@ -0,0 +1,47 @@ +#!/bin/sh +# +# +# This should be called whenever an interface goes down, not just when +# it is brought down explicitly. + +run_down() { :; } + +CONFIG=$1 +. /etc/sysconfig/network +. /etc/rc.d/init.d/functions +. /lib/rc-scripts/functions.network + +source_config + +# set all major variables +setup_ip_param + +# set REALDEVICE +get_ppp_device_and_pid + +# (QoS) Delete root queueing discipline +if [ -n "${BANDWIDTH_OUT}" ]; then + if [ "${QDISC_CLASS}" = "htb" -o "${QDISC_CLASS}" = "cbq" ]; then + tc qdisc del dev ${REALDEVICE} root + elif [ -z "${QDISC}" -o "${QDISC}" = "tbf" ]; then + tc qdisc del dev ${REALDEVICE} root + elif [ -n "${QDISC}" ]; then + tc qdisc del dev ${REALDEVICE} root + fi +else + if [ -n "${QDISC}" ]; then + tc qdisc del dev ${REALDEVICE} root + fi +fi + +if [ -n "${BANDWIDTH_IN}" ]; then + tc qdisc del dev ${REALDEVICE} ingress +fi + +# execute run_down() function (if available in device configuration file) +run_down + +# Notify programs that have requested notification +do_netreport + +exit 0 diff --git a/lib/ifdown-ppp b/lib/ifdown-ppp new file mode 100755 index 0000000..dd87a49 --- /dev/null +++ b/lib/ifdown-ppp @@ -0,0 +1,54 @@ +#!/bin/sh +# +# +PATH=/sbin:/usr/sbin:/bin:/usr/bin + +. /etc/sysconfig/network +. /etc/rc.d/init.d/functions +. /lib/rc-scripts/functions.network + +CONFIG=$1 +source_config + +if [ ! -f /var/run/ppp-$DEVNAME.pid ]; then + # ppp isn't running, or we didn't start it + exit 0 +fi + +# set all major variables +setup_ip_param +get_ppp_device_and_pid + +if [ -z "$PID" ]; then + exit 1 +fi + +rm -f /var/run/ppp-$DEVNAME.pid + +[ ! -d /proc/${PID} ] && exit 0 + +kill -TERM ${PID} > /dev/null 2>&1 + +sleep 2 +[ -d /proc/${PID} ] && sleep 2 && [ -d /proc/${PID} ] && sleep 5 + +if [ -d /proc/${PID} ]; then + kill -KILL ${PID} > /dev/null 2>&1 + logger -p daemon.info -t ifdown-ppp "ifdown-ppp unable to nicely kill pppd-$DEVICE (pppd-$DEVNAME)" & +fi + +# Special cases +if is_yes "${PPPOA_EAGLE}"; then + EAGLECTRL="/usr/sbin/adictrl" + if [ ! -x $EAGLECTRL ]; then + EAGLECTRL="/usr/sbin/eaglectrl" + fi + if [ -x $EAGLECTRL ]; then + PPPOA_IFACE=$( $EAGLECTRL -i 2>/dev/null) + [ -n "$PPPOA_IFACE" ] && ip link set "$PPPOA_IFACE" down + fi +fi + +/lib/rc-scripts/ifdown-post $1 + +exit 1 diff --git a/lib/ifdown-sl b/lib/ifdown-sl new file mode 100755 index 0000000..33f177e --- /dev/null +++ b/lib/ifdown-sl @@ -0,0 +1,63 @@ +#!/bin/sh +# +# +PATH=/sbin:/usr/sbin:/bin:/usr/bin + +. /etc/sysconfig/network +. /etc/rc.d/init.d/functions +. /lib/rc-scripts/functions.network + +CONFIG=$1 +source_config + +# set all major variables +setup_ip_param + +# signals ifup-sl not to persist +rm -f /var/run/sl-$DEVICE.dev + +# we can use dip or direct slip connection via slattach +if is_no "$DIRECT_CONNECT"; then + PID=$(pidof dip-$DEVICE) +else + PID=$(pidof slattach) + for x in $PID; do + if grep -q "$MODEMPORT" /proc/$x/cmdline; then + logger -p daemon.info -t ifdown-sl \ + "signal TERM send to \"$(ps -o cmd= $x)\" - this should be slattach" + kill -TERM $x + PID=$x + fi + done +fi +# +# The proctitle for connected dip daemons is actually "-dip (ipaddr)" +# with ipaddr = local on dial-out, remote on dial-in +# Grab the PID of connected dial-out daemon. +# +if [ -z "$PID" ]; then + PID=$(pidof -- -dip\ \($IPADDR\)) +fi +if [ -z "$PID" ]; then + exit 1 +fi + +kill $PID > /dev/null 2>&1 +if [ ! -d /proc/$PID ]; then + /lib/rc-scripts/ifdown-post $1 + exit 0 +fi +sleep 2 +if [ ! -d /proc/$PID ]; then + /lib/rc-scripts/ifdown-post $1 + exit 0 +fi + +kill -KILL $PID > /dev/null 2>&1 +if [ -d /proc/$PID ]; then + logger -p daemon.info -t ifdown-sl "ifdown-sl unable to kill sl-$DEVICE" & +else + /lib/rc-scripts/ifdown-post $1 +fi + +exit 1 diff --git a/lib/ifdown-vlan b/lib/ifdown-vlan new file mode 100755 index 0000000..58fa45c --- /dev/null +++ b/lib/ifdown-vlan @@ -0,0 +1,52 @@ +#!/bin/sh +# +# ifdown-vlan - Virtual LAN configuration script +# Copyright (C) 2001 Arkadiusz Miśkiewicz +# +# 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. +# +# This program 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 program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# +PATH=/sbin:/usr/sbin:/bin:/usr/bin + +cd /lib/rc-scripts +. /etc/sysconfig/network +. /etc/rc.d/init.d/functions +. /lib/rc-scripts/functions.network + +CONFIG=$1 +source_config + +if [ "foo$2" = "fooboot" ] && is_no "${ONBOOT}"; then + exit 0 +fi + +# set all major variables +setup_ip_param + +ip link set ${DEVICE} down +LC_ALL=C ip addr flush dev ${DEVICE} 2>&1 | grep -v "Nothing to flush" + +if LC_ALL=C ip link help 2>&1 | grep -q del; then + /sbin/ip link del ${DEVICE} +elif [ -x /sbin/vconfig ]; then + /sbin/vconfig rem ${DEVICE} +else + nls "/sbin/vconfig or iproute2 with vlan support is missing. Can't continue." + exit 1 +fi + +RESULT=$? + +exit $RESULT diff --git a/lib/ifup b/lib/ifup new file mode 100755 index 0000000..c534442 --- /dev/null +++ b/lib/ifup @@ -0,0 +1,266 @@ +#!/bin/sh +# +# +PATH=/sbin:/usr/sbin:/bin:/usr/bin + +. /etc/sysconfig/network +. /etc/rc.d/init.d/functions +. /lib/rc-scripts/functions.network + +# Will be removed in the future +if is_yes "$NETWORKING"; then + if [ -z "$IPV4_NETWORKING" ]; then + echo "NETWORKING is set to YES, but IPV4_NETWORKING is empty!" + echo "Please upgrade your config" + echo "Assuming you want IPv4 networking" + IPV4_NETWORKING=yes + export IPV4_NETWORKING + fi +fi + +need_hostname + +# device name must be ifcfg-somename +DEV=$1 + +[ -z "$DEV" ] && { + nls "Usage: %s " "ifup" >&2 + exit 1 +} + +if [ $(id -u) != 0 ]; then + if [ -x /sbin/usernetctl ]; then + exec /sbin/usernetctl $DEV up + fi + nls "Users cannot control this device." >&2 + exit 1 +fi + +if [ -f "/etc/sysconfig/interfaces/ifcfg-$DEV" ]; then + CONFIG="/etc/sysconfig/interfaces/ifcfg-$DEV" +elif [ -f "/etc/sysconfig/interfaces/$DEV" ]; then + CONFIG="/etc/sysconfig/interfaces/$DEV" +else + CONFIG="$DEV" +fi + +source_config + +if [ "foo$2" = "fooboot" ] && is_no "${ONBOOT}"; then + exit +fi + +if [ "foo$2" = "foohotplug" ] && ! is_yes "${HOTPLUG}"; then + exit +fi + +if [ "foo$2" = "foopcmcia-hotplug" ] && ! is_yes "${PCMCIA_HOTPLUG}"; then + exit +fi + +IPSETUP=no + +# set all major variables +setup_ip_param + +SYSCTLDEVICE=$(echo ${DEVICE} | sed 's/\./\//g') + +OTHERSCRIPT="/lib/rc-scripts/ifup-${DEVICETYPE}" + +if [ -x "$OTHERSCRIPT" ]; then + if is_yes "$DEFAULTHANDLING"; then + HANDLING=1 + fi + if [ "$HANDLING" = "0" ]; then + exec $OTHERSCRIPT $CONFIG $2 + elif [ "$HANDLING" = "1" ]; then + $OTHERSCRIPT $CONFIG $2 + fi +fi + +if [ -n "$MACVLAN_DEV" -a -n "$MACVLAN_MACADDR" ]; then + ip link del link ${MACVLAN_DEV} ${DEVICE} type macvlan > /dev/null 2>&1 + ip link add link ${MACVLAN_DEV} address ${MACVLAN_MACADDR} name ${DEVICE} type macvlan +fi + +# is this device available? (this catches PCMCIA devices for us) +if ! /sbin/ip link set multicast ${MULTICAST} dev ${DEVICE} > /dev/null 2>&1; then + nls "Delaying %s initialization" ${DEVICE} + exit 1 +fi + +if [ -n "$MACADDR" ]; then + ip link set ${DEVICE} address ${MACADDR} +fi + +ip link set ${DEVICE} multicast ${MULTICAST} ${ARP} down + +if [ -n "$MTU" ]; then + ip link set ${DEVICE} mtu ${MTU} +fi + +if is_yes "${IPV6_NETWORKING}" && is_yes "${IPV6_DISABLE_AUTOCONF}"; then + run_cmd "Disabling IPv6 autoconfiguration" sysctl -w net.ipv6.conf.${SYSCTLDEVICE}.autoconf=0 +fi + +if is_wireless_device "${DEVICE}"; then + is_yes "${WLAN_UPEARLY}" && ip link set ${DEVICE} up + wireless_param ${DEVICE} +fi + +if is_yes "${WLAN_WPA}"; then + /usr/sbin/wpa_supplicant -D ${WLAN_WPA_DRIVER:-wext} -c ${WLAN_WPA_CONFIG:-/etc/wpa_supplicant.conf} -i ${DEVICE} ${WLAN_WPA_OPTIONS} -P "/var/run/wpa_supplicant-${DEVICE}.pid" -B + [ -z "$WLAN_WPA_WAIT_TIMEOUT" ] && WLAN_WPA_WAIT_TIMEOUT=15 + # check_link_down sleeps for 0.5s + check_link_down ${DEVICE} $(( $WLAN_WPA_WAIT_TIMEOUT * 2 )) +fi + +if [ -n "$ETHTOOL_OPTS" ] ; then + /sbin/ethtool -s $DEVICE $ETHTOOL_OPTS +fi + +if is_yes "$SLAVE" && [ -n "$MASTER" ] ; then + nls "Enslaving %s to %s" "$DEVICE" "$MASTER" + ip link set "$DEVICE" master "$MASTER" + ip link set "$DEVICE" up + + exit 0 +fi + +if [ "$HANDLING" = "2" ]; then + exit 0 +fi + +if [ -n "$BOOTPROTO" -a "$BOOTPROTO" != "none" -a "$BOOTPROTO" != "static" ]; then + if is_yes "$IPV4_NETWORKING"; then + set_dhcpclient + + DHCP_ARGS= + if [ -n "$DHCP_CLIENT" ]; then + if [ -z "$DHCP_HOSTNAME" ]; then + # set DHCP_HOSTNAME only basename + DHCP_HOSTNAME=${HOSTNAME%%.*} + fi + case ${DHCP_CLIENT##*/} in + pump) + [ -n "$DHCP_HOSTNAME" ] && DHCP_ARGS="-h $DHCP_HOSTNAME" + DHCP_ARGS="$DHCP_ARGS -i $DEVICE" + ;; + dhcpcd) + [ -n "$DHCP_HOSTNAME" ] && DHCP_ARGS="-h $DHCP_HOSTNAME" + DHCP_ARGS="$DHCP_ARGS $DEVICE" + if is_no "$ZEROCONF"; then + DHCP_ARGS="$DHCP_ARGS --noipv4ll" + fi + ;; + dhcpxd) + [ -n "$DHCP_HOSTNAME" ] && DHCP_ARGS="-H $DHCP_HOSTNAME" + DHCP_ARGS="$DHCP_ARGS $DEVICE" + ;; + dhclient) + # Can't specify a host with dhclient ? + DHCP_ARGS="$DEVICE -pf /var/run/dhclient.$DEVICE.pid -lf /var/lib/dhclient/dhclient.$DEVICE.leases" + if [ -f /etc/dhclient.$DEVICE.conf ] ; then + DHCP_ARGS="$DHCP_ARGS -cf /etc/dhclient.$DEVICE.conf" + fi + ;; + avahi-autoipd) + DHCP_ARGS="-D $DEVICE" + ;; + esac + fi + DHCP_ARGS="$DHCP_OPTIONS $DHCP_ARGS" + + if check_link_down ${DEVICE}; then + run_cmd "$(nls 'Determining IP information for %s (%s)' "$DEVICE" "${DHCP_CLIENT##*/}")" /bin/false + nls '%s: Check cable/radio on-off switch?' "$DEVICE" + exit 1 + fi + + if ! run_cmd "$(nls 'Determining IP information for %s (%s)' "$DEVICE" "${DHCP_CLIENT##*/}")" $DHCP_CLIENT $DHCP_ARGS; then + exit 1 + fi + + # give time for determining IP information + check_device_down && sleep 1 && check_device_down && sleep 3 + check_device_down && ip link set ${DEVICE} up + fi +else + # IPv4 in use ? + if is_yes "$IPV4_NETWORKING" && [ -n "${IP4ADDR}" ]; then + # If broadcast is missing then autocalculate it + if ! (echo $IP4ADDROPT | grep -qE "brd|broadcast"); then + IP4ADDROPT="brd + ${IP4ADDROPT}" + fi + + if [ -n "${SUBDEVICE}" ]; then + ALIAS="label ${SUBDEVICE}" + fi + + if [ -n "$REMIP" ]; then + ip addr add ${IP4ADDR} peer ${REMIP} ${ALIAS} dev ${DEVICE} ${IP4ADDROPT} + else + ip addr add ${IP4ADDR} ${ALIAS} dev ${DEVICE} ${IP4ADDROPT} + fi + fi + + # Set device up + ip link set ${DEVICE} up + + # IPv6 in use ? + if is_yes "$IPV6_NETWORKING" && [ -n "${IP6ADDR}" ]; then + ip addr add ${IP6ADDR} dev ${DEVICE} ${IP6ADDROPT} + if [ -n "${IP6ADDRLABEL}" ]; then + ip addrlabel add prefix ${IP6ADDR} dev ${DEVICE} label ${IP6ADDRLABEL} + fi + fi + + if is_yes "$IPV4_NETWORKING" && [ -n "${IP4ADDR}" -a -x /sbin/arping ]; then + # update ARP cache of neighbouring computers + /sbin/arping -q -A -c 1 -I ${DEVICE} ${IP4ADDR%/*} + { ( sleep 2; /sbin/arping -q -U -c 1 -I ${DEVICE} ${IP4ADDR%/*} ) & } > /dev/null 2>&1 + fi + + # IPv4/6 gateways and default routes + setup_ip_gw_ro +fi + +# device have to have ip address set before +if is_yes "$PROXYARP"; then + run_cmd "$(nls 'Enabling proxy ARP on %s' "${DEVICE}")" sysctl -w net.ipv4.conf.${SYSCTLDEVICE}.proxy_arp=1 +fi + +if [ "$HANDLING" = "3" ]; then + exit 0 +fi + +if is_yes "$IPX"; then + /lib/rc-scripts/ifup-ipx $DEVICE +fi + +if is_yes "$ENABLE_6TO4"; then + # find an usable IPv4 address for this device; might have been obtained by dhcp or ppp + for ipv4 in `/sbin/ip addr show dev $DEVICE | awk -F'[ /]+' '/ inet /{print $3}'`; do + if [ `ipcalc -n $ipv4/8` != "NETWORK=10.0.0.0" \ + -a `ipcalc -n $ipv4/12` != "NETWORK=172.16.0.0" \ + -a `ipcalc -n $ipv4/24` != "NETWORK=192.168.0.0" \ + -a `ipcalc -n $ipv4/24` != "NETWORK=169.254.0.0" ]; then + local_ipv4=$ipv4 + local_ipv6=`printf "2002:%02x%02x:%02x%02x::1" $(echo $ipv4 | tr . ' ')` + break + fi + done + if [ -n "$local_ipv4" ]; then # we have an usable IPv4 address; set up the tunnel + tun6to4=tun6to4_$DEVICE + /sbin/ip tunnel add $tun6to4 mode sit ttl 128 remote any local $local_ipv4 + /sbin/ip link set dev $tun6to4 up + /sbin/ip -6 addr add $local_ipv6/16 dev $tun6to4 + /sbin/ip -6 route add 2000::/3 via ::192.88.99.1 dev $tun6to4 metric 1 + fi +fi + +if [ "$HANDLING" = "4" ]; then + exit 0 +fi + +exec /lib/rc-scripts/ifup-post $CONFIG diff --git a/lib/ifup-aliases b/lib/ifup-aliases new file mode 100644 index 0000000..b31474f --- /dev/null +++ b/lib/ifup-aliases @@ -0,0 +1,80 @@ +#!/bin/sh +# +# +# Adds all addresses of device. +# Called from ifup-post. + +# Add all addresses +for IP_ADDR in $IPADDR_ALIASES; do + [ -z "$IP_ADDR" ] && continue + # Be sure that primary address is added + if [ "$IP_ADDR" = "$IP4ADDR" -o "$IP_ADDR" = "$IP6ADDR" ]; then + if (ip addr show dev $DEVICE | grep -qE "[[:space:]]${IP_ADDR}[[:space:]]"); then + continue + fi + fi + if is_yes "${IPV4_NETWORKING}"; then + ip -4 addr add ${IP_ADDR} dev ${DEVICE} brd + + fi +done + +for IP_ADDR in $IPV6_ADDR; do + [ -z "$IP_ADDR" ] && continue + # Be sure that primary address is added + if [ "$IP_ADDR" = "$IP4ADDR" -o "$IP_ADDR" = "$IP6ADDR" ]; then + if (ip addr show dev $DEVICE | grep -qE "[[:space:]]${IP_ADDR}[[:space:]]"); then + continue + fi + fi + # Check for IPv6 address + if (echo $IP_ADDR | grep -q ":"); then + if is_yes "${IPV6_NETWORKING}"; then + ip -6 addr add ${IP_ADDR} dev ${DEVICE} + fi + elif is_yes "${IPV4_NETWORKING}"; then + ip -4 addr add ${IP_ADDR} dev ${DEVICE} brd + + fi +done + +for nr in $(awk 'BEGIN { max=0; }; /^IPADDR[0-9]+=/ { s = $0; gsub(/^IPADDR/, "", s); gsub(/=.*/, "", s); if (int(s) > int(max)) { max=s; }; }; END { for(j=1; j<=int(max); j++) print j } ' $CONFIG); do + eval IP_ADDR="\$IPADDR${nr}" + [ -z "$IP_ADDR" ] && continue + + eval IP_ADDR_OPT="\$IP_AOPTS${nr}" + eval IP_ROUTE_OPT="\$IP_ROPTS${nr}" + eval IP_ADDR_LABEL="\$IP_LABEL${nr}" + + # Be sure that primary address is added + if [ "$IP_ADDR" = "$IP4ADDR" -o "$IP_ADDR" = "$IP6ADDR" ]; then + if (ip addr show dev $DEVICE | grep -qE "[[:space:]]${IP_ADDR}[[:space:]]"); then + continue + fi + fi + # Check for IPv6 address + if echo $IP_ADDR | grep -q ":"; then + if is_yes "${IPV6_NETWORKING}"; then + ip -6 addr add ${IP_ADDR} dev ${DEVICE} ${IP_ADDR_OPT} + if [ -n "${IP_ADDR_LABEL}" ]; then + ip -6 addrlabel add prefix ${IP_ADDR} dev ${DEVICE} label ${IP_ADDR_LABEL} + fi + fi + elif is_yes "${IPV4_NETWORKING}"; then + # If broadcast is missing then autocalculate it + if ! (echo $IP_ADDR_OPT | grep -qE "brd|broadcast"); then + IP_ADDR_OPT="brd + ${IP_ADDR_OPT}" + fi + ip -4 addr add ${IP_ADDR} dev ${DEVICE} ${IP_ADDR_OPT} + fi +done + +# Setup IPv4-compatible addresses +if is_yes "$IPV6_NETWORKING" && [ "$BOOTPROTO6" = "v4compat" ]; then + # enable automatic tunnels + ip link set sit0 up + + # add v4compat addresses to device + for addr in $(ip -4 addr show scope global dev $DEVICE | \ + awk '/inet/ { print $2 }' | awk -F"/" '{ print $1 }'); do + ip -6 addr add ::$addr dev $DEVICE + done +fi diff --git a/lib/ifup-br b/lib/ifup-br new file mode 100755 index 0000000..4fd7b85 --- /dev/null +++ b/lib/ifup-br @@ -0,0 +1,88 @@ +#!/bin/sh +# +# ifup-br - bridge configuration script +# Copyright (C) 2000 Arkadiusz Miśkiewicz +# +# 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. +# +# This program 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 program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# +PATH=/sbin:/usr/sbin:/bin:/usr/bin + +. /etc/sysconfig/network +. /etc/rc.d/init.d/functions +. /lib/rc-scripts/functions.network + +CONFIG=$1 +source_config + +if [ "foo$2" = "fooboot" ] && is_no "${ONBOOT}"; then + exit +fi + +if [ ! -x /sbin/brctl ]; then + nls "%s is missing. Can't continue." "/sbin/brctl" + exit 1 +fi + +# load bridge module +is_module "bridge" && modprobe -s bridge + +# set all major variables +setup_ip_param + +# forget all addresses +for device in $BRIDGE_DEVS; do + LC_ALL=C ip addr flush dev ${device} 2>&1 | grep -v "Nothing to flush" +done + +# set wireless parameters +for device in $BRIDGE_DEVS; do + if is_wireless_device "${device}"; then + wireless_param "${device}" "br" + fi +done + +brctl addbr ${DEVICE} + +# add interfaces to bridge +for device in $BRIDGE_DEVS; do + brctl addif ${DEVICE} ${device} + ip link set dev ${device} multicast ${MULTICAST} ${ARP} + ip link set ${device} up +done + + +# standard +[ -n "$AGEING" ] && brctl setageing "$AGEING" +[ -n "$GCINT" ] && brctl setgcint "$GCINT" +[ -n "$FD" ] && brctl setfd ${DEVICE} "$FD" + +# spanning tree protocol +if is_yes "$SPANNING_TREE"; then + brctl stp ${DEVICE} yes + [ -n "$BRIDGEPRIO" ] && brctl setbridgeprio ${DEVICE} "$BRIDGEPRIO" + [ -n "$HELLO" ] && brctl sethello ${DEVICE} "$HELLO" + [ -n "$MAXAGE" ] && brctl setmaxage ${DEVICE} "$MAXAGE" + [ -n "$PATHCOST" -a -n "$PATHCOST_PORT" ] && brctl setpathcost ${DEVICE} "$PATHCOST_PORT" "$PATHCOST" + [ -n "$PORTPRIO" -a -n "$PORTPRIO_PORT" ] && brctl setportprio ${DEVICE} "$PORTPRIO_PORT" "$PORTPRIO" +else + brctl stp ${DEVICE} no +fi + +ip link set dev ${DEVICE} multicast ${MULTICAST} ${ARP} +if ! (ip link set dev ${DEVICE} up); then + nls "problems with setting bridge %s" "${DEVICE}" + exit 1 +fi diff --git a/lib/ifup-ipx b/lib/ifup-ipx new file mode 100755 index 0000000..0726b57 --- /dev/null +++ b/lib/ifup-ipx @@ -0,0 +1,51 @@ +#!/bin/sh +# +# +# configures IPX on $1 if appropriate + +. /etc/sysconfig/network +. /etc/rc.d/init.d/functions +. /lib/rc-scripts/functions.network + +PATH=/sbin:/usr/sbin:/bin:/usr/bin + +if [ "$1" = "" ]; then + nls "Usage: %s " "ifup-ipx" >&2 + exit 1 +fi + +if is_no "$IPX"; then + exit 0 +fi + +if [ ! -x /sbin/ipx_interface ] ; then + nls "%s is missing. Can't continue." "/sbin/ipx_interface" + exit 1 +fi + +cd /lib/rc-scripts + +CONFIG=$1 +[ -f "$CONFIG" ] || CONFIG=ifcfg-$CONFIG +source_config + +# set all major variables +setup_ip_param + +# add ipx for all frame types +for frametype in '802.2' '802.2TR' '802.3' 'EtherII' 'SNAP'; do + framename=$(echo $frametype | awk ' { gsub(/\./,"_"); print $0 } ') + case $(eval echo $(echo \$$(echo IPXACTIVE_$framename))) in + yes|true) + case $(eval echo $(echo \$$(echo IPXPRIMARY_$framename))) in + yes|true) primary="-p" ;; + *) primary= ;; + esac + ip link set $DEVICE up + /sbin/ipx_interface add $primary $DEVICE $frametype \ + $(eval echo $(echo \$$(echo IPXNETNUM_$framename))) + ;; + esac +done + +exit 0 diff --git a/lib/ifup-irda b/lib/ifup-irda new file mode 100755 index 0000000..10a4a01 --- /dev/null +++ b/lib/ifup-irda @@ -0,0 +1,61 @@ +#!/bin/sh +# +# ifup-irda - IrDA configuration script +# Copyright (C) 2001 Arkadiusz Miśkiewicz +# +# 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. +# +# This program 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 program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# +PATH=/sbin:/usr/sbin:/bin:/usr/bin + +cd /lib/rc-scripts +. /etc/sysconfig/network +. /etc/rc.d/init.d/functions +. /lib/rc-scripts/functions.network + +CONFIG=$1 +source_config + +if [ "foo$2" = "fooboot" ] && is_no "${ONBOOT}"; then + exit +fi + +if [ ! -x /sbin/irattach ]; then + nls "%s is missing. Can't continue." "/sbin/irattach" + exit 1 +fi + +. /etc/sysconfig/network + +# set all major variables +setup_ip_param + +IRDAOPTS= + +if [ -n "${DONGLE}" ]; then + IRDAOPTS="${IRDAOPTS} -d ${DONGLE}" +fi + +if is_yes "${DISCOVERY}" || [ -z "${DISCOVERY}" ]; then + IRDAOPTS="${IRDAOPTS} -s" +fi + +/sbin/irattach ${IRDAPORT} ${IRDAOPTS} + +ip link set dev ${DEVICE} multicast ${MULTICAST} ${ARP} +if ! (ip link set dev ${DEVICE} up); then + nls "problems with setting %s %s" "IrDA" "${DEVICE}" + exit 1 +fi diff --git a/lib/ifup-iucv b/lib/ifup-iucv new file mode 100755 index 0000000..a6fbfb4 --- /dev/null +++ b/lib/ifup-iucv @@ -0,0 +1,40 @@ +#!/bin/sh +# +# +PATH=/sbin:/usr/sbin:/bin:/usr/bin + +cd /lib/rc-scripts +. /etc/sysconfig/network +. /etc/rc.d/init.d/functions +. /lib/rc-scripts/functions.network + +CONFIG=$1 +source_config + +if [ "foo$2" = "fooboot" ] && is_no "${ONBOOT}"; then + exit +fi + +# set all major variables +setup_ip_param + +if is_yes "$IPV4_NETWORKING"; then + if [ -n "$IP4ADDR" ]; then + ip -4 addr add ${IP4ADDR} peer ${REMIP} dev ${DEVICE} + fi +fi + +if is_yes "$IPV6_NETWORKING"; then + if [ -n "$IP6ADDR" ]; then + ip -6 addr add ${IP6ADDR} dev ${DEVICE} + fi +fi + +ip link set dev ${DEVICE} up + +. /etc/sysconfig/network + +# IPv4/6 gateways and default routes +setup_ip_gw_ro + +/lib/rc-scripts/ifup-post $1 diff --git a/lib/ifup-neigh b/lib/ifup-neigh new file mode 100644 index 0000000..bd35922 --- /dev/null +++ b/lib/ifup-neigh @@ -0,0 +1,19 @@ +#!/bin/sh +# +# +# Adds static arps for device $DEVICE +# Called from ifup-post. + +if is_no "$IPV4_NETWORKING"; then + return +fi + +if [ ! -f /etc/sysconfig/static-arp ]; then + return +fi + +# note the trailing white space character in the grep gets rid of aliases +grep -E "^($DEVICE|any)[[:blank:]]" /etc/sysconfig/static-arp | while read iface mac ip state args; do + [ -z "$state" ] && state="stale" + /sbin/ip neigh replace $ip lladdr $mac nud $state dev $DEVICE +done diff --git a/lib/ifup-plip b/lib/ifup-plip new file mode 100755 index 0000000..5db4331 --- /dev/null +++ b/lib/ifup-plip @@ -0,0 +1,39 @@ +#!/bin/sh +# +# +PATH=/sbin:/usr/sbin:/bin:/usr/bin + +. /etc/sysconfig/network +. /etc/rc.d/init.d/functions +. /lib/rc-scripts/functions.network + +CONFIG=$1 +source_config + +if [ "foo$2" = "fooboot" ] && is_no "${ONBOOT}"; then + exit +fi + +# set all major variables +setup_ip_param + +if is_yes "$IPV4_NETWORKING"; then + if [ -n "$IP4ADDR" ]; then + ip -4 addr add ${IP4ADDR} peer ${REMIP} dev ${DEVICE} + fi +fi + +if is_yes "$IPV6_NETWORKING"; then + if [ -n "$IP6ADDR" ]; then + ip -6 addr add ${IP6ADDR} dev ${DEVICE} + fi +fi + +ip link set dev ${DEVICE} up + +. /etc/sysconfig/network + +# IPv4/6 gateways and default routes +setup_ip_gw_ro + +/lib/rc-scripts/ifup-post $1 diff --git a/lib/ifup-plusb b/lib/ifup-plusb new file mode 100755 index 0000000..65c896c --- /dev/null +++ b/lib/ifup-plusb @@ -0,0 +1,48 @@ +#!/bin/sh +# +# The plusb network driver is a USB host-host cable based on the Prolific +# chip. It works a lot like the plip driver. +# +# To get the plusb module to load automatically at boot, you will need to +# add the following lines to /etc/conf.modules: +# +# alias plusb0 plusb +# +# +PATH=/sbin:/usr/sbin:/bin:/usr/bin + +cd /lib/rc-scripts +. /etc/sysconfig/network +. /etc/rc.d/init.d/functions +. /lib/rc-scripts/functions.network + +CONFIG=$1 +source_config + +if [ "foo$2" = "fooboot" ] && is_no "${ONBOOT}"; then + exit +fi + +# set all major variables +setup_ip_param + +if is_yes "$IPV4_NETWORKING"; then + if [ -n "$IP4ADDR" ]; then + ip -4 addr add ${IP4ADDR} peer ${REMIP} dev ${DEVICE} + fi +fi + +if is_yes "$IPV6_NETWORKING"; then + if [ -n "$IP6ADDR" ]; then + ip -6 addr add ${IP6ADDR} dev ${DEVICE} + fi +fi + +ip link set dev ${DEVICE} up + +. /etc/sysconfig/network + +# IPv4/6 gateways and default routes +setup_ip_gw_ro + +/lib/rc-scripts/ifup-post $1 diff --git a/lib/ifup-post b/lib/ifup-post new file mode 100755 index 0000000..a271309 --- /dev/null +++ b/lib/ifup-post @@ -0,0 +1,76 @@ +#!/bin/sh +# +# + +run_up() { :; } + +. /etc/rc.d/init.d/functions +. /etc/sysconfig/network +. /lib/rc-scripts/functions.network + +need_hostname +CONFIG=$1 +source_config + +# set all major variables +setup_ip_param + +# set REALDEVICE +get_ppp_device_and_pid + +# Simple QoS support (bandwidth limit) +if [ -n "${BANDWIDTH_OUT}" ]; then + if [ "${QDISC_CLASS}" = "htb" -o "${QDISC_CLASS}" = "cbq" ]; then + case "${QDISC_CLASS}" in + htb) + tc qdisc add dev ${REALDEVICE} root handle 1: htb default 10 + tc class add dev ${REALDEVICE} parent 1: classid 1:10 htb rate ${BANDWIDTH_OUT}kbit ceil ${BANDWIDTH_OUT}kbit + [ -n "${QDISC}" ] && tc qdisc add dev ${REALDEVICE} parent 1:10 ${QDISC} + ;; + cbq) + # FIXME: hardcoded ethernet speed (bandwidth) + tc qdisc add dev ${REALDEVICE} root handle 1: cbq bandwidth 100000kbit cell 8 avpkt 1000 mpu 64 + tc class add dev ${REALDEVICE} parent 1: classid 1:10 cbq bandwidth 100000kbit rate ${BANDWIDTH_OUT}kbit maxburst 5 avpkt 1000 allot 1514 bounded + [ -n "${QDISC}" ] && tc qdisc add dev ${REALDEVICE} parent 1:10 ${QDISC} + tc filter add dev ${REALDEVICE} protocol ip parent 1: u32 match ip src 0.0.0.0/0 flowid 1:10 + ;; + esac + elif [ -z "${QDISC}" -o "${QDISC}" = "tbf" ]; then + tc qdisc add dev ${REALDEVICE} root tbf rate ${BANDWIDTH_OUT}kbit latency 50ms burst 51200 + elif [ -n "${QDISC}" ]; then + tc qdisc add dev ${REALDEVICE} root ${QDISC} + fi +else + if [ -n "${QDISC}" ]; then + tc qdisc add dev ${REALDEVICE} root ${QDISC} + fi +fi + +if [ -n "${BANDWIDTH_IN}" ]; then + tc qdisc add dev ${REALDEVICE} handle ffff: ingress + tc filter add dev ${REALDEVICE} parent ffff: protocol ip prio 50 u32 match ip src 0.0.0.0/0 police rate ${BANDWIDTH_IN}kbit burst 10k drop flowid :3 +fi + +. /lib/rc-scripts/ifup-aliases +. /lib/rc-scripts/ifup-routes +. /lib/rc-scripts/ifup-neigh + +# don't set hostname on ppp/slip connections +if [ -n "$NEEDHOSTNAME" -a "${DEVICETYPE}" != "ppp" -a "${DEVICETYPE}" != "slip" ]; then + IPADDR=$(ip -f inet addr show dev ${DEVICE} | + awk '/inet/ { print $2 }' |awk -F"/" '{ print $1 }') + eval $(/bin/ipcalc --silent --hostname ${IPADDR}) && set_hostname $HOSTNAME +fi + +# run tleds software +if [ "$TLEDS_DEV" = "$DEVICE" -a -x /usr/bin/tleds ]; then + /usr/bin/tleds -qc "$DEVICE" +fi + +# execute run_up() function (if available in device configuration file) +run_up + +# Notify programs that have requested notification +do_netreport + +exit 0 diff --git a/lib/ifup-ppp b/lib/ifup-ppp new file mode 100755 index 0000000..a9649ab --- /dev/null +++ b/lib/ifup-ppp @@ -0,0 +1,266 @@ +#!/bin/sh +# +# +# ifup-ppp script for pppd-2.3.5 (with persist & demand options) ver 0.2 +# Grzegorz Stanislawski +# Features: +# - since persist option is included to pppd it's no need to do werid loops +# ifup-ppp script. This also makes your logfile grow slower when Your link +# is down. +# - chat-ppp? file with script for chat is now parsed by shell, so You can +# include in it shell variables (for example $PHONE, $USERNAME) +# You can define any variable in ifcfg-ppp? file and use it in chat-ppp? +# You only have to add it's name into DATAFORCHAT variable +# Note, that chat-ppp file is now parsed by shell, so you have to escape +# with "\" all shell special characters like \$;:)(& etc. + +PATH=/sbin:/usr/sbin:/bin:/usr/bin + +# ifup-post for PPP is handled through /etc/ppp/ip-up + +. /etc/sysconfig/network +. /etc/rc.d/init.d/functions +. /lib/rc-scripts/functions.network + +CONFIG=$1 +source_config +# set all major variables +setup_ip_param + +if [ "$2" = "boot" ] && is_no "${ONBOOT}"; then + exit +fi +if [ ! -x /usr/sbin/pppd ]; then + nls "%s does not exist or is not executable" "/usr/sbin/pppd" + nls "%s for %s exiting" "ifup-ppp" "$DEVICE" + logger -p daemon.info -t ifup-ppp \ + "$(nls '%s does not exist or is not executable for %s' \ + "/usr/sbin/pppd" "$DEVICE")" + exit 1 +fi + +# modprobe ppp modules (udev case) +[ ! -e /dev/ppp ] && modprobe -s char-major-108 + +opts="lock" + +if [ -z "${REPORTFILE}" ] ; then + REPORTFILE=/dev/null +fi + +if [ -n "${PPPOE_DEV}" ]; then + if is_yes "${PPPOE_KERNEL}"; then + modprobe -s pppoe + MODEMMODE="plugin rp-pppoe.so" + MODEMPORT="${PPPOE_DEV}" + else + MODEMMODE="pty" + MODEMPORT="pppoe -I ${PPPOE_DEV} ${PPPOE_OPT}" + fi +elif is_yes "${PPPOA_EAGLE}"; then + EAGLECTRL="/usr/sbin/adictrl" + if [ ! -x $EAGLECTRL ]; then + EAGLECTRL="/usr/sbin/eaglectrl" + fi + if [ ! -x $EAGLECTRL ]; then + nls "%s does not exist or is not executable" "$EAGLECTRL" + nls "%s for %s exiting" "ifup-ppp" "$DEVICE" + exit 1 + fi + $EAGLECTRL -w + PPPOA_IFACE=$( $EAGLECTRL -i 2>/dev/null) + if [ -z "$PPPOA_IFACE" ]; then + PPPOA_IFACE="(unknown)" + else + ip link set "$PPPOA_IFACE" up + fi + MODEMMODE="pty" + MODEMPORT="pppoa -I ${PPPOA_IFACE} ${PPPOA_OPT}" +elif is_yes "${PPPOA_SPEEDTOUCH}"; then + if is_yes "${PPPOA_KERNEL}"; then + modprobe -s speedtch + modprobe -s pppoatm + if [ -n "${PPPOA_FIRMWARE}" ]; then + modem_run -k -s -f "${PPPOA_FIRMWARE}" + fi + MODEMMODE="plugin pppoatm.so" + MODEMPORT="${PPPOA_VPI}.${PPPOA_VCI}" + else + modem_run -s -f "${PPPOA_FIRMWARE}" + MODEMMODE="pty" + MODEMPORT="pppoa3 -v1 -c -vpi ${PPPOA_VPI} -vci ${PPPOA_VCI} ${PPPOA_OPT}" + fi +elif is_yes "${PPPOA}"; then + MODEMMODE="plugin pppoatm.so" + MODEMPORT="${PPPOA_VPI}.${PPPOA_VCI}" +else + + if [ -n "$MODEMPORT" -a ! -c "$MODEMPORT" ]; then + echo >&2 "MODEMPORT=$MODEMPORT is not a character device!" + exit 1 + fi + + if is_no "${DIRECT_CONNECT}" || [ -z "${DIRECT_CONNECT}" ]; then + PEERCONF=/etc/ppp/peers/${DEVNAME} + if [ ! -f ${PEERCONF} ]; then + if [ -z "${WVDIALSECT}" ]; then + # XXX: REPORTFILE support is problematic here --misiek + [ -f "${CHATSCRIPT}" ] || CHATSCRIPT=/etc/sysconfig/interfaces/data/chat-${PARENTDEVNAME} + if [ ! -f "${CHATSCRIPT}" ]; then + nls '%s does not exist, perhaps set $CHATSCRIPT' "${CHATSCRIPT}" + nls 'ifup-ppp for %s exiting' "${DEVNAME}" + logger -p daemon.info -t ifup-ppp \ + "$(nls '%s does not exist for %s' "${CHATSCRIPT}" "${DEVICE}")" + exit 1 + fi + fi + logger -s -p daemon.notice -t ifup-ppp "$(nls 'Setting up a new %s config file' "${PEERCONF}")" + if [ -f /etc/ppp/peers/${DEVICE} ]; then + cp -f /etc/ppp/peers/${DEVICE} ${PEERCONF} + else + touch ${PEERCONF} + fi + if [ "${WVDIALSECT}" ]; then + echo "connect \"/usr/bin/wvdial --chat ${WVDIALSECT} --config /etc/wvdial.conf >> ${REPORTFILE} 2>&1 \"" >> ${PEERCONF} + else + if is_yes "${DEBUG}"; then + chatdbg="-v" + fi + if [ -n "${DATAFORCHAT}" ]; then + chatreadenv=-E + fi + echo "connect \"/usr/sbin/chat $chatreadenv -f ${CHATSCRIPT} -r ${REPORTFILE} ${chatdbg}\"" >> ${PEERCONF} + fi + fi + opts="$opts call ${DEVNAME}" + fi +fi + +if [ -z "$MODEMPORT" ]; then + # Last try: + if [ "${PPPOA_VPI}" -a "${PPPOA_VCI}" ]; then + MODEMPORT=${PPPOA_VPI}.${PPPOA_VCI} + else + echo >&2 "Missing modemport!" + exit 1 + fi +fi + +if [ -z "$HOLDOFF" ]; then + HOLDOFF=30 +fi +if is_yes "${PERSIST}"; then + if [ -z "${MAXFAIL}" ]; then + MAXFAIL="0" + fi + opts="$opts persist holdoff $HOLDOFF maxfail $MAXFAIL" +fi +if is_yes "${DEMAND}"; then + if [ -z "${IDLE}" ]; then + IDLE="0" + fi + opts="$opts demand ktune idle ${IDLE}" +fi +if ! is_no "${HARDFLOWCTL}"; then + opts="$opts crtscts" +fi +if is_yes "${MODEMCTL}"; then + opts="$opts modem" +fi +if is_yes "${SYNC}"; then + opts="$opts sync" +fi +if is_yes "${ESCAPECHARS}"; then + opts="$opts asyncmap FFFFFFFF" +else + opts="$opts asyncmap 00000000" +fi +if is_yes "${DEFROUTE}"; then + # pppd will no longer delete an existing default route + # so we have to help it out a little here. + ip route del 0/0 > /dev/null 2>&1 + opts="$opts defaultroute" +elif ! is_no "${DEFROUTE}"; then + opts="$opts defaultroute" +fi +if ! is_no "${PEERDNS}"; then + opts="$opts usepeerdns" +fi +if [ -n "${MRU}" ] ; then + opts="$opts mru ${MRU}" +fi +if [ -n "${MTU}" ] ; then + opts="$opts mtu ${MTU}" +fi +if is_yes "$IPV4_NETWORKING" && [ -n "${IP4ADDR}${REMIP}" ] ; then + # if either IP address is set, the following will work. + opts="$opts ${IP4ADDR}:${REMIP}" +fi +if is_yes "$IPV6_NETWORKING"; then + if is_yes "$IPV6_PPP"; then + if [ -n "${IP6ADDR}${REMIP6}" ] ; then + opts="$opts ipv6 ${IP6ADDR},${REMIP6}" + elif is_yes "$IPV6_CP_USEV4"; then + opts="$opts ipv6cp-use-ipaddr" + elif is_yes "$IPV6_CP_PERSISTENT"; then + opts="$opts ipv6cp-use-persistent" + fi + elif is_no "$IPV6_PPP"; then + opts="$opts noipv6" + fi +elif is_no "$IPV6_NETWORKING"; then + opts="$opts noipv6" +fi +if is_yes "${IPX_PPP}"; then + opts="$opts ipx" + if [ -n "${IPX_PPP_NETWORK}" ]; then + opts="$opts ipx-network ${IPX_PPP_NETWORK}" + fi + if [ -n "${IPX_PPP_NODE}" ]; then + opts="$opts ipx-node ${IPX_PPP_NODE}" + fi + if [ -n "${IPX_PPP_ROUTING}" ]; then + opts="$opts ipx-routing ${IPX_PPP_ROUTING}" + fi +fi + +if [ -n "${PAPNAME}" ] ; then + opts="$opts user ${PAPNAME}" +fi +if [ -n "${REMOTENAME}" ] ; then + opts="$opts remotename ${REMOTENAME}" +fi +if is_yes "${DEBUG}"; then + opts="$opts debug" +fi +if is_yes "${AUTH}"; then + opts="$opts auth" +elif is_no "${AUTH}"; then + opts="$opts noauth" +fi +if is_yes "$PLUGIN_IFCFG_PASSWORD" && [ -n "$PASSWORD" ]; then + if [ -f "$CONFIG" ]; then + ifcfg_password_config="$CONFIG" + else + ifcfg_password_config="/etc/sysconfig/interfaces/$CONFIG" + fi + opts="$opts plugin ifcfg-password.so ifcfg $ifcfg_password_config" +fi + +if ! is_no "${UNIT}"; then + UNIT=$(echo "${DEVICE}" | awk ' { gsub(/ppp/,NUL); print $0} ') + opts="$opts unit ${UNIT}" +fi + +MODEM="${MODEMPORT}"; export MODEM + +(logger -p daemon.info -t ifup-ppp \ + "$(nls 'pppd started for %s on device %s at speed %s' "$DEVICE" \ + "$MODEMPORT" "${LINESPEED:-(unspecified)} on unit ${UNIT}")" &)& + +if [ -n "${DATAFORCHAT}" ]; then + export $DATAFORCHAT +fi +/usr/sbin/pppd $opts ${MODEMMODE} "${MODEMPORT}" ${LINESPEED} \ + ipparam ${DEVNAME} linkname ${DEVNAME} \ + ${PPPOPTIONS} diff --git a/lib/ifup-routes b/lib/ifup-routes new file mode 100644 index 0000000..c04aca8 --- /dev/null +++ b/lib/ifup-routes @@ -0,0 +1,54 @@ +#!/bin/sh +# +# +# Adds static routes which go through device $DEVICE +# Called from ifup-post. + +if [ ! -f /etc/sysconfig/static-routes -a ! -f /etc/sysconfig/static-routes6 ]; then + return +fi + +# note the trailing white space character in the grep gets rid of aliases +grep -E "^($DEVICE|any)[[:blank:]]" /etc/sysconfig/static-routes | while read device args; do + if [[ "$args" = *:* ]]; then + if is_no "$IPV6_NETWORKING"; then + continue + fi + else + if is_no "$IPV4_NETWORKING"; then + continue + fi + fi + /sbin/ip route add $args dev $REALDEVICE +done + +if ! is_no "$IPV6_NETWORKING"; then + grep -E "^($DEVICE|any)[[:blank:]]" /etc/sysconfig/static-routes6 | while read device args; do + /sbin/ip -6 route add $args dev $REALDEVICE + done +fi + +# based on information from http://avahi.org/wiki/AvahiAutoipd#Routes +if is_yes "$ZEROCONF" && ! /sbin/ip link show dev $REALDEVICE | grep -q POINTOPOINT ; then + # metric based on device ifindex, so the same route may be added to + # multiple devices. Big, so it won't conflict with anything else. + if [ -f /sys/class/net/$REALDEVICE/ifindex ] ; then + metric="$(cat /sys/class/net/$REALDEVICE/ifindex)" + metric=$(($metric + 1000)) + else + metric=1000 + fi + + # default route in default table, so it won't override default + # route set by other means + /sbin/ip route add default metric $metric dev $REALDEVICE table default + + # add 169.254.0.0/16 route if not already present on the device + current=$(/sbin/ip route show 169.254.0.0/16 dev $REALDEVICE) + if [ -z "$current" ] ; then + /sbin/ip route add 169.254.0.0/16 metric $metric dev $REALDEVICE + fi + + unset metric + unset current +fi diff --git a/lib/ifup-sl b/lib/ifup-sl new file mode 100755 index 0000000..61a1f75 --- /dev/null +++ b/lib/ifup-sl @@ -0,0 +1,116 @@ +#!/bin/sh +# +# +PATH=/sbin:/usr/sbin:/bin:/usr/bin + +# ifup-post can't be done for slip :-( Solution: use PPP + +. /etc/sysconfig/network +. /etc/rc.d/init.d/functions +. /lib/rc-scripts/functions.network + +# become a daemon in case we have to persist. +if [ "$1" != daemon ] ; then + # disconnect stdin, out, err to disassociate from controlling tty + # so that no HUPs will get through. + $0 daemon $*& /dev/null 2>/dev/null + exit 0 +fi +shift + +CONFIG=$1 +source_config + +if [ "foo$2" = "fooboot" ] && is_no ${ONBOOT}; then + exit +fi + +# set all major variables +setup_ip_param + +if [ -z "$RETRYTIMEOUT" ]; then + RETRYTIMEOUT=30 +fi + +# Try to load slip module +if is_module "slip"; then + /sbin/modprobe -s slip +fi + +# we can use dip or direct slip connection via slattach +if is_no "$DIRECT_CONNECT"; then + [ -x /usr/sbin/dip ] || { + nls "%s does not exist or is not executable" "/usr/sbin/dip" + nls "%s for %s exiting" "ifup-sl" "$DEVICE" + logger -p daemon.info -t ifup-sl \ + "$(nls '%s does not exist or is not executable for %s' "/usr/sbin/dip" "$DEVICE")" + exit 1 + } + + DIPSCRIPT=/etc/sysconfig/interfaces/data/dip-$DEVNAME + [ -f $DIPSCRIPT ] || { + DIPSCRIPT=/etc/sysconfig/interfaces/data/dip-$PARENTDEVNAME + } + [ -f $DIPSCRIPT ] || { + nls '%s does not exist' "/etc/sysconfig/interfaces/data/dip-$DEVICE" + nls 'ifup-sl - %s exiting' "$DEVICE" + logger -p daemon.info -t ifup-sl \ + "$(nls '%s does not exist for %s' "/etc/sysconfig/interfaces/data/dip-$DEVICE" "$DEVICE")" + exit 1 + } + + while : ; do + echo > /var/run/sl-$DEVICE.dev + (logger -p daemon.info -t ifup-sl \ + "$(nls 'dip started for %s on %s at %s' "$DEVICE" "$MODEMPORT" "$LINESPEED")" &)& + doexec /usr/sbin/dip dip-$DEVICE $DIPSCRIPT + if is_no "$PERSIST" || [ ! -f /var/run/sl-$DEVICE.dev ] ; then + exit 0 + fi + rm -f /var/run/sl-$DEVICE.dev + + sleep $RETRYTIMEOUT || { + # sleep was killed + exit 0 + } + done +else + # direct connection via slattach + [ -z "$MTU" ] && MTU=1500 + [ -z "$PROTOCOL" ] && PROTOCOL=slip + + [ -x /sbin/slattach ] || { + nls "%s is missing. Can't continue." "/sbin/slattach" + nls "ifup-sl - %s exiting" "$DEVICE" + logger -p daemon.info -t ifup-sl \ + "$(nls '%s does not exist or is not executable for %s' "/sbin/slattach" "$DEVICE")" + exit 1 + } + + echo > /var/run/sl-$DEVICE.dev + (logger -p daemon.info -t ifup-sl \ + "$(nls 'slattach started for %s on %s at %s' "$DEVICE" "$MODEMPORT" "$LINESPEED")" &)& + + slattach -p $PROTOCOL -s $LINESPEED $MODEMPORT & + usleep 1500 + + if is_yes "$IPV4_NETWORKING"; then + if [ -n "$IP4ADDR" -a -n "$REMIP" ]; then + # Peer is only for IPv4 + ip -4 addr add $IP4ADDR peer $REMIP dev $DEVICE + fi + fi + + if is_yes "$IPV6_NETWORKING"; then + if [ -n "$IP6ADDR" ]; then + ip -6 addr add $IP6ADDR dev $DEVICE + fi + fi + + ip link set $DEVICE mtu $MTU up + + # IPv4/6 gateways and default routes + setup_ip_gw_ro + + /lib/rc-scripts/ifup-post $1 +fi diff --git a/lib/ifup-vlan b/lib/ifup-vlan new file mode 100755 index 0000000..3d72d78 --- /dev/null +++ b/lib/ifup-vlan @@ -0,0 +1,84 @@ +#!/bin/sh +# +# ifup-vlan - Virtual LAN configuration script +# Copyright (C) 2001 Arkadiusz Miśkiewicz +# +# 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. +# +# This program 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 program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# +PATH=/sbin:/usr/sbin:/bin:/usr/bin + +cd /lib/rc-scripts +. /etc/sysconfig/network +. /etc/rc.d/init.d/functions +. /lib/rc-scripts/functions.network + +CONFIG=$1 +source_config + +if is_no "${VLAN_NETWORKING}"; then + exit 0 +fi + +if [ "foo$2" = "fooboot" ] && is_no "${ONBOOT}"; then + exit 0 +fi + +if [ -z "$VLAN_DEV" ]; then + VLAN_DEV=$(echo ${DEVICE} | awk ' { gsub(/\..*$/,NUL); print $0 } ') +fi +VLAN_ID=$(echo ${DEVICE} | awk " { gsub(/^.*\./,NUL); print \$0 } ") + +if [ ! -f /etc/sysconfig/interfaces/ifcfg-${VLAN_DEV} ]; then + nls "%s is missing. Can't continue." "ifcfg-${VLAN_DEV}" + exit 1 +fi + +if ! grep -qlE "ONBOOT=[^n][^o]" /etc/sysconfig/interfaces/ifcfg-${VLAN_DEV}; then + nls "Warning: ${VLAN_DEV} is disabled on boot." +fi + +modprobe -s 8021q + +if [ ! -e /proc/net/vlan/config ]; then + nls "VLAN kernel support is missing. Can't continue." + exit 1 +fi + +# set all major variables +setup_ip_param + +if (LC_ALL=C ip link add type vlan help 2>&1 | grep -q "VLANID :="); then + /sbin/ip link set ${VLAN_DEV} up + /sbin/ip link add link ${VLAN_DEV} name ${DEVICE} type vlan id ${VLAN_ID} + # default yes + is_no "${VLAN_REORDER_HDR}" && VLAN_REORDER_HDR=off || VLAN_REORDER_HDR=on + # default yes + is_no "$VLAN_GVRP" && VLAN_GVRP=off || VLAN_GVRP=on + /sbin/ip link set ${DEVICE} type vlan reorder_hdr ${VLAN_REORDER_HDR} gvrp ${VLAN_GVRP} +elif [ -x /sbin/vconfig ]; then + /sbin/vconfig set_name_type DEV_PLUS_VID_NO_PAD + /sbin/ip link set ${VLAN_DEV} up + /sbin/vconfig add ${VLAN_DEV} ${VLAN_ID} + /sbin/vconfig set_flag ${DEVICE} 1 ${VLAN_REORDER_HDR:-1} +else + nls "/sbin/vconfig or iproute2 with vlan support is missing. Can't continue." + exit 1 +fi +RESULT=$? + +# XXX: more VLAN specific options support + +exit $RESULT diff --git a/lib/tnldown b/lib/tnldown new file mode 100755 index 0000000..3f0a9f8 --- /dev/null +++ b/lib/tnldown @@ -0,0 +1,84 @@ +#!/bin/sh +# +# tnldown - tunnel configuration script +# Copyright (C) 1999, 2000 Arkadiusz Miśkiewicz +# +# 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. +# +# This program 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 program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# + +. /etc/sysconfig/network +. /etc/rc.d/init.d/functions +. /lib/rc-scripts/functions.network + +DEV=$1 + +[ -z "$DEV" ] && { + nls "Usage: %s " "tnldown" >&2 + exit 1 +} + +TNLCONFIGS=$(LC_ALL=C ls /etc/sysconfig/interfaces/tnlcfg-* 2>/dev/null | grep -vE '~$') +TNLCONFIGS=$(grep -LE '^#!' $TNLCONFIGS) +CONFIG=$(grep -lE "^DEVICE=[\"\']*$DEV[\"\']*\$" $TNLCONFIGS) + +if [ -z "$CONFIG" ]; then + CONFIG="$DEV" +fi + +if false; then + [ -f "/etc/sysconfig/interfaces/$CONFIG" ] || CONFIG=tnlcfg-$CONFIG + [ -f "/etc/sysconfig/interfaces/$CONFIG" ] || { + echo "usage: tnldown " >&2 + exit 1 + } +fi + +source_config + +case "${MODE}" in + sit|four) + is_no "${IPV6_NETWORKING}" && exit 0 + is_no "${IPV6_TUNNELCONFIG}" && exit 0 + ;; + ipip) + is_no "${IPV4_NETWORKING}" && exit 0 + ;; + gre) + is_no "${IPV4_NETWORKING}" && exit 0 + ;; + ipxip|ipipx) + is_no "${IPX}" && exit 0 + ;; +esac + +RESULT=0 + +case "${MODE}" in + ipip|sit|gre) + ip link set ${DEVICE} down + ip tunnel del ${DEVICE} + RESULT=$? + ;; + four) + ip link set ${DEVICE} down + fourcfg del ${DEVICE} + RESULT=$? + ;; + ipxip|ipipx) + ;; +esac + +exit $RESULT diff --git a/lib/tnlup b/lib/tnlup new file mode 100755 index 0000000..7e25492 --- /dev/null +++ b/lib/tnlup @@ -0,0 +1,135 @@ +#!/bin/sh +# +# tnlup - tunnel configuration script +# Copyright (C) 1999, 2000 Arkadiusz Miśkiewicz +# +# 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. +# +# This program 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 program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# + +. /etc/sysconfig/network +. /etc/rc.d/init.d/functions +. /lib/rc-scripts/functions.network + +DEV=$1 + +[ -z "$DEV" ] && { + nls "Usage: %s " "tnlup" >&2 + exit 1 +} + +TNLCONFIGS=$(LC_ALL=C ls /etc/sysconfig/interfaces/tnlcfg-* 2>/dev/null | grep -vE '~$') +TNLCONFIGS=$(grep -LE '^#!' $TNLCONFIGS) +CONFIG=$(grep -lE "^DEVICE=[\"\']*$DEV[\"\']*\$" $TNLCONFIGS) + +if [ -z "$CONFIG" ]; then + CONFIG="$DEV" +fi + +if false; then + [ -f "/etc/sysconfig/interfaces/$CONFIG" ] || CONFIG=tnlcfg-$CONFIG + [ -f "/etc/sysconfig/interfaces/$CONFIG" ] || { + echo "usage: tnlup " >&2 + exit 1 + } +fi + +source_config + +if [ "foo$2" = "fooboot" -a -n "${ONBOOT}" ] && is_no "${ONBOOT}"; then + exit +fi + +case "${MODE}" in + sit|four) + is_no "${IPV6_NETWORKING}" && exit 0 + is_no "${IPV6_TUNNELCONFIG}" && exit 0 + [ "${MODE}" = "sit" ] && is_module "sit" && modprobe -s sit + [ "${MODE}" = "four" ] && is_module "fourtun" && modprobe -s fourtun + ;; + ipip) + is_no "${IPV4_NETWORKING}" && exit 0 + is_module "ipip" && modprobe -s ipip + ;; + gre) + is_no "${IPV4_NETWORKING}" && exit 0 + is_module "ip_gre" && modprobe -s ip_gre + ;; + ipxip|ipipx) + is_no "${IPX}" && exit 0 + ;; +esac + +RESULT=0 +[ -z "${LOCALADDR}" ] && LOCALADDR=any +[ -z "${REMOTEADDR}" ] && REMOTEADDR=any +[ -n "${TTL}" ] && TTL="ttl ${TTL}" +[ -n "${TOS}" ] && TOS="tos ${TOS}" +[ -n "${BIND_DEV}" ] && BIND_DEV="dev ${BIND_DEV}" +[ -n "${PRIORITY}" ] && PRIORITY="priority ${PRIORITY}" +[ -n "${HOPLIMIT}" ] && HOPLIMIT="hoplimit ${HOPLIMIT}" +[ -n "${ENCAPLIMIT}" ] && ENCAPLIMIT="encaplimit ${ENCAPLIMIT}" + +if is_yes "${SEQ}"; then + SEQ=seq +else + is_yes "${ISEQ}" && SEQ=iseq + is_yes "${OSEQ}" && SEQ="${SEQ} oseq" +fi + +if is_yes "${CSUM}"; then + CSUM=csum +else + is_yes "${ICSUM}" && CSUM=icsum + is_yes "${ICSUM}" && CSUM="${SEQ} ocsum" +fi + +is_yes "${ISEQ}" && ISEQ=iseq + +[ -z "${PMTUDISC}" -a "${TTL}" != "0" -a "${TTL}" != "inherit" ] && PMTUDISC=yes + +if is_yes "${PMTUDISC}"; then + PMTUDISC=pmtudisc +elif is_no "${PMTUDISC}"; then + PMTUDISC=nopmtudisc +fi + +if [ -n "${KEY}" ]; then + IKEY="" + OKEY="" +fi + +case "${MODE}" in + ipip|sit) + ip tunnel add ${DEVICE} mode ${MODE} local ${LOCALADDR} \ + remote ${REMOTEADDR} ${TTL} ${TOS} ${PMTUDISC} ${BIND_DEV} + RESULT=$? + ;; + gre) + ip tunnel add ${DEVICE} mode ${MODE} local ${LOCALADDR} \ + remote ${REMOTEADDR} ${TTL} ${TOS} ${PMTUDISC} ${BIND_DEV} \ + ${CSUM} ${ISEQ} ${KEY} ${IKEY} ${OKEY} + RESULT=$? + ;; + fourtun) + fourcfg add ${DEVICE} saddr ${LOCALADDR} daddr ${REMOTEADDR} \ + ${PRIORITY} ${HOPLIMIT} ${ENCAPLIMIT} + RESULT=$? + ;; + ipxip|ipipx) + ;; +esac + +exit $RESULT diff --git a/make-tag.sh b/make-tag.sh new file mode 100755 index 0000000..2ad825d --- /dev/null +++ b/make-tag.sh @@ -0,0 +1,30 @@ +#!/bin/sh +set -e +rev=$(git rev-parse HEAD) +last_tag=$(git tag -l | grep '^0' | sort -V | tail -n1) + +if [ -n "$1" ]; then + tag="$1" +else + tag=$(awk -F, '/AC_INIT/{print $2}' configure.ac | tr -d '[ ]') +fi + +cat < +.TH crypttab 5 "Jul 2006" + +.SH NAME +/etc/crypttab - encrypted block device table + +.SH DESCRIPTION +The +.B /etc/crypptab +file describes encrypted block devices that are set up during system boot. + +Empty lines and lines starting with the +.B # +character are ignored. +Each of the remaining lines describes one encrypted block device, +fields on the line are delimited by white space. +The first two fields are mandatory, the remaining two are optional. + +The first field contains the +.I name +of the resulting encrypted block device; +the device is set up at +\fB/dev/mapper/\fIname\fR. + +The second field contains a path to the underlying block device. +If the block device contains a LUKS signature, +it is opened as a LUKS encrypted partition; +otherwise it is assumed to be a raw dm-crypt partition. + +The third field specifies the encryption password. +If the field is not present or the password is set to \fBnone\fR, +the password has to be manually entered during system boot. +Otherwise the field is interpreted as a path to a file +containing the encryption password. +For swap encryption +.B /dev/urandom +can be used as the password file; +using +.B /dev/random +may prevent boot completion +if the system does not have enough entropy +to generate a truly random encryption key. + +The fourth field, if present, is a comma-delimited list of options. +The following options are recognized: +.TP +\fBcipher=\fIcipher\fR +Specifies the cipher to use; see +.BR cryptsetup (8) +for possible values and the default value of this option. +A cipher with unpredictable IV values, such as +\fBaes-cbc-essiv:sha256\fR, is recommended. + +.TP +\fBsize=\fIsize\fR +Specifies the key size in bits; see +.BR cryptsetup (8) +for possible values and the default value of this option. + +.TP +\fBhash=\fIhash\fR +Specifies the hash to use for password hashing; see +.BR cryptsetup (8) +for possible values and the default value of this option. + +.TP +\fBverify\fR +If the the encryption password is read from console, +it has to be entered twice (to prevent typos). + +.TP +\fBswap\fR +The encrypted block device will be used as a swap partition, +and will be formatted as a swap partition +after setting up the encrypted block device. +The underlying block device +will be formatted again as an unencrypted swap partition +after destroying the encrypted block device. +(This allows sharing a single swap partition between operating +system installations, +with some of them encrypting the swap partitions and some of them not.) + +\fIWARNING\fR: Using the +.B swap +option will destroy the contents of the named partition during every boot, so +make sure the underlying block device is specified correctly. + +.TP +\fBtmp\fR +The encrypted block device will be prepared for using it as tmp partition: +it will be formatted using +.B mke2fs +and its root directory will be set to mode 01777. +The warning about the +.B swap +option applies here as well. + +.PP +No options can be specified for LUKS encrypted partitions. + +.SH COMPATIBILITY +The +.B /etc/crypptab +file format is based on the Debian cryptsetup package, +and is intended to be compatible. + +.SH SEE ALSO +.BR cryptsetup (8) diff --git a/man/de/Makefile.am b/man/de/Makefile.am new file mode 100644 index 0000000..e35be4d --- /dev/null +++ b/man/de/Makefile.am @@ -0,0 +1,8 @@ +@SET_MAKE@ + +mandir = @mandir@/de + +man_MANS = \ + start-stop-daemon.8 + +EXTRA_DIST = $(man_MANS) diff --git a/man/de/start-stop-daemon.8 b/man/de/start-stop-daemon.8 new file mode 100644 index 0000000..d913164 --- /dev/null +++ b/man/de/start-stop-daemon.8 @@ -0,0 +1,255 @@ +.TH START\-STOP\-DAEMON 8 "14. Mai 2004" "Debian-Projekt" "dpkg Werkzeuge" +.\" +.\" Translated into german by Helge Kreutzmann +.hw wei-tere +.SH NAME +start\-stop\-daemon \- startet und stoppt System-Daemon-Programme +.SH "ÜBERSICHT" +.B start-stop-daemon +.BR -S | --start +.IR Optionen +.RB [ \-\- ] +.IR Argumente +.HP +.B start-stop-daemon +.BR -K | --stop +.IR Optionen +.HP +.B start-stop-daemon +.BR -H | --help +.HP +.B start-stop-daemon +.BR -V | --version +.SH BESCHREIBUNG +.B start\-stop\-daemon +wird zur Kontrolle der Erzeugung und Beendigung von Prozessen auf +Systemebene verwendet. Durch die Verwendung der +.BR --exec ", " --pidfile ", " --user ", und " --name " Optionen" +kann +.B start\-stop\-daemon +so konfiguriert werden, daß er bereits existierende Instanzen von +einem laufenden Prozess finden kann. + +Mittels +.BR --start +überprüft +.B start\-stop\-daemon +auf die Existenz von speziellen Prozessen. +Falls ein solcher Prozess existiert, dann macht +.B start\-stop\-daemon +nichts, und beendet sich mit Fehlerstatus 1 +(0, falls +.BR --oknodo +angegeben wurde). +Falls ein solcher Prozess nicht existiert, dann +startet es eine Instanz, entweder unter Verwendung +des ausführbaren Programms, das mittels +.BR --exec +spezifiziert wurde (oder, falls angegeben, mittels +.BR --startas ). +Jedes weitere auf der Kommandozeile angegebene Argument nach +.BR -- +wird unverändert an das zu startende Programm weitergegeben. Falls +.B --retry +spezifiziert wurde, dann überprüft +.B start-stop-daemon +ob der Prozess (die Prozesse) beendet wurden. + +Mit +.BR --stop +überprüft +.B start\-stop\-daemon +auf auf die Existenz eines speziellen Prozesses. Falls ein +solcher Prozess existiert, dann sendet +.B start\-stop\-daemon +das durch +.BR --signal +spezifizierte Signal +und beendet sich mit Fehlerstatus 0. +Falls kein solcher Prozess existiert, dann +beendet sich +.B start\-stop\-daemon +mit Fehlerstatus 1 +(0 falls +.BR --oknodo +spezifiziert ist). + +.SH OPTIONEN + +.TP +\fB-x\fP|\fB--exec\fP \fIProgramm\fP +Überprüfe auf Prozesse die (laut +.BR /proc/\fIpid\fB/exe\fP ) +Instanzen von diesem Programm sind. +.TP +\fB-p\fP|\fB--pidfile\fP \fIpid-Datei\fP +Überprüfe auf Prozesse deren Prozess-ID in +.IR pid-Datei +angegeben ist. +.TP +\fB-u\fP|\fB--user\fP \fIBenutzername\fP|\fIuid\fP +Überprüfe auf Prozesse die dem mit +.I Benutzername +oder +.IR uid +spezifizierten Benutzer gehören. +.TP +\fB-g\fP|\fB--group\fP \fIGruppe\fP|\fIgid\fP +Wechsle zum Starten des Prozesses zur \fIGruppe\fP oder \fIgid\fP. +.TP +\fB-n\fP|\fB--name\fP \fIProzessname\fP +Überprüfe +(laut +.BR /proc/\fIpid\fB/stat\fP ) +auf Prozesse mit dem Namen +.IR Prozessname . +.TP +\fB-s\fP|\fB--signal\fP \fISignal\fP +Mit +.BR --stop +wird das an den zu beendenden Prozess zu sendende Signal spezifiziert +(standardmäßig 15). +.TP +\fB-R\fP|\fB--retry\fP \fItimeout\fP|\fIPlan\fP +Mit +.BR --stop +spezifiziert, das +.B start-stop-daemon +überprüfen soll, ob der Prozess (die Prozesse) sich beenden. Es +überprüft regelmäßig, ob ein passender Prozess läuft, bis dies +nicht mehr der Fall ist. Falls sich die Prozesse nicht +beenden werden weitere im »Plan« angegebene Aktionen durchgeführt. + +Falls +.I timeout +anstelle von +.I Plan +spezifiziert wird, dann wird der Plan +.IB signal / timeout /KILL/ timeout +verwendet, wobei +.I signal +das mit +.BR --signal +spezifizierte Signal ist. + +.I Plan +ist eine Liste von mindestens zwei durch Schrägstriche +.RB ( / ) +getrennten Punkten; jeder Punkt kann aus +.BI - Signalnummer +oder [\fB\-\fP]\fISignalname\fP bestehen, +was bedeutet, daß dieses Signal gesendet werden soll, oder +aus +.IR timeout +was bedeutet das soviele Sekunden auf das Beenden des +Prozesses gewartet werden soll, oder +.BR forever +was bedeutet, den Rest des Plans falls notwendig für immer +zu wiederholen. + +Falls das Ende des Plans erreicht wird und +.BR forever +nicht spezifiziert wurde, dann beendet sich der +.B start-stop-daemon +mit dem Fehlerstatus 2. +Falls ein Plan spezifiziert wurde dann wird jedes +mit +.B --signal +spezifizierte Signal ignoriert. +.TP +\fB-a\fP|\fB--startas\fP \fIPfadname\fP +Mit +.BR --start +wir der über +.IR Pfadname +spezifizierte Prozess gestartet. Falls nicht angegeben, +werden standardmäßig die an +.B --exec +übergebenen Argumente verwendet. +.TP +.BR -t | --test +Gibt die zu erledigenden Aktionen aus und setzt die entsprechenden +Rückgabewerte, führt aber keine Aktionen durch. +.TP +.BR -o | --oknodo +Liefert den Rückgabewert 0 anstatt 1 falls keine Aktionen ausgeführt wurden (würden). +.TP +.BR -q | --quiet +Gibt keine informationelle Meldungen aus, nur Fehlermeldungen werden angezeigt. +.TP +\fB-c\fP|\fB--chuid\fP \fIBenutzername\fR|\fIuid\fP +Wechselt vor dem Start des Prozesses zu diesem Benutzername/uid. Sie +können durch Anhängen von +.BR : +auch die Gruppe spezifizieren, in diesem Fall wird die Gruppe oder gid +wie bei dem »chown«-Befehl (\fIBenutzer\fP\fB:\fP\fIGruppe\fP) angegeben. +Wenn Sie diese Option verwenden, müssen Sie daran denken, daß die primäre +und zusätzlichen Gruppe auch gesetzt werden, selbst wenn die +.B --group +Option nicht spezifiziert wird. Die +.B --group +ist nur für Gruppen in denen der Benutzer normalerweise kein Mitglied +ist (wie das Hinzufügen von pro-Prozess Gruppenmitgliedschaften für +generische Nutzer wie +.BR nobody ). +.TP +\fB-r\fP|\fB--chroot\fP \fIWurzel\fP +Chdir und chroot vor dem Start des Prozesse zu +.IR Wurzel .# +Bitte beachten Sie das die PID-Datei auch nach dem chroot geschrieben +wird. +.TP +\fB-d\fP|\fB--chdir\fP \fIPfad\fP +Chdir vor dem Starten des Prozesses zu +.IR Pfad . +Dies wird, falls die \fB-r\fP|\fB--chroot\fP Option gesetzt ist, +nach dem chroot durchgeführt. +.TP +.BR -b | --background +Typischerweise verwendet für Programme die sich nicht selbständig +ablösen. Diese Option zwingt +.B start-stop-daemon +vor dem Start des Prozesses einen Fork durchzuführen, und ihn in +den Hintergrund zu zwingen. +.B WARNUNG: start-stop-daemon +kann nicht den Rückgabewert überprüfen, falls der Prozess aus +.B irgendeinem +Grund nicht startet. Dies ist ein letztes Mittel und ist nur für Programme +gedacht, bei denen das selbstständige Forken keinen Sinn macht oder wo es +nicht sinnvoll ist, den Code hierfür hinzuzufügen. +.TP +\fB-N\fP|\fB--nicelevel\fP \fIGanzzahl\fP +Dies ändert die Priorität des Prozesses bevor er gestartet wird. +.TP +.BR -m | --make-pidfile +Verwendet wenn ein Programm gestartet wird, dass keine eigene PID-Datei +erstellt. Diese Option sorgt dafür, dass +.B start-stop-daemon +die mit +.B --pidfile +referenzierte Datei anlegt und die PID kurz vor der Ausführung des Prozesse +hineinlegt. Beachten Sie, dass sie nicht entfernt wird wenn das Programm +beendet wird. +.B HINWEIS: +Diese Funktion könnte nicht in allen Fällen funktionieren. Insbesondere wenn +das auszuführende Programm sich vom Hauptprozess forkt. Deshalb ist diese +Option normalerweise nur in Kombination mit der +.B --background +Option sinnvoll. +.TP +.BR -v | --verbose +Gibt ausführliche informative Meldungen aus. +.TP +.BR -H | --help +Gibt Hilfeinformationen aus und beendet sich dann. +.TP +.BR -V | --version +Gibt Versionsinformationen aus und beendet sich dann. + +.SH AUTOREN +Marek Michalkiewicz basierend +auf einer vorherigen Version von +Ian Jackson . + +Handbuchseite von Klee Dienes , teilweise von Ian +Jackson umformatiert. diff --git a/man/doexec.1 b/man/doexec.1 new file mode 100644 index 0000000..59b8b91 --- /dev/null +++ b/man/doexec.1 @@ -0,0 +1,12 @@ +.TH DOEXEC 1 "Red Hat Software" "RHS" \" -*- nroff -*- +.SH NAME +doexec \- run an executable with an arbitrary argv[0] +.SH SYNOPSIS +.B doexec +\fI/path/to/executable\fP \fIargv[0]\fP [\fIargv[1-n]\fP] +.SH DESCRIPTION +.B doexec +simply runs the executable with the argv list provided. It allows you +to specify an argv[0] other than the name of the executable. +.SH OPTIONS +All options are passed in the argv list to the executable being run. diff --git a/man/es/Makefile.am b/man/es/Makefile.am new file mode 100644 index 0000000..6786f69 --- /dev/null +++ b/man/es/Makefile.am @@ -0,0 +1,8 @@ +@SET_MAKE@ + +mandir = @mandir@/es + +man_MANS = \ + start-stop-daemon.8 + +EXTRA_DIST = $(man_MANS) diff --git a/man/es/start-stop-daemon.8 b/man/es/start-stop-daemon.8 new file mode 100644 index 0000000..0bb522b --- /dev/null +++ b/man/es/start-stop-daemon.8 @@ -0,0 +1,245 @@ +.\" Hey, Emacs! This is an -*- nroff -*- source file. +.\" (c) 2003 Software in the Public Interest +.\" Traductor: Rubén Porras Campo y revisada +.\" por Santiago Vila +.\" Basado en la versión 1.3 de +.\" /cvs/debian-doc/manpages/english/dpkg/start-stop-daemon.8 + +.TH START\-STOP\-DAEMON 8 "15 de marzo de 1997" "Proyecto Debian" "Debian GNU/Linux" +.SH NOMBRE +start\-stop\-daemon \- para y arranca demonios del sistema +.SH SINOPSIS +.B start-stop-daemon +.BR -S | --start +.IR opciones +.RB [ \-\- ] +.IR argumentos +.HP +.B start-stop-daemon +.BR -K | --stop +.IR opciones +.HP +.B start-stop-daemon +.BR -H | --help +.HP +.B start-stop-daemon +.BR -V | --version +.SH DESCRIPCIÓN +.B start\-stop\-daemon +se usa para controlar la creación y terminación de los procesos del sistema. +Usando las opciones +.BR --exec ", " --pidfile ", " --user ", y " --name " opciones," +.B start\-stop\-daemon +se puede configurar para encontrar distintos procesos del mismo demonio. + +Con +.BR --start , +.B start\-stop\-daemon +comprueba la existencia del proceso especificado. +Si este proceso ya existe, +.B start\-stop\-daemon +no hace nada, y termina con un estado de error 1 (0 si se especifica +.BR --oknodo +). +Si el proceso no existe, comienza uno nuevo, +usando el ejecutable especificado por +.BR --exec , +(o, si se especifica, por +.BR --startas +). +Cualquier argumento dado en la línea de ordenes después de +.BR -- +se pasa sin modificación alguna al programa que se va a ejecutar. Si se +especifica la opción +.B --retry +entonces +.B start-stop-daemon +comprobará que el proceso o los procesos han terminado. + +Con +.BR --stop , +.B start\-stop\-daemon +comprueba además la existencia del proceso especificado. +Si este proceso existe, +.B start\-stop\-daemon +envía la señal especificada por +.BR --signal , +y termina con un estado de error 0. +Si este proceso no existe, +.B start\-stop\-daemon +termina con un estado de error 1 (0 si se ha especificado la opción +.BR --oknodo +). + +.SH OPCIONES + +.TP +\fB-x\fP|\fB--exec\fP \fIejecutable\fP +Busca distintos procesos de este ejecutable (según +.B /proc/\fIpid\fB/exe\fP +). +.TP +\fB-p\fP|\fB--pidfile\fP \fIfichero-de-pid\fP +Comprueba si existen los procesos cuyo id corresponde con el +especificado en +.IR fichero-de-pid . +.TP +\fB-u\fP|\fB--user\fP \fInombre-usuario\fP|\fIuid\fP +Comprueba si existen los procesos del usuario especificado por +.I nombre-usuario +o +.IR uid . +.TP +\fB-g\fP|\fB--group\fP \fIgrupo\fP|\fIgid\fP +Cambia a \fIgrupo\fP o \fIgid\fP cuando comienza el proceso. +.TP +\fB-n\fP|\fB--name\fP \fInombre-proceso\fP +Comprueba los procesos con el nombre +.I nombre-proceso +(según +.BR /proc/\fIpid\fB/stat\fP ). +.TP +\fB-s\fP|\fB--signal\fP \fIseñal\fP +Junto con +.BR --stop , +especifica la señal enviada al proceso que se desea parar (15 por omisión). +.TP +\fB-R\fP|\fB--retry\fP \fItiempo-de-espera\fP|\fIacción-programada\fP +Junto con +.BR --stop , +especifica que +.B start-stop-daemon +compruebe que el proceso o los procesos han terminado. Lo comprobará +repetidas veces hasta que no haya ningún proceso que coincida. Si el proceso +no termina tomará una decisión determinada por +.I acción-programada . + +Si se especifica +.I tiempo-de-espera +en vez de +.I acción-programada +entonces se usa la secuencia +.IB señal / tiempo-de-espera /KILL/ tiempo-de-espera +, donde +.I señal +es la señal especificada por +.BR --signal . + +.I acción-programada +es una lista de al menos dos artículos separados por barras +.RB ( / ); +cada artículo puede ser un +.BI - número de señal +o [\fB\-\fP]\fInombre de señal\fP, +que significa que se debe mandar esa señal, o +.IR tiempo-de-espera, +que significa que se debe esperar esos segundos para que el programa +termine, o +.BR forever , +que significa que se repite el resto de acción-programada para siempre +si es necesario. + +Si se alcanza el final de la acción-programada y no se ha especificado +.BR forever +, entonces +.B start-stop-daemon +termina con un estado de error 2. +Si se especifica una secuencia, entonces cualquier señal especificada +con +.B --signal +no se tendrá en cuenta. +.TP +\fB-a\fP|\fB--startas\fP \fIpathname\fP +Con +.BR --start , +comienza el proceso especificado por +.IR pathname . +Si no se especifica, se usarán los argumentos dados con +.BR --exec . +.TP +.BR -t | --test +Muestra las acciones que se realizarían y devuelve el valor +apropiado, pero no hace nada. +.TP +.BR -o | --oknodo +Devuelve un estado 0 en vez de 1 si no se realiza (realizasen) +ninguna acción. +.TP +.BR -q | --quiet +No muestra mensajes informativos, sólo muestra mensajes de error. +.TP +\fB-c\fP|\fB--chuid\fP \fInombre-usuario\fR|\fIuid\fP +Cambia a este usuario/uid antes de empezar el proceso. Además puede +especificar el grupo añadiendo +.BR : , +luego el grupo o el gid del mismo modo que haría con la orden +`chown' (\fIusuario\fP\fB:\fP\fIgrupo\fP). +Debe de darse cuenta que cuando se usa esta opción el grupo primario +y complementario se cambian también, incluso si no se especifica +.B --group . +La opción +.B --group +es sólo para grupos de los que el usuario no es miembro (como el grupo +nobody ). +.TP +\fB-r\fP|\fB--chroot\fP \fIdirectorio-raíz +Efectua chdir y chroot a +.I directorio-raíz +antes de empezar el proceso. Dese cuenta que el fichero del pid +también es escrito después de hacer el chroot. +.TP +\fB-d\fP|\fB--chdir\fP \fIdirectorio\fP +Efectua chdir a +.I directorio +antes de empezar el proceso. Esto se hace después de efectuar chroot, si es que +la opción +\fB-r\fP|\fB--chroot\fP está establecida. +.TP +.BR -b | --background +Usado típicamente con programas que no se separan por sí mismos. Esta +opción forzará +.B start-stop-daemon +a hacer fork antes de empezar el proceso, y luego dejarlo en segundo plano. +.B ATENCIÓN: start-stop-daemon +no puede comprobar el estado de salida si el proceso no puede ejecutarse +por +.B cualquier +razón. Esto se hace como último recurso, y sólo tiene sentido usarla en +programas donde no tiene sentido que hagan fork por sí mismos, o no es +factible añadir el código para que lo hagan por sí mismos. +.TP +\fB-N\fP|\fB--nicelevel\fP \fIentero\fP +Altera la prioridad del proceso antes de empezarlo. +.TP +.BR -m | --make-pidfile +Se usa cuando se quiere comenzar un programa que no crea su propio +fichero de pid. Esta opción hace que +.B start-stop-daemon +cree el fichero referido con +.B --pidfile +y coloque el pid dentro de él justo antes de ejecutar el +proceso. Dese cuenta que no se borrará cuando termine el programa. +.B NOTA: +Esta característica no funciona en todos los casos. Más notablemente +cuando el programa que se ejecuta hace fork en su proceso principal. +Por esto solamente es útil cuando se combina con la opción +.B --background . +.TP +.BR -v | --verbose +Muestra mensajes informativos detallados. +.TP +.BR -H | --help +Muestra la ayuda y luego termina. +.TP +.BR -V | --version +Muestra la versión y luego termina. + +.SH AUTORES +Marek Michalkiewicz basada en una +versión previa de Ian Jackson . + +Página del manual de Klee Dienes , reformada +parcialmente por Ian Jackson. + +Traducida por Rubén Porras +Revisada por Santiago Vila diff --git a/man/fr/Makefile.am b/man/fr/Makefile.am new file mode 100644 index 0000000..4c40260 --- /dev/null +++ b/man/fr/Makefile.am @@ -0,0 +1,8 @@ +@SET_MAKE@ + +mandir = @mandir@/fr + +man_MANS = \ + start-stop-daemon.8 + +EXTRA_DIST = $(man_MANS) diff --git a/man/fr/start-stop-daemon.8 b/man/fr/start-stop-daemon.8 new file mode 100644 index 0000000..16332a3 --- /dev/null +++ b/man/fr/start-stop-daemon.8 @@ -0,0 +1,234 @@ +.TH START\-STOP\-DAEMON 8 "15th March 1997" "Debian Project" "Debian GNU/Linux" +.\" traduction de la version cvs 1.15 +.SH NOM +start\-stop\-daemon \- lance ou arrête des démons-systèmes +.SH SYNOPSIS +.B start-stop-daemon +.BR -S |--start +.IR options +.RB [ \-\- ] +.IR arguments +.HP +.B start-stop-daemon +.BR -K | --stop +.IR options +.HP +.B start-stop-daemon +.BR -H | --help +.HP +.B start-stop-daemon +.BR -V | --version +.SH DESCRIPTION +On se sert de +.B start\-stop\-daemon +pour contrôler la création ou l'arrêt de processus-système. +On peut configurer +.B start\-stop\-daemon +avec les options +.BR --exec ", " --pidfile ", " --user ", et " --name +pour trouver les exemplaires présents d'un processus en fonctionnement. + +Avec l'action +.BR --start, +.B start\-stop\-daemon +vérifie l'existence d'un processus particulier. +Quand existe un tel processus, +.B start\-stop\-daemon +ne fait rien et se termine avec un code d'erreur égal à 1 (0 si +.BR --oknodo +est précisé). +Quand un tel processus n'existe pas, un exemplaire de l'exécutable est lancé +avec +.BR --exec, +(ou, si c'est précisé, avec +.BR --startas). +Tout argument donné après +.BR -- +sur la ligne de commande est passé tel quel au programme qui doit être lancé. +Si +.B --retry +est indiqué, +.B start\-stop\-daemon +vérifie que le (ou les) processus s'est terminé. + +Avec l'action +.BR --stop, +.B start\-stop\-daemon +vérifie aussi l'existence d'un processus particulier. +Quand un tel processus existe +.B start\-stop\-daemon +lui envoie le signal précisé avec +.BR --signal, +et se termine avec un code d'erreur égal à 0. +Quand un tel processus n'existe pas +.B start\-stop\-daemon +se termine avec un code d'erreur égal à 1 +(0 if +.BR --oknodo +est précisé). + +.SH OPTIONS + +.TP +\fB-x\fP|\fB--exec\fP \fIexécutable\fP +Cherche les processus qui sont des exemplaires de cet exécutable (selon +.B /proc/\fIpid\fB/exe\fP). +.TP +\fB-p\fP|\fB--pidfile\fP \fIpid-file\fP +Cherche les processus dont les identifiants sont précisés dans +.IR pid-file. +.TP +\fB-u\fP|\fB--user\fP \fInom-d-utilisateur\fP|\fIuid\fP +Cherche les processus qui appartiennent à l'utilisateur défini par +.I nom-d-utilisateur +ou +.IR uid. +.TP +\fB-g\fP|\fB--group\fP \fIgroup\fP|\fIgid\fP +Modifie le \fIgroup\fP ou le \fIgid\fP au début du processus. +.TP +\fB-n\fP|\fB--name\fP \fInom-de-processus\fP +Cherche les processus dont le nom est +.I nom-de-processus +(selon +.B /proc/\fIpid\fB/stat\fP). +.TP +\fB-s\fP|\fB--signal\fP \fIsignal\fP +Avec l'action +.BR --stop, +on définit le signal à envoyer au processus qui doit être arrêté +(par défaut : signal 15). +.TP +\fB-R\fP|\fB--retry\fP \fIdurée\fP|\fIaction-prévue\fP +Avec l'action +.BR --stop, +.B start-stop-daemon +doit vérifier que les processus se sont terminés. Il le fait pour tous les +processus correspondants qui tournent, jusqu'à ce qu'il n'y en ait plus. +Quand le processus ne se termine pas, il prend d'autres mesures déterminées +par l'action-prévue. + +Si +.I durée +est indiqué plutôt que +.I action-prévue, +l'action-prévue +.IB signal / durée /KILL/ durée +est utilisé, où +.I signal +est le signal indiqué par +.BR --signal. + +.I action-prévue +est une liste d'au moins deux items séparés par des barres obliques +.RB ( / )\ ; +Chaque item peut être de la forme +.BI - signal-number +ou de la forme [\fB\-\fP]\fIsignal-name\fP, +ce qui demande d'envoyer ce signal\ ; +ou bien de la forme +.IR durée, +ce qui demande d'attendre tant de secondes avant de terminer les processus, +ou bien de la forme +.BR forever , +ce qui demande de répéter constamment le reste de action-prévue, si nécessaire. + +Quand la fin de l'action-prévue est atteinte et que +.BR forever +n'a pa été précisé, +.B start-stop-daemon +se termine avec un code d'erreur égal à 2. +Quand une action-prévue est indiquée, tout signal donné par +.B --signal +est ignoré. +.TP +.I -a | --startas chemin/nom +Avec l'action +.B --start +, lance le processus spécifié par +.I chemin/nom. +Si rien n'est précisé, c'est par défaut l'argument donné à +.B --exec. +.TP +.I -t | --test +Affiche les actions qui seraient entreprises et détermine la bonne valeur de +retour, mais ne fait rien. +.TP +.I -o | --oknodo +Retourne un code de sortie égal à 0 au lieu de 1 si rien n'est ou ne sera fait. +.TP +.I -q | --quiet +N'affiche pas de messages d'information ; affiche seulement les messages +d'erreur. +.TP +.I -c | --chuid +Change l'utilisateur ou l'identifiant avant de lancer le processus. +On peut aussi préciser un groupe an ajoutant un « : », puis le groupe ou un +identifiant de la même façon qu'avec la commande « chown » +(utilisateur:groupe). Quand on utilise cette option, on doit s'apercevoir +que les groupes primaires ainsi que les groupes supplémentaires sont aussi +déterminés, même si l'option « group » n'est pas spécifiée. L'option « group » +sert seulement pour les groupes dont l'utilisateur n'est pas un membre régulier +(c'est comme rendre membres d'un groupe-processus des utilisateurs +génériques comme « nobody »). +.TP +.I -r | --chroot root +Change de répertoire racine pour +.B root +avant de lancer le processus. Remarquez que le « pidfile » est aussi écrit +après le changement de racine. +.TP +\fB-d\fP|\fB--chdir\fP \fIpath\fP +Change de répertoire pour +.I chemin +avant de commencer le processus. Cela est fait avant le changement de +répertoire racine si l'option \fB-r\fP|\fB--chroot\fP est demandée. ++.TP +.I -b | --background +est utilisé de manière classique pour les programmes qui ne « se détachent » +pas d'eux-mêmes. Cette option oblige +.B start-stop-daemon +à se dupliquer (fork) avant de lancer le processus, et l'oblige à passer en +arrière-plan. +.B AVERTISSEMENT : +start-stop-daemon +ne peut pas vérifier le code de sortie quand, pour +.B une raison ou une autre, +le processus échoue. +C'est un expédient dont on se servira seulement pour des programmes dont la +duplication n'a pas de sens ou bien des programmes dont le code +n'est pas transformable pour leur ajouter cette fonctionnalité. +.TP +\fB-N\fP|\fB--nicelevel\fP \fIint\fP. +Cela modifie la priorité du processus avant qu'il ne soit lancé. +.TP +.I -m | --make-pidfile +Est utilisé lors du lancement d'un programme qui ne crée pas son propre +fichier identificateur. Cette option dit à +.B start-stop-daemon +de créer le fichier référencé par +.B --pidfile +et place le « pid » dans ce fichier juste avant d'exécuter le processus. +Il faut remarquer que ce fichier n'est pas supprimé quand le programme +s'arrête. +.B NOTE : +il se peut que cette caractéristique ne marche pas dans tous les cas. Et +notamment quand le programme qui est exécuté se duplique. À cause de cela, +cette option n'est habituellement utile que combinée avec l'option +.B --background. +.TP +.I -v | --verbose +Affiche des messages prolixes de renseignements. +.TP +.I -H | --help +Affiche une aide et se termine. +.TP +.I -V | --version +Affiche le numéro de version et se termine. + +.SH AUTEURS +Ian Jackson +Marek Michalkiewicz +Page de manuel par Klee Dienes . +.SH TRADUCTION +Philippe Batailler , Octobre 2003. \ No newline at end of file diff --git a/man/genhostid.1 b/man/genhostid.1 new file mode 100644 index 0000000..436d953 --- /dev/null +++ b/man/genhostid.1 @@ -0,0 +1,12 @@ +.TH GENHOSTID 1 +.SH NAME +genhostid \- generate and set a hostid for the current host +.SH SYNOPSIS +.B genhostid + +.SH DESCRIPTION +\fBgenhostid\fR generates a random hostid and stores it in /etc/hostid, +if /etc/hostid does not already exist. + +.SH "SEE ALSO" +hostid(1), gethostid(2), sethostid(2) diff --git a/man/getkey.1 b/man/getkey.1 new file mode 100644 index 0000000..f6c1161 --- /dev/null +++ b/man/getkey.1 @@ -0,0 +1,80 @@ +.\" A man page for getkey(1). -*- nroff -*- +.\" +.\" Copyright (C) 2006 Red Hat, Inc. All rights reserved. +.\" +.\" This copyrighted material is made available to anyone wishing to use, +.\" modify, copy, or redistribute it subject to the terms and conditions of the +.\" GNU General Public License v.2. +.\" +.\" This program 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 program; if not, write to the Free Software Foundation, Inc., +.\" 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +.\" +.\" Author: Miloslav Trmac +.TH getkey 1 "Jan 2006" + +.SH NAME +getkey \- wait until a key is pressed + +.SH SYNOPSIS +\fBgetkey\fR [\fIOPTION\fR]... [\fIKEYS\fR] + +.SH DESCRIPTION +.B getkey +waits until one of +.I KEYS +is pressed. +If +.I KEYS +are not specified, any key is accepted. +.I KEYS +are matched case-insensitive. + +.SH EXIT STATUS +.B getkey +exits with status 0 if one of the expected keys is pressed. +If invalid arguments are specified, +.B getkey +exits with status 255. +If +.B getkey +is interrupted or the wait times out, +.B getkey +exits with other non-zero status. + +.SH OPTIONS +.TP +\fB\-c\fR, \fB\-\-wait\fR \fISECONDS\fR +Wait only for +.I SECONDS +seconds. +The default is 0, which means to wait without a time limit. + +.TP +\fB\-i\fR, \fB\-\-ignore\-control\-chars\fR +Don't treat Ctrl+C and Ctrl+D specially. +When this option is not specified, these characters interrupt \fBgetkey\fR. + +.TP +\fB\-m\fR, \fB\-\-message\fR \fIMESSAGE\fR +Display +.I MESSAGE +while waiting. +The message is used as a format string in +.BR sprintf (3), +with a single argument, the number of seconds left. +Typical usage is therefore +\fB"Press a key within %d seconds to ..."\fR. +If +.I MESSAGE +contains other format string directives, the behavior is undefined and +.B getkey +may crash. + +If there is no time limit specified, +the number of seconds left is reported as 0. diff --git a/man/initlog.1 b/man/initlog.1 new file mode 100644 index 0000000..1eb0587 --- /dev/null +++ b/man/initlog.1 @@ -0,0 +1,84 @@ +.TH initlog 8 "Sun Jan 24 1999" +.SH NAME +initlog \- log messages and events to the system logger +.SH SYNOPSIS +.B initlog +[\-cefnpqrs] [\-\-cmd=ARG] [\-\-event=ARG] [\-\-facility=ARG] +[\-\-name=ARG] [\-\-priority=ARG] [\-\-run=ARG] [\-\-string=ARG] +.SH DESCRIPTION +\fBinitlog\fR logs messages and events to the system logger. +It is mainly designed for use in init scripts. initlog +reads a configuration file +.I /etc/initlog.conf +by default, to determine its settings. Any line preceded with a +.I # +is a comment, and the following configuration directives +are recognized: +.TP +.I facility +Sets the default logging facility +.TP +.I priority +Sets the default logging priority +.TP +.I ignore +Messages that match the regular expression will not be logged. +.TP +initlog behavior can also be configured by command-line options. + +.SS OPTIONS +.TP +.I "\-c, \-\-cmd=[program]" +Execute the specified program, logging anything output to +stdout or stderr. +.TP +.I "\-e, \-\-event=[number]" +Logs that the specified event happened. Used in conjuction +with \fB\-\-name\fR. Currently specified events are: +.PD 0 +.RS 8n +.TP 3n +.B 1 +the action completed successfully +.TP +.B 2 +the action failed +.TP +.B 3 +the action was cancelled at user request +.TP +.B 4 +the action failed due to the failure of a dependent action +.RE +.PD +.TP +.I "\-f, \-\-facility=[facility]" +Log at the specified syslog facility. The default +is \fBdaemon\fR (see syslog(3)). +.TP +.I "\-n, \-\-name=[string]" +Log the event under the specified string, such as +"inetd". +.TP +.I "\-p, \-\-priority=[priority]" +Log at the specified syslog priority. The default +is \fBnotice\fR (see syslog(3)). +.TP +.I "\-q" +Do not print the program's output, unless it exits +with a non-zero exit code. +.TP +.I "\-r, \-\-run=[program]" +Execute the specified program, with an open file +descriptor so that the program can pass back +commands to initlog. +.TP +.I "\-s, \-\-string=[string]" +Log the specified string to the logger. +.TP +.I "\-\-conf=[file]" +Specifies an alternate configuration file. +.SH FILES +.I /etc/initlog.conf +.SH "SEE ALSO" +syslog(3), logger(1) diff --git a/man/ipcalc.1 b/man/ipcalc.1 new file mode 100644 index 0000000..fd9b212 --- /dev/null +++ b/man/ipcalc.1 @@ -0,0 +1,58 @@ +.TH IPCALC 1 "April 30 2001" "Red Hat, Inc." RH \" -*- nroff -*- +.SH NAME +ipcalc \- perform simple manipulation of IP addresses +.SH SYNOPSIS +.B ipcalc +[\fIOPTION\fR]... <\fBIP address\fR>[\fI/prefix\fR] [\fInetmask\fR] + +.SH DESCRIPTION +\fBipcalc\fR provides a simple way to calculate IP information for a host. +The various options specify what information \fBipcalc\fR should display +on standard out. Multiple options may be specified. An IP address to +operate on must always be specified. Most operations also require a +netmask or a CIDR prefix as well. + +.SH OPTIONS +.TP +.TP +\fB\-b\fR, \fB\-\-broadcast\fR +Display the broadcast address for the given IP address and netmask. + +.TP +\fB\-h\fR, \fB\-\-hostname\fR +Display the hostname for the given IP address. + +.TP +\fB\-m\fR, \fB\-\-netmask\fR +Calculate the netmask for the given IP address. It assumes that the IP +address is in a complete class A, B, or C network. Many networks do +not use the default netmasks, in which case an inappropriate value will +be returned. + +.TP +\fB\-p\fR, \fB\-\-prefix\fR +Show the prefix for the given mask/IP address. + +.TP +\fB\-n\fR, \fB\-\-network\fR +Display the network address for the given IP address and netmask. + +.TP +\fB\-s\fR, \fB\-\-silent\fR +Don't ever display error messages. + +.SH AUTHORS +.nf +Erik Troan +.nf +Preston Brown +.fi +.SH "REPORTING BUGS" +Report bugs to our bugtracking system: +http://bugzilla.redhat.com/bugzilla. +.SH COPYRIGHT +Copyright \(co 1997-2001 Red Hat, Inc. +.br +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. diff --git a/man/ja/Makefile.am b/man/ja/Makefile.am new file mode 100644 index 0000000..d6039bc --- /dev/null +++ b/man/ja/Makefile.am @@ -0,0 +1,8 @@ +@SET_MAKE@ + +mandir = @mandir@/ja + +man_MANS = \ + start-stop-daemon.8 + +EXTRA_DIST = $(man_MANS) diff --git a/man/ja/start-stop-daemon.8 b/man/ja/start-stop-daemon.8 new file mode 100644 index 0000000..1b08cd3 --- /dev/null +++ b/man/ja/start-stop-daemon.8 @@ -0,0 +1,257 @@ +.\"original revision: 1.15.2.2 +.\" +.\" Translated Wed May 13 17:28:56 JST 1998 +.\" by Hidenobu NABETANI +.\" Last modified: Tue Nov 11 14:24:54 JST 2003 +.\" +.\" WORD: infomational message »²¹Í¾ðÊó +.\" WORD: instance ¥¤¥ó¥¹¥¿¥ó¥¹ +.\" +.TH START\-STOP\-DAEMON 8 "15th March 1997" "Debian Project" "dpkg utilities" +.SH ̾Á° +start\-stop\-daemon \- ¥·¥¹¥Æ¥à¥Ç¡¼¥â¥ó¥×¥í¥°¥é¥à¤Îµ¯Æ°¡¢Ää»ß +.SH ½ñ¼° +.B start-stop-daemon +.BR -S | --start +.IR options +.RB [ \-\- ] +.IR arguments +.HP +.B start-stop-daemon +.BR -K | --stop +.IR options +.HP +.B start-stop-daemon +.BR -H | --help +.HP +.B start-stop-daemon +.BR -V | --version +.SH ÀâÌÀ +.B start\-stop\-daemon +¤Ï¥·¥¹¥Æ¥à¥ì¥Ù¥ë¤Î¥×¥í¥»¥¹¤ÎÀ¸À®¤äÄä»ß¤òÀ©¸æ¤¹¤ë¤¿¤á¤Ë»ÈÍѤµ¤ì¤ë¡£ +¤Þ¤¿¡¢ +.BR --exec ", " --pidfile ", " --user ", " --name +¥ª¥×¥·¥ç¥ó¤ò»ØÄꤹ¤ë¤³¤È¤Ç¡¢¼Â¹ÔÃæ¤Î¥×¥í¥»¥¹¤ò¸«¤Ä¤±¤ë¤³¤È¤¬¤Ç¤­¤ë¡£ + +.BR --start +¤ò»ÈÍѤ¹¤ë¤È¡¢ +.B start\-stop\-daemon +¤Ï»ØÄꤵ¤ì¤¿¥×¥í¥»¥¹¤¬Â¸ºß¤¹¤ë¤«¤òÄ´¤Ù¤ë¡£ +³ºÅö¤¹¤ë¥×¥í¥»¥¹¤¬Â¸ºß¤¹¤ë¾ì¹ç¡¢ +.B start\-stop\-daemon +¤Ï²¿¤â¤»¤º¡¢¥¨¥é¡¼¥¹¥Æ¡¼¥¿¥¹ 1 ¤òÊÖ¤·¤Æ½ªÎ»¤¹¤ë( +.BR --oknodo +¤¬»ØÄꤵ¤ì¤¿¾ì¹ç¤Ï¡¢0 ¤òÊÖ¤¹)¡£³ºÅö¤¹¤ë¥×¥í¥»¥¹¤¬Â¸ºß¤·¤Ê¤¤¾ì¹ç¡¢ +.BR --exec +¤Ë¤è¤ê(Ëô¤Ï¡¢ +.BR --startas +¤¬»ØÄꤵ¤ì¤¿¾ì¹ç¤Ï¤³¤ì¤Ë¤è¤ê +)»ØÄꤵ¤ì¤ë¼Â¹Ô¥Õ¥¡¥¤¥ë¤òµ¯Æ°¤¹¤ë¡£ +¥³¥Þ¥ó¥É¥é¥¤¥ó¾å¤Ç +.BR -- +°Ê¹ß¤ËÍ¿¤¨¤é¤ì¤¿Ç¤°Õ¤Î°ú¿ô¤Ïµ¯Æ°¤µ¤ì¤ë¥×¥í¥°¥é¥à¤Ë¤½¤Î¤Þ¤Þ°ú¤­ +ÅϤµ¤ì¤ë¡£¤â¤· +.B --retry +¤¬»ØÄꤵ¤ì¤¿¾ì¹ç¡¢ +.B start-stop-daemon +¤Ï¤½¤Î¥×¥í¥»¥¹¤¬½ªÎ»¤·¤¿¤«¤É¤¦¤«¤ò +³Îǧ¤¹¤ë¡£ + +.BR --stop +¤ò»ÈÍѤ¹¤ë¤È¡¢ +.B start\-stop\-daemon +¤Ï»ØÄꤵ¤ì¤¿¥×¥í¥»¥¹¤¬Â¸ºß¤¹¤ë¤«¤òÄ´¤Ù¤ë¡£³ºÅö¤¹¤ë¥×¥í¥»¥¹¤¬Â¸ºß¤¹ +¤ë¾ì¹ç¡¢ +.B start\-stop\-daemon +¤Ï +.BR --signal +¤Ë¤è¤ê»ØÄꤵ¤ì¤¿¥·¥°¥Ê¥ë¤ò¤½¤Î¥×¥í¥»¥¹¤ËÁ÷¤ê¡¢¥¨¥é¡¼¥¹¥Æ¡¼¥¿¥¹ 0 +¤òÊÖ¤·¤Æ½ªÎ»¤¹¤ë¡£³ºÅö¤¹¤ë¥×¥í¥»¥¹¤¬Â¸ºß¤·¤Ê¤¤¾ì¹ç¡¢ +.B start\-stop\-daemon +¤Ï¥¨¥é¡¼¥¹¥Æ¡¼¥¿¥¹ 1 ¤òÊÖ¤·¤Æ½ªÎ»¤¹¤ë( +.BR --oknodo +¤¬»ØÄꤵ¤ì¤¿¾ì¹ç¤Ï 0 ¤òÊÖ¤¹)¡£ + +.SH ¥ª¥×¥·¥ç¥ó + +.TP +\fB-x\fP|\fB--exec\fP \fIexecutable\fP +( +.B /proc/\fIpid\fB/exe\fP +¤Ë¤è¤ê)»ØÄꤵ¤ì¤¿ executable ¤Î¥×¥í¥»¥¹¤òÄ´¤Ù¤ë¡£ +.TP +\fB-p\fP|\fB--pidfile\fP \fIpid-file\fP +.IR pid-file +¤Ç»ØÄꤵ¤ì¤ë¥×¥í¥»¥¹ ID ¤ò»ý¤Ä¥×¥í¥»¥¹¤òÄ´¤Ù¤ë¡£ +.TP +\fB-u\fP|\fB--user\fP \fIusername\fP|\fIuid\fP +.I username +¤Þ¤¿¤Ï +.I uid +¤Ç»ØÄꤵ¤ì¤ë¥æ¡¼¥¶¤¬½êÍ­¤¹¤ë¥×¥í¥»¥¹¤òÄ´¤Ù¤ë¡£ +.TP +\fB-g\fP|\fB--group\fP \fIgroup\fP|\fIgid\fP +¥×¥í¥»¥¹¤ò³«»Ï¤¹¤ë»þÅÀ¤Ç¡¢\fIgroup\fP ¤ä \fIgid\fP ¤òÊѹ¹¤¹¤ë¡£ +.TP +\fB-n\fP|\fB--name\fP \fIprocess-name\fP +( +.BR /proc/\fIpid\fB/stat\fP +¤Ë¤è¤ê) +.I process-name +¤È¤¤¤¦Ì¾¤Î¥×¥í¥»¥¹¤òÄ´¤Ù¤ë¡£ +.TP +\fB-s\fP|\fB--signal\fP \fIsignal\fP +.BR --stop +¤¬Æ±»þ¤ËÍ¿¤¨¤é¤ì¤¿»þ¡¢¥×¥í¥»¥¹¤òÄä»ß¤¹¤ë¤¿¤á¤ËÁ÷¤ë¥·¥°¥Ê¥ë¤ò»ØÄꤹ¤ë +(¥Ç¥Õ¥©¥ë¥È¤Ï 15)¡£ +.TP +\fB-R\fP|\fB--retry\fP \fItimeout\fP|\fIschedule\fP +Ʊ»þ¤Ë +.BR --stop +¤¬Í¿¤¨¤é¤ì¤ë¤È +.B start-stop-daemon +¤Ï¤É¤Î¥×¥í¥»¥¹¤ò½ªÎ»¤µ¤»¤ë¤«¤ò³Îǧ¤¹¤ë¡£ +¥Þ¥Ã¥Á¤·¤¿¼Â¹ÔÃæ¤Î¥×¥í¥»¥¹¤¬Á´¤Æ½ªÎ»¤¹¤ë¤Þ¤Ç·«¤êÊÖ¤·³Îǧ¤¹¤ë¡£ +¤â¤·¥×¥í¥»¥¹¤¬½ªÎ»¤·¤Ê¤±¤ì¤Ð¡¢ +.I schedule +¤Ë¤è¤ê·èÄꤵ¤ì¤ë +Ê̤Υ¢¥¯¥·¥ç¥ó¤¬¼Â¹Ô¤µ¤ì¤ë¡£ +¤â¤· +.I timeout +¤¬ +.I schedule +¤Î¤«¤ï¤ê¤Ë»ØÄꤵ¤ì¤Æ¤¤¤ë¤È¡¢ +.IB signal / timeout /KILL/ timeout +¤¬»È¤ï¤ì¤ë¡£¤³¤³¤Ç +.I signal +¤Ï +.BR --signal +¤Ç»ØÄꤵ¤ì¤ë¥·¥°¥Ê¥ë¤Ç¤¢¤ë¡£ + +.I schedule +¤Ï¥¹¥é¥Ã¥·¥å +.RB ( / ) +¤Ç¶èÀÚ¤é¤ì¤¿¾¯¤Ê¤¯¤È¤â2¤Ä¤ÎÍ×ÁǤ«¤é¤Ê¤ë¥ê¥¹¥È¤Ç¤¢¤ë¡£ +¤½¤ì¤¾¤ì¤ÎÍ×ÁÇ¤Ï +.BI - signal-number +¤â¤·¤¯¤Ï [\fB\-\fP]\fIsignal-name\fP +¤Î¾ì¹ç¤ÏÁ÷¤ë¤Ù¤­¥·¥°¥Ê¥ë¡¢ +.IR timeout +¤Î¾ì¹ç¤Ï¥×¥í¥»¥¹¤¬½ªÎ»¤¹¤ë¤Î¤òÂÔ¤ÄÉÿô¡¢ +.BR forever +¤Î¾ì¹ç¤Ï¤â¤·É¬Íפʤé»Ä¤ê¤Î +.I schedule +¤ò·«¤êÊÖ¤·Å¬ÍѤ¹¤ë¤³¤È¤ò°ÕÌ£¤¹¤ë¡£ + +¤â¤· +.I schedule +¤òÁ´¤Æ»È¤Ã¤Æ¡¢ +.BR forever +¤¬»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ï¡¢ +.B start-stop-daemon +¤Ï¥¨¥é¡¼¾õÂÖ 2 ¤Ç½ªÎ»¤¹¤ë¡£ +¤â¤· +.I schedule +¤¬»ØÄꤵ¤ì¤Æ¤¤¤ì¤Ð¡¢ +.B --signal +¤Ç»ØÄꤷ¤¿¥·¥°¥Ê¥ë¤Ï̵»ë¤µ¤ì¤ë¡£ +Ʊ»þ¤Ë +.B --start +¤¬Í¿¤¨¤é¤ì¤ë¤È¡¢ +.I pathname +¤Ë¤è¤ê»ØÄꤵ¤ì¤ë¥×¥í¥»¥¹¤òµ¯Æ°¤¹¤ë¡£¤³¤Î¥ª¥×¥·¥ç¥ó¤¬»ØÄꤵ¤ì¤Ê¤¤¾ì¹ç¡¢ +.B --exec +¤ËÍ¿¤¨¤é¤ì¤ë°ú¿ô¤¬¥Ç¥Õ¥©¥ë¥È¤Ë¤Ê¤ë¡£ +.TP +.BR -t | --test +¼Â¹Ô¤·¤è¤¦¤È¤¹¤ë½èÍýÆâÍƤò½ÐÎϤ·¡¤¤½¤ì¤Ëȼ¤¤Å¬ÀÚ¤ÊÊÖ¤êÃͤ¬ÀßÄꤵ¤ì¤ë +¤¬¡¢¼ÂºÝ¤Î½èÍý¤Ï¹Ô¤ï¤Ê¤¤¡£ +.TP +.BR -o | --oknodo +½èÍý¤¬²¿¤â¹Ô¤ï¤ì¤Ê¤¤(Ëô¤Ï¡¢¹Ô¤Ê¤ï¤ì¤è¤¦¤È¤â¤·¤Ê¤«¤Ã¤¿)¾ì¹ç¡¢ +½ªÎ»¥¹¥Æ¡¼¥¿¥¹ 1 ¤Î¤«¤ï¤ê¤Ë 0 ¤òÊÖ¤¹¡£ +.TP +.BR -q | --quiet +»²¹Í¾ðÊó¤ò½ÐÎϤ·¤Ê¤¤¡£¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸¤Î¤ßɽ¼¨¡£ +.TP +\fB-c\fP|\fB--chuid\fP \fIusername\fR|\fIuid\fP +½èÍý¤ò³«»Ï¤¹¤ëÁ°¤Ë»ØÄꤵ¤ì¤¿¥æ¡¼¥¶Ì¾/¥æ¡¼¥¶ ID ¤ËÊѹ¹¤¹¤ë¡£ +.BR ':' +¤Î¸å¤Ë +¥°¥ë¡¼¥×̾¤Þ¤¿¤Ï¥°¥ë¡¼¥× ID ¤òÍ¿¤¨¤ë¤³¤È¤Ë¤è¤ê¥°¥ë¡¼¥×¤â»ØÄê¤Ç¤­¤ë¡£ +¤³¤ì¤Ï `chown' ¥³¥Þ¥ó¥É¤ÈƱ¤¸½ñ¼° (\fIuser\fP\fB:\fP\fIgroup\fP) +¤Ç¤¢¤ë¡£¤³¤Î¥ª¥×¥·¥ç¥ó¤ò +»ÈÍѤ·¤¿»þ¤Ë¤Ï¡¢ +.B --group +¥ª¥×¥·¥ç¥ó¤¬»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ç¤¢¤Ã¤Æ¤â¥×¥é¥¤¥Þ¥ê¥°¥ë¡¼¥×¤È +Êä½õ¥°¥ë¡¼¥×¤ÏƱÍͤËÀßÄꤵ¤ì¤ë¤³¤È¤òÍý²ò¤·¤Æ¤¤¤Ê¤±¤ì¤Ð¤Ê¤é +¤Ê¤¤¡£ +.B --group +¥ª¥×¥·¥ç¥ó¤Ï¡¢( +.B nobody +¤Î¤è¤¦¤Ê°ìÈÌŪ¥æ¡¼¥¶¤ËÂФ·¤Æ¥×¥í¥»¥¹Ã±°Ì¤Ç¥°¥ë¡¼¥×¤ËÄɲ乤ë¤È¤¤¤¦¤è¤¦¤Ë) +¥æ¡¼¥¶¤¬Ä̾ï¤Î¥á¥ó¥Ð¡¼¤Ç¤Ê¤¤¥°¥ë¡¼¥×¤ò»ØÄꤹ¤ë¾ì¹ç¤Ë¤Î¤ß»ÈÍѤ¹¤ë¡£ +.TP +\fB-r\fP|\fB--chroot\fP \fIroot\fP +½èÍý¤ò³«»Ï¤¹¤ëÁ°¤Ë¡¢ +.I root +¤Ë chdir ¤È chroot ¤ò¼Â¹Ô¤¹¤ë¡£pidfile ¤Ï chroot ¸å¤Ë¡¢½ñ¤­½Ð¤µ¤ì¤ë¤³¤È +¤ËÃí°Õ¤¹¤ë¡£ +.TP +\fB-d\fP|\fB--chdir\fP \fIpath\fP +¥×¥í¥»¥¹¤ò³«»Ï¤¹¤ëÁ°¤Ë¡¢ +.I path +¤Ë chdir ¤¹¤ë¡£ +\fB-r\fP|\fB--chroot\fP ¥ª¥×¥·¥ç¥ó¤òƱ»þ¤Ë»ØÄꤷ¤¿¾ì¹ç¤Ï¡¢ +chroot ¤Î¤¢¤È¤Ë chdir ¤¹¤ë¡£ +.TP +.BR -b | --background +ŵ·¿Åª¤Ë¤Ï¡¢¥Ç¡¼¥â¥ó¥×¥í¥»¥¹¤òÀÚ¤êÎ¥¤»¤Ê¤¤¥×¥í¥°¥é¥à¤Ç»ÈÍѤµ¤ì¤ë¡£¤³¤Î¥ª¥× +¥·¥ç¥ó¤ò»ØÄꤷ¤¿¾ì¹ç¡¢ +.B start-stop-daemon +¤Ï¼«Ê¬¼«¿È¤òÂÐ¾Ý¥×¥í¥»¥¹¤Î¼Â¹ÔÁ°¤Ë fork ¤·¡¢°Ê¸å¥Ð¥Ã¥¯¥°¥é¥¦¥ó¥É¤Ç½èÍý¤ò¹Ô¤¦¡£ +.B ·Ù¹ð: start-stop-daemon +¤Ï +.B ²¿¤é¤«¤ÎÍýͳ +¤Ë¤è¤Ã¤Æ½èÍý¤Î¼Â¹Ô¤Ë¼ºÇÔ¤·¤¿¾ì¹ç¤Ë¡¢¤½¤Î½ªÎ»¥¹¥Æ¡¼¥¿¥¹¤ò¥Á¥§¥Ã¥¯¤Ç¤­¤Ê¤¤¡£ +¤³¤Î¥ª¥×¥·¥ç¥ó¤ÏºÇ½ª¼êÃʤǤ¢¤ê¡¢¼«Ê¬¤«¤é fork ¤¹¤ë¤³¤È¤Ë°ÕÌ£¤Î¤Ê¤¤¥×¥í¥° +¥é¥à¤ä¡¢fork ¤ò¼«Ê¬¤Ç¹Ô¤¦¤¿¤á¤Î¥³¡¼¥É¤òÄɲäǤ­¤Ê¤¤¥×¥í¥°¥é¥à¤Î¤ß¤Ç¤Î»ÈÍÑ +¤ò°Õ¿Þ¤·¤Æ¤¤¤ë¡£ +.TP +\fB-N\fP|\fB--nicelevel\fP \fIint\fP +¥×¥í¥»¥¹¤ò³«»Ï¤¹¤ëÁ°¤Ë¥×¥í¥»¥¹¤Î¥×¥é¥¤¥ª¥ê¥Æ¥£¤òÊѹ¹¤¹¤ë¡£ +.TP +.BR -m | --make-pidfile +¼«Ê¬¼«¿È¤Ç PID ¥Õ¥¡¥¤¥ë¤òºîÀ®¤·¤Ê¤¤¥×¥í¥°¥é¥à¤òµ¯Æ°¤¹¤ëºÝ¤Ë»ÈÍѤ¹¤ë¡£ +¤³¤Î¥ª¥×¥·¥ç¥ó¤Ë¤è¤ê¡¢½èÍý¤Î¼Â¹ÔľÁ°¤Ë +.B start-stop-daemon +¤Ï +.B --pidfile +¤Ç»²¾È¤µ¤ì¤ë¥Õ¥¡¥¤¥ë¤òºîÀ®¤·¡¢ÇÛÃÖ¤¹¤ë¡£¤³¤Î¥Õ¥¡¥¤¥ë¤Ï¥×¥í¥°¥é¥à¤Î +Ää»ß»þ¤Ëºï½ü¤µ¤ì¤Ê¤¤¤³¤È¤ËÃí°Õ¤µ¤ì¤¿¤¤¡£ +.B Ãí°Õ: +¤³¤Î¥ª¥×¥·¥ç¥ó¤ÏÆ°ºî¤·¤Ê¤¤¾ì¹ç¤¬¤¢¤ë¡£Æäˡ¢¥×¥í¥°¥é¥à¤Î¼Â¹Ô»þ¤Ë¤½¤Î +¥á¥¤¥ó¥×¥í¥»¥¹¤«¤é fork ¤¹¤ë¤è¤¦¤Ê¥×¥í¥°¥é¥à¤Ç¤ÏÀµ¤·¤¯Æ°ºî¤·¤Ê¤¤¡£ +¤³¤Î¤¿¤á¡¢Ä̾ï¤Ï +.B --background +¥ª¥×¥·¥ç¥ó¤ÈÊ»ÍѤ¹¤ë¾ì¹ç¤Ë¤Î¤ßÍ­ÍѤǤ¢¤ë¡£ +.TP +.BR -v | --verbose +¾Ü¤·¤¤»²¹Í¾ðÊó¤ò½ÐÎϤ¹¤ë¡£ +.TP +.BR -H | --help +¥Ø¥ë¥×¾ðÊó¤ò½ÐÎϤ·¤Æ½ªÎ»¤¹¤ë¡£ +.TP +.BR -v | --verbose +¥Ð¡¼¥¸¥ç¥ó¾ðÊó¤ò½ÐÎϤ·¤Æ½ªÎ»¤¹¤ë¡£ + +.SH Ãø¼Ô +Marek Michalkiewicz +¤¬Ian Jackson ¤Ë¤è¤ë°ÊÁ°¤Î¥Ð¡¼¥¸¥ç¥ó¤ò +¸µ¤ËºîÀ®¡£ + +¤³¤Î¥Þ¥Ë¥å¥¢¥ë¤Ï Klee Dienes ¤Ë¤è¤Ã¤Æ½ñ¤«¤ì¤¿¡£ +°ìÉô Ian Jackson ¤Ë¤è¤ëÀ°·Á¡£ + +.SH ËÝÌõ¼Ô +Æéë ±ÉŸ diff --git a/man/netreport.1 b/man/netreport.1 new file mode 100644 index 0000000..75ed074 --- /dev/null +++ b/man/netreport.1 @@ -0,0 +1,22 @@ +.TH NETREPORT 1 "Red Hat, Inc." "RH" \" -*- nroff -*- +.SH NAME +netreport \- request notification of network interface changes +.SH SYNOPSIS +.B netreport +\fI[\fP-r\fI]\fP +.SH DESCRIPTION +.B netreport +tells the network management scripts to send a SIGIO signal +to the process which called netreport when any network interface +status changes occur. +.SH OPTIONS +.TP +.B -r +Remove the current request (if any) for the calling process. +.PP +.SH NOTES +If a program does not call netreport with the +.B -r +option before it exits, and another process is created with the +same PID before any changes take place in interface status, it +is possible that the new process will receive a spurious SIGIO. diff --git a/man/ppp-watch.8 b/man/ppp-watch.8 new file mode 100644 index 0000000..d2b8cc4 --- /dev/null +++ b/man/ppp-watch.8 @@ -0,0 +1,23 @@ +.TH PPP-WATCH 8 "Red Hat, Inc." "RHS" \" -*- nroff -*- +.SH NAME +ppp-watch \- daemon to make PPP interfaces act more like other interfaces +.SH SYNOPSIS +.B ppp-watch +\fIinterface-name\fP [boot] +.SH DESCRIPTION +.B ppp-watch +manages one PPP connection, including starting, stopping, and redialing. +It makes starting and stopping the connection synchronous activities. + +.B ppp-watch +is not really meant to be called directly. It should only be used from +within the ifup-ppp script. +.SH OPTIONS +.TP +.I interface-name +The name of the PPP interface to bring up. +.TP +boot +ppp-watch is being called at boot time and should time out after a +while if the PPP connection does not come up in order not to hang +the boot sequence. diff --git a/man/ru/Makefile.am b/man/ru/Makefile.am new file mode 100644 index 0000000..69a5015 --- /dev/null +++ b/man/ru/Makefile.am @@ -0,0 +1,8 @@ +@SET_MAKE@ + +mandir = @mandir@/ru + +man_MANS = \ + start-stop-daemon.8 + +EXTRA_DIST = $(man_MANS) diff --git a/man/ru/start-stop-daemon.8 b/man/ru/start-stop-daemon.8 new file mode 100644 index 0000000..60c00d0 --- /dev/null +++ b/man/ru/start-stop-daemon.8 @@ -0,0 +1,243 @@ +.\" Hey, Emacs! This is an -*- nroff -*- source file. +.\" +.\" Updated by to r1.11 of start-stop-daemon.8 from CVS +.\" +.TH START\-STOP\-DAEMON 8 "15 ÍÁÒÔÁ 1997" "Debian Project" "Debian GNU/Linux" +.SH éíñ +start\-stop\-daemon \- ÚÁÐÕÓË É ÏÓÔÁÎÏ×ËÁ ÓÉÓÔÅÍÎÙÈ ÐÒÏÇÒÁÍÍ-ÄÅÍÏÎÏ× +.SH ïâúïò +.B start-stop-daemon +.BR -S|--start +.I ÆÌÁÇÉ +.RB [ \-\- ] +.IR ÁÒÇÕÍÅÎÔÙ +.HP +.B start-stop-daemon +.BR -K|--stop +.IR "ÆÌÁÇÉ ..." +.HP +.B start-stop-daemon +.BR -H|--help +.HP +.B start-stop-daemon +.BR -V|--version +.SH ïðéóáîéå +.B start\-stop\-daemon +ÉÓÐÏÌØÚÕÅÔÓÑ ÄÌÑ ÕÐÒÁ×ÌÅÎÉÑ ÓÏÚÄÁÎÉÅÍ É ÚÁ×ÅÒÛÅÎÉÅÍ ÓÉÓÔÅÍÎÙÈ ÐÒÏÃÅÓÓÏ×. +éÓÐÏÌØÚÕÑ ÆÌÁÇÉ +.BR --exec , +.BR --pidfile , +.BR --user , +É +.BR --name , +.B start\-stop\-daemon +ÍÏÖÅÔ ÂÙÔØ ÎÁÓÔÒÏÅÎ ÄÌÑ ÐÏÉÓËÁ ÕÖÅ ÚÁÐÕÝÅÎÎÙÈ ÜËÚÅÍÐÌÑÒÏ× +ÐÒÏÃÅÓÓÁ. + +.B start\-stop\-daemon +Ó ÆÌÁÇÏÍ +.B --start +ÐÒÏ×ÅÒÑÅÔ ÓÕÝÅÓÔ×Ï×ÁÎÉÅ ÕËÁÚÁÎÎÏÇÏ ÐÒÏÃÅÓÓÁ. åÓÌÉ ÔÁËÏÊ ÐÒÏÃÅÓÓ ÓÕÝÅÓÔ×ÕÅÔ, +.B start\-stop\-daemon +ÎÉÞÅÇÏ ÎÅ ÄÅÌÁÅÔ É ÐÒÅËÒÁÝÁÅÔ ÒÁÂÏÔÕ Ó ËÏÄÏÍ ÚÁ×ÅÒÛÅÎÉÑ\~1 (ÉÌÉ\~0, ÅÓÌÉ ÚÁÄÁÎ +ÆÌÁÇ +.BR --oknodo ). +åÓÌÉ ÖÅ ÔÁËÏÊ ÐÒÏÃÅÓÓ ÎÅ ÓÕÝÅÓÔ×ÕÅÔ, ÔÏ ÏÎ ÚÁÐÕÓËÁÅÔÓÑ, ÉÓÐÏÌØÚÕÑ ÌÉÂÏ +ÉÓÐÏÌÎÑÅÍÙÊ ÆÁÊÌ, ÚÁÄÁÎÎÙÊ ÆÌÁÇÏÍ +.BR --exec , +ÌÉÂÏ ÆÌÁÇÏÍ +.BR --startas , +ÅÓÌÉ ÏÎ ÚÁÄÁÎ). +áÒÇÕÍÅÎÔÙ, ÚÁÄÁÎÎÙÅ × ËÏÍÁÎÄÎÏÊ ÓÔÒÏËÅ ÐÏÓÌÅ +.BR -- , +ÂÕÄÕÔ ÂÅÚ ÉÚÍÅÎÅÎÉÊ ÐÅÒÅÄÁÎÙ ÚÁÐÕÓËÁÅÍÏÊ ÐÒÏÇÒÁÍÍÅ. +åÓÌÉ ÕËÁÚÁÎ ÆÌÁÇ +.BR --retry , +ÔÏ +.B start-stop-daemon +ÓÔÁÎÅÔ ÏÔÓÌÅÖÉ×ÁÔØ ÚÁ×ÅÒÛÅÎÉÅ ÐÒÏÃÅÓÓÁ(Ï×). + +.B start\-stop\-daemon +Ó ÆÌÁÇÏÍ +.BR --stop +ÔÁËÖÅ ÐÒÏ×ÅÒÑÅÔ ÓÕÝÅÓÔ×Ï×ÁÎÉÅ ÚÁÄÁÎÎÏÇÏ ÐÒÏÃÅÓÓÁ. +åÓÌÉ ÔÁËÏÊ ÐÒÏÃÅÓÓ ÓÕÝÅÓÔ×ÕÅÔ, ÔÏ +.B start\-stop\-daemon +ÐÏÓÙÌÁÅÔ ÅÍÕ ÓÉÇÎÁÌ, ÚÁÄÁÎÎÙÊ ÆÌÁÇÏÍ +.BR --signal , +É ÐÒÅËÒÁÝÁÅÔ ÒÁÂÏÔÕ Ó ËÏÄÏÍ ÚÁ×ÅÒÛÅÎÉÑ\~0. +åÓÌÉ ÖÅ ÔÁËÏÊ ÐÒÏÃÅÓÓ ÎÅ ÓÕÝÅÓÔ×ÕÅÔ, ÔÏ +.B start\-stop\-daemon +ÐÒÅËÒÁÝÁÅÔ ÒÁÂÏÔÕ Ó ËÏÄÏÍ ÚÁ×ÅÒÛÅÎÉÑ\~1 (ÉÌÉ\~0, ÅÓÌÉ ÚÁÄÁÎ ÆÌÁÇ +.BR --oknodo ). + +.SH æìáçé + +.TP +\fB-x\fP|\fB--exec\fP \fIÉÓÐÏÌÎÑÅÍÙÊ_ÆÁÊÌ\fP +ðÒÏ×ÅÒÑÅÔ ÐÒÏÃÅÓÓÙ, ËÏÔÏÒÙÅ Ñ×ÌÑÀÔÓÑ ÜËÚÅÍÐÌÑÒÁÍÉ ÄÁÎÎÏÇÏ ÉÓÐÏÌÎÑÅÍÏÇÏ ÆÁÊÌÁ +(ÓÏÇÌÁÓÎÏ +.BR /proc/\fP\fIpid\fB/exe ). +.TP +\fB-p\fP|\fB--pidfile\fP \fIpid-ÆÁÊÌ\fP +ðÒÏ×ÅÒÑÅÔ ÐÒÏÃÅÓÓÙ, ÞØÉ ÉÄÅÎÔÉÆÉËÁÔÏÒÙ ÐÒÏÃÅÓÓÁ ÚÁÐÉÓÁÎÙ × +.IR pid-ÆÁÊÌ . +.TP +\fB-u\fP|\fB--user\fP \fIÉÍÑ_ÐÏÌØÚÏ×ÁÔÅÌÑ\fP|\fIuid\fP +ðÒÏ×ÅÒÑÅÔ ÐÒÏÃÅÓÓÙ, ÐÒÉÎÁÄÌÅÖÁÝÉÅ ÐÏÌØÚÏ×ÁÔÅÌÀ, ÕËÁÚÁÎÎÏÍÕ Ó ÐÏÍÏÝØÀ +.I ÉÍÅÎÉ_ÐÏÌØÚÏ×ÁÔÅÌÑ +ÉÌÉ +.IR uid . +.TP +\fB-n\fP|\fB--name\fP \fIprocess-name\fP +ðÒÏ×ÅÒÑÅÔ ÐÒÏÃÅÓÓÙ Ó ÉÍÅÎÅÍ +.I process-name +(ÓÏÇÌÁÓÎÏ +.BR /proc/\fP\fIpid\fB/stat ). +.TP +\fB-s\fP|\fB--signal\fP \fIsignal\fP +ðÒÉ ÉÓÐÏÌØÚÏ×ÁÎÉÉ ×ÍÅÓÔÅ Ó ÆÌÁÇÏÍ +.BR --stop , +ÚÁÄÁ£Ô ÓÉÇÎÁÌ, ËÏÔÏÒÙÊ ÂÕÄÅÔ ÐÏÓÌÁÎ ÐÒÏÃÅÓÓÁÍ ÄÌÑ ÉÈ ÏÓÔÁÎÏ×Á +(ÐÏ ÕÍÏÌÞÁÎÉÀ\~15). +.TP +\fB-R\fP|\fB--retry\fP \fIÔÁÊÍ-ÁÕÔ\fP|\fIÚÁÔÅÍ\fP +ðÒÉ ÉÓÐÏÌØÚÏ×ÁÎÉÉ ×ÍÅÓÔÅ Ó ÆÌÁÇÏÍ +.B --stop +ÕËÁÚÙ×ÁÅÔ, ÞÔÏ +.B start-stop-daemon +ÄÏÌÖÅÎ ÐÒÏ×ÅÒÑÔØ ÓÌÅÄÉÔØ ÚÁ ÐÒÁ×ÉÌØÎÙÍ ÚÁ×ÅÒÛÅÎÉÅÍ ÐÒÏÃÅÓÓÁ. +ðÅÒÉÏÄÉÞÅÓËÉ ÂÕÄÅÔ ÐÒÏ×ÅÒÑÔØÓÑ, ×ÙÐÏÌÎÑÀÔÓÑ ÌÉ ÅÝ£ ÕËÁÚÁÎÎÙÅ ÐÒÏÃÅÓÓÙ, +ÄÏ ÔÅÈ ÐÏÒ, ÐÏËÁ ×ÓÅ ÏÎÉ ÎÅ ÚÁ×ÅÒÛÁÔÓÑ. åÓÌÉ ÐÒÏÃÅÓÓÙ ÎÅ ÚÁ×ÅÒÛÁÀÔÓÑ, +ÔÏ ÂÕÄÅÔ ÐÒÅÄÐÒÉÎÑÔÏ ÄÅÊÓÔ×ÉÅ, ÚÁÄÁÎÎÏÅ × ÐÁÒÁÍÅÔÒÅ +.IR ÚÁÔÅÍ . + +åÓÌÉ ×ÍÅÓÔÏ ÐÁÒÁÍÅÔÒÁ +.I ÚÁÔÅÍ +ÕËÁÚÁÎ +.IR ÔÁÊÍ-ÁÕÔ , +ÔÏ ÉÓÐÏÌØÚÕÅÔÓÑ ÐÏÓÌÅÄÏ×ÁÔÅÌØÎÏÓÔØ ÄÅÊÓÔ×ÉÊ +.IB ÓÉÇÎÁÌ / timeout /KILL/ timeout\fR, +ÇÄÅ +.IR signal "\~--" +ÜÔÏ ÓÉÇÎÁÌ, ÚÁÄÁÎÎÙÊ ÆÌÁÇÏÍ +.BR --signal . + +÷ÏÏÂÝÅ, ÐÁÒÁÍÅÔÒ +.IR ÚÁÔÅÍ "\~--" +ÜÔÏ ÐÏÓÌÅÄÏ×ÁÔÅÌØÎÏÓÔØ ÉÚ ÎÅ ÍÅÎÅÅ Ä×ÕÈ ÜÌÅÍÅÎÔÏ×, ÒÁÚÄÅÌ£ÎÎÙÈ ËÏÓÏÊ +ÞÅÒÔÏÊ +.RB ( / ); +ÐÒÉÞ£Í ËÁÖÄÙÊ ÜÌÅÍÅÎÔ -- ÜÔÏ ÌÉÂÏ +.BI - ÎÏÍÅÒ-ÓÉÇÎÁÌÁ +ÉÌÉ [\fB-\fP]\fIÎÁÚ×ÁÎÉÅ-ÓÉÇÎÁÌÁ\fP, +ÉÌÉ +.IR ÔÁÊÍ-ÁÕÔ , +ÚÁÄÁÀÝÉÊ ËÏÌÉÞÅÓÔ×Ï ÓÅËÕÎÄ, × ÔÅÞÅÎÉÅ ËÏÔÏÒÙÈ ÓÌÅÄÕÅÔ ÖÄÁÔØ ÚÁ×ÅÒÛÅÎÉÑ +ÐÒÏÃÅÓÓÁ, ÉÌÉ ÖÅ ÓÌÏ×Ï +.BR forever , +ÐÒÅÄÐÉÓÙ×ÁÀÝÅÅ ÐÏ×ÔÏÒÑÔØ ÏÓÔÁÔÏË ÐÏÓÌÅÄÏ×ÁÔÅÌØÎÏÓÔÉ ÄÏ ÐÒÅÄÅÌÁ, ÅÓÌÉ +ÎÕÖÎÏ. + +åÓÌÉ ÄÏÓÔÉÇÎÕÔ ËÏÎÅà ÐÏÓÌÅÄÏ×ÁÔÅÌØÎÏÓÔÉ ÄÅÊÓÔ×ÉÊ, Á +.B forever +ÎÅ ÂÙÌÏ ÕËÁÚÁÎÏ, ÔÏ +.B start-stop-daemon +ÐÒÅËÒÁÝÁÅÔ ÒÁÂÏÔÕ Ó ËÏÄÏÍ ÚÁ×ÅÒÛÅÎÉÑ\~2. +åÓÌÉ ÐÁÒÁÍÅÔÒ +.I ÚÁÔÅÍ +ÕËÁÚÁÎ, ÔÏ ÓÉÇÎÁÌ, ÚÁÄÁÎÎÙÊ Ó ÐÏÍÏÝØÀ ÆÌÁÇÁ +.BR --signal , +ÉÇÎÏÒÉÒÕÅÔÓÑ. + +.TP +\fB-a\fP|\fB--startas\fP \fIÐÏÌÎÏÅ_ÉÍÑ\fP +ðÒÉ ÉÓÐÏÌØÚÏ×ÁÎÉÉ Ó ÆÌÁÇÏÍ +.B --start +ÚÁÐÕÓËÁÅÔ ÐÒÏÃÅÓÓ, ÕËÁÚÁÎÎÙÊ × ÐÁÒÁÍÅÔÒÅ +.IR ÐÏÌÎÏÅ_ÉÍÑ . +åÓÌÉ ÜÔÏÔ ÆÌÁÇ ÎÅ ÚÁÄÁÎ, ÔÏ ÂÅÒ£ÔÓÑ ÁÒÇÕÍÅÎÔ, ÚÁÄÁÎÎÙÊ ÆÌÁÇÏÍ +.BR --exec . +.TP +.BR -t | --test +îÁÐÅÞÁÔÁÔØ ÄÅÊÓÔ×ÉÑ, ËÏÔÏÒÙÅ ÄÏÌÖÎÙ ÂÙÔØ ×ÙÐÏÌÎÅÎÙ É ÕÓÔÁÎÏ×ÉÔØ ÓÏÏÔ×ÅÔÓÔ×ÕÀÝÉÊ +ËÏÄ ÚÁ×ÅÒÛÅÎÉÑ, ÎÏ ÎÅ ×ÙÐÏÌÎÑÔØ ÜÔÉ ÄÅÊÓÔ×ÉÑ. +.TP +.BR -o | --oknodo +÷ÏÚ×ÒÁÝÁÔØ ËÏÄ\~0 ×ÍÅÓÔÏ\~1, ÅÓÌÉ ÎÅ ÂÙÌÏ ×ÙÐÏÌÎÅÎÏ (ÉÌÉ ÎÅ ÄÏÌÖÎÏ +ÂÙÌÏ ÂÙÔØ ×ÙÐÏÌÎÅÎÏ) ÎÉËÁËÉÈ ÄÅÊÓÔ×ÉÊ. +.TP +.BR -q | --quiet +îÅ ×ÙÄÁ×ÁÔØ ÉÎÆÏÒÍÁÃÉÏÎÎÙÈ ÓÏÏÂÝÅÎÉÊ; ÔÏÌØËÏ ÓÏÏÂÝÅÎÉÑ Ï ÏÛÉÂËÁÈ. +.TP +\fB-c\fP|\fB--chuid\fP \fIÉÍÑ-ÐÏÌØÚÏ×ÁÔÅÌÑ\fR|\fIuid\fP +õÓÔÁÎÏ×ÉÔØ ÄÁÎÎÏÅ ÉÍÑ ÐÏÌØÚÏ×ÁÔÅÌÑ ÉÌÉ uid ÐÅÒÅÄ ÚÁÐÕÓËÏÍ ÐÒÏÃÅÓÓÁ. ÷Ù ÍÏÖÅÔÅ +ÔÁËÖÅ ÚÁÄÁÔØ ÇÒÕÐÐÕ, ÄÏÂÁ×É× Ä×ÏÅÔÏÞÉÅ +.BR : , +É ÉÍÑ ÇÒÕÐÐÙ ÉÌÉ gid, ËÁË × ËÏÍÁÎÄÅ `chown' +(\fIÐÏÌØÚÏ×ÁÔÅÌØ\fP\fB:\fP\fIÇÒÕÐÐÁ\fP). +ðÒÉ ÉÓÐÏÌØÚÏ×ÁÎÉÉ ÜÔÏÇÏ ÆÌÁÇÁ ×Ù ÄÏÌÖÎÙ ÐÏÎÉÍÁÔØ, ÞÔÏ ÏÓÎÏ×ÎÁÑ É +ÄÏÐÏÌÎÉÔÅÌØÎÙÅ ÇÒÕÐÐÙ ÂÕÄÕÔ ÕÓÔÁÎÏ×ÌÅÎÙ, ÄÁÖÅ ÅÓÌÉ ÎÅ ÚÁÄÁÎ ÆÌÁÇ +.BR --group . +æÌÁÇ +.B --group +ÉÓÐÏÌØÚÕÅÔÓÑ ÔÏÌØËÏ ÄÌÑ ÇÒÕÐÐ, × ËÏÔÏÒÙÈ ÐÏÌØÚÏ×ÁÔÅÌØ ÏÂÙÞÎÏ ÎÅ +ÓÏÓÔÏÉÔ (ÎÁÐÒÉÍÅÒ, × ÓÌÕÞÁÅ Ó ÓÉÓÔÅÍÎÙÍ ÐÏÌØÚÏ×ÁÔÅÌÅÍ `nobody'). +.TP +\fB-r\fP|\fB--chroot\fB \fIroot\fP +ðÅÒÅÄ ÚÁÐÕÓËÏÍ ÐÒÏÃÅÓÓÁ ÐÅÒÅÊÔÉ × ËÁÔÁÌÏÇ +.I root +É ÓÄÅÌÁÔØ ÅÇÏ ËÏÒÎÅ×ÙÍ (Ó ÐÏÍÏÝØÀ +.BR chroot ). +úÁÍÅÔØÔÅ, ÞÔÏ pid-ÆÁÊÌ ÂÕÄÅÔ ÓÏÚÄÁÎ ÐÏÓÌÅ ÕÓÔÁÎÏ×ËÉ ÎÏ×ÏÇÏ ËÏÒÎÅ×ÏÇÏ +ËÁÔÁÌÏÇÁ. +.TP +.BR -b | --background +üÔÏÔ ÆÌÁÇ ÏÂÙÞÎÏ ÉÓÐÏÌØÚÕÅÔÓÑ Ó ÐÒÏÇÒÁÍÍÁÍÉ, ËÏÔÏÒÙÅ ÎÅ ÍÏÇÕÔ ÓÁÍÉ +ÏÔËÌÀÞÉÔØÓÑ ÏÔ ÔÅÒÍÉÎÁÌÁ, ÎÁ ËÏÔÏÒÏÍ ÏÎÉ ÚÁÐÕÝÅÎÙ. üÔÏÔ ÆÌÁÇ ÚÁÓÔÁ×ÉÔ +.B start-stop-daemon +ÓÄÅÌÁÔØ fork() ÐÅÒÅÄ ÚÁÐÕÓËÏÍ ÐÒÏÃÅÓÓÁ É ÕÊÔÉ × ÆÏÎÏ×ÙÊ ÒÅÖÉÍ. +.B ÷îéíáîéå: start-stop-daemon +ÎÅ ÍÏÖÅÔ ÐÒÏ×ÅÒÉÔØ ËÏÄ ×ÏÚ×ÒÁÔÁ, ÅÓÌÉ ÐÒÏÃÅÓÓ ÎÅ ÍÏÖÅÔ ÕÓÐÅÛÎÏ ×ÙÐÏÌÎÉÔØÓÑ ÐÏ +.I ËÁËÏÊ ÂÙ ÔÏ ÎÉ ÂÙÌÏ +ÐÒÉÞÉÎÅ. üÔÏ\~-- ÐÏÓÌÅÄÎÑÑ ×ÏÚÍÏÖÎÏÓÔØ, ÐÒÅÄÎÁÚÎÁÞÅÎÎÁÑ ÔÏÌØËÏ ÄÌÑ +ÐÒÏÇÒÁÍÍ, ËÏÔÏÒÙÍ ÎÅ ÉÍÅÅÔ ÓÍÙÓÌÁ ×ÙÐÏÌÎÑÔØ fork() ÓÁÍÉÍ, ÉÌÉ ÅÓÌÉ ÎÅÔ +×ÏÚÍÏÖÎÏÓÔÉ ÄÏÂÁ×ÉÔØ × ÎÉÈ ËÏÄ ÄÌÑ ÜÔÏÇÏ. +.TP +.BR -n | --nicelevel +üÔÏÔ ÆÌÁÇ ÐÅÒÅÄ ÚÁÐÕÓËÏÍ ÉÚÍÅÎÑÅÔ ÐÒÉÏÒÉÔÅÔ ÐÒÏÃÅÓÓÁ. +.TP +.BR -m | --make-pidfile +üÔÏÔ ÆÌÁÇ ÉÓÐÏÌØÚÕÅÔÓÑ, ÅÓÌÉ ÚÁÐÕÓËÁÅÍÁÑ ÐÒÏÇÒÁÍÍÁ ÎÅ ÓÏÚÄÁ£Ô Ó×ÏÊ +ÓÏÂÓÔ×ÅÎÎÙÊ pid-ÆÁÊÌ. ðÒÉ ÜÔÏÍ +.B start-stop-daemon +ÎÅÐÏÓÒÅÄÓÔ×ÅÎÎÏ ÐÅÒÅÄ ÚÁÐÕÓËÏÍ ÐÒÏÃÅÓÓÁ ÓÏÚÄÁÓÔ ÆÁÊÌ, ÕËÁÚÁÎÎÙÊ × +ÐÁÒÁÍÅÔÒÅ ÆÌÁÇÁ +.B --pidfile +É ÐÏÍÅÓÔÉÔ × ÎÅÇÏ pid ÚÁÐÕÓËÁÅÍÏÇÏ ÐÒÏÃÅÓÓÁ. úÁÍÅÔØÔÅ, ÞÔÏ ÜÔÏÔ ÆÁÊÌ +ÎÅ ÂÕÄÅÔ ÕÄẠ́ΠÐÒÉ ÏÓÔÁÎÏ×ËÅ ÐÒÏÇÒÁÍÍÙ. +.B úáíåþáîéå: +üÔÁ ×ÏÚÍÏÖÎÏÓÔØ ÉÎÏÇÄÁ ÍÏÖÅÔ ÎÅ ÒÁÂÏÔÁÔØ: × ÏÓÎÏ×ÎÏÍ ÜÔÏ ÓÌÕÞÁÅÔÓÑ, +ËÏÇÄÁ ÚÁÐÕÓËÁÅÍÁÑ ÐÒÏÇÒÁÍÍÁ ×ÙÐÏÌÎÑÅÔ fork(). ðÏÜÔÏÍÕ ÄÁÎÎÙÊ ÆÌÁÇ +ÏÂÙÞÎÏ ÂÙ×ÁÅÔ ÐÏÌÅÚÅÎ ÔÏÌØËÏ ÐÒÉ ÉÓÐÏÌØÚÏ×ÁÎÉÉ ×ÍÅÓÔÅ Ó ÆÌÁÇÏÍ +.BR --background . +.TP +.BR -v | --verbose +÷ÙÄÁ×ÁÔØ ÐÏÄÒÏÂÎÙÅ ÉÎÆÏÒÍÁÃÉÏÎÎÙÅ ÓÏÏÂÝÅÎÉÑ. +.TP +.BR -H | --help +÷ÙÄÁÔØ ÐÏÄÓËÁÚËÕ É ÚÁ×ÅÒÛÉÔØÓÑ. +.TP +.BR -V | --version +÷ÙÄÁÔØ ÉÎÆÏÒÍÁÃÉÀ Ï ×ÅÒÓÉÉ É ÚÁ×ÅÒÛÉÔØÓÑ. + +.SH á÷ôïòù +Marek Michalkiewicz , ÏÓÎÏ×Ù×ÁÑÓØ +ÎÁ ×ÅÒÓÉÉ, ÓÄÅÌÁÎÎÏÊ by Ian Jackson . + +óÔÒÁÎÉÃÁ ÒÕËÏ×ÏÄÓÔ×Á by Klee Dienes , ÞÁÓÔÉÞÎÏ +ÐÅÒÅÆÏÒÍÁÔÉÒÏ×ÁÎÏ by Ian Jackson. + +.SH ðåòå÷ïä +ðÅÒÅ×£Ì Ó ÁÎÇÌÉÊÓËÏÇÏ ÷ÉËÔÏÒ ÷ÉÓÌÏÂÏËÏ× . +ïÂÎÏ×ÌÅÎÉÅ É ËÏÒÒÅËÔÕÒÁ: Alexey Mahotkin . diff --git a/man/run-parts.8 b/man/run-parts.8 new file mode 100644 index 0000000..7e762a2 --- /dev/null +++ b/man/run-parts.8 @@ -0,0 +1,130 @@ +.\" Hey, Emacs! This is an -*- nroff -*- source file. +.\" Build-from-directory and this manpage are Copyright 1994 by Ian Jackson. +.\" Changes to this manpage are Copyright 1996 by Jeff Noxon. +.\" More +.\" +.\" This is free software; see the GNU General Public Licence version 2 +.\" or later for copying conditions. There is NO warranty. +.TH RUN\-PARTS 8 "27 Jun 2012" "Debian" +.SH NAME +run\-parts \- run scripts or programs in a directory +.SH SYNOPSIS +.PP +.B run\-parts +[\-\-test] [\-\-verbose] [\-\-report] [\-\-lsbsysinit] [\-\-regex=RE] +[\-\-umask=umask] [\-\-arg=argument] [\-\-exit\-on\-error] [\-\-help] +[\-\-version] [\-\-list] [\-\-reverse] [\-\-] DIRECTORY +.PP +.B run\-parts +\-V +.SH DESCRIPTION +.PP +.B run\-parts +runs all the executable files named within constraints described below, found +in directory +.IR directory . +Other files and directories are silently ignored. + +If neither the \-\-lsbsysinit option nor the \-\-regex option is given +then the names must consist entirely of ASCII upper- and lower-case +letters, ASCII digits, ASCII underscores, and ASCII minus-hyphens. + +If the \-\-lsbsysinit option is given, then the names must not end +in rpm backups (.rpmsave, .rpmnew, .rpmorig), and must +belong to one or more of the following namespaces: the +LANANA-assigned namespace (^[a\-z0\-9]+$); the LSB hierarchical and +reserved namespaces (^_?([a\-z0\-9_.]+\-)+[a\-z0\-9]+$); +and the Debian cron script namespace (^[a\-zA-Z0\-9_\-]+$). + +If the \-\-regex option is given, the names must match the custom +extended regular expression specified as that option's argument. + +Files are run in the lexical sort order (according to the C/POSIX +locale character collation rules) of their names unless the +\-\-reverse option is given, in which case they are run in the +opposite order. + +.SH OPTIONS +.TP +.B \-\-test +print the names of the scripts which would be run, but don't actually run +them. +.TP +.B \-\-list +print the names of the all matching files (not limited to executables), +but don't actually run them. This option cannot be used with --test. +.TP +.B \-v, \-\-verbose +print the name of each script to stderr before running. +.TP +.B \-\-report +similar to +.BR \-\-verbose , +but only prints the name of scripts which produce output. The script's name is printed to whichever of stdout or stderr the script first produces output on. +.TP +.B \-\-reverse +reverse the scripts' execution order. +.TP +.B \-\-exit\-on\-error +exit as soon as a script returns with a non-zero exit code. +.TP +.B \-\-lsbsysinit +use LSB namespaces instead of classical behavior. +.TP +.B \-\-new\-session +run each script in a separate process session. If you use this option, +killing run-parts will not kill the currently running script, it will +run until completion. +.TP +.BI \-\-regex= RE +validate filenames against custom extended regular expression +.IR RE . +See the EXAMPLES section for an example. +.TP +.BI "\-u, \-\-umask=" umask +sets the umask to +.I umask +before running the scripts. +.I umask +should be specified in octal. By default the umask is set to 022. +.TP +.BI "\-a, \-\-arg=" argument +pass +.I argument +to the scripts. Use +.B --arg +once for each argument you want passed. +.TP +.B "\-\-" +specifies that this is the end of the options. Any filename after +.B "\-\-" +will be not be interpreted as an option even if it starts with a +hyphen. +.TP +.B \-h, \-\-help +display usage information and exit. +.TP +.B \-V, \-\-version +display version and copyright and exit. + +.SH EXAMPLES +.P +Print the names of all files in /etc that start with `p' and end with `d': +.P +run-parts \-\-list \-\-regex \[aq]^p.*d$\[aq] /etc + +.SH COPYRIGHT +.P +Copyright (C) 1994 Ian Jackson. +.P +Copyright (C) 1996 Jeff Noxon. +.P +Copyright (C) 1996, 1997, 1998 Guy Maor +.P +Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Clint Adams + +.B run\-parts +is free software; see the GNU General Public License version 2 or +later for copying conditions. There is +.I no +warranty. diff --git a/man/start-stop-daemon.8 b/man/start-stop-daemon.8 new file mode 100644 index 0000000..c69619a --- /dev/null +++ b/man/start-stop-daemon.8 @@ -0,0 +1,261 @@ +.TH START\-STOP\-DAEMON 8 "15th March 1997" "Debian Project" "dpkg utilities" +.SH NAME +start\-stop\-daemon \- start and stop system daemon programs +.SH SYNOPSIS +.B start\-stop\-daemon +.BR \-S | \-\-start +.IR options +.RB [ \-\- ] +.IR arguments +.HP +.B start\-stop\-daemon +.BR \-K | \-\-stop +.IR options +.HP +.B start\-stop\-daemon +.BR \-H | \-\-help +.HP +.B start\-stop\-daemon +.BR \-V | \-\-version +.SH DESCRIPTION +.B start\-stop\-daemon +is used to control the creation and termination of system-level processes. +Using the +.BR \-\-exec ", " \-\-pidfile ", " \-\-user ", and " \-\-name " options," +.B start\-stop\-daemon +can be configured to find existing instances of a running process. + +With +.BR \-\-start , +.B start\-stop\-daemon +checks for the existence of a specified process. +If such a process exists, +.B start\-stop\-daemon +does nothing, and exits with error status 1 (0 if +.BR \-\-oknodo +is specified). +If such a process does not exist, it starts an +instance, using either the executable specified by +.BR \-\-exec , +(or, if specified, by +.BR \-\-startas ). +Any arguments given after +.BR \-\- +on the command line are passed unmodified to the program being +started. + +With +.BR \-\-stop , +.B start\-stop\-daemon +also checks for the existence of a specified process. +If such a process exists, +.B start\-stop\-daemon +sends it the signal specified by +.BR \-\-signal , +and exits with error status 0. +If such a process does not exist, +.B start\-stop\-daemon +exits with error status 1 +(0 if +.BR \-\-oknodo +is specified). If +.B \-\-retry +is specified then +.B start\-stop\-daemon +will check that the process(es) have terminated. + +Note that unless +.BR \-\-pidfile , +is specified, then +.B start\-stop\-daemon +behaves similarly to +.B killall(1). +.B start\-stop\-daemon +will scan the process table looking for any processes which +match the process name, uid, and/or gid (if specified). Any +matching process will prevent +.BR \-\-start +from starting the daemon. All matching processes will be +sent the KILL signal if +.BR \-\-stop +is specified. For daemons which have long-lived children +which need to live through a +.BR \-\-stop +you must specify a pidfile. + +.SH OPTIONS + +.TP +\fB\-x\fP|\fB\-\-exec\fP \fIexecutable\fP +Check for processes that are instances of this executable (according to +.B /proc/\fIpid\fB/exe\fP +). +.TP +\fB\-p\fP|\fB\-\-pidfile\fP \fIpid-file\fP +Check whether a process has created the file +.IR pid-file . +.TP +\fB\-u\fP|\fB\-\-user\fP \fIusername\fP|\fIuid\fP +Check for processes owned by the user specified by +.I username +or +.IR uid . +.TP +\fB\-g\fP|\fB\-\-group\fP \fIgroup\fP|\fIgid\fP +Change to \fIgroup\fP or \fIgid\fP when starting the process. +.TP +\fB\-n\fP|\fB\-\-name\fP \fIprocess-name\fP +Check for processes with the name +.I process-name +(according to +.BR /proc/\fIpid\fB/stat\fP ). +.TP +\fB\-s\fP|\fB\-\-signal\fP \fIsignal\fP +With +.BR \-\-stop , +specifies the signal to send to processes being stopped (default 15). +.TP +\fB\-R\fP|\fB\-\-retry\fP \fItimeout\fP|\fIschedule\fP +With +.BR \-\-stop , +specifies that +.B start\-stop\-daemon +is to check whether the process(es) +do finish. It will check repeatedly whether any matching processes +are running, until none are. If the processes do not exit it will +then take further action as determined by the schedule. + +If +.I timeout +is specified instead of +.I schedule +then the schedule +.IB signal / timeout /KILL/ timeout +is used, where +.I signal +is the signal specified with +.BR \-\-signal . + +.I schedule +is a list of at least two items separated by slashes +.RB ( / ); +each item may be +.BI \- signal-number +or [\fB\-\fP]\fIsignal-name\fP, +which means to send that signal, +or +.IR timeout , +which means to wait that many seconds for processes to +exit, +or +.BR forever , +which means to repeat the rest of the schedule forever if +necessary. + +If the end of the schedule is reached and +.BR forever +is not specified, then +.B start\-stop\-daemon +exits with error status 2. +If a schedule is specified, then any signal specified +with +.B \-\-signal +is ignored. +.TP +\fB\-a\fP|\fB\-\-startas\fP \fIpathname\fP +With +.BR \-\-start , +start the process specified by +.IR pathname . +If not specified, defaults to the argument given to +.BR \-\-exec . +.TP +.BR \-t | \-\-test +Print actions that would be taken and set appropriate return value, +but take no action. +.TP +.BR \-o | \-\-oknodo +Return exit status 0 instead of 1 if no actions are (would be) taken. +.TP +.BR \-q | \-\-quiet +Do not print informational messages; only display error messages. +.TP +\fB\-c\fP|\fB\-\-chuid\fP \fIusername\fR|\fIuid\fP +Change to this username/uid before starting the process. You can also +specify a group by appending a +.BR : , +then the group or gid in the same way +as you would for the `chown' command (\fIuser\fP\fB:\fP\fIgroup\fP). +When using this option +you must realize that the primary and supplemental groups are set as well, +even if the +.B \-\-group +option is not specified. The +.B \-\-group +option is only for +groups that the user isn't normally a member of (like adding per/process +group membership for generic users like +.BR nobody ). +.TP +\fB\-r\fP|\fB\-\-chroot\fP \fIroot\fP +Chdir and chroot to +.I root +before starting the process. Please note that the pidfile is also written +after the chroot. +.TP +.BR \-D ", " \-\-dropcap " \fIcapabilities1,capabilities2\fP" +Drop theses capabilities separated by commas. +.TP +\fB\-d\fP|\fB\-\-chdir\fP \fIpath\fP +Chdir to +.I path +before starting the process. This is done after the chroot if the +\fB\-r\fP|\fB\-\-chroot\fP option is set. When not specified, +start\-stop\-daemon will chdir to the root directory before starting +the process. +.TP +.BR \-b | \-\-background +Typically used with programs that don't detach on their own. This option +will force +.B start\-stop\-daemon +to fork before starting the process, and force it into the background. +.B WARNING: start\-stop\-daemon +cannot check the exit status if the process fails to execute for +.B any +reason. This is a last resort, and is only meant for programs that either +make no sense forking on their own, or where it's not feasible to add the +code for it to do this itself. +.TP +\fB\-N\fP|\fB\-\-nicelevel\fP \fIint\fP +This alters the prority of the process before starting it. +.TP +.BR \-m | \-\-make\-pidfile +Used when starting a program that does not create its own pid file. This +option will make +.B start\-stop\-daemon +create the file referenced with +.B \-\-pidfile +and place the pid into it just before executing the process. Note, it will +not be removed when stopping the program. +.B NOTE: +This feature may not work in all cases. Most notably when the program +being executed forks from its main process. Because of this it is usually +only useful when combined with the +.B \-\-background +option. +.TP +.BR \-v | \-\-verbose +Print verbose informational messages. +.TP +.BR \-H | \-\-help +Print help information; then exit. +.TP +.BR \-V | \-\-version +Print version information; then exit. + +.SH AUTHORS +Marek Michalkiewicz based on +a previous version by Ian Jackson . + +Manual page by Klee Dienes , partially reformatted +by Ian Jackson. diff --git a/man/sv/Makefile.am b/man/sv/Makefile.am new file mode 100644 index 0000000..db21b59 --- /dev/null +++ b/man/sv/Makefile.am @@ -0,0 +1,8 @@ +@SET_MAKE@ + +mandir = @mandir@/sv + +man_MANS = \ + start-stop-daemon.8 + +EXTRA_DIST = $(man_MANS) diff --git a/man/sv/start-stop-daemon.8 b/man/sv/start-stop-daemon.8 new file mode 100644 index 0000000..b75887a --- /dev/null +++ b/man/sv/start-stop-daemon.8 @@ -0,0 +1,231 @@ +.\" Translation of CVS revision 1.15 +.TH START\-STOP\-DAEMON 8 "15 mars 1997" "Debianprojektet" "dpkg-verktygen" +.SH NAMN +start\-stop\-daemon \- startar och stoppar bakgrundsprocesser +.SH SYNOPS +.B start-stop-daemon +.BR -S | --start +.IR flaggor +.RB [ \-\- ] +.IR parametrar +.HP +.B start-stop-daemon +.BR -K | --stop +.IR flaggor +.HP +.B start-stop-daemon +.BR -H | --help +.HP +.B start-stop-daemon +.BR -V | --version +.SH BESKRIVNING +.B start\-stop\-daemon +används för att kontrollera skapande och avslutande av processer på +systemnivå. +Med hjälp av flaggorna +.BR --exec ", " --pidfile ", " --user " och " --name +kan +.B start\-stop\-daemon +ställas in att hitta existerande instanser av en körande process. + +Med +.B --start +letar +.B start\-stop\-daemon +efter om en angiven process existerar, och om så är fallet gör +.B start\-stop\-daemon +ingenting och avslutar med status 1 (0 om +.B --oknodo +anges). +Om en sådan process inte existerar startas en instans, antingen med +programfilen som anges med +.BR --exec , +(eller, om den anges, med +.BR --startas ). +Eventuella parametrar som ges efter +.BR -- +på kommandoraden skickas omodiferade till programmet som startas. +Om +.B --retry +anges kommer +.B start-stop-daemon +kontrollera att processen har avslutats. + +Med +.B --stop +testar +.B start\-stop\-daemon +också om den angivna processen existerar, och om så är fallet sänder +.B start\-stop\-daemon +den signal som anges av +.B --signal +till den, och avslutar med status 0. +Om en sådan process inte existerar avslutar +.B start\-stop\-daemon +med status 1 (0 om +.BR --oknodo +anges). + +.SH FLAGGOR + +.TP +\fB-x\fP|\fB--exec\fP \fIprogramfil\fP +Sök efter processer som är instanser av denna programfil (enligt +.B /proc/\fIpid\fB/exe\fP +). +.TP +\fB-p\fP|\fB--pidfile\fP \fIpidfil\fP +Sök efter processer vars process-id anges i +.IR pidfil . +.TP +\fB-u\fP|\fB--user\fP \fIanvändarnamn\fP|\fIanvändar-id\fP +Sök efter processer som ägs av den användare som anges med +.I användarnamn +eller +.IR användar-id . +.TP +\fB-n\fP|\fB--name\fP \fIprocessnamn\fP +Sök efter processer med namnet +.I processnamn +(enligt +.BR /proc/\fIpid\fB/stat\fP ). +.TP +\fB-s\fP|\fB--signal\fP \fIsignal\fP +Tillsammans med +.B --stop +anger detta den signal som skall sändas till processen som stoppas (förval +är 15). +.TP +\fB-R\fP|\fB--retry\fP \fItimeout\fP|\fIschema\fP +Tillsammans med +.B --stop +anger detta att +.B start-stop-daemon +skall kontrollera att processen avslutas. +Den testar flera gånger efter matchande processer som körs, tills ingen +längrefinns kvar. +Om processerna inte avslutar kommer programmet utföra ytterligare +kommandon enligt schemat. + +Om +.I timeout +anges istället för +.I schema +kommer schemat +.IB signal / timeout /KILL/ timeout +att användas, där +.I signal +är den signal som anges med +.BR --signal . + +.I schema +är den lista med åtminstone två poster avdelade med snedstreck +.RB ( / ); +varje post är antingen +.BI - signalnummer +eller [\fB\-\fP]\fIsignalnamn\fP, +vilket betyder att signalen skall sändas, eller +.IR timeout , +vilket anger det antal sekunder programmet skall vänta på att processen +avslutar, eller +.BR forever , +vilket betyder att resten av schemat skall repetera för evigt om så behövs. + +Om slutet på schemat nås och +.BR forever +inte anges kommer +.B start-stop-daemon +avslutas med felkod 2. +Om ett schema anges kommer eventuell signal angiven med +.B --signal +att ignoreras. +.TP +\fB-a\fP|\fB--startas\fP \fIsökväg\fP +Tillsammans med +.B --start +anger detta att processen som anges med +.I sökväg +skall startas. +Om den inte anges används parametern som gavs till +.BR --exec . +.TP +.BR -t | --test +Skriver ut vad som skulle ha utförts och sätter returvärdet, men utför +ingenting. +.TP +.BR -o | --oknodo +Returnerar felstatus 0 i stället för 1 om ingen åtgärd utförs/skulle +utförts. +.TP +.BR -q | --quiet +Skriv inte informationsmeddelanden; visa endast felmeddelanden. +.TP +\fB-c\fP|\fB--chuid\fP \fIanvändarnamn\fR|\fIanvändar-id\fP +Byt till detta användarnamn/användar-id innan processen startas. +Du kan även ange en grupp genom att lägga till ett kolontecken, +.BR : , +följt av gruppnamnet eller grupp-id på samma sätt som du skull gjort till +"chown"-kommandot +(\fIanvändarefP\fB:\fP\fIgrupp\fP). +När du använder detta alternativ måste du ha i åtanke att även både primär +och tilläggs-grupp sätts, även om +.BR --group -flaggan +inte anges. +.BR --group -flaggan +är bara till för grupper som användaren normalt inte är en medlem +i (t.ex för att lägga till gruppmedlemskap för enskilda processer för +standardanvändare såsom "nobody"). +.TP +\fB-r\fP|\fB--chroot\fP \fIrot\fP +Byt katalog och rot till +.B rot +innan processen startas. +Observera att även pidfilen skrivs efter chroot har utförts. +.TP +.BR -b | --background +Används typiskt med program som inte kopplar loss sig av sig själva. +Denna flagga kommer tvinga +.B start-stop-daemon +att förgrena sig (fork) innan processen startar, och tvinga den grenen +att köra i bakgrunden. +.B VARNING: start-stop-daemon +kan inte kontrollera felstatus för processer som av +.B någon som helst +anledning misslyckas med att exekvera. +Detta är en sista utväg, och är endast avsett för program som det normalt +sett inte är någon idé att på egen hand förgrena, eller där det inte är +möjligt att lägga till koden för detta på egen hand. +.TP +.BR -N | --nicelevel +Detta ändrar prioriteten på processen innan den startas. +.TP +.BR -m | --make-pidfile +Används när ett program startas som inte skapar sin egen pidfil. +Denna flagga kommer att göra så att +.B start-stop-daemon +skapar filen som anges med +.B --pidfile +och lägga process-id i den precis innan processen startas. +Observera att den inte kommer att tas bort när programmet stoppas. +.B OBSERVERA: +Denna funktion kanske inte alltid fungerar, något som huvudsakligen gäller +när programmet som startas förgrenar sig (fork) från sin huvudprocess, och +den är därför bara användbar i samband med flaggan +.BR --background . +.TP +.BR -v | --verbose +Skriv ut pratsamma informationsmeddelanden. +.TP +.BR -H | --help +Skriv ut hjälpinformation och avsluta sedan. +.TP +.BR -V | --version +Skriv ut versionsinformation och avsluta sedan. + +.SH FÖRFATTARE +Marek Michalkiewicz , baserat på en +tidigare version av Ian Jackson . + +Manualsida av Klee Dienes , delvis omformaterad av +Ian Jackson, översatt av Peter Karlsson . + diff --git a/man/usernetctl.8 b/man/usernetctl.8 new file mode 100644 index 0000000..7049dd8 --- /dev/null +++ b/man/usernetctl.8 @@ -0,0 +1,39 @@ +.TH USERNETCTL 8 "Red Hat, Inc." "RHS" \" -*- nroff -*- +.SH NAME +usernetctl \- allow a user to manipulate a network interface if permitted +.SH SYNOPSIS +.B usernetctl +\fIinterface-name\fP up\fI|\fPdown\fI|\fPreport +.SH DESCRIPTION +.B usernetctl +checks to see if users are allowed to manipulate the network interface +specified by \fIinterface-name\fP, and then tries to bring the network +interface up or down, if up or down was specified on the command line, +or returns true or false status (respectively) if the report option was +specified. + +.B usernetctl +is not really meant to be called directly by users, though it currently +works fine that way. It is used as a wrapper by the ifup and ifdown +scripts, so that users can do exactly the same thing as root: +.nf +ifup \fIinterface-name\fP +ifdown \fIinterface-name\fP +.fi +and \fBifup\fP and \fBifdown\fP will call usernetctl automatically to +allow the interface status change. +.SH OPTIONS +.TP +.I "\fIinterface-name" +The name of the network interface to check; for example, "ppp0". For +backwards compatibility, "ifcfg-ppp0" and +"/lib/rc-scripts/ifcfg-ppp0" are also supported. +.TP +up\fI|\fPdown +Attempt to bring the interface up or down. +.TP +report +Report on whether users can bring the interface up or down. +.SH NOTES +Alternate device configurations may inherit the default configuration's +permissions. diff --git a/man/usleep.1 b/man/usleep.1 new file mode 100644 index 0000000..cd82047 --- /dev/null +++ b/man/usleep.1 @@ -0,0 +1,50 @@ +.\" +.\" Copyright 2001 Werner Fink, 2001 SuSE GmbH Nuernberg, Germany. +.\" +.\" 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. +.\" +.TH USLEEP 1 "Jan 31, 2001" "Version 1.16" "The SuSE boot concept" +.UC 1 +.SH NAME +Usleep \- sleep for the specified number of microseconds +.\" +.SH SYNOPSIS +.\" +.B usleep [ +.I usec +.B ] +.\" +.SH DESCRIPTION +.B usleep +pauses for the number of +.I usec +microseconds. The default is +.B 1 +microsecond. If +.B 0 +microseconds are specified +.BR sched_yield (2) +is called. +.\" +.SH BUGS +The +.B usleep +program uses the +.BR usleep (3) +function and therefore shows the same weaknesses +by any system activity. +\." +.SH SEE ALSO +.BR usleep (3), +.BR sleep (1), +.BR sleep (3), +.BR sched_yield (2). +\." +.SH COPYRIGHT +2001 Werner Fink, +2001 SuSE GmbH Nuernberg, Germany. +.SH AUTHOR +Werner Fink diff --git a/modules b/modules new file mode 100644 index 0000000..e510de5 --- /dev/null +++ b/modules @@ -0,0 +1,15 @@ +# /etc/modules: kernel modules to load at boot time. +# +# This file should contain the names of kernel modules that are +# to be loaded at boot time, one per line with extra args treated as modprobe +# options. +# +# Comments begin with a `#', and everything on the line after them are ignored. +# +# You can also have /etc/modules.X.Y and /etc/modules.X.Y.Z, where X.Y.Z are kernel version numbers +# The modules files are processed in exactly that order too. + +#loop + +# modules can take params as well: +#loop max_loop=256 diff --git a/modules.preudev b/modules.preudev new file mode 100644 index 0000000..303b743 --- /dev/null +++ b/modules.preudev @@ -0,0 +1,21 @@ +# /etc/modules.preudev: kernel modules to load before udev at boot time. +# +# This file should contain the names of kernel modules that are +# to be loaded before udev starts doing its magick at boot time, +# one per line with extra args treated as modprobe options. +# +# Comments begin with a `#', and everything on the line after them are ignored. +# +# You can also have /etc/modules.preudev.X.Y and /etc/modules.preudev.X.Y.Z, +# where X.Y.Z are kernel version numbers +# The modules files are processed in exactly that order too. + +# example set for DELL MD3000 array driver +#sd_mod +#sg +#mppUpper +#mptsas +#mppVhba + +# modules can take params as well: +#loop max_loop=256 diff --git a/po/Makefile.am b/po/Makefile.am new file mode 100644 index 0000000..3adbc64 --- /dev/null +++ b/po/Makefile.am @@ -0,0 +1,107 @@ +@SET_MAKE@ + + +EXTRA_DIST = @POTFILES@ @PACKAGE@.pot makepot.pl + +POTSRC = @POTSRC@ + +makepot = $(top_srcdir)/po/makepot.pl + +CATOBJEXT = .gmo +INSTOBJEXT = .mo + +SUFFIXES = .po .mo .gmo + +.po.mo: $(PACKAGE).pot + $(MSGFMT) -c --statistics -o $@ $< + +.po.gmo: $(PACKAGE).pot + file=`echo $* | awk ' { gsub(/.*\//,NIL); print $0; } '`.gmo \ + && rm -f $$file && $(GMSGFMT) -c --statistics -o $$file $< + +$(PACKAGE).pot: Makefile $(POTSRC) + LC_ALL=C $(makepot) $(POTSRC) > $(PACKAGE).po + cmp $(PACKAGE).po $(PACKAGE).pot || \ + mv $(PACKAGE).po $(PACKAGE).pot; \ + rm -f $(PACKAGE).po + +update-po: Makefile + $(MAKE) $(PACKAGE).pot + PATH=`pwd`/../src:$$PATH; \ + cd $(srcdir); \ + catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + cat=`basename $$cat`; \ + lang=`echo $$cat | awk ' { gsub(/\$(CATOBJEXT)$$/,NIL); print $0; } '`; \ + mv $$lang.po $$lang.old.po; \ + echo "$$lang:"; \ + if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \ + rm -f $$lang.old.po; \ + else \ + echo "msgmerge for $$cat failed!"; \ + rm -f $$lang.po; \ + mv $$lang.old.po $$lang.po; \ + fi; \ + done + +all-am: Makefile $(CATALOGS) + +install-data-hook: all + if test -r "$(MKINSTALLDIRS)"; then \ + $(MKINSTALLDIRS) $(DESTDIR)$(datadir); \ + else \ + $(mkinstalldirs) $(DESTDIR)$(datadir); \ + fi + @catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + cat=`basename $$cat`; \ + case "$$cat" in \ + *.gmo) destdir=$(gnulocaledir);; \ + *) destdir=$(localedir);; \ + esac; \ + lang=`echo $$cat | awk ' { gsub(/\$(CATOBJEXT)$$/,NIL); print $0; } '`; \ + dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \ + if test -r "$(MKINSTALLDIRS)"; then \ + $(MKINSTALLDIRS) $$dir; \ + else \ + $(mkinstalldirs) $$dir; \ + fi; \ + if test -r $$cat; then \ + $(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \ + echo "installing $$cat as $$dir/$(PACKAGE)$(INSTOBJEXT)"; \ + else \ + $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \ + echo "installing $(srcdir)/$$cat as" \ + "$$dir/$(PACKAGE)$(INSTOBJEXT)"; \ + fi; \ + if test -r $$cat.m; then \ + $(INSTALL_DATA) $$cat.m $$dir/$(PACKAGE)$(INSTOBJEXT).m; \ + echo "installing $$cat.m as $$dir/$(PACKAGE)$(INSTOBJEXT).m"; \ + else \ + if test -r $(srcdir)/$$cat.m ; then \ + $(INSTALL_DATA) $(srcdir)/$$cat.m \ + $$dir/$(PACKAGE)$(INSTOBJEXT).m; \ + echo "installing $(srcdir)/$$cat as" \ + "$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \ + else \ + true; \ + fi; \ + fi; \ + done + +# Define this as empty until I found a useful application. +installcheck: + +uninstall-hook: + catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + cat=`basename $$cat`; \ + lang=`echo $$cat | awk ' { gsub(/\$(CATOBJEXT)$$/,NIL); print $0; } '`; \ + rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \ + rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \ + rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \ + rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \ + done + +clean-generic: + rm -f *.gmo *.mo $(PACKAGE).pot diff --git a/po/de.po b/po/de.po new file mode 100644 index 0000000..59fcaf5 --- /dev/null +++ b/po/de.po @@ -0,0 +1,902 @@ +# German translation of rc-scripts. +# Pawel Sakowski , 2000. +# +msgid "" +msgstr "" +"Project-Id-Version: rc-scripts 0.2.6\n" +"POT-Creation-Date: 1999-07-30 18:45+0200\n" +"PO-Revision-Date: 2004-12-13 22:57+0100\n" +"Last-Translator: Pawel Sakowski \n" +"Language-Team: German \n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: .././lib/functions:911 +#, fuzzy +msgid "%s (pid %s) is running%s" +msgstr "%s (pid %s) läuft..." + +#: .././rc.d/rc.shutdown:122 +msgid "Stopping LVM volume groups" +msgstr "" + +# #### INTERFACE ##### +#: .././lib/tnldown:29 .././lib/ifdown:23 .././lib/ifup-ipx:13 +#: .././lib/tnlup:29 .././lib/ifup:27 +msgid "Usage: %s " +msgstr "Verwendung: %s " + +#: .././rc.d/init.d/network:308 +#, fuzzy +msgid "Reloading interface %s" +msgstr "Der %s-Dienst wird umgeladen" + +#: .././rc.d/rc.sysinit:133 .././rc.d/rc.sysinit:146 .././rc.d/rc.sysinit:716 +#: .././rc.d/rc.sysinit:759 .././rc.d/rc.sysinit:822 .././rc.d/rc.shutdown:82 +msgid "Unmounting file systems" +msgstr "Die Dateisysteme werden unmountet" + +#: .././lib/functions:1157 +msgid "WORK" +msgstr "LÄUFT" + +#: .././lib/functions:931 +msgid "%s is stopped" +msgstr "%s ist gestoppt" + +#: .././rc.d/rc.shutdown:169 +#, fuzzy +msgid "The $_rebootwhat is halted" +msgstr "Das System ist untergangen" + +#: .././rc.d/rc.sysinit:717 .././rc.d/rc.sysinit:760 .././rc.d/rc.sysinit:823 +#: .././rc.d/rc.shutdown:113 +msgid "Remounting root filesystem in ro mode" +msgstr "Das Root-Dateisystem wird mit Schreibschütz erneut gemountet" + +#: .././lib/ifup-ppp:111 +msgid "ifup-ppp for %s exiting" +msgstr "ifup-ppp für $DEVICE wird beendet" + +#: .././rc.d/rc.sysinit:239 .././rc.d/rc.sysinit:241 +msgid "Host:" +msgstr "Rechnername:" + +#: .././lib/ifup-sl:65 +msgid "dip started for %s on %s at %s" +msgstr "dip gestartet für %s auf %s mit %s" + +#: .././rc.d/init.d/allowlogin:52 +msgid "Users are allowed to login right now" +msgstr "" + +#: .././rc.d/init.d/netfs:121 +#, fuzzy +msgid "Unmounting NFS filesystems (retry)" +msgstr "Die NFS-Dateisysteme werden unmountet" + +#: .././rc.d/init.d/netfs:142 +#, fuzzy +msgid "Configured CIFS mountpoints: " +msgstr "Konfigurierte Tunnel:" + +#: .././rc.d/init.d/random:56 +msgid "Saving random seed" +msgstr "Das Zufallskorn wird gespeichert" + +#: .././rc.d/init.d/cpusets:54 +msgid "ERROR: CGROUP/CPUSET support not enabled in kernel" +msgstr "" + +#: .././rc.d/rc.sysinit:336 +msgid "Initializing USB keyboard" +msgstr "Die USB-Tastatur wird initialisiert" + +#: .././rc.d/init.d/local:27 +msgid "rc.local has been started" +msgstr "" + +#: .././lib/functions:370 +msgid "%s service is not running." +msgstr "Der %s-Dienst läuft nicht." + +#: .././rc.d/init.d/netfs:150 +#, fuzzy +msgid "Configured network block devices: " +msgstr "Konfigurierte Geräte:" + +#: .././rc.d/init.d/network:200 +msgid "Bringing up interface %s" +msgstr "" + +#: .././rc.d/rc.sysinit:402 +msgid "Remounting root filesystem in rw mode" +msgstr "Das Root-Dateisystem wird ohne Schreibschütz erneut gemountet" + +#: .././rc.d/rc.shutdown:188 +#, fuzzy +msgid "Please stand by while rebooting the $_rebootwhat" +msgstr "Bitte warten auf den Neustart des Systems" + +#: .././rc.d/init.d/random:74 +msgid "%d bytes of entropy available" +msgstr "" + +#: .././lib/ifup-br:86 +msgid "problems with setting bridge %s" +msgstr "" + +#: .././rc.d/rc.sysinit:141 +msgid "*** Filesystem was repaired but system needs to be" +msgstr "*** Das Dateisystem wurde repariert aber man muss das System" + +#: .././lib/functions:921 +#, fuzzy +msgid "%s dead but pid file (%s) exists" +msgstr "%s tot, aber die pid-Datei existiert" + +#: .././rc.d/init.d/cpusets:171 +msgid "Currently empty cpusets:" +msgstr "" + +#: .././rc.d/init.d/netfs:68 +msgid "Setting up Logical Volume Management" +msgstr "" + +#: .././lib/functions:1112 +#, fuzzy +msgid "Unmounting loopback filesystems (retry):" +msgstr "Die Dateisysteme werden unmountet" + +#: .././rc.d/rc.shutdown:62 +msgid "Turning off quotas for local filesystems" +msgstr "Die Quotas für die lokalen Dateisysteme werden ausgeschaltet" + +#: .././lib/functions:506 +msgid "$message" +msgstr "" + +#: .././rc.d/rc:92 +msgid "Entering non-interactive startup" +msgstr "Anfang des uninteraktiven Hochfahrens" + +#: .././lib/ifup:234 +msgid "Enabling proxy ARP on %s" +msgstr "Proxy ARP wird auf %s eingeschaltet" + +#: .././rc.d/rc.sysinit:546 .././rc.d/rc.sysinit:551 +msgid "Loading sound module" +msgstr "Das Laut-Modul wird geladen" + +#: .././rc.d/init.d/random:71 +msgid "The random data source is missing" +msgstr "Die Zufallsdatenquelle fehlt" + +#: .././rc.d/init.d/netfs:133 +msgid "/proc filesystem unavailable" +msgstr "" + +#: .././rc.d/init.d/netfs:47 +#, fuzzy +msgid "Mounting NFS filesystems" +msgstr "Die NFS-Dateisysteme werden unmountet" + +#: .././rc.d/init.d/netfs:114 +#, fuzzy +msgid "Unmounting network block filesystems" +msgstr "Die Dateisysteme werden unmountet" + +#: .././rc.d/init.d/network:13 .././rc.d/init.d/network:42 .././lib/ifup-sl:83 +#: .././lib/ifup-irda:36 .././lib/ifdown:124 .././lib/ifdown-br:35 +#: .././lib/ifup-vlan:43 .././lib/ifup-ipx:22 .././lib/ifup:91 +#: .././lib/ifup-br:35 +msgid "%s is missing. Can't continue." +msgstr "Es fehlt %s. Fortsetzen nicht möglich." + +#: .././lib/functions:994 +msgid "Loading %s kernel module(s)" +msgstr "%s-Kernmodul(e) wird/werden geladen" + +#: .././rc.d/rc.sysinit:569 +#, fuzzy +msgid "Activating ATARAID devices" +msgstr "Die RAID-Geräte werden gestartet" + +#: .././rc.d/init.d/netfs:158 +msgid "Active CIFS mountpoints: " +msgstr "" + +#: .././rc.d/init.d/network:344 +msgid "Configured devices:" +msgstr "Konfigurierte Geräte:" + +#: .././rc.d/init.d/single:27 .././rc.d/rc.shutdown:49 +msgid "Sending all processes the KILL signal" +msgstr "Das KILL-Signal wird an alle Prozesse geschickt" + +#: .././lib/ifup-vlan:56 +msgid "VLAN kernel support is missing. Can't continue." +msgstr "" + +#: .././rc.d/init.d/network:204 +msgid "Bringing up bridge interface %s" +msgstr "" + +#: .././rc.d/rc.sysinit:418 +msgid "Starting disk encryption using the RNG" +msgstr "" + +#: .././rc.d/rc.sysinit:282 .././rc.d/rc.sysinit:871 +msgid "Setting clock" +msgstr "Die Systemuhr wird eingestellt" + +#: .././rc.d/rc.sysinit:564 +msgid "Activating dm-multipath" +msgstr "" + +#: .././rc.d/init.d/cpusets:105 .././rc.d/init.d/cpusets:118 +msgid "$(nls -n " +msgstr "" + +#: .././lib/ifup-sl:44 .././lib/ifup-ppp:35 .././lib/ifup-ppp:67 +msgid "%s for %s exiting" +msgstr "%s für %s wird beendet" + +#: .././rc.d/rc.sysinit:723 +msgid "Scanning for LVM volume groups (on RAID)" +msgstr "" + +#: .././rc.d/rc.sysinit:143 +msgid "*** REBOOTING ***" +msgstr "*** NEUSTART ***" + +#: .././rc.d/rc.sysinit:142 +msgid "*** rebooted before mounting it." +msgstr "*** neustarten bevor es gemountet werden kann." + +#: .././rc.d/init.d/network:234 +msgid "Shutting down bridge interface %s" +msgstr "" + +#: .././rc.d/init.d/netfs:50 +#, fuzzy +msgid "Mounting CIFS filesystems" +msgstr "Die CIFS-Dateisysteme werden unmountet" + +#: .././rc.d/init.d/netfs:115 +#, fuzzy +msgid "Unmounting network block filesystems (retry)" +msgstr "Die SMB-Dateisysteme werden unmountet" + +#: .././rc.d/init.d/netfs:162 +msgid "Active NCP mountpoints: " +msgstr "" + +#: .././rc.d/rc.sysinit:882 +msgid "Setting %s seconds for kernel reboot after panic" +msgstr "%s Sekunden werden für den Kern-Neustart nach der Panik eingestellt" + +#: .././rc.d/rc.sysinit:339 +msgid "Initializing USB mouse" +msgstr "Die USB-Maus wird initialisiert" + +#: .././rc.d/init.d/cpusets:178 +#, fuzzy +msgid "Currently active cpusets:" +msgstr "Bereits aktive Geräte und Tunnel:" + +#: .././lib/ifup-irda:59 +msgid "problems with setting %s %s" +msgstr "Probleme beim Einstellen von %s %s" + +#: .././rc.d/init.d/netfs:87 .././rc.d/rc.sysinit:125 .././rc.d/rc.sysinit:751 +#: .././rc.d/rc.sysinit:814 +msgid "(Repair filesystem)# " +msgstr "(Dateisystem-Reparieren)# " + +#: .././rc.d/rc.sysinit:703 +msgid "*** An error occurred during the RAID startup." +msgstr "*** Während des RAID-Startens ist ein Fehler passiert." + +#: .././rc.d/init.d/netfs:76 +#, fuzzy +msgid "Checking network-attached filesystems" +msgstr "Die verschlüsselten Dateisysteme werden nachgesehen" + +#: .././rc.d/init.d/cryptsetup:36 +msgid "INSECURE OWNER FOR %s" +msgstr "" + +#: .././lib/functions.network:104 +#, fuzzy +msgid "Can't find a DHCP client." +msgstr "Kein DHCP-Klient kann gefunden werden" + +#: .././rc.d/init.d/allowlogin:47 +msgid "Delay login is not enabled" +msgstr "" + +#: .././lib/functions:928 +#, fuzzy +msgid "daemon %s dead but subsys (%s) locked" +msgstr "%s tot, aber das Subsystem gesperrt" + +#: .././rc.d/init.d/netfs:51 +#, fuzzy +msgid "Mounting NCP filesystems" +msgstr "Die NCP-Dateisysteme werden unmountet" + +#: .././rc.d/init.d/network:238 +msgid "Shutting down interface %s" +msgstr "" + +#: .././rc.d/rc.shutdown:57 +msgid "Turning off swap" +msgstr "Die Auslagerung wird ausgeschaltet" + +#: .././rc.d/init.d/network:351 +msgid "Currently active devices and tunnels:" +msgstr "Bereits aktive Geräte und Tunnel:" + +#: .././lib/ifup:120 +msgid "Disabling IPv6 autoconfiguration" +msgstr "IPv6-Autokonfiguration wird ausgeschaltet" + +#: .././rc.d/rc.sysinit:620 +msgid "Activating LVM volume groups" +msgstr "" + +#: .././lib/functions:1109 +#, fuzzy +msgid "Unmounting loopback filesystems: " +msgstr "Die Dateisysteme werden unmountet" + +#: .././rc.d/rc:258 .././rc.d/rc:259 +msgid "%sResource Manager: %sRunlevel has been reached" +msgstr "%sRessourcenmanager: %sDie Betriebsebene ist erreicht worden" + +#: .././lib/ifup-ppp:110 +#, fuzzy +msgid "%s does not exist, perhaps set $CHATSCRIPT" +msgstr "%s existiert für %s nicht" + +#: .././lib/functions:358 +msgid "Starting %s service" +msgstr "Der %s-Dienst wird gestartet" + +#: .././rc.d/init.d/netfs:146 +#, fuzzy +msgid "Configured NCP mountpoints: " +msgstr "Konfigurierte Tunnel:" + +#: .././rc.d/rc.sysinit:619 +msgid "Scanning for LVM volume groups" +msgstr "" + +#: .././lib/functions:938 +msgid "Start service %s (Y)es/(N)o/(C)ontinue? [Y] " +msgstr "Den %s-Dienst starten? (J)a/(N)ein/(W)eiterführen [J] " + +#: .././lib/functions.network:175 +msgid "Setting static RARP entries" +msgstr "Die statischen RARP-Einträge werden eingestellt" + +#: .././lib/ifdown-vlan:46 .././lib/ifup-vlan:77 +msgid "/sbin/vconfig or iproute2 with vlan support is missing. Can't continue." +msgstr "" + +#: .././rc.d/init.d/network:230 +msgid "Removing tunnel %s" +msgstr "" + +#: .././rc.d/init.d/network:346 +msgid "Configured tunnels:" +msgstr "Konfigurierte Tunnel:" + +#: .././lib/functions:362 +msgid "%s service is already running." +msgstr "Der %s-Dienst läuft bereits." + +#: .././rc.d/init.d/network:209 +msgid "Bringing up tunnel interface %s" +msgstr "" + +#: .././lib/ifup:35 +msgid "Users cannot control this device." +msgstr "Die Benutzer dürfen dieses Gerät nicht kontrollieren." + +# #### FUNCTIONS ##### +#: .././lib/functions:354 +msgid "ERROR: Networking is down. %s can't be run." +msgstr "FEHLER: Das Netzwerkwesen läuft nicht. %s kann nicht gestartet werden." + +#: .././rc.d/init.d/netfs:124 +msgid "Unmounting CIFS filesystems" +msgstr "Die CIFS-Dateisysteme werden unmountet" + +#: .././lib/ifup-sl:55 +msgid "%s does not exist" +msgstr "%s existiert nicht" + +#: .././rc.d/rc.sysinit:325 +msgid "Mounting USB filesystem" +msgstr "Die USB-Dateisysteme werden gemountet" + +#: .././rc.d/init.d/netfs:85 .././rc.d/rc.sysinit:122 .././rc.d/rc.sysinit:705 +#: .././rc.d/rc.sysinit:748 .././rc.d/rc.sysinit:811 +msgid "*** when you leave the shell." +msgstr "*** nachdem Sie die Shell verlassen haben." + +#: .././rc.d/rc.sysinit:332 +msgid "Initializing USB HID interface" +msgstr "Die USB-HID-Schnittstelle wird initialisiert" + +#: .././rc.d/rc.sysinit:708 +msgid "(RAID Repair)# " +msgstr "(RAID-Reparieren)# " + +#: .././rc.d/rc.sysinit:233 +msgid "\t\t Press %sI%s to enter interactive startup" +msgstr "\t\tDrücken sie %sI%s um interaktiv hochzufahren" + +#: .././lib/functions:906 +msgid " in cpuset %s..." +msgstr "" + +#: .././rc.d/rc.sysinit:231 +msgid "\t\t\t%sPowered by %sPLD Linux Distribution%s" +msgstr "" + +#: .././rc.d/init.d/netfs:154 +msgid "Active NFS mountpoints: " +msgstr "" + +#: .././lib/functions.network:279 +msgid "" +"Warning: Default gateway already set proably via other interface. Do you " +"need to setup GATEWAYDEV?" +msgstr "" + +# Translation of words: "DONE", "WORK", "BUSY", "FAIL", "DIED" +# must have that same count of letters !!!!!!!!!!!!!!!!!!!!!!! +#: .././rc.d/rc:149 .././lib/functions:1156 +msgid "DONE" +msgstr "GETAN" + +#: .././rc.d/rc.sysinit:786 +msgid "Checking encrypted filesystems" +msgstr "Die verschlüsselten Dateisysteme werden nachgesehen" + +#: .././lib/functions:487 +msgid "username" +msgstr "" + +#: .././rc.d/rc.sysinit:507 .././rc.d/rc.sysinit:509 +msgid "Finding module dependencies" +msgstr "Die Modul-Abhängigkeiten werden gesucht" + +#: .././rc.d/rc:89 +msgid "Entering interactive startup" +msgstr "Anfang des interaktiven Hochfahrens" + +#: .././rc.d/rc:250 +msgid "Setting up /etc/ld.so.cache" +msgstr "/etc/ld.so.cache wird eingestellt" + +#: .././rc.d/rc.shutdown:142 +msgid "Turning off RAID for %s" +msgstr "RAID wird für %s ausgeschaltet" + +#: .././rc.d/init.d/netfs:84 .././rc.d/rc.sysinit:121 .././rc.d/rc.sysinit:704 +#: .././rc.d/rc.sysinit:747 .././rc.d/rc.sysinit:810 +msgid "*** Dropping you to a shell; the system will reboot" +msgstr "*** Lasse Sie in der Shell; das System wird neustarten," + +#: .././rc.d/rc.sysinit:135 .././rc.d/rc.sysinit:148 .././rc.d/rc.sysinit:718 +#: .././rc.d/rc.sysinit:761 .././rc.d/rc.sysinit:824 +msgid "Automatic reboot in progress" +msgstr "Automatischer Neustart wird ausgeführt" + +#: .././rc.d/rc.sysinit:772 +msgid "Mounting local filesystems" +msgstr "Die lokalen Dateisysteme werden gemountet" + +#: .././rc.d/rc.shutdown:194 +msgid "Will now restart with kexec" +msgstr "" + +#: .././rc.d/rc.shutdown:171 .././rc.d/rc.shutdown:190 +msgid "On the next boot fsck will be skipped." +msgstr "Bei dem nächsten Start wird fsck ausgelassen." + +#: .././rc.d/rc.sysinit:850 +msgid "Checking filesystem quotas" +msgstr "Die Dateisystem-Quotas werden geprüft" + +#: .././rc.d/rc.sysinit:315 +msgid "Initializing USB controller" +msgstr "" + +#: .././lib/functions:1080 +msgid "$3" +msgstr "" + +#: .././rc.d/rc.sysinit:665 +msgid "Starting up RAID device %s" +msgstr "Das RAID-Gerät %s wird gestartet" + +#: .././rc.d/init.d/cryptsetup:63 +msgid "%s: no value for cipher option, skipping" +msgstr "" + +#: .././lib/ifup-ppp:258 +msgid "pppd started for %s on device %s at speed %s" +msgstr "pppd gestartet für %s auf %s mit %s" + +#: .././rc.d/init.d/cryptsetup:168 .././rc.d/rc.shutdown:164 +#, fuzzy +msgid "Stopping disk encryption" +msgstr "Der %s-Dienst wird gestoppt" + +#: .././rc.d/init.d/netfs:120 +msgid "Unmounting NFS filesystems" +msgstr "Die NFS-Dateisysteme werden unmountet" + +#: .././lib/ifup-sl:46 .././lib/ifup-sl:86 .././lib/ifup-ppp:37 +msgid "%s does not exist or is not executable for %s" +msgstr "%s für %s existiert nicht oder ist nicht ausführbar" + +#: .././rc.d/init.d/cryptsetup:77 +msgid "%s: no value for hash option, skipping" +msgstr "" + +#: .././lib/functions:366 +msgid "Stopping %s service" +msgstr "Der %s-Dienst wird gestoppt" + +#: .././rc.d/rc.sysinit:388 +msgid "Setting up ISA PNP devices (userspace pnp)" +msgstr "Die ISA-PNP-Geräte werden eingestellt (userspace pnp)" + +#: .././rc.d/rc.sysinit:590 +msgid "Discovering EVMS volumes" +msgstr "" + +#: .././rc.d/rc.shutdown:150 +msgid "Remounting remaining filesystems ro mode" +msgstr "Die übrige Dateisysteme werden mit Schreibschütz erneut gemountet" + +#: .././rc.d/init.d/netfs:83 .././rc.d/rc.sysinit:120 .././rc.d/rc.sysinit:746 +#: .././rc.d/rc.sysinit:809 +msgid "*** An error occurred during the file system check." +msgstr "*** Während des Dateisystem-Prüfens ist ein Fehler passiert." + +#: .././lib/functions:1082 +msgid "$4" +msgstr "" + +#: .././rc.d/rc.sysinit:829 +msgid "Remounting encrypted filesystems back in rw mode" +msgstr "" +"Das verschlüsselten Dateisysteme werden ohne Schreibschütz erneut gemountet" + +#: .././rc.d/init.d/cryptsetup:176 +msgid "dm-crypt module is not loaded" +msgstr "" + +#: .././lib/functions:1117 +msgid "Detaching loopback device $dev: " +msgstr "" + +#: .././lib/ifup-sl:92 +msgid "slattach started for %s on %s at %s" +msgstr "slattach gestartet für %s auf %s mit %s" + +#: .././rc.d/init.d/network:229 +msgid "Shutting down tunnel interface %s" +msgstr "" + +#: .././rc.d/rc.sysinit:305 +msgid "Activating swap partitions" +msgstr "Die Auslagerungspartitionen werden aktiviert" + +#: .././lib/ifup:99 +msgid "Enslaving %s to %s" +msgstr "" + +#: .././rc.d/rc.sysinit:855 +msgid "Turning on quotas for local filesystems" +msgstr "Die Quotas für die lokalen Dateisysteme werden eingeschaltet" + +#: .././rc.d/init.d/cpusets:37 +msgid "ERROR: CGROUP/CPUSET mounted in a way I can't recognize" +msgstr "" + +# #### RANDOM ##### +#: .././rc.d/rc.sysinit:535 +msgid "Initializing firewire controller" +msgstr "" + +#: .././lib/functions:418 +msgid "$1" +msgstr "" + +#: .././lib/ifup-ppp:117 +msgid "Setting up a new %s config file" +msgstr "" + +#: .././rc.d/rc.sysinit:736 +msgid "Checking filesystems" +msgstr "Die Dateisysteme werden nachgesehen" + +#: .././lib/functions:378 +msgid "Usage: %s" +msgstr "Verwendung: %s" + +#: .././rc.d/init.d/netfs:98 +#, fuzzy +msgid "Mounting other filesystems" +msgstr "Die lokalen Dateisysteme werden gemountet" + +#: .././rc.d/init.d/cryptsetup:164 .././rc.d/rc.sysinit:298 +#: .././rc.d/rc.sysinit:629 +#, fuzzy +msgid "Starting disk encryption" +msgstr "Der %s-Dienst wird gestartet" + +#: .././rc.d/init.d/cryptsetup:40 +msgid "Key file for %s not found, skipping" +msgstr "" + +#: .././lib/ifup:86 +msgid "Delaying %s initialization" +msgstr "" + +# #### RANDOM ##### +#: .././rc.d/init.d/random:33 +msgid "Initializing random number generator" +msgstr "Der Zufallszahlgenerator wird initialisiert" + +#: .././rc.d/init.d/cryptsetup:174 +msgid "dm-crypt module is loaded" +msgstr "" + +# #### ALLOWLOGIN ##### +#: .././rc.d/init.d/allowlogin:30 +msgid "Allowing users to login" +msgstr "Die Benutzer werden erlaubt anzumelden" + +#: .././rc.d/rc.sysinit:110 +msgid "Checking root filesystem" +msgstr "Das Root-Dateisystem wird nachgesehen" + +#: .././rc.d/rc.sysinit:439 +msgid "System bootup in progress - please wait" +msgstr "Das System wird bereits gestartet - bitte warten" + +#: .././rc.d/rc.sysinit:644 .././rc.d/rc.sysinit:700 .././rc.d/rc.sysinit:728 +msgid "Starting up RAID devices" +msgstr "Die RAID-Geräte werden gestartet" + +#: .././rc.d/init.d/cpusets:168 +#, fuzzy +msgid "Configured cpusets:" +msgstr "Konfigurierte Geräte:" + +#: .././rc.d/init.d/cpusets:105 .././rc.d/init.d/cpusets:118 +msgid "$(" +msgstr "" + +#: .././lib/functions:386 +msgid "$@" +msgstr "" + +#: .././rc.d/rc.sysinit:960 +msgid "Enabling swap space" +msgstr "Der Auslagerungsbereich wird eingeschaltet" + +#: .././rc.d/rc.sysinit:393 +msgid "Setting up ISA PNP devices (kernelspace pnp)" +msgstr "Die ISA-PNP-Geräte werden eingestellt (kernelspace pnp)" + +#: .././lib/functions:1159 +msgid "DIED" +msgstr "STARB" + +#: .././lib/functions:1011 +msgid "Could not load %s kernel module(s)" +msgstr "%s-Kernmodul(e) konnte(n) nicht geladen werden" + +# #### INIT ##### +#: .././rc.d/init.d/single:25 .././rc.d/rc.shutdown:43 +msgid "Sending all processes the TERM signal" +msgstr "Das TERM-Signal wird an alle Prozesse geschickt" + +#: .././rc.d/init.d/single:53 +msgid "Telling INIT to go to single user mode" +msgstr "INIT wird befehlt, in den Single-Modus zu gehen" + +#: .././lib/functions:1387 +msgid "$command not implemented for $name" +msgstr "" + +#: .././lib/functions:374 +msgid "Reloading %s service" +msgstr "Der %s-Dienst wird umgeladen" + +#: .././rc.d/init.d/netfs:125 +msgid "Unmounting NCP filesystems" +msgstr "Die NCP-Dateisysteme werden unmountet" + +#: .././rc.d/init.d/local:29 +msgid "rc.local has not been started" +msgstr "" + +#: .././rc.d/init.d/allowlogin:37 +#, fuzzy +msgid "System shutdown in progress\n" +msgstr "System-Herunterfahren wird ausgeführt \n" + +#: .././rc.d/rc.sysinit:437 +msgid "Enabling Delay Login" +msgstr "Verzögerte Anmeldung wird aktiviert" + +#: .././lib/functions:1155 +msgid "BUSY" +msgstr "WIRKE" + +#: .././lib/ifdown-irda:69 +msgid "ifdown-%s unable to kill %s for %s" +msgstr "ifdown-%s kann %s nicht für %s töten" + +#: .././rc.d/init.d/cryptsetup:98 +msgid "$src: No such device" +msgstr "" + +#: .././rc.d/init.d/cryptsetup:105 +msgid "%s: LUKS requires non-random key, skipping" +msgstr "" + +#: .././lib/ifup-sl:58 .././lib/ifup-ppp:113 +msgid "%s does not exist for %s" +msgstr "%s existiert für %s nicht" + +#: .././rc.d/rc.sysinit:283 .././rc.d/rc.sysinit:872 +msgid "Today`s date:" +msgstr "Das heutige Datum:" + +#: .././rc.d/init.d/network:208 +msgid "Setting tunnel %s" +msgstr "" + +#: .././rc.d/init.d/allowlogin:45 +msgid "Delay login is enabled" +msgstr "" + +#: .././rc.d/init.d/network:349 +msgid "Currently inactive devices and tunnels:" +msgstr "Bereits inaktive Geräte und Tunnel:" + +#: .././lib/ifup-sl:43 .././lib/ifup-ppp:34 .././lib/ifup-ppp:66 +msgid "%s does not exist or is not executable" +msgstr "%s existiert nicht oder ist nicht ausführbar" + +#: .././rc.d/rc:147 .././rc.d/rc:148 +msgid "%sResource Manager: %sEntering runlevel number" +msgstr "%sRessourcenmanager: %sWechsel in die Betriebsebene Nummer" + +#: .././rc.d/init.d/cryptsetup:110 +msgid "%s: options are invalid for LUKS partitions, ignoring them" +msgstr "" + +#: .././lib/functions:570 +msgid "warning: --check option is ignored!" +msgstr "Warnung: die Option --check wird ignoriert!" + +#: .././lib/functions:908 +msgid " outside of configured cpuset %s..." +msgstr "" + +#: .././rc.d/init.d/netfs:166 +msgid "Active network block devices: " +msgstr "" + +#: .././lib/functions:1158 +msgid "FAIL" +msgstr "UNGUT" + +#: .././lib/functions.network:137 .././lib/functions.network:139 +msgid "Setting static ARP entries" +msgstr "Die statischen ARP-Einträge werden eingestellt" + +#: .././rc.d/init.d/allowlogin:50 +msgid "Users are not allowed to login right now" +msgstr "" + +#: .././rc.d/rc.sysinit:246 +msgid "NIS Domain:" +msgstr "NIS-Domäne:" + +#: .././rc.d/init.d/cryptsetup:32 +msgid "INSECURE MODE FOR %s" +msgstr "" + +#: .././rc.d/rc.sysinit:724 +msgid "Activating LVM volume groups (on RAID)" +msgstr "" + +#: .././lib/ifup:180 +msgid "%s: Check cable/radio on-off switch?" +msgstr "" + +#: .././rc.d/init.d/netfs:138 +#, fuzzy +msgid "Configured NFS mountpoints: " +msgstr "Konfigurierte Tunnel:" + +#: .././lib/ifup-sl:56 .././lib/ifup-sl:84 +msgid "ifup-sl - %s exiting" +msgstr "ifup-sl - %s wird beendet" + +#: .././rc.d/init.d/network:51 +msgid "Setting interfaces names (nameif)" +msgstr "" + +#: .././rc.d/rc.sysinit:407 +msgid "Checking root filesystem quotas" +msgstr "Die Root-Dateisystem-Quotas werden nachgesehen" + +#: .././lib/ifup:179 .././lib/ifup:184 +msgid "Determining IP information for %s (%s)" +msgstr "" + +#: .././rc.d/init.d/cryptsetup:70 +msgid "%s: no value for size option, skipping" +msgstr "" + +#, fuzzy +#~ msgid "Checking %s configuration" +#~ msgstr "IPv6-Autokonfiguration wird ausgeschaltet" + +#~ msgid "Setting time zone information (%s, %s)" +#~ msgstr "Information über die Zeitzone (%s, %s) wird eingestellt" + +#~ msgid "Starting Device Filesystem Daemon" +#~ msgstr "Der Device-Dateisystem-Server wird gestartet" + +#~ msgid "Starting udev" +#~ msgstr "udev wird gestartet" + +# #### TIMEZONE ##### +#~ msgid "Setting time zone information (%s)" +#~ msgstr "Information über die Zeitzone (%s) wird eingestellt" + +#~ msgid "Usage: %s {start|stop|restart|reload|force-reload|status}" +#~ msgstr "Verwendung: %s {start|stop|restart|reload|force-reload|status}" + +#~ msgid "The random data source exists" +#~ msgstr "Die Zufallsdatenquelle existiert" + +#~ msgid "Reload %s service" +#~ msgstr "Der %s-Dienst wird umgeladen" + +#~ msgid "Turning off RAID devices" +#~ msgstr "Die RAID-Geräte werden ausgeschaltet" + +#~ msgid "Mounting Device Filesystem" +#~ msgstr "Das Device-Dateisystem wird gemountet" + +#~ msgid "Unsetting time zone information" +#~ msgstr "Information über die Zeitzone wird gelöscht" + +#~ msgid "does not exist" +#~ msgstr "existiert nicht" + +# #### NETWORK ##### +#~ msgid "Setting network parameters" +#~ msgstr "Die Netzwerkparameter werden eingestellt" + +#~ msgid "Configuring kernel parameters" +#~ msgstr "Die Kernparameter werden konfiguriert" diff --git a/po/makepot.pl b/po/makepot.pl new file mode 100755 index 0000000..cf7d816 --- /dev/null +++ b/po/makepot.pl @@ -0,0 +1,83 @@ +#!/usr/bin/perl -w + +# +# Extract messages from scripts and make pot +# +# Copyright (c) 1999 Free Software Fundation, Inc. +# Artur Frysiak +# Changes: +# 2000-08-25 Arkadiusz Miskiewicz +# - support for $(nls "xyz"), progress "xyz" and '' instead of "". +# + +my %pot; + +sub potentry { + my( $msg, $lnr, $filename ) = @_; +#print STDERR "msg = $msg\nlnr = $lnr\nfilename = $filename\n"; + if (defined $pot{"$msg"}) { + $pot{"$msg"} = $pot{"$msg"} . "\n#: $filename:$lnr"; +#print STDERR "append $msg\n"; + } else { + $pot{"$msg"} = "\n#: $filename:$lnr"; +#print STDERR "new $msg\n"; + }; +}; + +print STDERR "\n". $#ARGV . " files\n"; + +if (1) { +print <\\n\" +\"Language-Team: LANGUAGE \\n\" +\"MIME-Version: 1.0\\n\" +\"Content-Type: text/plain; charset=CHARSET\\n\" +\"Content-Transfer-Encoding: 8bit\\n\" + +# Translation of words: \"DONE\", \"WORK\", \"BUSY\", \"FAIL\", \"DIED\" +# must have that same count of letters !!!!!!!!!!!!!!!!!!!!!!! + +# \(4 + \"\\b\" * count of letters\) in one of five previous words +# msgid \"\\b\\b\\b\\b\\b\\b\\b\\b\" +EOF + +} + + +for (my $a = 0; $a <= $#ARGV; $a++) { + my $lnr = 0; + my $filename = $ARGV[$a]; + print STDERR " " .$filename . "\n"; + open (POTSRC, "< " . $filename) || die "Can't open " . $filename; + foreach () { + chop; + if ((/(run_cmd|nls|show|progress)\s[\sa-zA-Z0-9-]*"(?!(\`|\$\()nls\s[\"\'])([^"]*)"/g) or (/(run_cmd|nls|show|progress)\s[\sa-zA-Z0-9-]*'(?!(\`|\$\()nls\s[\"\'])([^"]*)'/g)) { +# potentry($1,$lnr,$filename) if defined $1; + potentry($2,$lnr,$filename) if defined $2; + potentry($3,$lnr,$filename) if defined $3; + potentry($4,$lnr,$filename) if defined $4; + potentry($5,$lnr,$filename) if defined $5; + potentry($6,$lnr,$filename) if defined $6; + potentry($7,$lnr,$filename) if defined $7; + potentry($8,$lnr,$filename) if defined $8; + potentry($9,$lnr,$filename) if defined $9; + potentry($10,$lnr,$filename) if defined $10; + potentry($11,$lnr,$filename) if defined $11; + }; + $lnr++; + }; + + close (POTSRC); + +}; + +foreach $key (keys %pot) { + print $pot{"$key"} . "\nmsgid \"$key\"\nmsgstr \"\"\n"; +}; diff --git a/po/pl.po b/po/pl.po new file mode 100644 index 0000000..9c7dfa6 --- /dev/null +++ b/po/pl.po @@ -0,0 +1,886 @@ +# Polish translation of rc-scripts. +# Copyright (C) 1999, 2000 Free Software Foundation, Inc. +# Arkadiusz Miskiewicz , 1999, 2000. +# +msgid "" +msgstr "" +"Project-Id-Version: rc-scripts 0.3.1\n" +"POT-Creation-Date: 1999-07-30 18:45+0200\n" +"PO-Revision-Date: 2004-06-28 00:00+0200\n" +"Last-Translator: rc-scripts team \n" +"Language-Team: Polish \n" +"Language: pl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: .././lib/functions:911 +msgid "%s (pid %s) is running%s" +msgstr "%s (pid %s) jest uruchomiony%s" + +#: .././rc.d/rc.shutdown:122 +msgid "Stopping LVM volume groups" +msgstr "Zatrzymywanie grup woluminów LVM" + +#: .././lib/tnldown:29 .././lib/ifdown:23 .././lib/ifup-ipx:13 +#: .././lib/tnlup:29 .././lib/ifup:27 +msgid "Usage: %s " +msgstr "Użycie: %s " + +#: .././rc.d/init.d/network:308 +msgid "Reloading interface %s" +msgstr "Przeładowywanie interfejsu %s" + +#: .././rc.d/rc.sysinit:133 .././rc.d/rc.sysinit:146 .././rc.d/rc.sysinit:716 +#: .././rc.d/rc.sysinit:759 .././rc.d/rc.sysinit:822 .././rc.d/rc.shutdown:82 +msgid "Unmounting file systems" +msgstr "Odłączanie systemów plików" + +#: .././lib/functions:1157 +msgid "WORK" +msgstr "AKTYWUJĘ" + +#: .././lib/functions:931 +msgid "%s is stopped" +msgstr "%s jest zatrzymany" + +#: .././rc.d/rc.shutdown:169 +msgid "The $_rebootwhat is halted" +msgstr "$_rebootwhat jest zatrzymany" + +#: .././rc.d/rc.sysinit:717 .././rc.d/rc.sysinit:760 .././rc.d/rc.sysinit:823 +#: .././rc.d/rc.shutdown:113 +msgid "Remounting root filesystem in ro mode" +msgstr "Przełączanie głównego systemu plików w tryb tylko do odczytu" + +#: .././lib/ifup-ppp:111 +msgid "ifup-ppp for %s exiting" +msgstr "ifup-ppp dla %s kończy" + +#: .././rc.d/rc.sysinit:239 .././rc.d/rc.sysinit:241 +msgid "Host:" +msgstr "Host:" + +#: .././lib/ifup-sl:65 +msgid "dip started for %s on %s at %s" +msgstr "dip wystartował dla %s na %s przy %s" + +#: .././rc.d/init.d/allowlogin:52 +msgid "Users are allowed to login right now" +msgstr "" + +#: .././rc.d/init.d/netfs:121 +#, fuzzy +msgid "Unmounting NFS filesystems (retry)" +msgstr "Odłączanie systemów plików NFS" + +#: .././rc.d/init.d/netfs:142 +#, fuzzy +msgid "Configured CIFS mountpoints: " +msgstr "Skonfigurowane tunele:" + +#: .././rc.d/init.d/random:56 +msgid "Saving random seed" +msgstr "Zapisanie podstawy generatora losowego" + +#: .././rc.d/init.d/cpusets:54 +#, fuzzy +msgid "ERROR: CGROUP/CPUSET support not enabled in kernel" +msgstr "" +"BŁĄD: Obsługa CPUSET nie włączona w jądrze albo /dev/cpuset nie jest " +"zamontowany" + +#: .././rc.d/rc.sysinit:336 +msgid "Initializing USB keyboard" +msgstr "Inicjalizacja klawiatury USB" + +#: .././rc.d/init.d/local:27 +msgid "rc.local has been started" +msgstr "" + +#: .././lib/functions:370 +msgid "%s service is not running." +msgstr "Usługa %s nie jest uruchomiona." + +#: .././rc.d/init.d/netfs:150 +#, fuzzy +msgid "Configured network block devices: " +msgstr "Skonfigurowane urządzenia sieciowe:" + +#: .././rc.d/init.d/network:200 +msgid "Bringing up interface %s" +msgstr "Podnoszenie interfejsu %s" + +#: .././rc.d/rc.sysinit:402 +msgid "Remounting root filesystem in rw mode" +msgstr "Przełączanie głównego systemu plików w tryb zapis/odczyt" + +#: .././rc.d/rc.shutdown:188 +msgid "Please stand by while rebooting the $_rebootwhat" +msgstr "Proszę czekać - restart systemu $_rebootwhat" + +#: .././rc.d/init.d/random:74 +msgid "%d bytes of entropy available" +msgstr "" + +#: .././lib/ifup-br:86 +msgid "problems with setting bridge %s" +msgstr "wystąpiły problemy przy ustawianiu bridge'a %s" + +#: .././rc.d/rc.sysinit:141 +msgid "*** Filesystem was repaired but system needs to be" +msgstr "*** System plików został naprawiony ale konieczny jest" + +#: .././lib/functions:921 +#, fuzzy +msgid "%s dead but pid file (%s) exists" +msgstr "%s zabity ale plik z numerem procesu istnieje" + +#: .././rc.d/init.d/cpusets:171 +msgid "Currently empty cpusets:" +msgstr "Puste cpusety:" + +#: .././rc.d/init.d/netfs:68 +msgid "Setting up Logical Volume Management" +msgstr "" + +#: .././lib/functions:1112 +#, fuzzy +msgid "Unmounting loopback filesystems (retry):" +msgstr "Odłączanie systemów plików" + +#: .././rc.d/rc.shutdown:62 +msgid "Turning off quotas for local filesystems" +msgstr "Wyłączanie quot na lokalnych systemach plików" + +#: .././lib/functions:506 +msgid "$message" +msgstr "" + +#: .././rc.d/rc:92 +msgid "Entering non-interactive startup" +msgstr "Wchodzę w tryb nieinteraktywny" + +#: .././lib/ifup:234 +msgid "Enabling proxy ARP on %s" +msgstr "" + +#: .././rc.d/rc.sysinit:546 .././rc.d/rc.sysinit:551 +msgid "Loading sound module" +msgstr "Ładowanie modułu obsługi dźwięku" + +#: .././rc.d/init.d/random:71 +msgid "The random data source is missing" +msgstr "Brak źródła losowych danych" + +#: .././rc.d/init.d/netfs:133 +msgid "/proc filesystem unavailable" +msgstr "" + +#: .././rc.d/init.d/netfs:47 +#, fuzzy +msgid "Mounting NFS filesystems" +msgstr "Odłączanie systemów plików NFS" + +#: .././rc.d/init.d/netfs:114 +#, fuzzy +msgid "Unmounting network block filesystems" +msgstr "Odłączanie systemów plików" + +#: .././rc.d/init.d/network:13 .././rc.d/init.d/network:42 .././lib/ifup-sl:83 +#: .././lib/ifup-irda:36 .././lib/ifdown:124 .././lib/ifdown-br:35 +#: .././lib/ifup-vlan:43 .././lib/ifup-ipx:22 .././lib/ifup:91 +#: .././lib/ifup-br:35 +msgid "%s is missing. Can't continue." +msgstr "%s nie jest obecny. Nie mogę kontynuować." + +#: .././lib/functions:994 +msgid "Loading %s kernel module(s)" +msgstr "Ładowanie modułu(ów) %s" + +#: .././rc.d/rc.sysinit:569 +msgid "Activating ATARAID devices" +msgstr "Ustawianie urządzeń ATARAID" + +#: .././rc.d/init.d/netfs:158 +msgid "Active CIFS mountpoints: " +msgstr "" + +#: .././rc.d/init.d/network:344 +msgid "Configured devices:" +msgstr "Skonfigurowane urządzenia sieciowe:" + +#: .././rc.d/init.d/single:27 .././rc.d/rc.shutdown:49 +msgid "Sending all processes the KILL signal" +msgstr "Wysyłanie do wszystkich procesów sygnału KILL" + +#: .././lib/ifup-vlan:56 +msgid "VLAN kernel support is missing. Can't continue." +msgstr "Brak wsparcia dla VLAN w jądrze. Nie można kontynuować." + +#: .././rc.d/init.d/network:204 +msgid "Bringing up bridge interface %s" +msgstr "Podnoszenie interfejsu mostu %s" + +#: .././rc.d/rc.sysinit:418 +msgid "Starting disk encryption using the RNG" +msgstr "" + +#: .././rc.d/rc.sysinit:282 .././rc.d/rc.sysinit:871 +msgid "Setting clock" +msgstr "Ustawianie zegara systemowego" + +#: .././rc.d/rc.sysinit:564 +msgid "Activating dm-multipath" +msgstr "" + +#: .././rc.d/init.d/cpusets:105 .././rc.d/init.d/cpusets:118 +msgid "$(nls -n " +msgstr "" + +#: .././lib/ifup-sl:44 .././lib/ifup-ppp:35 .././lib/ifup-ppp:67 +msgid "%s for %s exiting" +msgstr "%s dla %s kończy" + +#: .././rc.d/rc.sysinit:723 +msgid "Scanning for LVM volume groups (on RAID)" +msgstr "Poszukiwanie woluminów grup LVM (na RAID)" + +#: .././rc.d/rc.sysinit:143 +msgid "*** REBOOTING ***" +msgstr "*** RESTARTUJĘ ***" + +#: .././rc.d/rc.sysinit:142 +msgid "*** rebooted before mounting it." +msgstr "*** restart przez zamontowaniem go." + +#: .././rc.d/init.d/network:234 +msgid "Shutting down bridge interface %s" +msgstr "Wyłączanie interfejsu mostu %s" + +#: .././rc.d/init.d/netfs:50 +#, fuzzy +msgid "Mounting CIFS filesystems" +msgstr "Odłączanie systemów plików CIFS" + +#: .././rc.d/init.d/netfs:115 +#, fuzzy +msgid "Unmounting network block filesystems (retry)" +msgstr "Odłączanie systemów plików SMB" + +#: .././rc.d/init.d/netfs:162 +msgid "Active NCP mountpoints: " +msgstr "" + +#: .././rc.d/rc.sysinit:882 +msgid "Setting %s seconds for kernel reboot after panic" +msgstr "Restart systemu po %s sekundach od zawieszenia sie jądra" + +#: .././rc.d/rc.sysinit:339 +msgid "Initializing USB mouse" +msgstr "Inicjalizacja myszy USB" + +#: .././rc.d/init.d/cpusets:178 +msgid "Currently active cpusets:" +msgstr "Aktualnie aktywne cpuset:" + +#: .././lib/ifup-irda:59 +msgid "problems with setting %s %s" +msgstr "wystąpiły problemy przy ustawianiu %s %s" + +#: .././rc.d/init.d/netfs:87 .././rc.d/rc.sysinit:125 .././rc.d/rc.sysinit:751 +#: .././rc.d/rc.sysinit:814 +msgid "(Repair filesystem)# " +msgstr "(Naprawa systemu plików)# " + +#: .././rc.d/rc.sysinit:703 +msgid "*** An error occurred during the RAID startup." +msgstr "" +"*** Podczas inicjacji urządzeń RAID wykryto błąd niemożliwy do usunięcia." + +#: .././rc.d/init.d/netfs:76 +#, fuzzy +msgid "Checking network-attached filesystems" +msgstr "Sprawdzanie zaszyfrowanych systemów plików" + +#: .././rc.d/init.d/cryptsetup:36 +msgid "INSECURE OWNER FOR %s" +msgstr "NIEBEZPIECZNY WŁAŚCICIEL DLA %s" + +#: .././lib/functions.network:104 +msgid "Can't find a DHCP client." +msgstr "Nie mogę znaleźć klienta DHCP." + +#: .././rc.d/init.d/allowlogin:47 +msgid "Delay login is not enabled" +msgstr "Opóźnianie logowania jest nieaktywne" + +#: .././lib/functions:928 +#, fuzzy +msgid "daemon %s dead but subsys (%s) locked" +msgstr "%s zabity ale podsystem zablokowany" + +#: .././rc.d/init.d/netfs:51 +#, fuzzy +msgid "Mounting NCP filesystems" +msgstr "Odłączanie systemów plików NCP" + +#: .././rc.d/init.d/network:238 +msgid "Shutting down interface %s" +msgstr "Wyłączanie interfejsu %s" + +#: .././rc.d/rc.shutdown:57 +msgid "Turning off swap" +msgstr "Wyłączanie swapa" + +#: .././rc.d/init.d/network:351 +msgid "Currently active devices and tunnels:" +msgstr "Aktywne urządzenia sieciowe i tunele:" + +#: .././lib/ifup:120 +msgid "Disabling IPv6 autoconfiguration" +msgstr "Wyłączanie autokonfiguracji IPv6" + +#: .././rc.d/rc.sysinit:620 +msgid "Activating LVM volume groups" +msgstr "Aktywacja grup woluminów LVM" + +#: .././lib/functions:1109 +#, fuzzy +msgid "Unmounting loopback filesystems: " +msgstr "Odłączanie systemów plików" + +#: .././rc.d/rc:258 .././rc.d/rc:259 +msgid "%sResource Manager: %sRunlevel has been reached" +msgstr "%sZarządca zasobów: %sOsiągnięto poziom" + +#: .././lib/ifup-ppp:110 +msgid "%s does not exist, perhaps set $CHATSCRIPT" +msgstr "%s nie istnieje, być może ustaw $CHATSCRIPT" + +#: .././lib/functions:358 +msgid "Starting %s service" +msgstr "Uruchamianie usługi %s" + +#: .././rc.d/init.d/netfs:146 +#, fuzzy +msgid "Configured NCP mountpoints: " +msgstr "Skonfigurowane tunele:" + +#: .././rc.d/rc.sysinit:619 +msgid "Scanning for LVM volume groups" +msgstr "Poszukiwanie woluminów grup LVM" + +#: .././lib/functions:938 +msgid "Start service %s (Y)es/(N)o/(C)ontinue? [Y] " +msgstr "Uruchomić usługę %s (T)ak/(N)ie/(K)ontynuuj? [T] " + +#: .././lib/functions.network:175 +msgid "Setting static RARP entries" +msgstr "Ustawianie statycznych wpisów RARP" + +#: .././lib/ifdown-vlan:46 .././lib/ifup-vlan:77 +msgid "/sbin/vconfig or iproute2 with vlan support is missing. Can't continue." +msgstr "" +"/sbin/vconfig lub iproute2 ze wsparciem dla vlan nie znalezione. Nie można " +"kontynuować." + +#: .././rc.d/init.d/network:230 +msgid "Removing tunnel %s" +msgstr "Usuwanie tunelu %s" + +#: .././rc.d/init.d/network:346 +msgid "Configured tunnels:" +msgstr "Skonfigurowane tunele:" + +#: .././lib/functions:362 +msgid "%s service is already running." +msgstr "Usługa %s jest już uruchomiona." + +#: .././rc.d/init.d/network:209 +msgid "Bringing up tunnel interface %s" +msgstr "Podnoszenie tunelu %s" + +#: .././lib/ifup:35 +msgid "Users cannot control this device." +msgstr "Użytkownicy nie mogą kontrolować tego urządzenia." + +#: .././lib/functions:354 +msgid "ERROR: Networking is down. %s can't be run." +msgstr "BŁĄD: Sieć nie jest uruchomiona. %s nie może zostać uruchomiony." + +#: .././rc.d/init.d/netfs:124 +msgid "Unmounting CIFS filesystems" +msgstr "Odłączanie systemów plików CIFS" + +#: .././lib/ifup-sl:55 +msgid "%s does not exist" +msgstr "%s nie istnieje" + +#: .././rc.d/rc.sysinit:325 +msgid "Mounting USB filesystem" +msgstr "Montowanie systemu plików USB" + +#: .././rc.d/init.d/netfs:85 .././rc.d/rc.sysinit:122 .././rc.d/rc.sysinit:705 +#: .././rc.d/rc.sysinit:748 .././rc.d/rc.sysinit:811 +msgid "*** when you leave the shell." +msgstr "*** po opuszczeniu powłoki." + +#: .././rc.d/rc.sysinit:332 +msgid "Initializing USB HID interface" +msgstr "Inicjalizacja interfejsu USB HID" + +#: .././rc.d/rc.sysinit:708 +msgid "(RAID Repair)# " +msgstr "(Naprawa RAID)# " + +#: .././rc.d/rc.sysinit:233 +msgid "\t\t Press %sI%s to enter interactive startup" +msgstr "\t Proszę wcisnąć %sI%s żeby wejść w tryb interaktywny" + +#: .././lib/functions:906 +msgid " in cpuset %s..." +msgstr " w cpusecie %s..." + +#: .././rc.d/rc.sysinit:231 +msgid "\t\t\t%sPowered by %sPLD Linux Distribution%s" +msgstr "\t\t\t%sNapędzane przez %sPLD Linux Distribution%s" + +#: .././rc.d/init.d/netfs:154 +msgid "Active NFS mountpoints: " +msgstr "" + +#: .././lib/functions.network:279 +msgid "" +"Warning: Default gateway already set proably via other interface. Do you " +"need to setup GATEWAYDEV?" +msgstr "" + +#: .././rc.d/rc:149 .././lib/functions:1156 +msgid "DONE" +msgstr "ZROBIONE" + +#: .././rc.d/rc.sysinit:786 +msgid "Checking encrypted filesystems" +msgstr "Sprawdzanie zaszyfrowanych systemów plików" + +#: .././lib/functions:487 +msgid "username" +msgstr "" + +#: .././rc.d/rc.sysinit:507 .././rc.d/rc.sysinit:509 +msgid "Finding module dependencies" +msgstr "Wyszukiwanie powiązań pomiędzy modułami" + +#: .././rc.d/rc:89 +msgid "Entering interactive startup" +msgstr "Wchodzę w tryb interaktywny" + +#: .././rc.d/rc:250 +msgid "Setting up /etc/ld.so.cache" +msgstr "Ustawianie /etc/ld.so.cache" + +#: .././rc.d/rc.shutdown:142 +msgid "Turning off RAID for %s" +msgstr "Wyłączanie obsługi RAID dla %s" + +#: .././rc.d/init.d/netfs:84 .././rc.d/rc.sysinit:121 .././rc.d/rc.sysinit:704 +#: .././rc.d/rc.sysinit:747 .././rc.d/rc.sysinit:810 +msgid "*** Dropping you to a shell; the system will reboot" +msgstr "*** Uruchamianie powłoki; system zostanie zrestartowany" + +#: .././rc.d/rc.sysinit:135 .././rc.d/rc.sysinit:148 .././rc.d/rc.sysinit:718 +#: .././rc.d/rc.sysinit:761 .././rc.d/rc.sysinit:824 +msgid "Automatic reboot in progress" +msgstr "Automatyczny restart w toku" + +#: .././rc.d/rc.sysinit:772 +msgid "Mounting local filesystems" +msgstr "Podłączanie lokalnych systemów plików" + +#: .././rc.d/rc.shutdown:194 +msgid "Will now restart with kexec" +msgstr "" + +#: .././rc.d/rc.shutdown:171 .././rc.d/rc.shutdown:190 +msgid "On the next boot fsck will be skipped." +msgstr "Przy następnym starcie systemu program fsck będzie pominięty." + +#: .././rc.d/rc.sysinit:850 +msgid "Checking filesystem quotas" +msgstr "Sprawdzanie quot w systemach plików" + +#: .././rc.d/rc.sysinit:315 +msgid "Initializing USB controller" +msgstr "Inicjalizacja kontrolera USB" + +#: .././lib/functions:1080 +msgid "$3" +msgstr "" + +#: .././rc.d/rc.sysinit:665 +msgid "Starting up RAID device %s" +msgstr "Włączanie urządzenia RAID %s" + +#: .././rc.d/init.d/cryptsetup:63 +msgid "%s: no value for cipher option, skipping" +msgstr "" + +#: .././lib/ifup-ppp:258 +msgid "pppd started for %s on device %s at speed %s" +msgstr "pppd wystartował dla %s na %s przy prędkości %s" + +#: .././rc.d/init.d/cryptsetup:168 .././rc.d/rc.shutdown:164 +msgid "Stopping disk encryption" +msgstr "Zatrzymywanie szyfrowania dysków" + +#: .././rc.d/init.d/netfs:120 +msgid "Unmounting NFS filesystems" +msgstr "Odłączanie systemów plików NFS" + +#: .././lib/ifup-sl:46 .././lib/ifup-sl:86 .././lib/ifup-ppp:37 +msgid "%s does not exist or is not executable for %s" +msgstr "%s nie istnieje lub nie jest wykonywalny dla %s" + +#: .././rc.d/init.d/cryptsetup:77 +msgid "%s: no value for hash option, skipping" +msgstr "%s: nie podano wartości dla opcji hash, pomijam" + +#: .././lib/functions:366 +msgid "Stopping %s service" +msgstr "Zatrzymywanie usługi %s" + +#: .././rc.d/rc.sysinit:388 +msgid "Setting up ISA PNP devices (userspace pnp)" +msgstr "Ustawianie urządzeń ISA PNP (userspace pnp)" + +#: .././rc.d/rc.sysinit:590 +msgid "Discovering EVMS volumes" +msgstr "Wykrywanie woluminów EVMS" + +#: .././rc.d/rc.shutdown:150 +msgid "Remounting remaining filesystems ro mode" +msgstr "Przełączanie pozostałych systemów plików w tryb tylko do odczytu" + +#: .././rc.d/init.d/netfs:83 .././rc.d/rc.sysinit:120 .././rc.d/rc.sysinit:746 +#: .././rc.d/rc.sysinit:809 +msgid "*** An error occurred during the file system check." +msgstr "" +"*** Podczas sprawdzania systemów plików wykryto błąd niemożliwy do usunięcia." + +#: .././lib/functions:1082 +msgid "$4" +msgstr "" + +#: .././rc.d/rc.sysinit:829 +msgid "Remounting encrypted filesystems back in rw mode" +msgstr "Przełączanie zaszyfrowanych systemów plików w tryb zapis/odczyt" + +#: .././rc.d/init.d/cryptsetup:176 +msgid "dm-crypt module is not loaded" +msgstr "" + +#: .././lib/functions:1117 +msgid "Detaching loopback device $dev: " +msgstr "" + +#: .././lib/ifup-sl:92 +msgid "slattach started for %s on %s at %s" +msgstr "slattach wystartował dla %s na %s przy %s" + +#: .././rc.d/init.d/network:229 +msgid "Shutting down tunnel interface %s" +msgstr "Wyłączanie tunelu %s" + +#: .././rc.d/rc.sysinit:305 +msgid "Activating swap partitions" +msgstr "Aktywacja partycji swap" + +#: .././lib/ifup:99 +msgid "Enslaving %s to %s" +msgstr "Ustawianie %s na %s" + +#: .././rc.d/rc.sysinit:855 +msgid "Turning on quotas for local filesystems" +msgstr "Włączanie quot na lokalnych systemach plików" + +#: .././rc.d/init.d/cpusets:37 +msgid "ERROR: CGROUP/CPUSET mounted in a way I can't recognize" +msgstr "" + +#: .././rc.d/rc.sysinit:535 +msgid "Initializing firewire controller" +msgstr "Inicjalizacja kontrolera firewire" + +#: .././lib/functions:418 +msgid "$1" +msgstr "" + +#: .././lib/ifup-ppp:117 +msgid "Setting up a new %s config file" +msgstr "Ustawianie nowego pliku konfiguracyjnego %s" + +#: .././rc.d/rc.sysinit:736 +msgid "Checking filesystems" +msgstr "Sprawdzanie systemów plików" + +#: .././lib/functions:378 +msgid "Usage: %s" +msgstr "Użycie: %s" + +#: .././rc.d/init.d/netfs:98 +#, fuzzy +msgid "Mounting other filesystems" +msgstr "Podłączanie lokalnych systemów plików" + +#: .././rc.d/init.d/cryptsetup:164 .././rc.d/rc.sysinit:298 +#: .././rc.d/rc.sysinit:629 +msgid "Starting disk encryption" +msgstr "Uruchamianie szyfrowania dysków" + +#: .././rc.d/init.d/cryptsetup:40 +msgid "Key file for %s not found, skipping" +msgstr "" + +#: .././lib/ifup:86 +msgid "Delaying %s initialization" +msgstr "Opóźnianie inicjalizacji %s" + +#: .././rc.d/init.d/random:33 +msgid "Initializing random number generator" +msgstr "Inicjalizacja generatora liczb losowych" + +#: .././rc.d/init.d/cryptsetup:174 +msgid "dm-crypt module is loaded" +msgstr "" + +#: .././rc.d/init.d/allowlogin:30 +msgid "Allowing users to login" +msgstr "Zezwolenie użytkownikom na logowanie" + +#: .././rc.d/rc.sysinit:110 +msgid "Checking root filesystem" +msgstr "Sprawdzanie głównego systemu plików" + +#: .././rc.d/rc.sysinit:439 +msgid "System bootup in progress - please wait" +msgstr "Uruchamianie systemu w toku - proszę czekać" + +#: .././rc.d/rc.sysinit:644 .././rc.d/rc.sysinit:700 .././rc.d/rc.sysinit:728 +msgid "Starting up RAID devices" +msgstr "Ustawianie urządzeń RAID" + +#: .././rc.d/init.d/cpusets:168 +msgid "Configured cpusets:" +msgstr "Skonfigurowane cpusety:" + +#: .././rc.d/init.d/cpusets:105 .././rc.d/init.d/cpusets:118 +msgid "$(" +msgstr "" + +#: .././lib/functions:386 +msgid "$@" +msgstr "" + +#: .././rc.d/rc.sysinit:960 +msgid "Enabling swap space" +msgstr "Włączanie swapa" + +#: .././rc.d/rc.sysinit:393 +msgid "Setting up ISA PNP devices (kernelspace pnp)" +msgstr "Ustawianie urządzeń ISA PNP (kernelspace pnp)" + +#: .././lib/functions:1159 +msgid "DIED" +msgstr " ZGINĄŁ " + +#: .././lib/functions:1011 +msgid "Could not load %s kernel module(s)" +msgstr "Nie można załadować modułu(ów) %s" + +#: .././rc.d/init.d/single:25 .././rc.d/rc.shutdown:43 +msgid "Sending all processes the TERM signal" +msgstr "Wysyłanie do wszystkich procesów sygnału TERM" + +#: .././rc.d/init.d/single:53 +msgid "Telling INIT to go to single user mode" +msgstr "Nakazywanie procesowi INIT przejście do trybu pojedynczego użytkownika" + +#: .././lib/functions:1387 +msgid "$command not implemented for $name" +msgstr "" + +#: .././lib/functions:374 +msgid "Reloading %s service" +msgstr "Przeładowanie usługi %s" + +#: .././rc.d/init.d/netfs:125 +msgid "Unmounting NCP filesystems" +msgstr "Odłączanie systemów plików NCP" + +#: .././rc.d/init.d/local:29 +msgid "rc.local has not been started" +msgstr "" + +#: .././rc.d/init.d/allowlogin:37 +#, fuzzy +msgid "System shutdown in progress\n" +msgstr "Zamykanie systemu w toku \n" + +#: .././rc.d/rc.sysinit:437 +msgid "Enabling Delay Login" +msgstr "Włączanie opóźniania logowania" + +#: .././lib/functions:1155 +msgid "BUSY" +msgstr " ZAJĘTY " + +#: .././lib/ifdown-irda:69 +msgid "ifdown-%s unable to kill %s for %s" +msgstr "ifdown-%s nie mógł zabić %s dla %s" + +#: .././rc.d/init.d/cryptsetup:98 +msgid "$src: No such device" +msgstr "" + +#: .././rc.d/init.d/cryptsetup:105 +msgid "%s: LUKS requires non-random key, skipping" +msgstr "" + +#: .././lib/ifup-sl:58 .././lib/ifup-ppp:113 +msgid "%s does not exist for %s" +msgstr "%s nie istnieje dla %s" + +#: .././rc.d/rc.sysinit:283 .././rc.d/rc.sysinit:872 +msgid "Today`s date:" +msgstr "Dzisiejsza data:" + +#: .././rc.d/init.d/network:208 +msgid "Setting tunnel %s" +msgstr "Podnoszenie tunelu %s" + +#: .././rc.d/init.d/allowlogin:45 +msgid "Delay login is enabled" +msgstr "" + +#: .././rc.d/init.d/network:349 +msgid "Currently inactive devices and tunnels:" +msgstr "Nieaktywne urządzenia sieciowe i tunele:" + +#: .././lib/ifup-sl:43 .././lib/ifup-ppp:34 .././lib/ifup-ppp:66 +msgid "%s does not exist or is not executable" +msgstr "%s nie istnieje lub nie jest wykonywalny" + +#: .././rc.d/rc:147 .././rc.d/rc:148 +msgid "%sResource Manager: %sEntering runlevel number" +msgstr "%sZarządca zasobów: %sWejście na poziom" + +#: .././rc.d/init.d/cryptsetup:110 +msgid "%s: options are invalid for LUKS partitions, ignoring them" +msgstr "" + +#: .././lib/functions:570 +msgid "warning: --check option is ignored!" +msgstr "uwaga: opcja --check jest ignorowana!" + +#: .././lib/functions:908 +msgid " outside of configured cpuset %s..." +msgstr " poza swoim cpusetem %s..." + +#: .././rc.d/init.d/netfs:166 +msgid "Active network block devices: " +msgstr "" + +#: .././lib/functions:1158 +msgid "FAIL" +msgstr "PROBLEMY" + +#: .././lib/functions.network:137 .././lib/functions.network:139 +msgid "Setting static ARP entries" +msgstr "Ustawianie statycznych wpisów ARP" + +#: .././rc.d/init.d/allowlogin:50 +msgid "Users are not allowed to login right now" +msgstr "" + +#: .././rc.d/rc.sysinit:246 +msgid "NIS Domain:" +msgstr "Domena NIS:" + +#: .././rc.d/init.d/cryptsetup:32 +msgid "INSECURE MODE FOR %s" +msgstr "" + +#: .././rc.d/rc.sysinit:724 +msgid "Activating LVM volume groups (on RAID)" +msgstr "Aktywacja grup woluminów LVM (na RAID)" + +#: .././lib/ifup:180 +msgid "%s: Check cable/radio on-off switch?" +msgstr "" + +#: .././rc.d/init.d/netfs:138 +#, fuzzy +msgid "Configured NFS mountpoints: " +msgstr "Skonfigurowane tunele:" + +#: .././lib/ifup-sl:56 .././lib/ifup-sl:84 +msgid "ifup-sl - %s exiting" +msgstr "ifup-sl - %s kończy" + +#: .././rc.d/init.d/network:51 +msgid "Setting interfaces names (nameif)" +msgstr "Ustawianie nazw interfejsów (nameif)" + +#: .././rc.d/rc.sysinit:407 +msgid "Checking root filesystem quotas" +msgstr "Sprawdzanie quot na głównym systemie plików" + +#: .././lib/ifup:179 .././lib/ifup:184 +msgid "Determining IP information for %s (%s)" +msgstr "Ustalanie informacji IP dla %s (%s)" + +#: .././rc.d/init.d/cryptsetup:70 +msgid "%s: no value for size option, skipping" +msgstr "" + +#, fuzzy +#~ msgid "Checking %s configuration" +#~ msgstr "Wyłączanie autokonfiguracji IPv6" + +#~ msgid "The random data source exists" +#~ msgstr "Źródło losowych danych istnieje" + +#~ msgid "Setting time zone information (%s, %s)" +#~ msgstr "Ustawianie informacji o strefie czasowej (%s, %s)" + +#~ msgid "Creating cpuset %s" +#~ msgstr "Tworzenie cpusetu %s" + +#~ msgid "Setting time zone information (%s)" +#~ msgstr "Ustawianie informacji o strefie czasowej (%s)" + +#~ msgid "Reload %s service" +#~ msgstr "Przeładowanie usługi %s" + +#~ msgid "Setting default font" +#~ msgstr "Ustawianie standardowego fontu" + +#~ msgid "Turning off RAID devices" +#~ msgstr "Wyłączanie obsługi urządzeń RAID" + +#, fuzzy +#~ msgid "Removing cpuset %s" +#~ msgstr "Usuwanie cpusetu %s" + +#~ msgid "Unsetting time zone information" +#~ msgstr "Usuwanie informacji o strefie czasowej" + +#~ msgid "%s (pid %s) is running..." +#~ msgstr "%s (pid %s) jest uruchomiony..." + +#~ msgid "Setting network parameters" +#~ msgstr "Ustawianie parametrów sieci" + +#~ msgid "Configuring kernel parameters" +#~ msgstr "Ustawianie parametrów jądra" diff --git a/ppp/Makefile.am b/ppp/Makefile.am new file mode 100644 index 0000000..983058b --- /dev/null +++ b/ppp/Makefile.am @@ -0,0 +1,21 @@ +@SET_MAKE@ + +pppdir = @pppdir@ + +ppp_SCRIPTS = \ + auth-up \ + auth-down \ + ip-up \ + ip-down \ + ipx-up \ + ipx-down + +EXTRA_DIST = $(ppp_SCRIPTS) + +install-data-hook: all + ln -sf ip-up $(DESTDIR)$(pppdir)/ipv6-up + ln -sf ip-down $(DESTDIR)$(pppdir)/ipv6-down + +uninstall-hook: + rm -f $(DESTDIR)$(pppdir)/ipv6-up + rm -f $(DESTDIR)$(pppdir)/ipv6-down diff --git a/ppp/auth-down b/ppp/auth-down new file mode 100755 index 0000000..3b7cf43 --- /dev/null +++ b/ppp/auth-down @@ -0,0 +1,41 @@ +#!/bin/sh +# +# +# This script is run by the pppd _after_ the link is brought down. +# +# This script is called with the following arguments: +# Arg Name Example +# $1 Interface name ppp0 +# $2 Peer name +# $3 User name +# $4 The tty ttyS1 +# $5 The link speed 38400 + +set +e + +# The environment is cleared before executing this script +# so the path must be reset +PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin +export PATH +# These variables are for the use of the scripts run by run-parts +PPP_IFACE="$1" +PPP_PEER="$2" +PPP_USER="$3" +PPP_TTY="$4" +PPP_SPEED="$5" +export PPP_IFACE PPP_PEER PPP_USER PPP_TTY PPP_SPEED + +. /etc/rc.d/init.d/functions +. /lib/rc-scripts/functions.network +CONFIG="$PPP_IPPARAM" +source_config + +# as an additional convienince, $PPP_TTYNAME is set to the tty name, +# stripped of /dev/ (if present) for easier matching. +PPP_TTYNAME=$(basename "$PPP_TTY") +export PPP_TTYNAME + +# Main Script starts here +[ -x /etc/ppp/auth-down.local ] && /etc/ppp/auth-down.local + +exit 0 diff --git a/ppp/auth-up b/ppp/auth-up new file mode 100755 index 0000000..d117e54 --- /dev/null +++ b/ppp/auth-up @@ -0,0 +1,41 @@ +#!/bin/sh +# +# +# This script is run by the pppd after the link is established. +# +# This script is called with the following arguments: +# Arg Name Example +# $1 Interface name ppp0 +# $2 Peer name +# $3 User name +# $4 The tty ttyS1 +# $5 The link speed 38400 + +set +e + +# The environment is cleared before executing this script +# so the path must be reset +PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin +export PATH +# These variables are for the use of the scripts run by run-parts +PPP_IFACE="$1" +PPP_PEER="$2" +PPP_USER="$3" +PPP_TTY="$4" +PPP_SPEED="$5" +export PPP_IFACE PPP_PEER PPP_USER PPP_TTY PPP_SPEED + +. /etc/rc.d/init.d/functions +. /lib/rc-scripts/functions.network +CONFIG="$PPP_IPPARAM" +source_config + +# as an additional convenience, $PPP_TTYNAME is set to the tty name, +# stripped of /dev/ (if present) for easier matching. +PPP_TTYNAME=$(basename "$PPP_TTY") +export PPP_TTYNAME + +# Main script starts here. +[ -x /etc/ppp/auth-up.local ] && /etc/ppp/auth-up.local + +exit 0 diff --git a/ppp/ip-down b/ppp/ip-down new file mode 100755 index 0000000..72e0658 --- /dev/null +++ b/ppp/ip-down @@ -0,0 +1,48 @@ +#!/bin/sh +# +# This file should not be modified +# +# This script is run by the pppd _after_ the link is brought down. +# +# This script is called with the following arguments: +# Arg Name Example +# $1 Interface name ppp0 +# $2 The tty ttyS1 +# $3 The link speed 38400 +# $4 Local IP number 12.34.56.78 +# $5 Peer IP number 12.34.56.99 +# $6 Optional ``ipparam'' value foo + +set +e + +# The environment is cleared before executing this script +# so the path must be reset +PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin +export PATH +# These variables are for the use of the scripts run by run-parts +PPP_IFACE="$1" +PPP_TTY="$2" +PPP_SPEED="$3" +PPP_LOCAL="$4" +PPP_REMOTE="$5" +PPP_IPPARAM="$6" +export PPP_IFACE PPP_TTY PPP_SPEED PPP_LOCAL PPP_REMOTE PPP_IPPARAM + +. /etc/rc.d/init.d/functions +. /lib/rc-scripts/functions.network +CONFIG="/etc/sysconfig/interfaces/ifcfg-$PPP_IPPARAM" +source_config + +# as an additional convienince, $PPP_TTYNAME is set to the tty name, +# stripped of /dev/ (if present) for easier matching. +PPP_TTYNAME=$(basename "$PPP_TTY") +export PPP_TTYNAME + +# Main Script starts here +[ -x /etc/ppp/ip-down.local ] && /etc/ppp/ip-down.local + +run-parts /etc/sysconfig/interfaces/down.d/ppp + +/lib/rc-scripts/ifdown-post "${CONFIG}" + +exit 0 diff --git a/ppp/ip-down.d/Makefile.am b/ppp/ip-down.d/Makefile.am new file mode 100644 index 0000000..a74542c --- /dev/null +++ b/ppp/ip-down.d/Makefile.am @@ -0,0 +1,7 @@ +@SET_MAKE@ + +ipdowndir= @pppdir@/ip-down.d + +ipdown_SCRIPTS = logger + +EXTRA_DIST = $(ipdown_SCRIPTS) diff --git a/ppp/ip-down.d/logger b/ppp/ip-down.d/logger new file mode 100644 index 0000000..79f00a9 --- /dev/null +++ b/ppp/ip-down.d/logger @@ -0,0 +1,5 @@ +#!/bin/sh +# You can put here anything :) +# +echo " Disconnect time: $(date) from $PPP_REMOTE " >> /var/log/ppp.log +echo "+---------------------------------------------------------------+" >> /var/log/ppp.log diff --git a/ppp/ip-up b/ppp/ip-up new file mode 100755 index 0000000..5d1faad --- /dev/null +++ b/ppp/ip-up @@ -0,0 +1,48 @@ +#!/bin/sh +# +# This file should not be modified +# +# This script is run by the pppd after the link is established. +# +# This script is called with the following arguments: +# Arg Name Example +# $1 Interface name ppp0 +# $2 The tty ttyS1 +# $3 The link speed 38400 +# $4 Local IP number 12.34.56.78 +# $5 Peer IP number 12.34.56.99 +# $6 Optional ``ipparam'' value foo + +set +e + +# The environment is cleared before executing this script +# so the path must be reset +PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin +export PATH +# These variables are for the use of the scripts run by run-parts +PPP_IFACE="$1" +PPP_TTY="$2" +PPP_SPEED="$3" +PPP_LOCAL="$4" +PPP_REMOTE="$5" +PPP_IPPARAM="$6" +export PPP_IFACE PPP_TTY PPP_SPEED PPP_LOCAL PPP_REMOTE PPP_IPPARAM + +. /etc/rc.d/init.d/functions +. /lib/rc-scripts/functions.network +CONFIG="/etc/sysconfig/interfaces/ifcfg-$PPP_IPPARAM" +source_config + +# as an additional convenience, $PPP_TTYNAME is set to the tty name, +# stripped of /dev/ (if present) for easier matching. +PPP_TTYNAME=$(basename "$PPP_TTY") +export PPP_TTYNAME + +# Main Script starts here +[ -x /etc/ppp/ip-up.local ] && /etc/ppp/ip-up.local + +run-parts /etc/sysconfig/interfaces/up.d/ppp + +/lib/rc-scripts/ifup-post "$CONFIG" + +exit 0 diff --git a/ppp/ip-up.d/Makefile.am b/ppp/ip-up.d/Makefile.am new file mode 100644 index 0000000..4622300 --- /dev/null +++ b/ppp/ip-up.d/Makefile.am @@ -0,0 +1,7 @@ +@SET_MAKE@ + +ipupdir= @pppdir@/ip-up.d + +ipup_SCRIPTS = logger + +EXTRA_DIST = $(ipup_SCRIPTS) diff --git a/ppp/ip-up.d/logger b/ppp/ip-up.d/logger new file mode 100644 index 0000000..4a36a22 --- /dev/null +++ b/ppp/ip-up.d/logger @@ -0,0 +1,5 @@ +#!/bin/sh +# You can put here anything :) +# +echo "+---------------------------------------------------------------+" >> /var/log/ppp.log +echo " Connect time: $(date) with $PPP_REMOTE " >> /var/log/ppp.log diff --git a/ppp/ipx-down b/ppp/ipx-down new file mode 100755 index 0000000..74822c8 --- /dev/null +++ b/ppp/ipx-down @@ -0,0 +1,61 @@ +#!/bin/sh +# +# This file should not be modified +# +# This script is run by the pppd after the link is established. +# +# This script is called with the following arguments: +# Arg Name Example +# $1 Interface name ppp0 +# $2 The tty ttyS1 +# $3 The link speed 38400 +# $4 The network number ??? +# $5 Local IPX node address ??? +# $6 Remote IPX node address ??? +# $7 Local IPX routing protocol ??? +# $8 Remote IPX routing protocol ??? +# $9 Local IPX router name ??? +# $10 Remote IPX router name ??? +# $11 Optional ``ipparam'' value foo +# $12 PPPD pid 1276 + +set +e + +# The environment is cleared before executing this script +# so the path must be reset +PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin +export PATH +# These variables are for the use of the scripts run by run-parts +PPP_IFACE="$1" +PPP_TTY="$2" +PPP_SPEED="$3" +PPP_NETWORK="$4" +PPP_LOCAL="$5" +PPP_REMOTE="$6" +PPP_LOCAL_RPROTO="$7" +PPP_REMOTE_RPROTO="$8" +PPP_LOCAL_RNAME="$9" +PPP_REMOTE_RNAME="$10" +PPP_IPPARAM="$11" +PPP_PID="$12" + +export PPP_IFACE PPP_TTY PPP_SPEED PPP_NETWORK PPP_LOCAL PPP_REMOTE +export PPP_LOCAL_RPROTO PPP_REMOTE_RPROTO PPP_LOCAL_RNAME PPP_REMOTE_RNAME +export PPP_IPPARAM PPP_PID + +. /etc/rc.d/init.d/functions +. /lib/rc-scripts/functions.network +CONFIG="$PPP_IPPARAM" +source_config + +# as an additional convenience, $PPP_TTYNAME is set to the tty name, +# stripped of /dev/ (if present) for easier matching. +PPP_TTYNAME=$(basename "$PPP_TTY") +export PPP_TTYNAME + +# Main Script starts here +[ -x /etc/ppp/ipx-down.local ] && /etc/ppp/ipx-down.local + +run-parts /etc/sysconfig/interfaces/down.d/ipx + +exit 0 diff --git a/ppp/ipx-up b/ppp/ipx-up new file mode 100755 index 0000000..496906a --- /dev/null +++ b/ppp/ipx-up @@ -0,0 +1,66 @@ +#!/bin/sh +# +# This file should not be modified +# +# This script is run by the pppd after the link is established. +# It uses run-parts to run scripts in /etc/ppp/ip-up.d, so to add routes, +# set IP address, run the mailq etc. you should create script(s) there. +# +# Be aware that other packages may include /etc/ppp/ip-up.d scripts (named +# after that package), so choose local script names with that in mind. +# +# This script is called with the following arguments: +# Arg Name Example +# $1 Interface name ppp0 +# $2 The tty ttyS1 +# $3 The link speed 38400 +# $4 The network number ??? +# $5 Local IPX node address ??? +# $6 Remote IPX node address ??? +# $7 Local IPX routing protocol ??? +# $8 Remote IPX routing protocol ??? +# $9 Local IPX router name ??? +# $10 Remote IPX router name ??? +# $11 Optional ``ipparam'' value foo +# $12 PPPD pid 1276 + +set +e + +# The environment is cleared before executing this script +# so the path must be reset +PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin +export PATH +# These variables are for the use of the scripts run by run-parts +PPP_IFACE="$1" +PPP_TTY="$2" +PPP_SPEED="$3" +PPP_NETWORK="$4" +PPP_LOCAL="$5" +PPP_REMOTE="$6" +PPP_LOCAL_RPROTO="$7" +PPP_REMOTE_RPROTO="$8" +PPP_LOCAL_RNAME="$9" +PPP_REMOTE_RNAME="$10" +PPP_IPPARAM="$11" +PPP_PID="$12" + +export PPP_IFACE PPP_TTY PPP_SPEED PPP_NETWORK PPP_LOCAL PPP_REMOTE +export PPP_LOCAL_RPROTO PPP_REMOTE_RPROTO PPP_LOCAL_RNAME PPP_REMOTE_RNAME +export PPP_IPPARAM PPP_PID + +. /etc/rc.d/init.d/functions +. /lib/rc-scripts/functions.network +CONFIG="$PPP_IPPARAM" +source_config + +# as an additional convenience, $PPP_TTYNAME is set to the tty name, +# stripped of /dev/ (if present) for easier matching. +PPP_TTYNAME=$(basename "$PPP_TTY") +export PPP_TTYNAME + +# Main Script starts here +[ -x /etc/ppp/ipx-up.local ] && /etc/ppp/ipx-up.local + +run-parts /etc/sysconfig/interfaces/up.d/ipx + +exit 0 diff --git a/rc.d/Makefile.am b/rc.d/Makefile.am new file mode 100644 index 0000000..37abfc0 --- /dev/null +++ b/rc.d/Makefile.am @@ -0,0 +1,14 @@ +@SET_MAKE@ + +SUBDIRS = init.d + +rcdir = @rcdir@ + +rc_SCRIPTS = \ + rc \ + rc.local \ + rc.sysinit \ + rc.init \ + rc.shutdown + +EXTRA_DIST = $(rc_SCRIPTS) diff --git a/rc.d/init.d/Makefile.am b/rc.d/init.d/Makefile.am new file mode 100644 index 0000000..df44ba9 --- /dev/null +++ b/rc.d/init.d/Makefile.am @@ -0,0 +1,25 @@ +@SET_MAKE@ + +initdir = @rcdir@/init.d + +init_SCRIPTS = \ + allowlogin \ + cpusets \ + killall \ + netfs \ + network \ + random \ + single \ + sys-chroots \ + cryptsetup \ + local + +EXTRA_DIST = $(init_SCRIPTS) $(init_DATA) + +install-data-hook: all + $(LN_S) $(initdir) $(DESTDIR)$(sysconfdir)/init.d + $(LN_S) /lib/rc-scripts/functions $(DESTDIR)$(initdir)/functions + +uninstall-hook: + rm -f $(DESTDIR)$(sysconfdir)/init.d + rm -f $(DESTDIR)$(sysconfdir)/init.d/functions diff --git a/rc.d/init.d/allowlogin b/rc.d/init.d/allowlogin new file mode 100755 index 0000000..d837189 --- /dev/null +++ b/rc.d/init.d/allowlogin @@ -0,0 +1,70 @@ +#!/bin/sh +# +# allowlogin Allow users to login +# +# description: Allow users to login. +# + +[ -f /etc/sysconfig/system ] && . /etc/sysconfig/system + +# exit early without loading big init.d functions +case "$1" in +start|restart|try-restart|reload|force-reload) + # Check value + case "$DELAY_LOGIN" in + yes|Yes|YES|true|True|TRUE|on|On|ON|Y|y|1) + ;; + *) + exit 0 + ;; + esac +esac + +# Source function library. +. /etc/rc.d/init.d/functions + +start() { + if ! is_no "$DELAY_LOGIN" && [ -f /etc/nologin.boot ]; then + run_cmd "Allowing users to login" rm -f /etc/nologin /etc/nologin.boot + fi +} + +stop() { + # /etc/nologin when shutting down system + if ! is_no "$DELAY_LOGIN" && [ ! -f /etc/nologin ]; then + nls "System shutdown in progress\n" > /etc/nologin + chmod 644 /etc/nologin + cp -fp /etc/nologin /etc/nologin.boot + fi +} + +status() { + if ! is_no "$DELAY_LOGIN"; then + nls "Delay login is enabled" + else + nls "Delay login is not enabled" + fi + if [ -f /etc/nologin ]; then + nls "Users are not allowed to login right now" + else + nls "Users are allowed to login right now" + fi +} + +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + status) + status + ;; + *) + msg_usage "$0 {start|stop|status}" + exit 3 +esac + +exit 0 diff --git a/rc.d/init.d/cpusets b/rc.d/init.d/cpusets new file mode 100755 index 0000000..9199c33 --- /dev/null +++ b/rc.d/init.d/cpusets @@ -0,0 +1,196 @@ +#!/bin/sh +# +# cpusets Create/remove cpusets +# +# chkconfig: 12345 01 99 +# description: Creates/Removes all cpu sets configured to \ +# start at boot time. +# +# probe: true + + +. /etc/sysconfig/system + +if [ "${CPUSETS:-no}" = "no" ]; then + case "$1" in + start|stop|restart) + exit 0 + ;; + esac +fi + +# Source function library. +. /etc/rc.d/init.d/functions + +CGDIR= +CSUBSYS= +if grep -q "/dev/cgroup" /proc/mounts ; then + CGDIR="/dev/cgroup" +elif grep -q "/dev/cpuset" /proc/mounts ; then + CGDIR="/dev/cpuset" +fi + +if [ -n "${CGDIR}" ]; then + if [ -e ${CGDIR}/cpuset.cpus ]; then + CSUBSYS="cpuset." + elif [ ! -e ${CGDIR}/cpus ]; then + nls "ERROR: CGROUP/CPUSET mounted in a way I can't recognize" >&2 + exit 1 + fi +fi + +cpuset_mount() { + [ -n "${CGDIR}" ] && return + + if grep -q cgroup /proc/filesystems 2>/dev/null ; then + mkdir -p /dev/cpuset 2>/dev/null + mount -t cgroup none /dev/cpuset -ocpuset + CSUBSYS="cpuset." + elif grep -q cpuset /proc/filesystems 2>/dev/null ; then + mkdir -p /dev/cpuset 2>/dev/null + mount -t cpuset none /dev/cpuset + CSUBSYS="" + else + nls "ERROR: CGROUP/CPUSET support not enabled in kernel" >&2 + exit 1 + fi + CGDIR="/dev/cpuset" +} + +cpuset_create() { + local CPUS MEMS CPU_EXCLUSIVE MEM_EXCLUSIVE NOTIFY_ON_RELEASE TASKS + + . /etc/sysconfig/cpusets/cpuset-$i + + if mkdir "${CGDIR}/${NAME}" >/dev/null 2>&1 ; then + [ -n "$CPUS" ] && echo "$CPUS" >"${CGDIR}/${NAME}/${CSUBSYS}cpus" + [ -n "$MEMS" ] && echo "$MEMS" >"${CGDIR}/${NAME}/${CSUBSYS}mems" + [ -n "$CPU_EXCLUSIVE" ] && echo "$CPU_EXCLUSIVE" >"${CGDIR}/${NAME}/${CSUBSYS}cpu_exclusive" + [ -n "$MEM_EXCLUSIVE" ] && echo "$MEM_EXCLUSIVE" >"${CGDIR}/${NAME}/${CSUBSYS}mem_exclusive" + [ -n "$VIRTUALIZE" ] && echo "$VIRTUALIZE" >"${CGDIR}/${NAME}/${CSUBSYS}virtualize" + [ -n "$NOTIFY_ON_RELEASE" ] && echo "$NOTIFY_ON_RELEASE" >"${CGDIR}/${NAME}/${CSUBSYS}notify_on_release" + [ -n "$TASKS" ] && echo "$TASKS" >"${CGDIR}/${NAME}/tasks" + return 0 + fi + return 1 +} + +cpuset_remove() { + local CPUS MEMS CPU_EXCLUSIVE MEM_EXCLUSIVE NOTIFY_ON_RELEASE TASKS + + . /etc/sysconfig/cpusets/cpuset-$i + + # This MUST be rmdir (not rm -rf) + if rmdir "${CGDIR}/${NAME}" >/dev/null 2>&1 ; then + return 0 + else + return 1 + fi +} + +cpuset_empty() { + if [ $(cat "${CGDIR}/$1/tasks" 2>/dev/null | wc -c) -eq 0 ] ; then + # true returns zero + return 0 + else + # false returns one + return 1 + fi +} + +start() { + rc_splash "bootcpusets start" + + for i in $cpusets_boot; do + show "$(nls -n "Creating cpuset %s" "$i")" + if cpuset_create $i ; then + ok + else + fail + fi + done + + touch /var/lock/subsys/cpusets +} + +stop() { + for i in $cpusets_boot; do + show "$(nls -n "Removing cpuset %s" "$i")" + busy + if cpuset_empty $i; then + if cpuset_remove $i; then + ok + else + fail + fi + else + fail + fi + done + + rm -f /var/lock/subsys/cpusets >/dev/null 2>&1 +} + +# Get list of config files +# ignores editor backup files and rpm blackups +cpuset_configs() { + local match="$1" + for a in /etc/sysconfig/cpusets/$match; do + case "$a" in + *rpmorig|*rpmnew|*rpmsave|*~|*.orig) + continue + ;; + *) + echo $a + ;; + esac + done +} + +cpuset_files="$(cpuset_configs 'cpuset-*')" +cpusets_boot=$( + for i in $cpuset_files; do + ONBOOT=""; . "$i" 2>/dev/null + is_yes "$ONBOOT" && echo "${i##*/cpuset-}" + done +) + +# See how we were called. +case "$1" in + start) + cpuset_mount + start + ;; + stop) + stop + ;; + status) + nls "Configured cpusets:" + echo "$cpusets_boot" + echo + nls "Currently empty cpusets:" + for i in $(ls /dev/cpuset 2>/dev/null); do + if [ -d ${CGDIR}/$i ]; then + cpuset_empty $i && echo $i + fi + done + echo + nls "Currently active cpusets:" + for i in $(ls /dev/cpuset 2>/dev/null); do + if [ -d ${CGDIR}/$i ]; then + cpuset_empty $i || echo $i + fi + done + echo + ;; + restart) + stop + cpuset_mount + start + ;; + *) + msg_usage "$0 {start|stop|restart|status}" + exit 3 +esac + +exit 0 diff --git a/rc.d/init.d/cryptsetup b/rc.d/init.d/cryptsetup new file mode 100755 index 0000000..0e7f272 --- /dev/null +++ b/rc.d/init.d/cryptsetup @@ -0,0 +1,185 @@ +#!/bin/sh +# cryptsetup functions for rc-scripts +# if invoked standalone, processes /etc/cryptab like on boot/shutdown + +key_is_random() { + [ "$1" = "/dev/urandom" -o "$1" = "/dev/hw_random" -o "$1" = "/dev/random" ] +} + +# Because of a chicken/egg problem, init_crypto must be run twice. /var may be +# encrypted but /var/lib/random-seed is needed to initialize swap. +init_crypto() { + local have_random dst src key opt mode owner params makeswap skip arg + local param value rc ret mke2fs mdir + + # call mknodes as the dm node could be missing if device was opened from + # initrd. + # XXX: shouldn't udev handle the nodes creation here? + /sbin/dmsetup mknodes + + ret=0 + have_random=$1 + while read dst src key opt; do + [ -z "$dst" -o "${dst#\#}" != "$dst" ] && continue + [ -b "/dev/mapper/$dst" ] && continue; + if [ "$have_random" = 0 ] && key_is_random "$key"; then + continue + fi + if [ -n "$key" -a "x$key" != "xnone" ]; then + if test -e "$key" ; then + mode=$(ls -l "$key" | cut -c 5-10) + owner=$(ls -l $key | awk '{ print $3 }') + if [ "$mode" != "------" ] && ! key_is_random "$key"; then + nls "INSECURE MODE FOR %s" "$key" + ret=1 + fi + if [ "$owner" != root ]; then + nls "INSECURE OWNER FOR %s" "$key" + ret=1 + fi + else + nls "Key file for %s not found, skipping" "$dst" + continue + fi + else + key="" + fi + params="" + makeswap="" + mke2fs="" + skip="" + # Parse the options field, convert to cryptsetup parameters + # and contruct the command line + while [ -n "$opt" ]; do + arg=${opt%%,*} + opt=${opt##$arg} + opt=${opt##,} + param=${arg%%=*} + value=${arg##$param=} + + case "$param" in + cipher) + params="$params -c $value" + if [ -z "$value" ]; then + nls "%s: no value for cipher option, skipping" "$dst" + skip="yes" + fi + ;; + size) + params="$params -s $value" + if [ -z "$value" ]; then + nls "%s: no value for size option, skipping" "$dst" + skip="yes" + fi + ;; + hash) + params="$params -h $value" + if [ -z "$value" ]; then + nls "%s: no value for hash option, skipping" "$dst" + skip="yes" + fi + ;; + verify) + params="$params -y" + ;; + swap) + makeswap=yes + ;; + tmp) + mke2fs=yes + esac + done + + if [ "$skip" = "yes" ]; then + ret=1 + continue + fi + + if [ ! -b "$src" ]; then + nls "$src: No such device" + ret=1 + continue + fi + + if /sbin/cryptsetup isLuks "$src" 2>/dev/null; then + if key_is_random "$key"; then + nls "%s: LUKS requires non-random key, skipping" "$dst" + ret=1 + continue + fi + if [ -n "$params" ]; then + nls "%s: options are invalid for LUKS partitions, ignoring them" "$dst" + fi + /sbin/cryptsetup ${key:+-d $key} luksOpen "$src" "$dst" <&1 + else + /sbin/cryptsetup $params ${key:+-d $key} create "$dst" "$src" <&1 2>/dev/null + fi + rc=$? + if [ $rc -ne 0 ]; then + ret=1 + continue + fi + if [ -b "/dev/mapper/$dst" ]; then + if [ "$makeswap" = "yes" ]; then + mkswap "/dev/mapper/$dst" 2>/dev/null >/dev/null + fi + if [ "$mke2fs" = "yes" ]; then + if mke2fs "/dev/mapper/$dst" 2>/dev/null >/dev/null \ + && mdir=$(mktemp -d /tmp/mountXXXXXX); then + mount "/dev/mapper/$dst" "$mdir" && chmod 1777 "$mdir" + umount "$mdir" + rmdir "$mdir" + fi + fi + fi + done < /etc/crypttab + return $ret +} + +halt_crypto() { + local fnval=0 dst src key + while read dst src key; do + [ -z "$dst" -o "${dst#\#}" != "$dst" ] && continue + if [ -b "/dev/mapper/$dst" ]; then + if LC_ALL=C /sbin/dmsetup info "$dst" | grep -q '^Open count: *0$'; then + /sbin/cryptsetup remove "$dst" + else + fnval=1 + fi + fi + done < /etc/crypttab + return $fnval +} + +[ -f /etc/crypttab ] || return + +# if not invoked directly, return to caller +case "$0" in *cryptsetup);; *) return;; esac + +. /etc/rc.d/init.d/functions + +RETVAL=0 +# See how we were called. +case "$1" in + start) + show "Starting disk encryption"; started + init_crypto 1 && deltext; ok + ;; + stop) + show "Stopping disk encryption"; started + halt_crypto && deltext; ok + ;; + status) + # this is way overkill, but at least we have some status output... + if grep -qF dm_crypt /proc/modules; then + nls "dm-crypt module is loaded" + else + nls "dm-crypt module is not loaded" + fi + ;; + *) + msg_usage "$0 {start|stop|status}" + exit 3 +esac + +exit $RETVAL diff --git a/rc.d/init.d/killall b/rc.d/init.d/killall new file mode 100755 index 0000000..7892925 --- /dev/null +++ b/rc.d/init.d/killall @@ -0,0 +1,36 @@ +#!/bin/sh +# +# killall Script for system downing +# +# description: kill em all +# + +# Bring down all services that are still running (there shouldn't be any, so +# this is just a sanity check) + +# First set up a default search path. +export PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin" + +case "$1" in + start*) + exit 0 + ;; + stop*) + for i in /var/lock/subsys/*; do + # Check if the script is there. + [ ! -f $i ] && continue + + # Get the subsystem name. + subsys=${i#/var/lock/subsys/} + + # Bring the subsystem down. + if [ -x /etc/rc.d/init.d/$subsys ]; then + /etc/rc.d/init.d/$subsys stop + elif [ -x /etc/rc.d/init.d/$subsys.init ]; then + /etc/rc.d/init.d/$subsys.init stop + fi + done + ;; +esac + +exit 0 diff --git a/rc.d/init.d/local b/rc.d/init.d/local new file mode 100755 index 0000000..9ded073 --- /dev/null +++ b/rc.d/init.d/local @@ -0,0 +1,37 @@ +#!/bin/sh +# +# local Invoke custom scripts at startup +# chkconfig: 2345 99 01 +# +# description: This script will be executed *after* all the other init \ +# scripts. You can put your own initialization stuff in here if you don't \ +# want to do the full Sys V style init stuff. +# + +# Source function library. +. /etc/rc.d/init.d/functions + +# See how we were called. +case "$1" in + start) + msg_starting "rc.local" + . /etc/rc.d/rc.local + ok + touch /var/lock/subsys/local + ;; + stop) + rm -f /var/lock/subsys/local >/dev/null 2>&1 + ;; + status) + if [ -f /var/lock/subsys/local ]; then + nls 'rc.local has been started' + else + nls 'rc.local has not been started' + fi + ;; + *) + msg_usage "$0 {start|stop|status}" + exit 3 +esac + +exit 0 diff --git a/rc.d/init.d/netfs b/rc.d/init.d/netfs new file mode 100755 index 0000000..ab00e6d --- /dev/null +++ b/rc.d/init.d/netfs @@ -0,0 +1,208 @@ +#!/bin/sh +# +# netfs Mount network filesystems. +# +# Authors: Bill Nottingham +# AJ Lewis +# Miquel van Smoorenburg, +# +# chkconfig: 345 25 75 +# description: Mounts and unmounts all Network File System (NFS), \ +# CIFS (Lan Manager/Windows), and NCP (NetWare) mount points. + +[ -f /etc/sysconfig/network ] || exit 0 +. /etc/rc.d/init.d/functions +. /etc/rc.d/init.d/cryptsetup +. /etc/sysconfig/network + +if is_yes "$VSERVER" || [[ "$container" = lxc* ]]; then + exit 0 +fi + +# nfs uses own script for that +if [ ! -f /etc/rc.d/init.d/nfsfs ]; then + NFSFSTAB=$(LC_ALL=C awk '!/^#/ && $3 ~ /^nfs/ && $3 != "nfsd" && $4 !~ /noauto/ { print $2 }' /etc/fstab) + NFSMTAB=$(LC_ALL=C awk '$3 ~ /^nfs/ && $3 != "nfsd" && $2 != "/" { print $2 }' /proc/mounts) +fi + +CIFSFSTAB=$(LC_ALL=C awk '!/^#/ && $3 == "cifs" && $4 !~ /noauto/ { print $2 }' /etc/fstab) +NCPFSTAB=$(LC_ALL=C awk '!/^#/ && $3 == "ncpfs" && $4 !~ /noauto/ { print $2 }' /etc/fstab) +NETDEVFSTAB=$(LC_ALL=C awk '!/^#/ && $4 ~/_netdev/ && $4 !~ /noauto/ { print $1 }' /etc/fstab) + +NFSMTAB=$(LC_ALL=C awk '$3 ~ /^nfs/ && $3 != "nfsd" && $2 != "/" { print $2 }' /proc/mounts) +CIFSMTAB=$(LC_ALL=C awk '$3 == "cifs" { print $2 }' /proc/mounts) +NCPMTAB=$(LC_ALL=C awk '$3 == "ncpfs" { print $2 }' /proc/mounts) +NETDEVMTAB=$(LC_ALL=C awk '$4 ~ /_netdev/ && $2 != "/" { print $2 }' /etc/mtab) + +start() { + if [ ! -f /var/lock/subsys/network ]; then + return + fi + if [ "$(id -u)" != "0" ]; then + RETVAL=4 + return + fi + + [ -n "$NFSFSTAB" ] && { + [ ! -f /var/lock/subsys/rpcbind ] && service rpcbind start + run_cmd "Mounting NFS filesystems" mount -a -t nfs,nfs4 + } + + [ -n "$CIFSFSTAB" ] && run_cmd "Mounting CIFS filesystems" mount -a -t cifs + [ -n "$NCPFSTAB" ] && run_cmd "Mounting NCP filesystems" mount -a -t ncpfs + + [ -n "$NETDEVFSTAB" ] && { + if [ -f /etc/mdadm.conf ]; then + mdadm -A -s + fi + + if [ -f /etc/multipath.conf ] && [ -x /sbin/multipath ]; then + modprobe dm-multipath >/dev/null 2>&1 + /sbin/multipath -v 0 + if [ -x /sbin/kpartx ]; then + /sbin/dmsetup ls --target multipath --exec "/sbin/kpartx -a -p p" + fi + fi + + if [ -x /sbin/lvm ]; then + if /sbin/lvm vgscan > /dev/null 2>&1 ; then + run_cmd "Setting up Logical Volume Management" /sbin/lvm vgchange -a y + fi + fi + + if [ -f /etc/crypttab ]; then + init_crypto 1 + fi + + show "Checking network-attached filesystems"; started + initlog -c "fsck -A -T -R -a -t opts=_netdev" + rc=$? + + if [ "$rc" -gt 1 ]; then + echo + echo + nls "*** An error occurred during the file system check." + nls "*** Dropping you to a shell; the system will reboot" + nls "*** when you leave the shell." + + PS1="$(nls '(Repair filesystem)# ')"; export PS1 + [ "$SELINUX" = "1" ] && disable_selinux + if ! is_no "$RUN_SULOGIN_ON_ERR"; then + /sbin/sulogin + else + /bin/sh + fi + shutdown -r now + fi + } + + run_cmd "Mounting other filesystems" mount -a -t nonfs,nfs4,cifs,ncpfs,gfs,devpts + + touch /var/lock/subsys/netfs +} + +stop() { + # Unmount loopback stuff first + if [ "$(id -u)" != "0" ]; then + RETVAL=4 + return + fi + + __umount_loopback_loop + if [ -n "$NETDEVMTAB" ]; then + __umount_loop '$4 ~ /_netdev/ && $2 != "/" {print $2}' \ + /etc/mtab \ + "$(nls "Unmounting network block filesystems")" \ + "$(nls "Unmounting network block filesystems (retry)")" + fi + if [ -n "$NFSMTAB" ]; then + __umount_loop '$3 ~ /^nfs/ && $3 != "nfsd" && $2 != "/" {print $2}' \ + /proc/mounts \ + "$(nls "Unmounting NFS filesystems")" \ + "$(nls "Unmounting NFS filesystems (retry)")" \ + "-f -l" + fi + [ -n "$CIFSMTAB" ] && run_cmd "Unmounting CIFS filesystems" umount -a -t cifs + [ -n "$NCPMTAB" ] && run_cmd "Unmounting NCP filesystems" umount -a -t ncp,ncpfs + rm -f /var/lock/subsys/netfs +} + +status() { + [ -r /var/lock/subsys/netfs ] || RETVAL=3 + + if [ ! -f /proc/mounts ]; then + nls "/proc filesystem unavailable" + return + fi + + [ -n "$NFSFSTAB" ] && { + nls "Configured NFS mountpoints: " + for fs in $NFSFSTAB; do echo $fs; done + } + [ -n "$CIFSFSTAB" ] && { + nls "Configured CIFS mountpoints: " + for fs in $CIFSFSTAB; do echo $fs; done + } + [ -n "$NCPFSTAB" ] && { + nls "Configured NCP mountpoints: " + for fs in $NCPFSTAB; do echo $fs; done + } + [ -n "$NETDEVFSTAB" ] && { + nls "Configured network block devices: " + for fs in $NETDEVFSTAB; do echo $fs; done + } + [ -n "$NFSMTAB" ] && { + nls "Active NFS mountpoints: " + for fs in $NFSMTAB; do echo $fs; done + } + [ -n "$CIFSMTAB" ] && { + nls "Active CIFS mountpoints: " + for fs in $CIFSMTAB; do echo $fs; done + } + [ -n "$NCPMTAB" ] && { + nls "Active NCP mountpoints: " + for fs in $NCPMTAB; do echo $fs; done + } + [ -n "$NETDEVMTAB" ] && { + nls "Active network block devices: " + for fs in $NETDEVMTAB; do echo $fs; done + } +} + +RETVAL=0 +# See how we were called. +case "$1" in + start) + if is_yes "$VSERVER_ISOLATION_NET"; then + exit 0 + fi + start + ;; + stop) + if is_yes "$VSERVER_ISOLATION_NET"; then + exit 0 + fi + stop + ;; + restart) + if is_yes "$VSERVER_ISOLATION_NET"; then + exit 0 + fi + stop + start + ;; + reload) + if is_yes "$VSERVER_ISOLATION_NET"; then + exit 0 + fi + start + ;; + status) + status + ;; + *) + msg_usage "$0 {start|stop|restart|reload|status}" + exit 3 +esac + +exit $RETVAL diff --git a/rc.d/init.d/network b/rc.d/init.d/network new file mode 100755 index 0000000..3592a2b --- /dev/null +++ b/rc.d/init.d/network @@ -0,0 +1,418 @@ +#!/bin/sh +# +# network Bring up/down networking +# +# chkconfig: 2345 10 90 +# description: Activates/Deactivates all network interfaces configured to \ +# start at boot time. +# +# probe: true + +if [ ! -f /etc/sysconfig/network ]; then + . /etc/rc.d/init.d/functions + nls "%s is missing. Can't continue." "/etc/sysconfig/network" + exit 1 +fi + +. /etc/sysconfig/network + +# Source function library. +. /etc/rc.d/init.d/functions +. /lib/rc-scripts/functions.network + +# Will be removed in the future +if [ -n "$NETWORKING" ] && is_yes "$NETWORKING"; then + if [ -z "$IPV4_NETWORKING" ]; then + echo "NETWORKING is set to YES, but IPV4_NETWORKING is empty!" + echo "Please upgrade your config" + echo "Assuming you want IPv4 networking" + IPV4_NETWORKING=yes + fi +fi + +###### +# initialize networking: +# - check IPv4, IPv6, IPX can be handled by system +# - setup default IPv{4,6} interfaces policy like: +# - spoofig protection, +# - icmp echo ignore broadcasts, +# - setup lo interface +network_init() { + if [ ! -x /sbin/ip ]; then + nls "%s is missing. Can't continue." "/sbin/ip" + exit 1 + fi + + # Modprobe needed devices + modprobe_net + + # load sysctl params + apply_sysctl + + # Setup interfaces names + if ! is_empty_file /etc/mactab && [ -x /sbin/nameif ]; then + run_cmd "Setting interfaces names (nameif)" /sbin/nameif + fi + + # Kernel network parameters + sysctl -e -p /etc/sysctl.conf > /dev/null 2>&1 + + # Set UP loopback interface + set_up_loopback + + # Setup configuration + setup_nat on + setup_routes on + setup_ip_rules on + # Setup IPX + if is_yes "$IPX"; then + if [ -n $IPXAUTOPRIMARY ] ; then + if is_yes "$IPXAUTOPRIMARY"; then + IPXAUTOPRIMARY="on" + else + IPXAUTOPRIMARY="off" + fi + /sbin/ipx_configure --auto_primary=$IPXAUTOPRIMARY + fi + if [ -n $IPXAUTOFRAME ] ; then + if is_yes "$IPXAUTOFRAME"; then + IPXAUTOFRAME="on" + else + IPXAUTOFRAME="off" + fi + /sbin/ipx_configure --auto_interface=$IPXAUTOFRAME + fi + if [ -n "$IPXINTERNALNETNUM" -a "$IPXINTERNALNETNUM" != "0" ]; then + /sbin/ipx_internal_net add $IPXINTERNALNETNUM $IPXINTERNALNODENUM + fi + fi +} + +network_postinit() { + # Run this again to catch any interface-specific actions + apply_sysctl + + # Set static RARP table + static_rarp + + # Set static ARP table + static_arp +} + +###### +# deinitialize networking +# - down lo interface. +network_deinit() { + setup_routes off + setup_ip_rules off + + # Set down NAT rules + setup_nat off + # Set DOWN loopback interface + set_down_loopback +} + +# Get list of interface configs +# ignores editor backup files and rpm backups +network_interface_configs() { + local match="$1" + for a in /etc/sysconfig/interfaces/$match; do + case "$a" in + *.rpmorig|*.rpmnew|*.rpmsave|*~|*.orig) + continue + ;; + *) + echo $a + ;; + esac + done +} + +find_boot_interfaces() { + ifcfg_files="$(network_interface_configs 'ifcfg-*')" + bootprio=$(grep '^BOOTPRIO=' $ifcfg_files) + + if [ -n "$bootprio" ]; then + # find all the interfaces besides loopback. + interfaces_boot=` + for a in $(echo "$bootprio" | sort -t= -s -n -k2,2); do + i="${a%:BOOTPRIO*}" + case $i in + *ifcfg-lo) continue ;; + esac + DEVICE=""; ONBOOT=""; USERS=""; . "$i" 2>/dev/null + [ "${DEVICE:+set}" != "set" ] && continue + [ ${USERS:-no} != no ] && continue + [ ${ONBOOT:-no} = yes ] && echo "${i##*/ifcfg-}" + done + ` + else + interfaces_boot=` + for i in $ifcfg_files; do + case ${i##*/} in + ifcfg-lo|ifcfg-sit*|ifcfg-atm*|ifcfg-lec*|ifcfg-nas*|ifcfg-br*|ifcfg-macvlan*|ifcfg-macvtap*|ifcfg-*.*) continue ;; + esac + DEVICE=""; ONBOOT=""; USERS=""; . "$i" 2>/dev/null + [ "${DEVICE:+set}" != "set" ] && continue + [ ${USERS:-no} != no ] && continue + [ ${ONBOOT:-no} = yes ] && echo "${i##*/ifcfg-}" + done + ` + + interfaces_vlan_boot=` + for i in $ifcfg_files; do + case ${i##*/} in + ifcfg-*.*) ;; + *) continue ;; + esac + DEVICE=""; ONBOOT=""; USERS=""; . "$i" 2>/dev/null + [ "${DEVICE:+set}" != "set" ] && continue + [ ${USERS:-no} != no ] && continue + [ ${ONBOOT:-no} = yes ] && echo "${i##*/ifcfg-}" + done + ` + + interfaces_br_boot=` + for i in $ifcfg_files; do + case ${i##*/} in + ifcfg-br*) ;; + *) continue ;; + esac + DEVICE=""; ONBOOT=""; USERS=""; . "$i" 2>/dev/null + [ "${DEVICE:+set}" != "set" ] && continue + [ ${USERS:-no} != no ] && continue + [ ${ONBOOT:-no} = yes ] && echo "${i##*/ifcfg-}" + done + ` + + interfaces_virt_boot=` + for i in $ifcfg_files; do + case ${i##*/} in + ifcfg-macvtap*|ifcfg-macvlan*) ;; + *) continue ;; + esac + DEVICE=""; ONBOOT=""; USERS=""; . "$i" 2>/dev/null + [ "${DEVICE:+set}" != "set" ] && continue + [ ${USERS:-no} != no ] && continue + [ ${ONBOOT:-no} = yes ] && echo "${i##*/ifcfg-}" + done + ` + + interfaces_sit_boot=` + for i in $ifcfg_files; do + case ${i##*/} in + ifcfg-sit*) ;; + *) continue ;; + esac + DEVICE=""; ONBOOT=""; USERS=""; . "$i" 2>/dev/null + [ "${DEVICE:+set}" != "set" ] && continue + [ ${USERS:-no} != no ] && continue + [ ${ONBOOT:-no} = yes ] && echo "${i##*/ifcfg-}" + done + ` + fi + + tunnels=$( + for i in $(network_interface_configs 'tnlcfg-*'); do + DEVICE=""; ONBOOT=""; USERS=""; . "$i" 2>/dev/null + [ "${DEVICE:+set}" != "set" ] && continue + [ ${USERS:-no} != no ] && continue + [ ${ONBOOT:-no} = yes ] && echo "${i##*/tnlcfg-}" + done + ) +} + +start() { + rc_splash "bootnetwork start" + network_init + + for i in $interfaces_boot $interfaces_vlan_boot $interfaces_sit_boot; do + run_cmd -a "$(nls 'Bringing up interface %s' "$i")" /sbin/ifup $i boot + done + + for i in $interfaces_br_boot ; do + run_cmd -a "$(nls 'Bringing up bridge interface %s' "$i")" /sbin/ifup $i boot + done + + for i in $interfaces_virt_boot ; do + run_cmd -a "$(nls 'Bringing up virtual interface %s' "$i")" /sbin/ifup $i boot + done + + for i in $tunnels; do + run_cmd -a "$(nls 'Setting tunnel %s' "$i")" /sbin/tnlup $i boot + run_cmd -a "$(nls 'Bringing up tunnel interface %s' "$i")" /sbin/ifup tnlcfg-$i boot + done + + network_postinit + + touch /var/lock/subsys/network +} + +stop() { + # If we go to runlevel 0, 1 or 6 then umount all network fs + if [ "$RUNLEVEL" = "6" -o "$RUNLEVEL" = "0" -o "$RUNLEVEL" = "1" ]; then + if [ -x /etc/rc.d/init.d/netfs -a -f /var/lock/subsys/netfs ]; + then + /etc/rc.d/init.d/netfs stop + fi + fi + + for i in $tunnels; do + run_cmd -a "$(nls 'Shutting down tunnel interface %s' "$i")" /sbin/ifdown tnlcfg-$i boot + run_cmd -a "$(nls 'Removing tunnel %s' "$i")" /sbin/tnldown $i boot + done + + for i in $interfaces_virt_boot ; do + run_cmd -a "$(nls 'Shutting down virtual interface %s' "$i")" /sbin/ifup $i boot + done + + for i in $interfaces_br_boot ; do + run_cmd -a "$(nls 'Shutting down bridge interface %s' "$i")" /sbin/ifdown $i boot + done + + for i in $interfaces_sit_boot $interfaces_vlan_boot $interfaces_boot ; do + run_cmd -a "$(nls 'Shutting down interface %s' "$i")" /sbin/ifdown $i boot + done + + network_deinit + + rm -f /var/lock/subsys/network >/dev/null 2>&1 +} + +# Reload all active interfaces +reload() { + if [ ! -f /var/lock/subsys/network ]; then + msg_not_running network + RETVAL=7 + return + fi + + set_dhcpclient + + # if no DHCP client found we can't reload anything + if [ -z "$DHCP_CLIENT" ]; then + return + fi + + local DHCP_ARGS + case ${DHCP_CLIENT##*/} in +# pump) +# DHCP_ARGS="" +# ;; + dhcpcd) + DHCP_ARGS="-n" + ;; +# dhcpxd) +# DHCP_ARGS="" +# ;; +# dhclient) +# DHCP_ARGS="" +# ;; + *) + echo "Reloading using $DHCP_CLIENT DHCP Client is not implmemented in rc-scripts" + RETVAL=1 + return + ;; + esac + + # for IPv4 DHCP interfaces send signal to refresh interface + local dev devs=${*:-$(/sbin/ip link show | awk -F: '/UP/{print $2}')} + for dev in $devs; do + if [ ! -f /etc/sysconfig/interfaces/ifcfg-$dev ]; then + continue + fi + . /etc/sysconfig/interfaces/ifcfg-$dev + + if [ -n "$BOOTPROTO" -a "$BOOTPROTO" != "none" -a "$BOOTPROTO" != "static" ] && is_yes "$IPV4_NETWORKING"; then + case ${DHCP_CLIENT##*/} in + pump) + DHCP_ARGS="$DHCP_ARGS -i $DEVICE" + ;; + dhcpcd) + DHCP_ARGS="$DHCP_ARGS $DEVICE" + ;; + dhcpxd) + DHCP_ARGS="$DHCP_ARGS $DEVICE" + ;; + dhclient) + DHCP_ARGS="$DHCP_ARGS $DEVICE" + ;; + esac + DHCP_ARGS="$DHCP_OPTIONS $DHCP_ARGS" + + show 'Reloading interface %s' $dev + if $DHCP_CLIENT $DHCP_ARGS; then + ok + else + fail + fi + fi + done + +} + +find_boot_interfaces + +# See how we were called. +case "$1" in + start) + if is_yes "$VSERVER_ISOLATION_NET"; then + touch /var/lock/subsys/network + else + start + fi + ;; + start_init) + network_init + ;; + start_postinit) + network_postinit + touch /var/lock/subsys/network + ;; + stop_deinit) + network_deinit + rm -f /var/lock/subsys/network + ;; + stop) + if is_yes "$VSERVER_ISOLATION_NET"; then + rm -f /var/lock/subsys/network >/dev/null 2>&1 + else + stop + fi + ;; + + status) + nls "Configured devices:" + echo "lo $interfaces" + nls "Configured tunnels:" + echo "$tunnels" + echo + nls "Currently inactive devices and tunnels:" + /sbin/ip link show | awk -F":" '(/^[0-90-90-9]:/) && ! (/UP/) { print $2 }' | xargs + nls "Currently active devices and tunnels:" + /sbin/ip link show | awk -F":" ' (/UP/) { print $2 }' | xargs + ;; + + reload) + if is_yes "$VSERVER_ISOLATION_NET"; then + exit 0 + fi + shift + reload ${1:+"$@"} + ;; + + restart) + if is_yes "$VSERVER_ISOLATION_NET"; then + exit 0 + fi + + stop + start + ;; + + *) + msg_usage "$0 {start|stop|reload|restart|status}" + exit 3 +esac + +exit 0 diff --git a/rc.d/init.d/random b/rc.d/init.d/random new file mode 100755 index 0000000..342dcdc --- /dev/null +++ b/rc.d/init.d/random @@ -0,0 +1,88 @@ +#!/bin/sh +# +# random Script to snapshot random state and reload it at boot time. +# +# chkconfig: 12345 20 80 +# +# description: Saves and restores system entropy pool for higher quality \ +# random number generation. +# + +# Source function library. +. /etc/rc.d/init.d/functions + +# do nothing in vserver +if is_yes "$VSERVER"; then + return +fi + +random_seed=/var/run/random-seed + +poolfile=/proc/sys/kernel/random/poolsize +[ -r $poolfile ] && bytes="$(cat $poolfile)" || bytes=512 + +start() { + # Check if the service is already running? + if [ -f /var/lock/subsys/random ]; then + return + fi + + show "Initializing random number generator" + busy + # Carry a random seed from start-up to start-up + if [ -f $random_seed ]; then + cat $random_seed >/dev/urandom + else + touch $random_seed + fi + chmod 600 $random_seed + dd if=/dev/urandom of=$random_seed count=1 bs=$bytes 2>/dev/null + touch /var/lock/subsys/random + deltext + ok +} + +stop() { + if [ ! -f /var/lock/subsys/random ]; then + return + fi + + # Carry a random seed from shut-down to start-up + show "Saving random seed" + busy + touch $random_seed + chmod 600 $random_seed + dd if=/dev/urandom of=$random_seed count=1 bs=$bytes 2>/dev/null + + rm -f /var/lock/subsys/random >/dev/null 2>&1 + deltext + ok +} + +status() { + entropy_avail="$(cat /proc/sys/kernel/random/entropy_avail)" + if [ "$entropy_avail" -eq 0 -o ! -c /dev/random ] ; then + nls "The random data source is missing" + RETVAL=1 + else + nls "%d bytes of entropy available" $entropy_avail + fi +} + +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + status) + status + ;; + *) + msg_usage "$0 {start|stop|status}" + exit 3 +esac + +exit 0 diff --git a/rc.d/init.d/single b/rc.d/init.d/single new file mode 100755 index 0000000..09d7316 --- /dev/null +++ b/rc.d/init.d/single @@ -0,0 +1,56 @@ +#!/bin/sh +# +# single Script for sedding up administrative/rescue shell. +# +# chkconfig: 1 00 00 +# description: This file is executed by init when it goes into runlevel \ +# 1, which is the administrative state. It kills all \ +# deamons and then puts the system into single user mode. \ +# Note that the file systems are kept mounted. \ +# +# Author: Miquel van Smoorenburg, +# + +# Source function library. +. /etc/rc.d/init.d/functions + +case "$1" in + stop*) + exit 0 + ;; + start*) + # Kill all processes. + [ "${BASH+bash}" = bash ] && enable kill + + run_cmd "Sending all processes the TERM signal" killall5 -15 + sleep 5 + run_cmd "Sending all processes the KILL signal" killall5 -9 + + rm -f /var/lock/subsys/* >/dev/null 2>&1 + + # this looks nicer + [ -x /usr/bin/clear ] && /usr/bin/clear + + # make sure modprobe is working + if [ -f /proc/sys/kernel/modprobe ]; then + sysctl -w kernel.modprobe="/sbin/modprobe" >/dev/null 2>&1 + fi + + # If they want to run something in single user mode, might as well run it... + for i in /etc/rc.d/rc1.d/S[0-9][0-9]*; do + # Check if the script is there. + [ ! -f $i ] && continue + + # Don't run [KS]??foo.{rpmsave,rpmorig} scripts + [ "${i%.rpmsave}" != "${i}" ] && continue + [ "${i%.rpmorig}" != "${i}" ] && continue + [ "${i%.rpmnew}" != "${i}" ] && continue + [ "$i" = "/etc/rc.d/rc1.d/S00single" ] && continue + $i start + done + + # Now go to the single user level. + show "Telling INIT to go to single user mode"; ok + exec init -t1 S + ;; +esac diff --git a/rc.d/init.d/sys-chroots b/rc.d/init.d/sys-chroots new file mode 100755 index 0000000..b6e88ef --- /dev/null +++ b/rc.d/init.d/sys-chroots @@ -0,0 +1,178 @@ +#!/bin/sh +# +# sys-chroots Starts and stops services in chroots +# +# chkconfig: 2345 99 01 +# description: This shell script starts and stops services in chroots + +[ -r /etc/sysconfig/system ] && . /etc/sysconfig/system +[ -n "$2" ] && SYSTEM_CHROOTS="$2" + +if [ -z "$SYSTEM_CHROOTS" ]; then + case "$1" in + start|stop|restart) + exit 0 + ;; + esac +fi + +CMD="$1" + +set $(runlevel) +runlevel=$2 +previous=$1 +export runlevel previous + +[ -z "$runlevel" -o -z "$previous" -o "$runlevel" = "$previous" ] && exit 0 + +# Source function library. +. /etc/rc.d/init.d/functions + +start() { + if [ "$previous" = "N" ]; then + runlevel=5 + previous=0 + export runlevel previous + fi + + if [ -f /var/lock/subsys/sys-chroots ]; then + msg_already_running "System chroots services" + return + fi + + msg_starting "System chroots services"; started + + for dir in $SYSTEM_CHROOTS; do + [ ! -x "$dir/etc/rc.d/rc" ] && continue + msg_starting "System chroots services for $dir"; started + + # Cleaning part, keep in sync with rc.sysinit + + chroot $dir sh -c ' + . /etc/rc.d/init.d/functions + # Clear mtab + > /etc/mtab + [ -f /etc/cryptomtab ] && > /etc/cryptomtab + + # Remove stale backups + rm -f /etc/mtab~ /etc/mtab~~ /etc/cryptomtab~ /etc/cryptomtab~~ + + # Clean up /var + # I would d use find, but /usr may not be mounted. + for afile in /var/lock/* /var/run/*; do + bafile=$(basename $afile) + if [ -d "$afile" ]; then + [ "$bafile" != "news" -a "$bafile" != "sudo" -a "$bafile" != "mon" ] && rm -rf $afile/* + else + [ "$bafile" != "hwprofile" ] && rm -f $afile 2> /dev/null + fi + done + # Delete stale files + rm -f /var/lib/rpm/__db* /var/spool/postoffice/.pid.* /tmp/.X*-lock \ + /tmp/.lock.* /tmp/.gdm_socket /tmp/.s.PGSQL.* + rm -rf /tmp/.X*-unix /tmp/.ICE-unix /tmp/.font-unix /tmp/hsperfdata_* \ + /tmp/kde-* /tmp/ksocket-* /tmp/mc-* /tmp/mcop-* /tmp/orbit-* \ + /tmp/scrollkeeper-* /tmp/ssh-* + + # Clean up utmp/wtmp + rm -f /var/run/utmpx + > /var/run/utmp + if [ -e /var/log/wtmpx ]; then + if [ -e /var/log/wtmp ]; then + rm -f /var/log/wtmpx + else + mv /var/log/wtmpx /var/log/wtmp + fi + fi + touch /var/log/wtmp + chown root:utmp /var/run/utmp /var/log/wtmp + chmod 0664 /var/run/utmp /var/log/wtmp + # Clean /tmp + if is_yes "$CLEAN_TMP"; then + rm -rf /tmp/* /tmp/.[a-zA-Z0-9]* + fi + ' + + # Do our things + + # proc + chroot $dir mount -o gid=17 -t proc proc /proc + # usbfs, if available + if [ -f /proc/bus/usb/devices ]; then + chroot $dir mount -t usbfs usbfs /proc/bus/usb + fi + # sysfs is also needed before any other things (under kernel > 2.5) + if grep -q sysfs /proc/filesystems ; then + chroot $dir mount -o gid=17 -t sysfs sysfs /sys + fi + # selinux + if grep -q selinuxfs /proc/filesystems ; then + chroot $dir mount -o gid=17 -t selinuxfs selinuxfs /selinux + fi + chroot $dir mount -a + # network + [ -f /var/lock/subsys/network ] && touch $dir/var/lock/subsys/network + # other + chroot $dir /sbin/chkconfig single off + rm -f $dir/etc/rc.d/rc*.d/K*single + # run it + chroot $dir /etc/rc.d/rc $runlevel chroot + done + + touch /var/lock/subsys/sys-chroots +} + +stop() { + # Stop daemons. + if [ "$previous" = "N" ]; then + runlevel=0 + previous=5 + export runlevel previous + fi + + if [ ! -f /var/lock/subsys/sys-chroots ]; then + msg_not_running "System chroots services" + return + fi + + msg_stopping "System chroots services"; started + for dir in $SYSTEM_CHROOTS; do + [ ! -x "$dir/etc/rc.d/rc" ] && continue + msg_stopping "System chroots services for $dir"; started + rm -f $dir/var/lock/subsys/network + chroot $dir /etc/rc.d/rc $runlevel chroot + chroot $dir sh -c "grep -q selinuxfs /proc/filesystems && umount /selinux" + chroot $dir sh -c "grep -q sysfs /proc/filesystems && umount /sys" + chroot $dir umount -a + chroot $dir umount /proc + done + rm -f /var/lock/subsys/sys-chroots >/dev/null 2>&1 +} + +RETVAL=0 +# See how we were called. +case "$CMD" in + start) + start + ;; + stop) + stop + ;; + restart) + stop + start + ;; + status) + # TODO: running each service with status parameter + for dir in $SYSTEM_CHROOTS; do + echo "System chroots services for $dir" + chroot $dir /sbin/chkconfig --list + done + exit $? + ;; + *) + msg_usage "$0 {start|stop|restart|status}" + exit 3 +esac + +exit $RETVAL diff --git a/rc.d/rc b/rc.d/rc new file mode 100755 index 0000000..eba0652 --- /dev/null +++ b/rc.d/rc @@ -0,0 +1,269 @@ +#!/bin/sh +# +# rc This file is responsible for starting/stopping +# services when the runlevel changes. It is also +# responsible for the very first setup of basic +# things, such as setting the hostname. +# +# +# Original Author: +# Miquel van Smoorenburg, +# + +# avoid being interrupted by child or keyboard +trap ":" INT QUIT TSTP + +# Save argument +argv1="$1" +argv2="$2" + +# Get terminal size of standard input of the system console +[ -z "$CONSOLE" ] && CONSOLE=/dev/console +if [ -c $CONSOLE ]; then + set -- $(stty size < $CONSOLE 2>/dev/null) + LINES=$1 + COLUMNS=$2 +else + LINES= + COLUMNS= +fi +export LINES COLUMNS CONSOLE + +# NLS +if [ -f /etc/sysconfig/i18n ]; then + . /etc/sysconfig/i18n + [ -n "$LANG" ] && export LANG || unset LANG + [ -n "$LC_CTYPE" ] && export LC_CTYPE || unset LC_CTYPE + [ -n "$LC_COLLATE" ] && export LC_COLLATE || unset LC_COLLATE + [ -n "$LC_MESSAGES" ] && export LC_MESSAGES || unset LC_MESSAGES + [ -n "$LC_NUMERIC" ] && export LC_NUMERIC || unset LC_NUMERIC + [ -n "$LC_MONETARY" ] && export LC_MONETARY || unset LC_MONETARY + [ -n "$LC_TIME" ] && export LC_TIME || unset LC_TIME + [ -n "$LC_ALL" ] && export LC_ALL || unset LC_ALL + [ -n "$LANGUAGE" ] && export LANGUAGE || unset LANGUAGE + [ -n "$LINGUAS" ] && export LINGUAS || unset LINGUAS +fi + +# Source function library. +. /etc/rc.d/init.d/functions + +if [ "$argv2" != "chroot" ]; then + # Now find out what the current and what the previous runlevel are. + set $(runlevel) + runlevel=$2 + previous=$1 + export runlevel previous +fi + +# Get first argument. Set new runlevel to this argument. +[ -n "$argv1" ] && runlevel="$argv1" + +# if previous runlevel = current runlevel do nothing +[ "$runlevel" = "$previous" ] && exit 0 + +# Tell linuxconf what runlevel we are in +[ -d /var/run -a -w /var/run ] && echo "/etc/rc.d/rc$runlevel.d" > /var/run/runlevel.dir + +# if runlevel is 0 (halt) or 6 (reboot) change to first +# virtual console, and send messages to /dev/console +# (it can be serial console too) +if [ "$COLUMNS" -gt 0 ]; then + if [ "$argv2" != "chroot" ] && ! is_yes "$VSERVER" && \ + [ "$runlevel" = "0" -o "$runlevel" = "6" ]; then + CONSOLE=/dev/tty1 + [ -x /usr/bin/chvt ] && /usr/bin/chvt 1 && echo > $CONSOLE + exec 0<> /dev/console 1>&0 2>&0 + fi +else + # Serial: columns and lines are not defined + LINES=24 + COLUMNS=80 +fi + +# See if we want to be in user confirmation mode +if [ "$previous" = "N" ]; then + if ! is_yes "$VSERVER" && grep -qi confirm /proc/cmdline >/dev/null 2>/dev/null \ + || [ -f /var/run/confirm ]; then + rm -f /var/run/confirm + CONFIRM="yes" + nls "Entering interactive startup" + else + CONFIRM= + nls "Entering non-interactive startup" + fi +fi + +# calculate bootsplash variables +sscripts=0 +for i in /etc/rc.d/rc$runlevel.d/S*; do + [ ! -f $i ] && continue + [ "${1%.rpmsave}" != "${1}" ] && continue + [ "${1%.rpmorig}" != "${1}" ] && continue + [ "${1%.rpmnew}" != "${1}" ] && continue + subsys=${i#/etc/rc.d/rc$runlevel.d/S??} + [ -f /var/lock/subsys/$subsys ] && \ + [ ! -f /var/lock/subsys/${subsys}.init ] && continue + sscripts=$(( sscripts + 1 )) +done +export sscripts + +if test "$previous" != "N" ; then + kscripts=0 + for i in /etc/rc.d/rc$runlevel.d/K*; do + [ ! -f $i ] && continue + [ "${1%.rpmsave}" != "${1}" ] && continue + [ "${1%.rpmorig}" != "${1}" ] && continue + [ "${1%.rpmnew}" != "${1}" ] && continue + subsys=${i#/etc/rc.d/rc$runlevel.d/K??} + [ ! -f /var/lock/subsys/$subsys ] && \ + [ ! -f /var/lock/subsys/${subsys}.init ] && continue + kscripts=$(( kscripts + 1 )) + done + export kscripts +fi + +if test "$previous" = "N" -a "$runlevel" = "5" ; then + export progress=16 + sscripts=$(( $sscripts + 15 )) +else + export progress=0 +fi + +if is_yes "$VSERVER"; then + # if runlevel is not 0 (halt) or 6 (reboot) run rc.sysinit + # BUT only if rc is run standalone (not run by init, as init will run rc.sysinit) + if [ "$previous" != "N" -a "$runlevel" != "0" -a "$runlevel" != "6" ]; then + /etc/rc.d/rc.sysinit $runlevel + fi +fi + +# set onlcr to avoid staircase effect and do not lock scrolling +stty onlcr -ixon 0>&1 2>/dev/null + +# Say something ;) +af2=$(termput setaf $CRESMAN) +af6=$(termput setaf $CBRACKETS) +af7=$(termput op) +text="$(termput op)$(nls '%sResource Manager: %sEntering runlevel number' "$af2" "$af7")" +text_size="$(nls '%sResource Manager: %sEntering runlevel number' "" "")" +resp_size="$(nls 'DONE')" +{ + local _len=${#text_size} + local _last_col=$(($INIT_COL+${#resp_size}-${#runlevel})) + while [ $((_len++)) -lt $_last_col ]; do + text="$text." + done + echo -n "$text" +} +echo "${af6}[${af2} $runlevel ${af6}]${af7}" + +# Is there an rc directory for this new runlevel? +if [ -d /etc/rc.d/rc$runlevel.d ]; then + # First, run the KILL scripts. + for i in /etc/rc.d/rc$runlevel.d/K*; do + # Check if the script is there. + [ ! -f $i ] && continue + + # Don't run [KS]??foo.{rpmsave,rpmorig,rpmnew} scripts + [ "${1%.rpmsave}" != "${1}" ] && continue + [ "${1%.rpmorig}" != "${1}" ] && continue + [ "${1%.rpmnew}" != "${1}" ] && continue + + # Check if the subsystem is already up. + subsys=${i#/etc/rc.d/rc$runlevel.d/K??} + [ ! -f /var/lock/subsys/$subsys ] && \ + [ ! -f /var/lock/subsys/${subsys}.init ] && continue + + rc_splash "$i stop" + + # Bring the subsystem down. + $i stop + done + + # Now run the START scripts. + for i in /etc/rc.d/rc$runlevel.d/S*; do + # Check if the script is there. + [ ! -f $i ] && continue + + # Don't run [KS]??foo.{rpmsave,rpmorig} scripts + [ "${1%.rpmsave}" != "${1}" ] && continue + [ "${1%.rpmorig}" != "${1}" ] && continue + [ "${1%.rpmnew}" != "${1}" ] && continue + + # Check if the subsystem is already up. + subsys=${i#/etc/rc.d/rc$runlevel.d/S??} + [ -f /var/lock/subsys/$subsys ] || \ + [ -f /var/lock/subsys/${subsys}.init ] && continue + + # If we're in confirmation mode, get user confirmation + [ -n "$CONFIRM" ] && + { + confirm $subsys + case $? in + 0) + : + ;; + 2) + CONFIRM= + ;; + *) + continue + ;; + esac + } + + rc_splash "$i start" + # Bring the subsystem up. + $i start + done +fi + +# if runlevel is 0 (halt) or 6 (reboot) run rc.shutdown +if [ "$runlevel" = "0" ] || [ "$runlevel" = "6" ]; then + unset LANG + unset LC_CTYPE + unset LC_NUMERIC + unset LC_TIME + unset LC_COLLATE + unset LC_MONETARY + unset LC_MESSAGES + unset LC_PAPER + unset LC_NAME + unset LC_ADDRESS + unset LC_TELEPHONE + unset LC_MEASUREMENT + unset LC_IDENTIFICATION + unset LC_ALL + TMPDIR=/dev/null + export TMPDIR + if [ "$argv2" != "chroot" ]; then + exec /etc/rc.d/rc.shutdown $runlevel $previous + else + exit 0 + fi +else + if is_yes "$RUN_LDCONFIG" || [ ! -f /etc/ld.so.cache ] ; then + if [ -x /sbin/ldconfig ]; then + run_cmd "Setting up /etc/ld.so.cache" /sbin/ldconfig -X + fi + fi +fi + +rc_splash "master" + +# Say something ;) +text="$(nls '%sResource Manager: %sRunlevel has been reached' "$af2" "$af7")" +text_size="$(nls '%sResource Manager: %sRunlevel has been reached' "" "")" + +_len=${#text_size} +_last_col=$(($INIT_COL+${#resp_size}-${#runlevel})) +while [ $((_len++)) -lt $_last_col ]; do + text="$text." +done +echo -n "$text" +unset _len _last_col + +echo "${af6}[${af2} $runlevel ${af6}]${af7}" +unset af2 af6 af7 + +exit 0 diff --git a/rc.d/rc.init b/rc.d/rc.init new file mode 100755 index 0000000..221f275 --- /dev/null +++ b/rc.d/rc.init @@ -0,0 +1,26 @@ +#!/bin/sh +# +# If this script is intalled as /etc/rc.d/rc.init, +# it is executed by init(8) for every program it +# wants to spawn like this: +# +# /bin/sh /etc/rc.d/rc.init +# +# It can be used to set the default umask and ulimit +# of all processes. See initscript(5) for more details. + +[ -r /etc/sysconfig/i18n ] && . /etc/sysconfig/i18n + +[ -n "$LANG" ] && export LANG || unset LANG +[ -n "$LC_CTYPE" ] && export LC_CTYPE || unset LC_CTYPE +[ -n "$LC_COLLATE" ] && export LC_COLLATE || unset LC_COLLATE +[ -n "$LC_MESSAGES" ] && export LC_MESSAGES || unset LC_MESSAGES +[ -n "$LC_NUMERIC" ] && export LC_NUMERIC || unset LC_NUMERIC +[ -n "$LC_MONETARY" ] && export LC_MONETARY || unset LC_MONETARY +[ -n "$LC_TIME" ] && export LC_TIME || unset LC_TIME +[ -n "$LC_ALL" ] && export LC_ALL || unset LC_ALL +[ -n "$LANGUAGE" ] && export LANGUAGE || unset LANGUAGE +[ -n "$LINGUAS" ] && export LINGUAS || unset LINGUAS + +# Execute the program. +eval exec "$4" diff --git a/rc.d/rc.local b/rc.d/rc.local new file mode 100644 index 0000000..3c5265a --- /dev/null +++ b/rc.d/rc.local @@ -0,0 +1,5 @@ +# +# This script will be executed *after* all the other init scripts. +# You can put your own initialization stuff in here if you don't +# want to do the full Sys V style init stuff. + diff --git a/rc.d/rc.shutdown b/rc.d/rc.shutdown new file mode 100755 index 0000000..d86f962 --- /dev/null +++ b/rc.d/rc.shutdown @@ -0,0 +1,184 @@ +#!/bin/sh +# +# shutdown Common script for system halt/reboot. +# +# Author: Miquel van Smoorenburg, +# + +# Set the path. +PATH=/sbin:/bin:/usr/bin:/usr/sbin + +# move to root dir +cd / + +IN_SHUTDOWN=yes + +. /etc/rc.d/init.d/functions + +# avoid keyboard interruption +trap "echo" INT SEGV QUIT TERM +set +e + +rc_splash "reboot" + +# Kill all processes. +[ "${BASH+bash}" = bash ] && enable kill + +runlevel=$1 +previous=$2 + +# Stop blogd before umounting /var +if [ -x /sbin/blogd ]; then + killall -q -QUIT blogd +fi + +if [ -e /dev/rtc -o -e /dev/rtc0 ]; then + run_cmd "$(nls 'Syncing hardware clock to system time')" hwclock --systohc +fi + +# check for other processes. +# there could be none if all services were terminated properly +# pgrep -g 0 requires procps >= 3.2.6-1.1 +# XXX: pgrep is on /usr! +pids=$(pgrep -g 0 -l -v | grep -v '^1 ') +if [ -n "$pids" ] || [ ! -x /usr/bin/pgrep ]; then + run_cmd "Sending all processes the TERM signal" killall5 -15 +fi + +pids=$(pgrep -g 0 -l -v | grep -v '^1 ') +if [ -n "$pids" ] || [ ! -x /usr/bin/pgrep ]; then + sleep 5 + run_cmd "Sending all processes the KILL signal" killall5 -9 +fi + +# Write to wtmp file before unmounting /var +halt -w + +if ! is_yes "$VSERVER"; then + # Turn off swap, then unmount file systems. + run_cmd "Turning off swap" swapoff -a + + [ -x /etc/rc.d/rc.acct ] && /etc/rc.d/rc.acct stop + + if [ -x /sbin/quotaoff ]; then + run_cmd "Turning off quotas for local filesystems" /sbin/quotaoff -a + fi + + # grab kexec_loaded state before we umount /sys + kexec_loaded=`cat /sys/kernel/kexec_loaded 2>/dev/null` + + # Unmount file systems, killing processes if we have to. + sig=-15 + retry=3 + force= + if [ -z "$UMOUNT_IGNORE" ]; then + UMOUNT_IGNORE="/" + else + UMOUNT_IGNORE="/ $UMOUNT_IGNORE" + fi + remaining=$(awk -v ig="^($UMOUNT_IGNORE)$" 'BEGIN { gsub(/[\t ]+/, "|", ig); } \ + $3 !~ /^(proc|loopfs|devpts|devtmpfs|shm|iso9660|ramfs|tmpfs|sysfs|securityfs|squashfs)$/ \ + && $1 !~ /^(none|\/dev\/root)$/ \ + && $2 !~ ig {print $2}' /proc/mounts) + while [ -n "$remaining" -a "$retry" -gt 0 ]; do + show "Unmounting file systems"; busy + ERRORS=$(umount -a $force -t noproc 2>&1); rc=$? + + # we might had unmounted /usr, recheck $TPUT availability + # but well. we need tput only for show() and busy() (ok() and fail() messages are already cached) + # TODO: look ahead the messages? + if is_yes "$TPUT"; then + TPUT= + rc_gettext_init + fi + + if [ $rc = 0 ]; then + ok + else + fail + [ -n "$ERRORS" ] && echo "$ERRORS" + fi + + sleep 2 + remaining=$(awk -v ig="^($UMOUNT_IGNORE)$" 'BEGIN { gsub(/[\t ]+/, "|", ig); } \ + $3 !~ /^(proc|loopfs|devpts|devtmpfs|shm|iso9660|ramfs|tmpfs|sysfs|securityfs|squashfs)$/ \ + && $1 !~ /^(none|\/dev\/root)$/ \ + && $2 !~ ig {print $2}' /proc/mounts) + [ -z "$remaining" ] && break + fuser -k -m $sig $remaining > /dev/null + sleep 5 + retry=$(($retry-1)) + sig=-9 + force="-f" + done + + run_cmd "Remounting root filesystem in ro mode" mount -n -o remount,ro / + + if [ -x /sbin/vgchange ]; then + lvmversion=$(LC_ALL=C /sbin/vgchange --version 2>/dev/null | awk '/LVM version:/{if ($3 >= 2) print "2"}') + if [ "$lvmversion" = "2" ]; then + lvmsysinit="--sysinit" + else + lvmsysinit="" + fi + /sbin/vgchange -a n $lvmsysinit > /dev/null 2>&1 + fi + + if [ -x /sbin/mdadm -a -f /etc/mdadm.conf ]; then + if grep -qE "^([[:blank:]]|)ARRAY[[:blank:]]" /etc/mdadm.conf 2>/dev/null; then + /sbin/mdadm --stop --scan > /dev/null 2>&1 + rc=$? + fi + fi + + show "Remounting remaining filesystems ro mode"; busy + if mount | awk '/ext2|ext3|reiserfs|xfs|jfs/ { print $3 }' | while read line; do mount -n -o ro,remount $line; done; then + ok + else + fail + fi + _rebootwhat="system" +else + _rebootwhat="vserver" +fi + +if [ -f /etc/crypttab ] && ! is_empty_file /etc/crypttab; then + . /etc/rc.d/init.d/cryptsetup + + show "Stopping disk encryption" + halt_crypto && ok || fail +fi + +if [ "$runlevel" = "0" ] ; then + show "The $_rebootwhat is halted"; ok + if [ -f /fastboot ]; then + show "On the next boot fsck will be skipped."; ok + fi + + if [ -f /etc/killpower -a -f /etc/sysconfig/ups ] ; then + . /etc/sysconfig/ups + if is_yes "$POWEROFF_UPS"; then + if [ -d /etc/ups.d ]; then + for i in /etc/ups.d/*.sh; do + [ ! -f $i -o ! -x $i ] && continue + $i poweroff + done + fi + [ -x /sbin/poweroff-ups ] && /sbin/poweroff-ups + fi + fi + [ "$previous" != "unknown" ] && halt -d -p -f +else + show "Please stand by while rebooting the $_rebootwhat"; ok + if [ -f /fastboot ]; then + show "On the next boot fsck will be skipped."; ok + fi + + if [ -x /sbin/kexec ] && [ "$kexec_loaded" = "1" ]; then + show "Will now restart with kexec" + /sbin/kexec -e + fail + fi + + [ "$previous" != "unknown" ] && reboot -d -f +fi diff --git a/rc.d/rc.sysinit b/rc.d/rc.sysinit new file mode 100755 index 0000000..f7f0eea --- /dev/null +++ b/rc.d/rc.sysinit @@ -0,0 +1,1081 @@ +#!/bin/sh +# +# /etc/rc.d/rc.sysinit - run once at boot time +# +# Taken in part from Miquel van Smoorenburg's bcheckrc. +# + +# reasonable start values for bootsplash progress. +export progress=0 +export sscripts=45 +export kscripts=45 + +# NLS +if [ -r /etc/sysconfig/i18n ]; then + . /etc/sysconfig/i18n + [ -n "$LANG" ] && export LANG || unset LANG + [ -n "$LC_CTYPE" ] && export LC_CTYPE || unset LC_CTYPE + [ -n "$LC_COLLATE" ] && export LC_COLLATE || unset LC_COLLATE + [ -n "$LC_MESSAGES" ] && export LC_MESSAGES || unset LC_MESSAGES + [ -n "$LC_NUMERIC" ] && export LC_NUMERIC || unset LC_NUMERIC + [ -n "$LC_MONETARY" ] && export LC_MONETARY || unset LC_MONETARY + [ -n "$LC_TIME" ] && export LC_TIME || unset LC_TIME + [ -n "$LC_ALL" ] && export LC_ALL || unset LC_ALL + [ -n "$LANGUAGE" ] && export LANGUAGE || unset LANGUAGE + [ -n "$LINGUAS" ] && export LINGUAS || unset LINGUAS +fi + +# Read network config data +if [ -r /etc/sysconfig/network ]; then + . /etc/sysconfig/network +else + NETWORKING=no + HOSTNAME=localhost +fi + +CONSOLE_LOGLEVEL=1 + +# Read functions +. /lib/rc-scripts/functions + +modprobe_c_cache="" +modprobe_c() { + if [ "$modprobe_c_cache" ]; then + echo "$modprobe_c_cache" + return + fi + + # filter only what is wanted by this script: aliases and options + modprobe_c_cache=$(modprobe -c | grep -E '^(alias|options)') +} + +# parse kernel cmdline +# needs /proc mounted +parse_cmdline() { + local arg cmdline + read cmdline < /proc/cmdline + + for arg in $cmdline; do + case "$arg" in + noudev) + # default is set in /etc/sysconfig/system + START_UDEV=no + ;; + nomdadm) + # default is set in /etc/sysconfig/system + MDADM=no + ;; + nomultipath) + # default is set in /etc/sysconfig/system + DM_MULTIPATH=no + ;; + noselinux) + # default is set in /etc/sysconfig/system + SELINUX=no + ;; + nousb) + nousb=1 + ;; + nohdparm) + nohdparm=1 + ;; + fastboot) + fastboot=1 + ;; + nopnp) + nopnp=1 + ;; + nomodules) + nomodules=1 + ;; + nofirewire) + nofirewire=1 + ;; + nofsck) + nofsck=1 + ;; + esac + done +} + +# resolve a device node to its major:minor numbers in decimal or hex +get_numeric_dev() { + local dev=$1 enc=${2:-hex} res + + res=$(stat -Lc "%t:%T" "$dev") + if [ "$enc" = dec ]; then + local oifs=$IFS + IFS=":" + set -- $res + IFS=$oifs + res=$((0x$1)):$((0x$2)) + fi + echo -n $res +} + +# setup SELINUX variable +init_selinux() { + # user knows! + if is_no "$SELINUX"; then + return + fi + + if ! grep -Fq selinuxfs /proc/filesystems; then + # no support in kernel, no chance + SELINUX=no + fi + + if ! is_fsmounted selinuxfs /selinux; then + mount -n -o gid=17 -t selinuxfs selinuxfs /selinux + fi + + # Check SELinux status + local selinuxfs=$(awk '/ selinuxfs / { print $2 }' /proc/mounts 2> /dev/null) + SELINUX= + if [ -n "$selinuxfs" ] && [ "$(cat /proc/self/attr/current)" != "kernel" ]; then + if [ -r $selinuxfs/enforce ] ; then + SELINUX=$(cat $selinuxfs/enforce) + else + # assume enforcing if you can't read it + SELINUX=1 + fi + fi +} + +disable_selinux() { + local _d selinuxfs _t _r + + while read _d selinuxfs _t _r; do + [ "$_t" = "selinuxfs" ] && break + done $selinuxfs/enforce +} + +relabel_selinux() { + local _d selinuxfs _t _r + + while read _d selinuxfs _t _r; do + [ "$_t" = "selinuxfs" ] && break + done $selinuxfs/enforce + /sbin/fixfiles -F relabel > /dev/null 2>&1 + rm -f /.autorelabel + echo "*** Enabling security enforcement. ***" + echo $SELINUX > $selinuxfs/enforce +} + +# Enable automatic swapon of all partitions with the proper swap magic. +# This allows setting up swap without editing /etc/fstab. +enable_autoswap() { + local swappartitions=$(blkid -t TYPE=swap -o device) + if [ -z "$swappartitions" ]; then + return + fi + + local curswap=$(awk '/^\/dev/ { print $1 }' /proc/swaps | while read x; do echo -n " "; get_numeric_dev $x; echo -n " "; done) + + local partition + for partition in $swappartitions; do + [ ! -e $partition ] && continue + majmin=$(get_numeric_dev $partition) + if ! strstr "$curswap" " $majmin "; then + run_cmd "$(nls 'Enabling local swap partitions: %s' $partition)" swapon $partition + fi + done +} + + +enable_swap() { + run_cmd "Activating swap" swapon -a "$@" + is_yes "$AUTOSWAP" && enable_autoswap +} + +# Remove duplicate entries from mtab (for vserver guest use only) +clean_vserver_mtab() { + > /etc/mtab.clean + while read device mountpoint line; do + grep -qs "$mountpoint" /etc/mtab.clean || \ + echo "$device $mountpoint $line" >> /etc/mtab.clean + done < /etc/mtab + cat /etc/mtab.clean > /etc/mtab + rm -f /etc/mtab.clean +} + +# Loads modules from /etc/modules, /etc/modules.X.Y and /etc/modules.X.Y.Z +load_kernel_modules() { + local modules_file=$1 + local _x _y _z v v1 old_IFS kernel kerneleq + { + read _x _y v _z + old_IFS=$IFS + # strip _* or -* from versions like: "2.6.25_vanilla-1", "2.6.25-1" + IFS='_-' + set -- $v + v1=${1} + IFS='.' + set -- $v1 + IFS=$old_IFS + + kernel="$1.$2" + kerneleq="$1.$2.$3" + } < /proc/version + + local module args + # Loop over every line in modules file + ( \ + grep -hvE '^(#|[[:blank:]]*$)' /etc/$modules_file /etc/$modules_file.$kernel /etc/$modules_file.$kerneleq 2>/dev/null + echo '' # make sure there is a LF at the end + ) | while read module args; do + [ -z "$module" ] && continue + # strip comments + args=${args%%#*} + show "Loading %s kernel module(s)" "$module" + busy + modprobe -s $module -- $args && ok || fail + done +} + +# launch repair shell +# which after exiting will reboot +repair_shell() { + local reason="$2" + + # don't use '\n' in nls macro ! + echo + echo + echo "$reason" + nls "*** Dropping you to a shell; the system will reboot" + nls "*** when you leave the shell." + echo + + [ "$SELINUX" = "1" ] && disable_selinux + if ! is_no "$RUN_SULOGIN_ON_ERR"; then + /sbin/sulogin + else + /bin/sh + fi + + run_cmd "Unmounting file systems" umount -a + run_cmd "Remounting root filesystem in ro mode" mount -n -o remount,ro / + run_cmd "Automatic reboot in progress" reboot +} + +check_root_fs() { + show "Checking root filesystem"; started + initlog -c "fsck -C -T -a $fsckoptions /" + rc=$? + + # A return of 4 or higher means there were serious problems. + if [ $rc -gt 3 ]; then + [ -e /proc/splash ] && echo "verbose" > /proc/splash + + PS1="$(nls '(Repair filesystem)# ')"; export PS1 + repair_shell "$(nls '*** An error occurred during the file system check.')" + + # A return of 2 or 3 means that filesystem was repaired but we need + # to reboot. + elif [ "$rc" = "2" -o "$rc" = "3" ]; then + [ -e /proc/splash ] && echo "verbose" > /proc/splash + echo + nls "*** Filesystem was repaired but system needs to be" + nls "*** rebooted before mounting it." + nls "*** REBOOTING ***" + echo + + run_cmd "Unmounting file systems" umount -a + mount -n -o remount,ro / + run_cmd "Automatic reboot in progress" reboot + elif [ "$rc" = "1" ]; then + _RUN_QUOTACHECK=1 + fi +} + +# mdadm - manage MD devices aka Linux Software RAID +init_mdadm() { + if [ ! -x /sbin/mdadm -o ! -f /etc/mdadm.conf ]; then + return + fi + + modprobe -s md + local rc=0 golvm=0 have_md=0 + if [ ! -f /proc/mdstat ]; then + return + fi + + # assume we have md if at least one ARRAY line is present + if grep -qE "^([[:blank:]]|)ARRAY[[:blank:]]" /etc/mdadm.conf; then + have_md=1 + fi + # configured to do auto scanning + if [ $have_md = 0 ] && grep -qE "^([[:blank:]]|)DEVICE[[:blank:]]partitions" /etc/mdadm.conf; then + have_md=1 + fi + + # none found + if [ $have_md = 0 ]; then + return + fi + + show "Starting up RAID devices"; busy + /sbin/mdadm --assemble --scan --auto=yes + rc=$? + if [ "$rc" -eq 0 -o "$rc" -eq 2 ]; then + # rc is used later too, so set sane value + rc=0 + deltext; ok + golvm=1 + else + deltext; fail + fi + + # A non-zero return means there were problems + if [ $rc -gt 0 ]; then + [ -e /proc/splash ] && echo "verbose" > /proc/splash + show "Starting up RAID devices"; fail + + PS1="$(nls '(RAID Repair)# ')"; export PS1 + repair_shell "$(nls '*** An error occurred during the RAID startup.')" + fi + + # LVM on RAID (keep in sync with LVM init) + if [ "$golvm" -eq "1" ]; then + if [ -x /sbin/vgscan -a -x /sbin/vgchange ]; then + run_cmd "Scanning for LVM volume groups (on RAID)" /sbin/vgscan $lvmignorelocking + run_cmd "Activating LVM volume groups (on RAID)" /sbin/vgchange -a y $lvmsysinit + [ "$lvmversion" = "2" ] && /sbin/vgmknodes + fi + fi + show "Starting up RAID devices"; ok + return $rc +} + +# Init LVM +init_lvm() { + if [ ! -x /sbin/vgscan -o ! -x /sbin/vgchange ] && ! is_yes "$EVMS_LVM"; then + return + fi + + if is_no "$LVM2"; then + lvmversion=$(LC_ALL=C /sbin/vgchange --version 2>/dev/null | awk '/LVM version:/{if ($3 >= 2) print "2"}') + else + lvmversion=2 + fi + + if [ "$lvmversion" = "1" ] ; then + modprobe -s lvm-mod + lvmignorelocking="" + lvmsysinit="" + elif [ "$lvmversion" = "2" ] ; then + modprobe -s dm-mod + lvmignorelocking="--ignorelockingfailure" + lvmsysinit="--sysinit" + else + modprobe -s lvm-mod + # device mapper (2.5+ and patched 2.4) + modprobe -s dm-mod + lvmignorelocking="" + lvmsysinit="" + fi + + run_cmd "Scanning for LVM volume groups" /sbin/vgscan $lvmignorelocking + run_cmd "Activating LVM volume groups" /sbin/vgchange -a y $lvmsysinit + if [ "$lvmversion" = "2" ]; then + /sbin/vgmknodes $lvmignorelocking + # display VG statistics + /sbin/vgdisplay -s $lvmignorelocking + fi +} + +# boot logging to /var/log/boot.log. install showconsole package to get it. +if ! is_no "$RC_BOOTLOG" && [ -x /sbin/blogd ]; then + RC_BOOTLOG=1 +else + RC_BOOTLOG= +fi + +if ! is_yes "$VSERVER" && [[ "$container" != lxc* ]]; then + # we need /proc mounted before everything + is_fsmounted proc /proc || mount -n /proc || mount -n -o gid=17,hidepid=2 -t proc /proc /proc + + parse_cmdline + + if [ -d /run ]; then + is_fsmounted tmpfs /run || mount -n -t tmpfs run /run + fi + + # Early sysctls + apply_sysctl + + # sysfs is also needed before any other things (under kernel > 2.5) + if ! is_fsmounted sysfs /sys; then + grep -Fq sysfs /proc/filesystems && mount -n -o gid=17 -t sysfs sysfs /sys + fi + if grep -Fq securityfs /proc/filesystems; then + mount -n -o gid=17 -t securityfs securityfs /sys/kernel/security + fi + + init_selinux + + # PLD Linux LiveCD support + if [ -x /etc/rc.d/rc.live ]; then + /etc/rc.d/rc.live + fi + + # Choose Hardware profile + if ! is_no "$HWPROFILES" && [ -f /etc/sysconfig/hwprof ]; then + . /etc/sysconfig/hwprof + if is_yes "${HWPROFILES}" && [ -x /sbin/hwprofile -a -d /etc/sysconfig/hwprofiles/data ]; then + mount -n / -o rw,remount + /sbin/hwprofile -qf + mount -n / -o ro,remount + fi + fi + + # Disable splash when requested + is_no "$BOOT_SPLASH" && [ -e /proc/splash ] && echo "0" > /proc/splash + + if [ -x /sbin/restorecon ] && is_fsmounted tmpfs /dev; then + /sbin/restorecon -R /dev 2>/dev/null + fi + + [ -z "${CONSOLETYPE}" ] && CONSOLETYPE="$(/sbin/consoletype)" + + if [ "$CONSOLETYPE" = "vt" -a -x /sbin/setsysfont ]; then + /sbin/setsysfont + fi +fi + + +# Print welcome message +nls "\t\t\t%sPowered by %sPLD Linux Distribution%s" "$(termput setaf $CPOWEREDBY)" "$(termput setaf $CPLD)" "$(termput op)" +if ! is_no "$RC_PROMPT"; then + nls -n "\t\t Press %sI%s to enter interactive startup" "$(termput setaf $CI)" "$(termput op)" + echo +fi + +# Set the hostname +if [ -z "${HOSTNAME}" ]; then + show "$(nls 'Host:') $(hostname)"; ok +else + run_cmd "$(nls 'Host:') ${HOSTNAME}" hostname ${HOSTNAME} +fi + +# Set the NIS domain name +if [ -n "$NISDOMAIN" ]; then + run_cmd "$(nls 'NIS Domain:') ${NISDOMAIN}" domainname $NISDOMAIN +else + domainname "" +fi + +if ! is_yes "$VSERVER" && [[ "$container" != lxc* ]]; then + # Set console loglevel + if [ -n "$CONSOLE_LOGLEVEL" ]; then + dmesg -n $CONSOLE_LOGLEVEL + fi + + if ! is_no "$START_UDEV" && [ -x /sbin/start_udev ] && [[ "$container" != lxc* ]]; then + is_fsmounted devtmpfs /dev || mount -n -t devtmpfs devtmpfs /dev + load_kernel_modules modules.preudev + /sbin/start_udev + elif [ -x /lib/firmware/firmware-loader.sh ]; then + /sbin/sysctl -q -e -w kernel.hotplug=/lib/firmware/firmware-loader.sh + fi + + # Unmount the initrd, if necessary + if grep -q /initrd /proc/mounts 2>/dev/null && ! grep -q /initrd/loopfs /proc/mounts 2>/dev/null; then + umount /initrd/dev 2>/dev/null + umount /initrd + /sbin/blockdev --flushbufs /dev/ram0 >/dev/null 2>&1 + fi + + # Start logging console output since we have all /dev stuff setup + if [ "$RC_BOOTLOG" ]; then + /sbin/blogd + fi + + # Configure Linux kernel (initial configuration, some required modules still may be missing). + apply_sysctl + + # Check if timezone definition is available + if [ -e /etc/localtime ] && [ -e /dev/rtc -o -e /dev/rtc0 ] ; then + if run_cmd "$(nls 'Setting clock')" hwclock --hctosys; then + show "$(nls 'Today`s date:') $(LC_CTYPE=C date)"; ok + fi + else + TIME_SETUP_DELAYED=yes + fi + + delay_cryptsetup=0 + if [ -f /etc/crypttab ] && ! is_empty_file /etc/crypttab; then + # XXX might need modules dep + # Device mapper & related initialization + if ! grep -qF device-mapper /proc/devices; then + modprobe -s dm-mod + fi + + . /etc/rc.d/init.d/cryptsetup + show "Starting disk encryption" + init_crypto 0 + delay_cryptsetup=$? + [ $delay_cryptsetup = 0 ] && ok || fail + fi + + # Start up swapping + enable_swap -e + + # Initialize USB controllers + usb=0 + if [ -z "$nousb" ] && ! is_fsmounted usbfs /proc/bus/usb; then + aliases=$(modprobe_c | awk '/^alias[[:space:]]+usb[-_]controller[[:space:]]+/{ print $3 }') + if [ -n "$aliases" -a "$aliases" != "off" ] ; then + modprobe -s usbcore + for alias in $aliases ; do + [ "$alias" = "off" ] && continue + run_cmd "$(nls 'Initializing USB controller') ($alias)" modprobe -s $alias + done + [ $? -eq 0 -a -n "$aliases" ] && usb=1 + fi + if grep -iq "usb" /proc/devices 2>/dev/null ; then + usb=1 + fi + fi + + if [ "$usb" = "1" -a -d /proc/bus/usb ] && ! is_fsmounted usbfs /proc/bus/usb; then + run_cmd "Mounting USB filesystem" mount -n -t usbfs -o devgid=78,devmode=664 usbfs /proc/bus/usb + fi + + needusbstorage= + if [ "$usb" = "1" ]; then + needusbstorage=$(cat /proc/bus/usb/devices 2>/dev/null | grep -e "^I.*Cls=08" 2>/dev/null) + if [ "$(kernelverser)" -lt "002006" ]; then + grep -Fq 'hid' /proc/bus/usb/drivers 2>/dev/null || run_cmd "Initializing USB HID interface" modprobe -s hid + mouseoutput=$(cat /proc/bus/usb/devices 2>/dev/null|grep -E "^I.*Cls=03.*Prot=02" 2>/dev/null) + kbdoutput=$(cat /proc/bus/usb/devices 2>/dev/null|grep -E "^I.*Cls=03.*Prot=01" 2>/dev/null) + if [ -n "$kbdoutput" ]; then + run_cmd "Initializing USB keyboard" modprobe -s keybdev + fi + if [ -n "$mouseoutput" ]; then + run_cmd "Initializing USB mouse" modprobe -s mousedev + fi + fi + fi + + # Setup hdparm thing (if exists and is needed) + if [ -z "$nohdparm" ]; then + [ -x /etc/rc.d/rc.hdparm ] && /etc/rc.d/rc.hdparm + fi + + if [ -z "$fastboot" ] && [ -f /fastboot ]; then + fastboot=1 + fi + + if [ -f /fsckoptions ]; then + fsckoptions=$(cat /fsckoptions) + else + fsckoptions='' + fi + + if [ -f /forcefsck ]; then + fsckoptions="-f $fsckoptions" + else + # Obey the fs_passno setting for / (see fstab(5)) + # - find the / entry + # - make sure we have at least 6 fields + _ROOTFS_PASSNO=$(awk '($1 !~ /^#/ && $2 == "/" && NF >= 6) { print $6}' /etc/fstab) + fi + + _RUN_QUOTACHECK=0 + _ROOTFS_DEVICE=$(awk '($1 !~ /^#/ && $2 == "/" && NF >= 6) { print $1}' /etc/fstab) + _ROOTFS_TYPE=$(awk '$2 == "/" && $3 != "rootfs" { print $3 }' /proc/mounts 2>/dev/null) + + if [ -z "$fastboot" -a "$_ROOTFS_TYPE" != "aufs" -a "$_ROOTFS_TYPE" != "nfs" -a "$_ROOTFS_TYPE" != "romfs" -a "$_ROOTFS_TYPE" != "squashfs" -a "$_ROOTFS_PASSNO" != 0 -a -e $_ROOTFS_DEVICE ] && [[ "$container" != lxc* ]]; then + check_root_fs + fi + + # set up pnp and kernel pnp + if is_yes "$RUN_USERPNP" || is_yes "$RUN_KERNELPNP"; then + if [ -z "$nopnp" ] && is_yes "$RUN_USERPNP" && [ -x /sbin/isapnp -a -f /etc/isapnp/isapnp.conf ]; then + run_cmd "Setting up ISA PNP devices (userspace pnp)" /sbin/isapnp /etc/isapnp/isapnp.conf + fi + if [ -z "$nopnp" ] && is_yes "$RUN_KERNELPNP"; then + modprobe -s isa-pnp + if [ -e /proc/isapnp -a -f /etc/isapnp/isapnp-kernel.conf ]; then + show "Setting up ISA PNP devices (kernelspace pnp)"; busy + grep -v "^#" /etc/isapnp/isapnp-kernel.conf 2>/dev/null >/proc/isapnp && (deltext; ok) || (deltext; fail) + fi + fi + fi + + _ROOTFS_RO=$(awk '($1 !~ /^#/ && $2 == "/" && ($4 == "ro" || $4 ~ /,ro$/ || $4 ~ /^ro,/ || $4 ~ /,ro,/ ) && NF >= 6) { print "ro" }' /etc/fstab) + # Remount the root filesystem read-write + if [ -z "$_ROOTFS_RO" ]; then + run_cmd "Remounting root filesystem in rw mode" mount -n -o remount,rw / + fi + + # Update quotas if fsck was run on / + if [ "$_RUN_QUOTACHECK" = "1" -a -x /sbin/quotacheck ]; then + run_cmd "Checking root filesystem quotas" /sbin/quotacheck -vnug / + fi + + # Clean up SELinux labels + if is_yes "$SELINUX"; then + for file in /etc/mtab /etc/cryptomtab /etc/ld.so.cache; do + [ -r $file ] && restorecon $file >/dev/null 2>&1 + done + fi + + if [ "$delay_cryptsetup" != 0 ]; then + show "Starting disk encryption using the RNG" + init_crypto 1 + delay_cryptsetup=$? + [ $delay_cryptsetup = 0 ] && ok || fail + fi +else + # Start logging console output since we have all /dev stuff setup + if [ "$RC_BOOTLOG" ]; then + /sbin/blogd -q + fi +fi + +# Remove stale backups +rm -f /etc/mtab~ /etc/mtab~~ /etc/cryptomtab~ /etc/cryptomtab~~ >/dev/null 2>&1 + +# Remove /etc/nologin when starting system +[ -f /etc/nologin.boot ] && rm -f /etc/nologin /etc/nologin.boot + +if ! is_no "$DELAY_LOGIN" && [ ! -f /etc/nologin ]; then + show "Enabling Delay Login"; busy + echo > /etc/nologin + nls "System bootup in progress - please wait" >> /etc/nologin + echo >> /etc/nologin + chmod 644 /etc/nologin + cp -fp /etc/nologin /etc/nologin.boot + ok +fi + +# The root filesystem is now read-write, so we can now log via +# syslog() directly... +if [ -n "$IN_INITLOG" ]; then + IN_INITLOG="" +fi + +if ! is_yes "$VSERVER" && [[ "$container" != lxc* ]]; then + # Clear mtab + > /etc/mtab + [ -f /etc/cryptomtab ] && > /etc/cryptomtab + + # Enter root, /proc, /sys and other into mtab. + mount -f / 2> /dev/null + mount -f /proc 2> /dev/null + if is_fsmounted devtmpfs /dev; then + mount -f -t devtmpfs devtmpfs /dev 2> /dev/null + fi + if is_fsmounted tmpfs /run; then + mount -f -t tmpfs run /run 2> /dev/null + fi + + if is_fsmounted usbfs /proc/bus/usb; then + mount -f -t usbfs -o devgid=78,devmode=664 usbfs /proc/bus/usb 2> /dev/null + fi + + if is_fsmounted sysfs /sys; then + mount -f -t sysfs sysfs /sys 2> /dev/null + if is_fsmounted securityfs /sys/kernel/security ; then + mount -f -t securityfs securityfs /sys/kernel/security 2> /dev/null + fi + fi + + if is_fsmounted selinuxfs /selinux; then + mount -f -t selinuxfs selinuxfs /selinux 2> /dev/null + fi + + if [ ! -f /proc/modules ]; then + USEMODULES= + elif [ -z "$nomodules" ]; then + USEMODULES=y + else + USEMODULES= + fi + + uname_r=$(uname -r) + # Adjust symlinks as necessary in /boot to keep system services from + # spewing messages about mismatched System maps and so on. + if ! is_no "$SET_SLINKS"; then + if [ -L /boot/System.map -a -r /boot/System.map-$uname_r ] ; then + ln -s -f System.map-$uname_r /boot/System.map + fi + if [ ! -e /boot/System.map -a -r /boot/System.map-$uname_r ] ; then + ln -s -f System.map-$uname_r /boot/System.map + fi + fi + + # Run depmod if RUN_DEPMOD != "no" and: + # a) user requested or RUN_DEPMOD=""; + # b) modules.dep is missing + if ! is_no "$RUN_DEPMOD" && [ -n "$USEMODULES" ]; then + if is_yes "$RUN_DEPMOD" || [ -z "$RUN_DEPMOD" ]; then + run_cmd "Finding module dependencies" depmod -a + elif [ "$RUN_DEPMOD" = "ifmissing" ] && [ ! -f /lib/modules/$uname_r/modules.dep ]; then + run_cmd "Finding module dependencies" depmod -A + fi + fi + unset uname_r + + if [ -f /proc/sys/kernel/modprobe ]; then + if [ -n "$USEMODULES" ]; then + sysctl -q -w kernel.modprobe="/sbin/modprobe" + else + # We used to set this to NULL, but that causes + # 'failed to exec' messages" + sysctl -q -w kernel.modprobe="/bin/true" + fi + fi + + # Load usb storage here, to match most other things + if [ -n "$needusbstorage" ]; then + modprobe -s usb-storage + fi + + # Load firewire devices + if [ -z "$nofirewire" ]; then + aliases=$(modprobe_c | awk '/^alias[[:space:]]+ieee1394[-_]controller[[:space:]]+/{ print $3 }') + if [ -n "$aliases" -a "$aliases" != "off" ] ; then + for alias in $aliases ; do + [ "$alias" = "off" ] && continue + run_cmd "$(nls 'Initializing firewire controller') ($alias)" modprobe $alias + done + grep -E "SBP2" /proc/bus/ieee1394/devices 2>/dev/null && modprobe -s sbp2 + fi + fi + + # Load sound modules if they need persistent DMA buffers + if modprobe_c | grep -q "^options sound dmabuf=1"; then + RETURN=0 + alias=$(modprobe_c | awk '/^alias[[:space:]]+sound[[:space:]]+/{ print $3 }') + if [ -n "$alias" -a "$alias" != "off" ] ; then + run_cmd "$(nls 'Loading sound module') ($alias)" modprobe -s $alias + RETURN=$? + fi + alias=$(modprobe_c | awk '/^alias[[:space:]]+sound[-_]slot[-_]0[[:space:]]+/ { print $3 }') + if [ -n "$alias" -a "$alias" != "off" ] ; then + run_cmd "$(nls 'Loading sound module') ($alias)" modprobe -s $alias + RETURN=$? + fi + fi + + # Load modules + load_kernel_modules modules + for f in /etc/modules-load.d/*.conf; do + # already loaded by implicit "modules" load + [ "${f##*/}" = "modules.conf" ] && continue + + [ -r $f ] || continue + load_kernel_modules ${f##/etc/} + done + + if ! is_no "$DM_MULTIPATH" && [ -x /sbin/multipath ]; then + modprobe -s dm-mod + modprobe -s dm-multipath + # make nodes that were discarded due (possible) new /dev mount + /sbin/dmsetup mknodes + run_cmd "Activating dm-multipath" /sbin/multipath -v 0 + /sbin/dmsetup ls --target multipath --exec '/sbin/kpartx -a -p p' + fi + + if ! is_no "$DMRAID" && [ -x /sbin/dmraid ]; then + run_cmd "Activating ATARAID devices" /sbin/dmraid -ay + fi + + # Find and activate volume groups: + # EVMS + if is_yes "$EVMS_LVM" && [ -x /sbin/evms_activate ]; then + if [ "$(kernelverser)" -lt "002006" ]; then + # Linux 2.4 core modules + modprobe -s evms + modprobe -s evms_passthru + modprobe -s ldev_mgr + modprobe -s dos_part + else + # Linux 2.6 core module + modprobe -s evmscore + fi + + is_yes "$EVMS_GUID_PTABLE" && modprobe -s gpt_part + is_yes "$EVMS_LVM" && modprobe -s lvm_vge + is_yes "$EVMS_AIX" && modprobe -s AIXlvm_vge + is_yes "$EVMS_OS2" && modprobe -s os2lvm_vge + run_cmd "Discovering EVMS volumes" /sbin/evms_activate + if is_yes "$EVMS_LVM" && is_yes "$EVMS_LVM_COMPAT_NODES" ; then + # Link nodes for compatibility with LVM + if [ "$(echo /dev/evms/lvm/*)" != '/dev/evms/lvm/*' ] ; then + ln -s /dev/evms/lvm/* /dev + fi + fi + fi + + # Init LVM + if ! is_no "$LVM2"; then + init_lvm + fi + + if [ "$delay_cryptsetup" != 0 ]; then + show "Starting disk encryption" + init_crypto 1 + delay_cryptsetup=$? + [ $delay_cryptsetup = 0 ] && ok || fail + fi + + if ! is_no "$MDADM"; then + init_mdadm + fi + + _RUN_QUOTACHECK=0 + # Check filesystems + if [ -z "$fastboot" ] && [ -z "$nofsck" ]; then + rc_splash "fsck start" + show "Checking filesystems"; started + initlog -c "fsck -C -T -R -A -a -P $fsckoptions" + + rc=$? + + # A return of 2 or higher means there were serious problems + if [ $rc -gt 1 ]; then + [ -e /proc/splash ] && echo "verbose" > /proc/splash + + PS1="$(nls '(Repair filesystem)# ')"; export PS1 + repair_shell "$(nls '*** An error occurred during the file system check.')" + + elif [ "$rc" = "1" -a -x /sbin/quotacheck ]; then + _RUN_QUOTACHECK=1 + fi + rc_splash "fsck stop" + fi + + # Mount all other filesystems (except for NFS and /proc, which is already + # mounted). Contrary to standard usage, + # filesystems are NOT unmounted in single user mode. + run_cmd "Mounting local filesystems" mount -a -t nonfs,nfs4,smbfs,ncpfs,proc,cifs -O no_netdev + + # now we have /usr mounted, recheck if we have gettext and tput available. + if is_no "$TPUT"; then + GETTEXT= + TPUT= + rc_gettext_init + fi + + # Now do some workaround - encrypted filesystems couldn't have been fsck-ed + # before mount - that's where the password is entered. + # mount is buggy - when remounting loopback filesystem, loop=XXX + # option is removed from /etc/mtab + if [ -z "$fastboot" ] && grep "^[^#].*encryption=" /etc/fstab 2>/dev/null | grep -v -q "noauto" 2>/dev/null; then + show "Checking encrypted filesystems"; started + LOOPLIST="$(LC_ALL=C awk ' + FILENAME=="/proc/mounts" { + TAB[$2]=$1; + } + FILENAME=="/etc/fstab" && /encryption=/ && ! /noauto/ && /[^a-zA-Z_]ro[^a-zA-Z_]/ { + if ($2 in TAB){print TAB[$2];} + } + FILENAME=="/etc/fstab" && /encryption=/ && ! /noauto/ && ! /[^a-zA-Z_]ro[^a-zA-Z_]/ { + if ($2 in TAB){print TAB[$2];} + sub("loop(=[^,]*)?","loop=" TAB[$2] ",ro",$4); + cmd="mount " $2 " -o remount," $4; + system(cmd); + } + ' /proc/mounts /etc/fstab)" + initlog -c "fsck -T -C -a $fsckoptions $LOOPLIST" + rc=$? + + # A return of 2 or higher means there were serious problems. + if [ $rc -gt 1 ]; then + [ -e /proc/splash ] && echo "verbose" > /proc/splash + + PS1="$(nls '(Repair filesystem)# ')"; export PS1 + repair_shell "$(nls '*** An error occurred during the file system check.')" + + elif [ "$rc" = "1" -a -x /sbin/quotacheck ]; then + _RUN_QUOTACHECK=1 + fi + + show "Remounting encrypted filesystems back in rw mode"; busy + LC_ALL=C awk ' + FILENAME=="/proc/mounts" { + TAB[$2]=$1; + } + FILENAME=="/etc/fstab" && /encryption=/ && ! /noauto/ && ! /[^a-zA-Z_]ro[^a-zA-Z_]/ { + sub("loop(=[^,]*)?","loop=" TAB[$2] ",rw",$4); + cmd="mount " $2 " -o remount," $4; + system(cmd); + } + ' /proc/mounts /etc/fstab + ok + fi + + # /var/log should be writable now, so start saving the boot output + if [ "$RC_BOOTLOG" ]; then + echo > /var/log/boot.log + killall -IO blogd + fi + + if [ "$_RUN_QUOTACHECK" = "1" -a -x /sbin/quotacheck ]; then + run_cmd "Checking filesystem quotas" /sbin/quotacheck -vnugRa + fi + + # Turn on quota + if [ -x /sbin/quotaon ]; then + run_cmd "Turning on quotas for local filesystems" /sbin/quotaon -aug + fi + + # Turn on process accounting + if [ -x /etc/rc.d/rc.acct ]; then + /etc/rc.d/rc.acct start + fi + + # Set the clock if timezone definition wasn't available (eg. /usr not mounted) + if is_yes "$TIME_SETUP_DELAYED" && [ -e /dev/rtc -o -e /dev/rtc0 ]; then + if run_cmd "$(nls 'Setting clock')" hwclock --hctosys; then + show "$(nls 'Today`s date:') $(LC_CTYPE=C date)"; ok + fi + fi + + # Initialize the serial ports + if [ -f /etc/rc.d/rc.serial ]; then + . /etc/rc.d/rc.serial + fi + + if [ -n "$PANIC_REBOOT_TIME" -a "$PANIC_REBOOT_TIME" -gt "0" -a -f /proc/sys/kernel/panic ]; then + show 'Setting %s seconds for kernel reboot after panic' "$PANIC_REBOOT_TIME"; busy + # DEPRECATED: use /etc/sysctl.conf or kernel commandline instead + if sysctl -q -w kernel.panic=$PANIC_REBOOT_TIME; then ok; else fail; fi + fi + + # ... and here finish configuring parameters + apply_sysctl +else + # /var/log should be writable now, so start saving the boot output + if [ "$RC_BOOTLOG" ]; then + echo > /var/log/boot.log + killall -IO blogd + fi + + clean_vserver_mtab +fi + +is_yes "$SELINUX" && [ -f /.autorelabel ] && relabel_selinux + +# Clean up /. +rm -f /fastboot /fsckoptions /forcefsck /halt /poweroff >/dev/null 2>&1 + +# Clean up /var +# /usr could be still not mounted if it is on NFS. +for afile in /var/lock/* /var/run/*; do + bafile=${afile##*/} + if [ -d "$afile" ]; then + case $bafile in + news|sudo|mon|cvs) + ;; + *) + echo $afile/* | xargs rm -rf + ;; + esac + else + [ "$bafile" != "hwprofile" -a "$bafile" != "random-seed" ] && rm -f $afile 2> /dev/null + fi +done + +# Delete stale files +rm -f /var/lib/rpm/__db* /var/spool/postoffice/.pid.* /tmp/.X*-lock \ + /tmp/.lock.* /tmp/.gdm_socket /tmp/.s.PGSQL.* +rm -rf /tmp/.X*-unix /tmp/.ICE-unix /tmp/.font-unix /tmp/hsperfdata_* \ + /tmp/kde-* /tmp/ksocket-* /tmp/mc-* /tmp/mcop-* /tmp/orbit-* \ + /tmp/scrollkeeper-* /tmp/ssh-* + +{ +# Clean up utmp/wtmp +rm -f /var/run/utmpx +> /var/run/utmp +if [ -e /var/log/wtmpx ]; then + if [ -e /var/log/wtmp ]; then + rm -f /var/log/wtmpx + else + mv /var/log/wtmpx /var/log/wtmp + fi +fi +touch /var/log/wtmp +chown root:utmp /var/run/utmp /var/log/wtmp +chmod 0664 /var/run/utmp /var/log/wtmp + +# Clean /tmp +if is_yes "$CLEAN_TMP" && ! is_fsmounted tmpfs /tmp; then + LC_ALL=C rm -rf /tmp/* /tmp/.[a-zA-Z0-9]* +fi + +# System protected dirs +mkdir -m 1777 -p /tmp/.ICE-unix > /dev/null 2>&1 +chown root:root /tmp/.ICE-unix +is_yes "$SELINUX" && restorecon /tmp/.ICE-unix >/dev/null 2>&1 + +test -d /var/run/netreport || mkdir -m 770 /var/run/netreport + +if ! is_yes "$VSERVER"; then + enable_swap + + # If a SCSI tape has been detected, load the st module unconditionally + # since many SCSI tapes don't deal well with st being loaded and unloaded + if [ -f /proc/scsi/scsi ] && grep -q 'Type: Sequential-Access' /proc/scsi/scsi 2>/dev/null ; then + if grep -qv ' 9 st' /proc/devices 2>/dev/null; then + if [ -n "$USEMODULES" ] ; then + # Try to load the module. If it fails, ignore it... + insmod -p st >/dev/null 2>&1 && modprobe -s st + fi + fi + fi + + # Now that we have all of our basic modules loaded and the kernel going, + # let's dump the syslog ring somewhere so we can find it later + mode=0600 + if [ "$(cat /proc/sys/kernel/dmesg_restrict)" = 0 ]; then + mode=0644 + fi + dmesg --raw > /var/log/dmesg + chmod $mode /var/log/dmesg + i=5 + while [ $i -ge 0 ]; do + if [ -f /var/log/dmesg.$i ]; then + mv -f /var/log/dmesg.$i /var/log/dmesg.$(($i+1)) + fi + i=$(($i-1)) + done + cp -pf /var/log/dmesg /var/log/dmesg.0 +fi + +if ! is_no "$RC_PROMPT"; then + while :; do + pid=$(/sbin/pidof getkey) + [ -n "$pid" -o -e /var/run/getkey_done ] && break + usleep 100000 + done + [ -n "$pid" ] && kill -TERM "$pid" >/dev/null 2>&1 +fi +} & + +# /proc extra check if the background process we just spawned is still running, +# as in case of vserver bootup it finishes quite instantly. +if ! is_no "$RC_PROMPT" && [ -d /proc/$! ]; then + /sbin/getkey i && touch /var/run/confirm + touch /var/run/getkey_done +fi +wait +if ! is_no "$RC_PROMPT"; then + rm -f /var/run/getkey_done +fi +echo diff --git a/run-parts.sh b/run-parts.sh new file mode 100755 index 0000000..8b473a5 --- /dev/null +++ b/run-parts.sh @@ -0,0 +1,80 @@ +#!/bin/sh + +# run-parts - concept taken from Debian +# +# modified for PLD Linux by Pawel Wilk +# +# NOTE: +# 1.) run-parts is now able to get arguments! +# 2.) relative pathname of the invoked directory can be +# obtained by reading RUNPARTS_DIR env. variable +# 3.) absolute pathname of the invoked directory can be +# obtained by reading RUNPARTS_ADIR env. variable +# + +# keep going when something fails +set +e + +if [ "$1" = "--test" ]; then + test=yes + shift +fi + +if [ "$1" = "--" ]; then + shift +fi + +# std checks +if [ $# -lt 1 ]; then + echo "Usage: run-parts [-u] [--test] " + exit 1 +fi + +if [ ! -d $1 ]; then + echo "Is not a directory: $1" + echo "Usage: run-parts [-u] [--test] " + exit 1 +fi + +# assign passed dir name +RUNPARTS_DIR=$1 + +# assign absolute dir name +olddir=$(pwd) +cd $RUNPARTS_DIR +RUNPARTS_ADIR=$(pwd) +cd $olddir +unset olddir + +# export directories for our descendants +export RUNPARTS_ADIR RUNPARTS_DIR + +# shift args +shift + +# Ignore *~ and *, scripts +for i in $RUNPARTS_DIR/*[!~,] ; do + [ -d "$i" ] && continue + # Don't run *.{rpmsave,rpmorig,rpmnew,swp} scripts + [ "${i%.rpmsave}" != "${i}" ] && continue + [ "${i%.rpmorig}" != "${i}" ] && continue + [ "${i%.rpmnew}" != "${i}" ] && continue + [ "${i%.swp}" != "${i}" ] && continue + [ "${i%,v}" != "${i}" ] && continue + + if [ -x "$i" ]; then + runprog="$i $@" + if [ "$test" = yes ]; then + echo "$runprog" + continue + fi + $runprog 2>&1 | awk -v "progname=$i" \ + 'progname { + print progname ":\n" + progname=""; + } + { print; }' + fi +done + +exit 0 diff --git a/service b/service new file mode 100755 index 0000000..f882bdb --- /dev/null +++ b/service @@ -0,0 +1,189 @@ +#!/bin/sh + +# Set up a default search path. +PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin" +export PATH + +is_ignored_file() { + case "$1" in + skeleton | README | *.dpkg-dist | *.dpkg-old | rc | rcS | single | reboot | bootclean.sh) + return 0 + ;; + *rpmorig | *rpmnew | *rpmsave | *~ | *.orig) + return 0 + ;; + esac + return 1 +} + +# check if SERVICE is present in systemd and ACTION is valid systemctl command +# returns false if systemd is disabled or not active +is_systemd_service() { + local SERVICE=$1 ACTION=$2 + + [ "$USE_SYSTEMD" = "no" ] && return 1 + + # if we are called from systemd itself, because some .service specified + # invocation via /sbin/service. this avoids loops + # detect this via CMDLINE var, which has leaked from geninitrd + if [ -n "$CMDLINE" ]; then + echo >&2 "Warning: CMDLINE env set, likely you are defining .service to use /sbin/service, please use /etc/rc.d/init.d/ instead" + return 1 + fi + + case "$ACTION" in + # list obtained as: man systemctl | grep N.*A.*M.*E + start | \ + stop | \ + reload | \ + restart | \ + try-restart | \ + reload-or-restart | \ + reload-or-try-restart | \ + isolate | \ + kill | \ + is-active | \ + status | \ + show | \ + reset-failed | \ + enable | \ + disable | \ + is-enabled | \ + reenable | \ + preset | \ + mask | \ + unmask | \ + link | \ + load | \ + snapshot | \ + delete | \ + set-environment | \ + unset-environment ) + ;; + *) + #echo "Not valid systemd command" + return 1 + esac + + [ -x /bin/systemd_booted ] || return 1 + /bin/systemd_booted || return 1 + + /bin/systemctl show "$SERVICE".service | grep -q LoadError= && return 1 || return 0 +} + +status_all() { + local SERVICE TYPE has_systemd + + if [ "$USE_SYSTEMD" != "no" ] && [ -x /bin/systemd_booted ] && /bin/systemd_booted; then + has_systemd=1 + else + unset has_systemd + fi + + cd ${SERVICEDIR} + for SERVICE in *; do + case "${SERVICE}" in + functions | halt | killall | single| linuxconf| kudzu) + ;; + *) + if ! is_ignored_file "${SERVICE}" \ + && [ -x "${SERVICEDIR}/${SERVICE}" ]; then + if [ "$has_systemd" ] && [ -f /lib/systemd/system/${SERVICE}.service ]; then + # D for SystemD + TYPE='D' + else + # S for SysVinit + TYPE='S' + fi + if ! grep -qs "\Wstatus)" "$SERVICE"; then + printf " %s %-60s %s\n" "$TYPE:[?]" "$SERVICE:" "unknown" + continue + else + out=$(env -i LANG="$LANG" PATH="$PATH" TERM="$TERM" "$SERVICEDIR/$SERVICE" status 2>&1) + if [ "$?" = "0" -a -n "$out" ]; then + printf " %s %-60s %s\n" "$TYPE:[+]" "$SERVICE:" "running" + continue + else + printf " %s %-60s %s %s\n" "$TYPE:[-]" "$SERVICE:" "NOT running" + continue + fi + fi + fi + ;; + esac + done +} + +VERSION="$(basename $0) ver. 0.91-pld" +USAGE="Usage: $(basename $0) < option > | --status-all | \ +[ service_name [ command | --full-restart ] ]" + +SERVICE= +USE_SYSTEMD= + +if [ -d /etc/rc.d/init.d ]; then + SERVICEDIR="/etc/rc.d/init.d" +else + SERVICEDIR="/etc/init.d" +fi + +if [ $# -eq 0 ]; then + echo "${USAGE}" >&2 + exit 1 +fi + +cd / +while [ $# -gt 0 ]; do + case "${1}" in + --help | -h | --h* ) + echo "${USAGE}" >&2 + exit 0 + ;; + --version | -V ) + echo "${VERSION}" >&2 + exit 0 + ;; + --ignore-dependencies) + export SYSTEMCTL_IGNORE_DEPENDENCIES=1 + shift + ;; + --skip-redirect) + export SYSTEMCTL_SKIP_REDIRECT=1 + shift + ;; + --no-systemd) + USE_SYSTEMD=no + shift + ;; + *) + if [ -z "${SERVICE}" -a $# -eq 1 -a "${1}" = "--status-all" ]; then + status_all + exit 0 + elif [ $# -eq 2 -a "${2}" = "--full-restart" ]; then + SERVICE="${1}" + if [ -x "${SERVICEDIR}/${SERVICE}" ]; then + env -i LANG=$LANG PATH=$PATH TERM=$TERM "${SERVICEDIR}/${SERVICE}" stop + env -i LANG=$LANG PATH=$PATH TERM=$TERM "${SERVICEDIR}/${SERVICE}" start + exit $? + fi + elif [ -z "${SERVICE}" ]; then + SERVICE="${1}" + elif [ -z "${ACTION}" ]; then + ACTION="${1}" + else + OPTIONS="${OPTIONS} ${1}" + fi + shift + ;; + esac +done + +if is_systemd_service "${SERVICE}" "${ACTION}"; then + echo >&2 "Redirecting to /bin/systemctl --output=cat ${ACTION} ${SERVICE}.service ${OPTIONS}" + exec /bin/systemctl --output=cat ${ACTION} ${SERVICE}.service ${OPTIONS} +elif [ -x "${SERVICEDIR}/${SERVICE}" ]; then + exec env -i LANG=$LANG PATH=$PATH TERM=$TERM "${SERVICEDIR}/${SERVICE}" ${ACTION} ${OPTIONS} +else + echo "${SERVICE}: unrecognized service" >&2 + exit 1 +fi diff --git a/setsysfont b/setsysfont new file mode 100755 index 0000000..e4f96ab --- /dev/null +++ b/setsysfont @@ -0,0 +1,51 @@ +#!/bin/sh +# +# + +[ -f /etc/sysconfig/i18n ] && . /etc/sysconfig/i18n +[ -f /etc/sysconfig/console ] && . /etc/sysconfig/console + +[ -n "$SYSFONT" ] && CONSOLEFONT="$SYSFONT" + + +charmap= +# /usr might not be mounted +if [ -x /usr/bin/locale ]; then + charmap=$(LANG="$LANG" locale charmap) +fi + +if [ "$charmap" = "UTF-8" ]; then + if [ -x /bin/unicode_start ] && /sbin/consoletype fg; then + exec unicode_start $CONSOLEFONT $CONSOLEMAP + fi +elif [ -x /bin/unicode_stop ] && /sbin/consoletype fg; then + unicode_stop +fi + +# console-tools, obsolete part +if [ -x /usr/bin/consolechars -o -x /bin/consolechars ]; then + if [ -n "$CONSOLEFONT" ]; then + consolechars --acm ${CONSOLEMAP:-trivial.trans} --font $CONSOLEFONT + fi + if [ -n "$KEYTABLE" ]; then + loadkeys $KEYTABLE < /dev/tty0 > /dev/tty0 + fi +# kbd, currently used +elif [ -x /usr/bin/setfont -o -x /bin/setfont ]; then + if [ -n "$CONSOLESCREENFONTMAP" ]; then + ARGS="-u $CONSOLESCREENFONTMAP" + fi + if [ -n "$CONSOLEMAP" ]; then + if [ ! -f /lib/kbd/consoletrans/${CONSOLEMAP}_to_uni.trans ]; then + CONSOLEMAP=$(echo "$CONSOLEMAP" | awk '{ gsub(/iso[0]?/,"8859-"); print $0; }') + fi + ARGS="$ARGS -m $CONSOLEMAP" + fi + if [ -n "$CONSOLEFONT" ]; then + setfont $CONSOLEFONT $ARGS + else + echo -ne "\033(K" 2>/dev/null > /proc/$$/fd/0 + fi +fi + +exit 0 diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..cd77139 --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,69 @@ +@SET_MAKE@ + +DEFS = @DEFS@ -D_GNU_SOURCE=1 -DSBINDIR=\""@sbindir@"\" + +sysconf_DATA = \ + initlog.conf + +bin_PROGRAMS = \ + doexec \ + ipcalc \ + usleep \ + run-parts \ + resolvesymlink + +sbin_PROGRAMS = \ + consoletype \ + genhostid \ + getkey \ + initlog \ + loglevel \ + minilogd \ + netreport \ + ppp-watch \ + start-stop-daemon \ + setuidgid \ + usernetctl + +EXTRA_PROGRAMS = \ + testd + +EXTRA_DIST = $(sysconf_DATA) + +doexec_SOURCES = doexec.c + +resolvesymlink_SOURCES = resolvesymlink.c + +ipcalc_SOURCES = ipcalc.c +ipcalc_LDADD = -lpopt + +genhostid_SOURCES = genhostid.c + +netreport_SOURCES = netreport.c + +testd_SOURCES = testd.c + +usernetctl_SOURCES = usernetctl.c + +usleep_SOURCES = usleep.c + +loglevel_SOURCES = loglevel.c + +initlog_SOURCES = initlog.c initlog.h process.c process.h +initlog_LDADD = -lpopt + +getkey_SOURCES = getkey.c +getkey_LDADD = -lpopt + +ppp_watch_SOURCES = ppp-watch.c shvar.c shvar.h +ppp_watch_LDADD = $(GLIB_LIBS) +AM_CPPFLAGS = $(GLIB_CFLAGS) + +consoletype_SOURCES = consoletype.c + +start_stop_daemon_SOURCES = start-stop-daemon.c +start_stop_daemon_LDADD = -lcap + +setuidgid_SOURCES = setuidgid.c + +run_parts_CPPFLAGS = -include config.h diff --git a/src/consoletype.c b/src/consoletype.c new file mode 100644 index 0000000..ab7e753 --- /dev/null +++ b/src/consoletype.c @@ -0,0 +1,66 @@ +/* + * Copyright (c) 1999-2003 Red Hat, Inc. All rights reserved. + * + * This software may be freely redistributed under the terms of the GNU + * public license. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include + +int main(int argc, char **argv) +{ + unsigned char twelve = 12; + char *type; + int maj, min, ret = 0, fg = -1; + struct stat sb; + + fstat(0, &sb); + maj = major(sb.st_rdev); + min = minor(sb.st_rdev); + if (maj != 3 && (maj < 136 || maj > 143)) { + if ((fg = ioctl (0, TIOCLINUX, &twelve)) < 0) { + type = "serial"; + ret = 1; + } else { +#ifdef __powerpc__ + int fd; + char buf[65536]; + + fd = open("/proc/tty/drivers",O_RDONLY); + read(fd, buf, 65535); + if (strstr(buf,"vioconsole /dev/tty")) { + type = "vio"; + ret = 3; + } else { + type = "vt"; + ret = 0; + } +#else + type = "vt"; + ret = 0; +#endif + } + } else { + type = "pty"; + ret = 2; + } + if (argc > 1 && !strcmp(argv[1],"fg")) { + if (fg < 0 || fg != (min-1)) + return 1; + return 0; + } else { + printf("%s\n",type); + return ret; + } +} diff --git a/src/doexec.c b/src/doexec.c new file mode 100644 index 0000000..1b04532 --- /dev/null +++ b/src/doexec.c @@ -0,0 +1,19 @@ +/* + * Copyright (c) 1997-1999 Red Hat, Inc. All rights reserved. + * + * This software may be freely redistributed under the terms of the GNU + * public license. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include + +int main(int argc, char ** argv) { + if (argc<2) return 1; + execvp(argv[1], argv + 2); + return 1; +} diff --git a/src/genhostid.c b/src/genhostid.c new file mode 100644 index 0000000..a56cad8 --- /dev/null +++ b/src/genhostid.c @@ -0,0 +1,32 @@ +/* Copyright (C) 2003 Red Hat, Inc. + * + * This software may be freely redistributed under the terms of the GNU + * public license. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include +#include +#include +#include +#include +int +main (void) +{ + struct stat st; + long int n; + if (stat ("/etc/hostid", &st) == 0 && S_ISREG (st.st_mode) + && st.st_size >= sizeof (n)) + return 0; + int fd = open ("/dev/random", O_RDONLY); + if (fd == -1 || read (fd, &n, sizeof (n)) != sizeof (n)) + { + srand48 ((long int) time (NULL) ^ (long int) getpid ()); + n = lrand48 (); + } + return sethostid (n); +} diff --git a/src/getkey.c b/src/getkey.c new file mode 100644 index 0000000..1149626 --- /dev/null +++ b/src/getkey.c @@ -0,0 +1,141 @@ +/* + * Copyright (c) 1999-2003, 2006 Red Hat, Inc. 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, version 2, + * as published by the Free Software Foundation. + * + * This program 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 program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * + * getkey + * + * A very simple keygrabber. + * + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "popt.h" + +static struct termios orig_tp; + +static void reset_term(int x) { + tcsetattr(0,TCSANOW,&orig_tp); + _exit(x); +} + +int main(int argc, char **argv) { + static const char default_list[] = ""; + + const char *list; + char *waitmessage = NULL; + char *waitprint, *waitsprint; + int waitseconds=0; + int alarmlen=0; + int ignore_control=0; + struct termios tp; + int r; + struct pollfd ufds; /* only one, no need for an array... */ + poptContext context; + struct poptOption options[] = { + { "wait", 'c', POPT_ARG_INT, &waitseconds, 0, "Number of seconds to wait for keypress", NULL }, + { "message", 'm', POPT_ARG_STRING, &waitmessage, 0, "Message to print out while waiting for string\nNOTE: The message may have a \"%d\" in it, to hold the number of seconds left to wait.", NULL }, + { "ignore-control-chars", 'i', POPT_ARG_NONE, &ignore_control, 0, "Ignore Control-C and Control-D", NULL }, + POPT_AUTOHELP + POPT_TABLEEND + }; + + context = poptGetContext("getkey", argc, (const char **)argv, options, + POPT_CONTEXT_POSIXMEHARDER); + poptSetOtherOptionHelp(context, "[keys]"); + + r = poptGetNextOpt(context); + if (r < -1) { + fprintf(stderr, "%s: %s\n", + poptBadOption(context, POPT_BADOPTION_NOALIAS), + poptStrerror(r)); + + return -1; + } + list = poptGetArg(context); + if (list != NULL) { + char *p; + + p = strdup(list); + list = p; + while (*p != 0) { + *p = toupper(*p); + p++; + } + } else + list = default_list; + if (waitseconds) { + if (waitseconds < 0) { + fprintf(stderr, "--wait: Invalid time %d seconds\n", + waitseconds); + return -1; + } + alarmlen = waitseconds; + } + + tcgetattr(0,&tp); + orig_tp = tp; + signal(SIGTERM,reset_term); + if (alarmlen != 0) { + signal(SIGALRM,reset_term); + alarm(alarmlen); + } + + tp.c_iflag=0; + tp.c_oflag &= ~OPOST; + tp.c_lflag &= ~(ISIG | ICANON); + tcsetattr(0,TCSANOW,&tp); + + ufds.events = POLLIN; + ufds.fd = 0; + + if (waitmessage) { + waitprint = alloca (strlen(waitmessage)+15); /* long enough */ + waitprint[0] = '\r'; + waitsprint = waitprint + 1; + } + + while (1) { + if (waitmessage) { + sprintf (waitsprint, waitmessage, waitseconds); + write (1, waitprint, strlen(waitprint)); + } + r = poll(&ufds, 1, alarmlen ? 1000 : -1); + if (r == 0) { + /* we have waited a whole second with no keystroke... */ + waitseconds--; + } + if (r > 0) { + char ch; + + read(0, &ch, sizeof(ch)); + ch = toupper(ch); + /* Die if we get a control-c or control-d */ + if (ignore_control == 0 && (ch == 3 || ch == 4)) + reset_term(1); + /* Don't let a null character be interpreted as a match + by strchr */ + if (ch != 0 + && (strcmp(list, "") == 0 || strchr(list, ch) != NULL)) + reset_term(0); + } + } +} diff --git a/src/initlog.c b/src/initlog.c new file mode 100644 index 0000000..3b1cded --- /dev/null +++ b/src/initlog.c @@ -0,0 +1,465 @@ +/* + * Copyright (c) 1999-2003 Red Hat, Inc. All rights reserved. + * + * This software may be freely redistributed under the terms of the GNU + * public license. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define SYSLOG_NAMES +#include + +#include +#include +#include +#include + +#define _(String) gettext((String)) + +#include + +#include + +#include "initlog.h" +#include "process.h" + +static int logfacility=LOG_DAEMON; +static int logpriority=LOG_NOTICE; +static int reexec=0; +static int quiet=0; +int debug=0; + +regex_t **regList = NULL; + +static int logEntries = 0; +struct logInfo *logData = NULL; + +void readConfiguration(char *fname) { + int fd,num=0; + struct stat sbuf; + char *data,*line; + regex_t *regexp; + int lfac=-1,lpri=-1; + + if ((fd=open(fname,O_RDONLY))==-1) return; + if (fstat(fd,&sbuf)) { + close(fd); + return; + } + data=malloc(sbuf.st_size+1); + if (read(fd,data,sbuf.st_size)!=sbuf.st_size) { + close(fd); + free(data); + return; + } + close(fd); + data[sbuf.st_size] = '\0'; + while ((line=getLine(&data))) { + if (line[0]=='#') continue; + if (!strncmp(line,"ignore ",7)) { + regexp = malloc(sizeof(regex_t)); + if (!regcomp(regexp,line+7,REG_EXTENDED|REG_NOSUB|REG_NEWLINE)) { + regList = realloc(regList,(num+2) * sizeof(regex_t *)); + regList[num] = regexp; + regList[num+1] = NULL; + num++; + } + } + if (!strncmp(line,"facility ",9)) { + lfac=atoi(line+9); + if ((lfac == 0) && strcmp(line+9,"0")) { + int x =0; + + lfac = LOG_DAEMON; + for (x=0;facilitynames[x].c_name;x++) { + if (!strcmp(line+9,facilitynames[x].c_name)) { + lfac = facilitynames[x].c_val; + break; + } + } + } + } + if (!strncmp(line,"priority ",9)) { + lpri = atoi(line+9); + if ((lpri == 0) && strcmp(line+9,"0")) { + int x=0; + + lpri = LOG_NOTICE; + for (x=0;prioritynames[x].c_name;x++) { + if (!strcmp(line+9,prioritynames[x].c_name)) { + lpri = prioritynames[x].c_val; + break; + } + } + } + } + } + if (lfac!=-1) logfacility=lfac; + if (lpri!=-1) logpriority=lpri; +} + +char *getLine(char **data) { + /* Get one line from data */ + /* Anything up to a carraige return (\r) or a backspace (\b) is discarded. */ + /* If this really bothers you, mail me and I might make it configurable. */ + /* It's here to avoid confilcts with fsck's progress bar. */ + char *x, *y; + + if (!*data) return NULL; + x=*data; + while (*x && (*x != '\n')) { + while (*x && (*x != '\n') && (*x != '\r') && (*x != '\b')) x++; + if (*x && (*x=='\r' || *x =='\b')) { + *data = x+1; + x++; + } + } + if (*x) { + x++; + } else { + if (x-*data) { + y=malloc(x-*data+1); + y[x-*data] = 0; + y[x-*data-1] = '\n'; + memcpy(y,*data,x-*data); + } else { + y=NULL; + } + *data = NULL; + return y; + } + y = malloc(x-*data); + y[x-*data-1] = 0; + memcpy(y,*data,x-*data-1); + *data = x; + return y; +} + +char **toArray(char *line, int *num) { + /* Converts a long string into an array of lines. */ + char **lines; + char *tmpline; + + *num = 0; + lines = NULL; + + while ((tmpline=getLine(&line))) { + if (!*num) + lines = (char **) malloc(sizeof(char *)); + else + lines = (char **) realloc(lines, (*num+1)*sizeof(char *)); + lines[*num] = tmpline; + (*num)++; + } + return lines; +} + +int startDaemon() { + int pid; + int rc; + + if ( (pid = fork()) == -1 ) { + perror("fork"); + return -1; + } + if ( pid ) { + /* parent */ + waitpid(pid,&rc,0); + if (WIFEXITED(rc)) { + DDEBUG("minilogd returned %d!\n",WEXITSTATUS(rc)); + return WEXITSTATUS(rc); + } + else + return -1; + } else { + int fd; + + fd=open("/dev/null",O_RDWR); + dup2(fd,0); + dup2(fd,1); + dup2(fd,2); + close(fd); + /* kid */ + execlp("minilogd","minilogd",NULL); + perror("exec"); + exit(-1); + } +} + +int trySocket() { + int s; + struct sockaddr_un addr; + + s = socket(AF_LOCAL, SOCK_DGRAM, 0); + if (s<0) + return 1; + + bzero(&addr,sizeof(addr)); + addr.sun_family = AF_LOCAL; + strncpy(addr.sun_path,_PATH_LOG,sizeof(addr.sun_path)-1); + + if (connect(s,(struct sockaddr *) &addr,sizeof(addr))<0) { + if (errno == EPROTOTYPE || errno == ECONNREFUSED) { + DDEBUG("connect failed (EPROTOTYPE), trying stream\n"); + close(s); + s = socket(AF_LOCAL, SOCK_STREAM, 0); + if (connect(s,(struct sockaddr *) &addr, sizeof(addr)) < 0) { + DDEBUG("connect failed: %s\n",strerror(errno)); + close(s); + return 1; + } + close(s); + return 0; + } + close(s); + DDEBUG("connect failed: %s\n",strerror(errno)); + return 1; + } else { + close(s); + return 0; + } +} + +int logLine(struct logInfo *logEnt) { + /* Logs a line... somewhere. */ + int x; + struct stat statbuf; + + /* Don't log empty or null lines */ + if (!logEnt->line || !strcmp(logEnt->line,"\n")) return 0; + + + if ( ((stat(_PATH_LOG,&statbuf)==-1) || trySocket()) + && startDaemon() + ) { + DDEBUG("starting daemon failed, pooling entry %d\n",logEntries); + logData=realloc(logData,(logEntries+1)*sizeof(struct logInfo)); + logData[logEntries]= (*logEnt); + logEntries++; + } else { + if (logEntries>0) { + for (x=0;xline); + openlog(logEnt->cmd,0,logEnt->fac); + syslog(logEnt->pri,"%s",logEnt->line); + closelog(); + } + return 0; +} + +int logEvent(char *cmd, int eventtype,char *string) { + char *eventtable [] = { + _("%s babbles incoherently"), + _("%s succeeded"), + _("%s failed"), + _("%s cancelled at user request"), + _("%s failed due to a failed dependency"), + /* insert more here */ + NULL + }; + int x=0,len; + struct logInfo logentry; + + if (cmd) { + logentry.cmd = strdup(basename(cmd)); + if ((logentry.cmd[0] =='K' || logentry.cmd[0] == 'S') && + ( logentry.cmd[1] >= '0' && logentry.cmd[1] <= '9' ) && + ( logentry.cmd[2] >= '0' && logentry.cmd[2] <= '9' ) ) + logentry.cmd+=3; + } else + logentry.cmd = strdup(_("(none)")); + if (!string) + string = strdup(cmd); + + while (eventtable[x] && x= '0' && logentry.cmd[1] <= 0x39 ) && + ( logentry.cmd[2] >= '0' && logentry.cmd[2] <= 0x39 ) ) + logentry.cmd+=3; + } else + logentry.cmd = strdup(_("")); + logentry.line = strdup(string); + logentry.pri = logpriority; + logentry.fac = logfacility; + + return logLine(&logentry); +} + +int processArgs(int argc, char **argv, int silent) { + char *cmdname=NULL; + char *conffile=NULL; + int cmdevent=0; + char *cmd=NULL; + char *logstring=NULL; + char *fac=NULL,*pri=NULL; + int lfac=-1, lpri=-1; + poptContext context; + int rc; + struct poptOption optTable[] = { + POPT_AUTOHELP + { "conf", 0, POPT_ARG_STRING, &conffile, 0, + "configuration file (default: /etc/initlog.conf)", NULL + }, + { "name", 'n', POPT_ARG_STRING, &cmdname, 0, + "name of service being logged", NULL + }, + { "event", 'e', POPT_ARG_INT, &cmdevent, 0, + "event being logged (see man page)", NULL + }, + { "cmd", 'c', POPT_ARG_STRING, &cmd, 0, + "command to run, logging output", NULL + }, + { "debug", 'd', POPT_ARG_NONE, &debug, 0, + "print lots of verbose debugging info", NULL + }, + { "run", 'r', POPT_ARG_STRING, &cmd, 3, + "command to run, accepting input on open fd", NULL + }, + { "string", 's', POPT_ARG_STRING, &logstring, 0, + "string to log", NULL + }, + { "facility", 'f', POPT_ARG_STRING, &fac, 1, + "facility to log at (default: 'local7')", NULL + }, + { "priority", 'p', POPT_ARG_STRING, &pri, 2, + "priority to log at (default: 'notice')", NULL + }, + { "quiet", 'q', POPT_ARG_NONE, &quiet, 0, + "suppress stdout/stderr", NULL + }, + { 0, 0, 0, 0, 0, 0 } + }; + + context = poptGetContext("initlog", argc, argv, optTable, 0); + + while ((rc = poptGetNextOpt(context)) > 0) { + switch (rc) { + case 1: + lfac=atoi(fac); + if ((lfac == 0) && strcmp(fac,"0")) { + int x =0; + + lfac = LOG_DAEMON; + for (x=0;facilitynames[x].c_name;x++) { + if (!strcmp(fac,facilitynames[x].c_name)) { + lfac = facilitynames[x].c_val; + break; + } + } + } + break; + case 2: + lpri = atoi(pri); + if ((lpri == 0) && strcmp(pri,"0")) { + int x=0; + + lpri = LOG_NOTICE; + for (x=0;prioritynames[x].c_name;x++) { + if (!strcmp(pri,prioritynames[x].c_name)) { + lpri = prioritynames[x].c_val; + break; + } + } + } + break; + case 3: + reexec = 1; + break; + default: + break; + } + } + + if ((rc < -1)) { + if (!silent) + fprintf(stderr, "%s: %s\n", + poptBadOption(context, POPT_BADOPTION_NOALIAS), + poptStrerror(rc)); + + return -1; + } + if ( (cmd && logstring) || (cmd && cmdname) ) { + if (!silent) + fprintf(stderr, _("--cmd and --run are incompatible with --string or --name\n")); + return -1; + } + if ( cmdname && (!logstring && !cmdevent)) { + if (!silent) + fprintf(stderr, _("--name requires one of --event or --string\n")); + return -1; + } + if (cmdevent && cmd) { + if (!silent) + fprintf(stderr, _("--cmd and --run are incompatible with --event\n")); + return -1; + } + if (conffile) { + readConfiguration(conffile); + } else { + readConfiguration("/etc/initlog.conf"); + } + if (cmd) { + while (isspace(*cmd)) cmd++; + } + if (lpri!=-1) logpriority=lpri; + if (lfac!=-1) logfacility=lfac; + if (cmdevent) { + logEvent(cmdname,cmdevent,logstring); + } else if (logstring) { + logString(cmdname,logstring); + } else if ( cmd && *cmd) { + return(runCommand(cmd,reexec,quiet,debug)); + } else { + if (!silent) + fprintf(stderr,"nothing to do!\n"); + return -1; + } + return 0; +} + +int main(int argc, char **argv) { + + setlocale(LC_ALL,""); + bindtextdomain("initlog","/etc/locale"); + textdomain("initlog"); + exit(processArgs(argc,argv,0)); +} diff --git a/src/initlog.conf b/src/initlog.conf new file mode 100644 index 0000000..4505c7d --- /dev/null +++ b/src/initlog.conf @@ -0,0 +1,23 @@ +# /etc/initlog.conf +# +# initlog configuration file +# +# lines preceded by a '#' are comments +# +# anything not recognized is ignored. :) + +# This sets the default logging facility. (can override with command line arguments) +facility local7 + +# This sets the default logging priority. (can override with command line arguments) +priority notice + +# ignore foo +# means to discard any output lines that match the regular expression foo + +# This regexp is useful if you use fsck's -C option. +ignore [^:]+: \|[=]+ +# This regexp is useful for fsck's feature of setting file types +ignore [^:]+: Setting filetype +# This regexp is useful for quotacheck +ignore ^[-\\\|\/]$ diff --git a/src/initlog.h b/src/initlog.h new file mode 100644 index 0000000..94f467b --- /dev/null +++ b/src/initlog.h @@ -0,0 +1,20 @@ + +#define _GNU_SOURCE 1 + +#ifndef INITLOG_H +#define INITLOG_H + +struct logInfo { + char *cmd; + char *line; + int fac; + int pri; +}; + +char *getLine(char **data); +int logString(char *cmd, char *string); +int processArgs(int argc, char **argv, int silent); + +#define DDEBUG if (debug) printf + +#endif diff --git a/src/ipcalc.c b/src/ipcalc.c new file mode 100644 index 0000000..f133412 --- /dev/null +++ b/src/ipcalc.c @@ -0,0 +1,361 @@ +/* + * Copyright (c) 1997-2003 Red Hat, Inc. All rights reserved. + * + * This software may be freely redistributed under the terms of the GNU + * public license. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Authors: + * Erik Troan + * Preston Brown + */ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/*! + \def IPBITS + \brief the number of bits in an IP address. +*/ +#define IPBITS (sizeof(u_int32_t) * 8) +/*! + \def IPBYTES + \brief the number of bytes in an IP address. +*/ +#define IPBYTES (sizeof(u_int32_t)) + + +/*! + \file ipcalc.c + \brief provides utilities for manipulating IP addresses. + + ipcalc provides utilities and a front-end command line interface for + manipulating IP addresses, and calculating various aspects of an ip + address/netmask/network address/prefix/etc. + + Functionality can be accessed from other languages from the library + interface, documented here. To use ipcalc from the shell, read the + ipcalc(1) manual page. + + When passing parameters to the various functions, take note of whether they + take host byte order or network byte order. Most take host byte order, and + return host byte order, but there are some exceptions. + +*/ + +/*! + \fn u_int32_t prefix2mask(int bits) + \brief creates a netmask from a specified number of bits + + This function converts a prefix length to a netmask. As CIDR (classless + internet domain internet domain routing) has taken off, more an more IP + addresses are being specified in the format address/prefix + (i.e. 192.168.2.3/24, with a corresponding netmask 255.255.255.0). If you + need to see what netmask corresponds to the prefix part of the address, this + is the function. See also \ref mask2prefix. + + \param prefix is the number of bits to create a mask for. + \return a network mask, in network byte order. +*/ +u_int32_t prefix2mask(int prefix) { + return htonl(~((1 << (32 - prefix)) - 1)); +} + +/*! + \fn int mask2prefix(u_int32_t mask) + \brief calculates the number of bits masked off by a netmask. + + This function calculates the significant bits in an IP address as specified by + a netmask. See also \ref prefix2mask. + + \param mask is the netmask, specified as an u_int32_teger in network byte order. + \return the number of significant bits. */ +int mask2prefix(u_int32_t mask) +{ + int i; + int count = IPBITS; + + for (i = 0; i < IPBITS; i++) { + if (!(ntohl(mask) & ((2 << i) - 1))) + count--; + } + + return count; +} + +/*! + \fn u_int32_t default_netmask(u_int32_t addr) + + \brief returns the default (canonical) netmask associated with specified IP + address. + + When the Internet was originally set up, various ranges of IP addresses were + segmented into three network classes: A, B, and C. This function will return + a netmask that is associated with the IP address specified defining where it + falls in the predefined classes. + + \param addr an IP address in network byte order. + \return a netmask in network byte order. */ +u_int32_t default_netmask(u_int32_t addr) +{ + if (((ntohl(addr) & 0xFF000000) >> 24) <= 127) + return htonl(0xFF000000); + else if (((ntohl(addr) & 0xFF000000) >> 24) <= 191) + return htonl(0xFFFF0000); + else + return htonl(0xFFFFFF00); +} + +/*! + \fn u_int32_t calc_broadcast(u_int32_t addr, int prefix) + + \brief calculate broadcast address given an IP address and a prefix length. + + \param addr an IP address in network byte order. + \param prefix a prefix length. + + \return the calculated broadcast address for the network, in network byte + order. +*/ +u_int32_t calc_broadcast(u_int32_t addr, + int prefix) +{ + return (addr & prefix2mask(prefix)) | ~prefix2mask(prefix); +} + +/*! + \fn u_int32_t calc_network(u_int32_t addr, int prefix) + \brief calculates the network address for a specified address and prefix. + + \param addr an IP address, in network byte order + \param prefix the network prefix + \return the base address of the network that addr is associated with, in + network byte order. +*/ +u_int32_t calc_network(u_int32_t addr, int prefix) +{ + return (addr & prefix2mask(prefix)); +} + +/*! + \fn const char *get_hostname(u_int32_t addr) + \brief returns the hostname associated with the specified IP address + + \param addr an IP address to find a hostname for, in network byte order + + \return a hostname, or NULL if one cannot be determined. Hostname is stored + in a static buffer that may disappear at any time, the caller should copy the + data if it needs permanent storage. +*/ +const char *get_hostname(u_int32_t addr) +{ + struct hostent * hostinfo; + int x; + + hostinfo = gethostbyaddr((char *) &addr, sizeof(addr), AF_INET); + if (!hostinfo) + return NULL; + + for (x=0; hostinfo->h_name[x]; x++) { + hostinfo->h_name[x] = tolower(hostinfo->h_name[x]); + } + return hostinfo->h_name; +} + +/*! + \fn main(int argc, const char **argv) + \brief wrapper program for ipcalc functions. + + This is a wrapper program for the functions that the ipcalc library provides. + It can be used from shell scripts or directly from the command line. + + For more information, please see the ipcalc(1) man page. +*/ +int main(int argc, const char **argv) { + int showBroadcast = 0, showPrefix = 0, showNetwork = 0; + int showHostname = 0, showNetmask = 0; + int beSilent = 0; + int rc; + poptContext optCon; + char *ipStr, *prefixStr, *netmaskStr, *hostName, *chptr; + struct in_addr ip, netmask, network, broadcast; + int prefix = 0; + char errBuf[250]; + struct poptOption optionsTable[] = { + { "broadcast", 'b', 0, &showBroadcast, 0, + "Display calculated broadcast address", }, + { "hostname", 'h', 0, &showHostname, 0, + "Show hostname determined via DNS" }, + { "netmask", 'm', 0, &showNetmask, 0, + "Display default netmask for IP (class A, B, or C)" }, + { "network", 'n', 0, &showNetwork, 0, + "Display network address", }, + { "prefix", 'p', 0, &showPrefix, 0, + "Display network prefix", }, + { "silent", 's', 0, &beSilent, 0, + "Don't ever display error messages " }, + POPT_AUTOHELP + { NULL, '\0', 0, 0, 0, NULL, NULL } + }; + + optCon = poptGetContext("ipcalc", argc, argv, optionsTable, 0); + poptReadDefaultConfig(optCon, 1); + + if ((rc = poptGetNextOpt(optCon)) < -1) { + if (!beSilent) { + fprintf(stderr, "ipcalc: bad argument %s: %s\n", + poptBadOption(optCon, POPT_BADOPTION_NOALIAS), + poptStrerror(rc)); + poptPrintHelp(optCon, stderr, 0); + } + return 1; + } + + if (!(ipStr = (char *) poptGetArg(optCon))) { + if (!beSilent) { + fprintf(stderr, "ipcalc: ip address expected\n"); + poptPrintHelp(optCon, stderr, 0); + } + return 1; + } + + if (strchr(ipStr,'/') != NULL) { + prefixStr = strchr(ipStr, '/') + 1; + prefixStr--; + *prefixStr = '\0'; /* fix up ipStr */ + prefixStr++; + } else + prefixStr = NULL; + + if (prefixStr != NULL) { + prefix = atoi(prefixStr); + if (prefix == 0) { + if (!beSilent) + fprintf(stderr, "ipcalc: bad prefix: %s\n", + prefixStr); + return 1; + } + } + + if (showBroadcast || showNetwork || showPrefix) { + if (!(netmaskStr = (char *) poptGetArg(optCon)) && + (prefix == 0)) { + if (!beSilent) { + fprintf(stderr, "ipcalc: netmask or prefix expected\n"); + poptPrintHelp(optCon, stderr, 0); + } + return 1; + } else if (netmaskStr && prefix != 0) { + if (!beSilent) { + fprintf(stderr, "ipcalc: both netmask and prefix specified\n"); + poptPrintHelp(optCon, stderr, 0); + } + return 1; + } else if (netmaskStr) { + if (!inet_aton(netmaskStr, &netmask)) { + if (!beSilent) + fprintf(stderr, "ipcalc: bad netmask: %s\n", + netmaskStr); + return 1; + } + prefix = mask2prefix(netmask.s_addr); + } + } + + if ((chptr = (char *) poptGetArg(optCon))) { + if (!beSilent) { + fprintf(stderr, "ipcalc: unexpected argument: %s\n", chptr); + poptPrintHelp(optCon, stderr, 0); + } + return 1; + } + + /* Handle CIDR entries such as 172/8 */ + if (prefix) { + char *tmp = ipStr; + int i; + + for(i=3; i> 0; i--) { + tmp = strchr(tmp,'.'); + if (!tmp) + break; + else + tmp++; + } + tmp = NULL; + for (; i>0; i--) { + tmp = malloc(strlen(ipStr) + 3); + sprintf(tmp,"%s.0",ipStr); + ipStr = tmp; + } + } + + if (!inet_aton(ipStr, (struct in_addr *) &ip)) { + if (!beSilent) + fprintf(stderr, "ipcalc: bad ip address: %s\n", ipStr); + return 1; + } + + + if (!(showNetmask|showPrefix|showBroadcast|showNetwork|showHostname)) { + poptPrintHelp(optCon, stderr, 0); + return 1; + } + + poptFreeContext(optCon); + + /* we know what we want to display now, so display it. */ + + if (showNetmask) { + if (prefix) { + netmask.s_addr = prefix2mask(prefix); + } else { + netmask.s_addr = default_netmask(ip.s_addr); + prefix = mask2prefix(netmask.s_addr); + } + + printf("NETMASK=%s\n", inet_ntoa(netmask)); + } + + if (showPrefix) { + if (!prefix) + prefix = mask2prefix(ip.s_addr); + printf("PREFIX=%d\n", prefix); + } + + if (showBroadcast) { + broadcast.s_addr = calc_broadcast(ip.s_addr, prefix); + printf("BROADCAST=%s\n", inet_ntoa(broadcast)); + } + + if (showNetwork) { + network.s_addr = calc_network(ip.s_addr, prefix); + printf("NETWORK=%s\n", inet_ntoa(network)); + } + + if (showHostname) { + if ((hostName = (char *) get_hostname(ip.s_addr)) == NULL) { + if (!beSilent) { + sprintf(errBuf, "ipcalc: cannot find hostname for %s", ipStr); + herror(errBuf); + } + return 1; + } + + printf("HOSTNAME=%s\n", hostName); + } + + return 0; +} diff --git a/src/loglevel.c b/src/loglevel.c new file mode 100644 index 0000000..de2a4e1 --- /dev/null +++ b/src/loglevel.c @@ -0,0 +1,25 @@ + +/* Change the default console loglevel */ + +#include +#include +#include +#include +#include + +int main(int argc, char **argv) { + int level; + + if (!argv[1]) exit(0); + level=atoi(argv[1]); + if ( (level<1) || (level>8) ) { + fprintf(stderr,"invalid log level %d\n",level); + exit(-1); + } + if (!syscall(SYS_syslog,8,NULL,level)) { + exit(0); + } else { + perror("syslog"); + exit(-1); + } +} diff --git a/src/minilogd.c b/src/minilogd.c new file mode 100644 index 0000000..8543097 --- /dev/null +++ b/src/minilogd.c @@ -0,0 +1,187 @@ +/* minilogd.c + * + * A pale imitation of syslogd. Most notably, doesn't write anything + * anywhere except possibly back to syslogd. + * + * Copyright (c) 1999-2001 Red Hat, Inc. All rights reserved. + * + * This software may be freely redistributed under the terms of the GNU + * public license. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +static int we_own_log=0; +static char **buffer=NULL; +static int buflines=0; + +int debug; + +int recvsock; + +void alarm_handler(int x) { + alarm(0); + close(recvsock); + recvsock = -1; +} + +void freeBuffer() { + struct sockaddr_un addr; + int sock; + int x=0,conn; + + bzero(&addr,sizeof(addr)); + addr.sun_family = AF_LOCAL; + strncpy(addr.sun_path,_PATH_LOG,sizeof(addr.sun_path)-1); + /* wait for klogd to hit syslog */ + sleep(2); + sock = socket(AF_LOCAL, SOCK_DGRAM,0); + conn=connect(sock,(struct sockaddr *) &addr,sizeof(addr)); + while (x0) && pfds.revents & (POLLIN | POLLPRI)) { + message = calloc(8192,sizeof(char)); + addrlen = sizeof(struct sockaddr_un); + recvsock = accept(sock,(struct sockaddr *) &addr, &addrlen); + if (recvsock == -1) + continue; + alarm(2); + signal(SIGALRM, alarm_handler); + len = recv(recvsock,message,8192,0); + alarm(0); + close(recvsock); + if (len>0) { + if (buflines < 200000) { + if (buffer) + buffer = realloc(buffer,(buflines+1)*sizeof(char *)); + else + buffer = malloc(sizeof(char *)); + message[strlen(message)]='\n'; + buffer[buflines]=message; + buflines++; + } + } + else { + recvsock=-1; + } + } + if ( (x>0) && ( pfds.revents & (POLLHUP | POLLNVAL)) ) + done = 1; + /* Check to see if syslogd's yanked our socket out from under us */ + if ( (stat(_PATH_LOG,&s2)!=0) || + (s1.st_ino != s2.st_ino ) || (s1.st_ctime != s2.st_ctime) || + (s1.st_mtime != s2.st_mtime) ) { + done = 1; + we_own_log = 0; + } + } + cleanup(0); +} + +int main(int argc, char **argv) { + struct sockaddr_un addr; + int sock; + int pid; + + /* option processing made simple... */ + if (argc>1) debug=1; + /* just in case */ + sock = open("/dev/null",O_RDWR); + dup2(sock,0); + dup2(sock,1); + dup2(sock,2); + close(sock); + + bzero(&addr, sizeof(addr)); + addr.sun_family = AF_LOCAL; + strncpy(addr.sun_path,_PATH_LOG,sizeof(addr.sun_path)-1); + sock = socket(AF_LOCAL, SOCK_STREAM,0); + unlink(_PATH_LOG); + /* Bind socket before forking, so we know if the server started */ + if (!bind(sock,(struct sockaddr *) &addr, sizeof(addr))) { + we_own_log = 1; + listen(sock,5); + if ((pid=fork())==-1) { + perror("fork"); + exit(3); + } + if (pid) { + exit(0); + } else { + runDaemon(sock); + /* shouldn't get back here... */ + exit(4); + } + } else { + exit(5); + } +} diff --git a/src/netreport.c b/src/netreport.c new file mode 100644 index 0000000..6eb220c --- /dev/null +++ b/src/netreport.c @@ -0,0 +1,66 @@ +/* + * Copyright (c) 1997-2002 Red Hat, Inc. All rights reserved. + * + * This software may be freely redistributed under the terms of the GNU + * public license. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ +#include +#include +#include +#include +#include +#include + +/* this will be running setgid root, so be careful! */ + +static void +usage(void) { + fprintf(stderr, "usage: netreport [-r]\n"); + exit(1); +} + +#define ADD 1 +#define DEL 0 +int main(int argc, char ** argv) { + int action = ADD; + /* more than long enough for "/var/run/netreport/\0" */ + char netreport_name[64]; + int netreport_file; + + if (argc > 2) { + usage(); + } + + if (argc > 1) { + if (argc == 2 && strcmp(argv[1], "-r") == 0) { + action = DEL; + } else { + usage(); + } + } + + snprintf(netreport_name, sizeof(netreport_name), + "/var/run/netreport/%d", getppid()); + if (action == ADD) { + netreport_file = open(netreport_name, + O_EXCL|O_CREAT|O_WRONLY|O_TRUNC|O_NOFOLLOW, 0); + if (netreport_file == -1) { + if (errno != EEXIST) { + perror("Could not create netreport file"); + exit (1); + } + } else { + close(netreport_file); + } + } else { + /* ignore errors; not much we can do, won't hurt anything */ + unlink(netreport_name); + } + + return 0; +} diff --git a/src/ppp-watch.c b/src/ppp-watch.c new file mode 100644 index 0000000..4a08d78 --- /dev/null +++ b/src/ppp-watch.c @@ -0,0 +1,786 @@ +/* + * ppp-watch.c + * + * Bring up a PPP connection and Do The Right Thing[tm] to make bringing + * the connection up or down with ifup and ifdown syncronous. Takes + * one argument: the logical name of the device to bring up. Does not + * detach until the interface is up or has permanently failed to come up. + * + * Copyright 1999-2003 Red Hat, Inc. + * + * This 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. + * + * This program 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 program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +/* Algorithm: + * fork + * if child: + * Register with netreport. (now exit implies deregister first) + * fork/exec ifup-ppp daemon + * else: + * while (1): + * sigsuspend() + * if SIGTERM or SIGINT: + * kill pppd pgrp + * exit + * if SIGHUP: + * reload ifcfg files + * kill pppd pgrp + * wait for SIGCHLD to redial + * if SIGIO: + * if no physical device found: continue + * elif physical device is down: + * wait for pppd to exit to redial if appropriate + * else: (physical device is up) + * detach; continue + * if SIGCHLD: (pppd exited) + * wait() + * if pppd exited: + * if PERSIST: redial + * else: exit + * else: (pppd was killed) + * exit + * + * + * When ppp-watch itself dies for reasons of its own, it uses a return code + * higher than 25 so as not to clash with pppd return codes, which, as of + * this writing, range from 0 to 19. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "shvar.h" + +#define IFCFGPREFIX "/etc/sysconfig/interfaces/ifcfg-" +#define IFUP_PPP "/lib/rc-scripts/ifup-ppp" + +static int theSigterm = 0; +static int theSigint = 0; +static int theSighup = 0; +static int theSigio = 0; +static int theSigchld = 0; +static int theSigalrm = 0; +static int pipeArray[2]; + +// patch to respect the maxfail parameter to ppp +// Scott Sharkey +static int dialCount = 0; +static int theChild; +static void failureExit(int exitCode); + +static void +interrupt_child(int signo) { + kill(theChild, SIGINT); +} + +static void +set_signal(int signo, void (*handler)(int)) { + struct sigaction act; + act.sa_handler = handler; + act.sa_flags = SA_RESTART; + sigemptyset(&act.sa_mask); + sigaction(signo, &act, NULL); +} + +/* Create a pipe, and fork off a child. This is the end of the road for + * the parent, which will wait for an exit status byte on the pipe (which + * is written by the child). */ +static void +detach(char *device) { + pid_t childpid; + unsigned char exitCode; + int fd; + + if (pipe(pipeArray) == -1) + exit(25); + + childpid = fork(); + if (childpid == -1) + exit(26); + + if (childpid != 0) { + /* The parent only cares about notifications from the child. */ + close (pipeArray[1]); + + /* Certain signals are meant for our child, the watcher process. */ + theChild = childpid; + set_signal(SIGINT, interrupt_child); + set_signal(SIGTERM, interrupt_child); + set_signal(SIGHUP, interrupt_child); + + /* Read the pipe until the child gives us an exit code as a byte. */ + while (read (pipeArray[0], &exitCode, 1) == -1) { + switch (errno) { + case EINTR: continue; + default: exit (27); /* this will catch EIO in particular */ + } + } + switch (exitCode) { + case 0: + break; + case 33: + fprintf(stderr, "%s already up, initiating redial\n", device); + break; + case 34: + fprintf(stderr, "Failed to activate %s, retrying in the background\n", device); + break; + default: + fprintf(stderr, "Failed to activate %s with error %d\n", device, exitCode); + break; + } + exit(exitCode); + } + + /* We're in the child process, which only writes the exit status + * of the pppd process to its parent (i.e., it reads nothing). */ + close (pipeArray[0]); + + /* Don't leak this into programs we call. */ + fcntl(pipeArray[1], F_SETFD, FD_CLOEXEC); + + /* Redirect stdio to /dev/null. */ + fd = open("/dev/null", O_RDONLY); + dup2(fd, STDIN_FILENO); + close(fd); + + fd = open("/dev/null", O_WRONLY); + dup2(fd, STDOUT_FILENO); + dup2(fd, STDERR_FILENO); + close(fd); + + /* Become session and process group leader. */ + setsid(); + setpgid(0, 0); +} + +/* Do magic with the pid file (/var/run/pppwatch-$DEVICE.pid): + * Try to open it for writing. If it exists, send a SIGHUP to whatever PID + * is already listed in it and remove it. Repeat until we can open it. + * Write out our PID, and return. */ +static void +doPidFile(char *device) { + static char pidFilePath[PATH_MAX] = ""; + int fd = -1; + FILE *f = NULL; + pid_t pid = 0; + + if (device == NULL) { + /* Remove an existing pid file -- we're exiting. */ + if(strlen(pidFilePath) > 0) { + unlink(pidFilePath); + } + } else { + /* Set up the name of the pid file, used only the first time. */ + snprintf(pidFilePath, sizeof(pidFilePath), "/var/run/pppwatch-%s.pid", + device); + + /* Create the pid file. */ + do { + fd = open(pidFilePath, O_WRONLY|O_TRUNC|O_CREAT|O_EXCL|O_NOFOLLOW, + S_IRUSR|S_IWUSR | S_IRGRP | S_IROTH); + if(fd == -1) { + /* Try to open the file for read. */ + fd = open(pidFilePath, O_RDONLY); + if(fd == -1) + failureExit(36); /* This is not good. */ + + /* We're already running, send a SIGHUP (we presume that they + * are calling ifup for a reason, so they probably want to + * redial) and then exit cleanly and let things go on in the + * background. Muck with the filename so that we don't go + * deleting the pid file for the already-running instance. + */ + f = fdopen(fd, "r"); + if(f == NULL) + failureExit(37); + + pid = 0; + fscanf(f, "%d", &pid); + fclose(f); + + if(pid) { + /* Try to kill it. */ + if (kill(pid, SIGHUP) == -1) { + /* No such pid, remove the bogus pid file. */ + unlink(pidFilePath); + } else { + /* Got it. Don't mess with the pid file on + * our way out. */ + memset(pidFilePath, '\0', sizeof(pidFilePath)); + failureExit(33); + } + } + } + } while(fd == -1); + + f = fdopen(fd, "w"); + if(f == NULL) + failureExit(31); + fprintf(f, "%d\n", getpid()); + fclose(f); + } +} + +/* Fork off and exec() a child process. If reap_child is non-zero, + * wait for the child to exit and return 0 if it ran successfully, + * otherwise return 0 right away and let the SIGCHLD handler deal. */ +static int +fork_exec(gboolean reap, char *path, char *arg1, char *arg2, char *arg3) +{ + pid_t childpid; + int status; + + sigset_t sigs; + + childpid = fork(); + if (childpid == -1) + exit(26); + + if (childpid == 0) { + /* Do the exec magic. Prepare by clearing the signal mask for pppd. */ + sigemptyset(&sigs); + sigprocmask(SIG_SETMASK, &sigs, NULL); + + if (!reap) { + /* Make sure that the pppd is the leader for its process group. */ + setsid(); + setpgid(0, 0); + } + + execl(path, path, arg1, arg2, arg3, NULL); + perror(path); + _exit (1); + } + + if (reap) { + waitpid (childpid, &status, 0); + if (WIFEXITED(status) && (WEXITSTATUS(status) == 0)) { + return 0; + } else { + return 1; + } + } else { + return 0; + } +} + +/* Relay the pppd's exit code up to the parent -- can only be called once, + * because the parent exits as soon as it reads a byte. */ +static void +relay_exitcode(unsigned char code) +{ + unsigned char exitCode; + exitCode = code; + write(pipeArray[1], &exitCode, 1); + close(pipeArray[1]); +} + +/* Unregister with netreport, relay a status byte to the parent, clean up + * the pid file, and bail. */ +static void +failureExit(int exitCode) { + fork_exec(TRUE, "/sbin/netreport", "-r", NULL, NULL); + relay_exitcode(exitCode); + doPidFile(NULL); + exit(exitCode); +} + +/* Keeps track of which signals we've seen so far. */ +static void +signal_tracker (int signum) { + switch(signum) { + case SIGTERM: + theSigterm = 1; break; + case SIGINT: + theSigint = 1; break; + case SIGHUP: + theSighup = 1; break; + case SIGIO: + theSigio = 1; break; + case SIGCHLD: + theSigchld = 1; break; + case SIGALRM: + theSigalrm = 1; break; + } +} + +/* Return a shvarFile for this interface, taking into account one level of + * inheritance (eeewww). */ +static shvarFile * +shvarfilesGet(const char *interfaceName) { + shvarFile *ifcfg = NULL; + char ifcfgName[PATH_MAX]; + char *ifcfgParentDiff = NULL; + + /* Start with the basic configuration. */ + snprintf(ifcfgName, sizeof(ifcfgName), "%s%s", IFCFGPREFIX, interfaceName); + ifcfg = svNewFile(ifcfgName); + if (ifcfg == NULL) + return NULL; + + /* Do we have a parent interface (i.e., for ppp0-blah, ppp0) to inherit? */ + ifcfgParentDiff = strchr(ifcfgName + sizeof(IFCFGPREFIX), '-'); + if (ifcfgParentDiff) { + *ifcfgParentDiff = '\0'; + ifcfg->parent = svNewFile(ifcfgName); + } + + /* This is very unclean, but we have to close the shvar descriptors in + * case they've been numbered STDOUT_FILENO or STDERR_FILENO, which would + * be disastrous if inherited by a child process. */ + close (ifcfg->fd); + ifcfg->fd = 0; + + if (ifcfg->parent) { + close (ifcfg->parent->fd); + ifcfg->parent->fd = 0; + } + + return ifcfg; +} + +/* Convert a logical interface name to a real one by reading the lock + * file created by pppd. */ +static void +pppLogicalToPhysical(int *pppdPid, char *logicalName, char **physicalName) { + char mapFileName[PATH_MAX]; + char buffer[20]; + char *p, *q; + int fd, n; + char *physicalDevice = NULL; + + snprintf(mapFileName, sizeof(mapFileName), "/var/run/ppp-%s.pid", + logicalName); + fd = open(mapFileName, O_RDONLY); + if (fd != -1) { + n = read(fd, buffer, sizeof(buffer)); + close(fd); + if (n > 0) { + buffer[n] = '\0'; + /* Split up the file at the first line break -- the PID is on the + * first line. */ + if((p = strchr(buffer, '\n')) != NULL) { + *p = '\0'; + p++; + if (pppdPid) { + *pppdPid = atoi(buffer); + } + /* The physical device name is on the second line. */ + if((q = strchr(p, '\n')) != NULL) { + *q = '\0'; + physicalDevice = strdup(p); + } + } + } + } + + if (physicalDevice) { + if (physicalName) { + *physicalName = physicalDevice; + } else { + free(physicalDevice); + } + } else { + if (physicalName) { + *physicalName = NULL; + } + } +} + +/* Return a boolean value indicating if the interface is up. If not, or + * if we don't know, return FALSE. */ +static gboolean +interfaceIsUp(char *device) { + int sock = -1; + int family[] = {PF_INET, PF_IPX, PF_AX25, PF_APPLETALK, 0}; + int p = 0; + struct ifreq ifr; + gboolean retcode = FALSE; + + /* Create a socket suitable for doing routing ioctls. */ + for (p = 0; (sock == -1) && family[p]; p++) { + sock = socket(family[p], SOCK_DGRAM, 0); + } + if (sock == -1) + return FALSE; + + /* Populate the request structure for getting the interface's status. */ + memset(&ifr, 0, sizeof(ifr)); + strncpy(ifr.ifr_name, device, sizeof(ifr.ifr_name) - 1); + ifr.ifr_name[sizeof(ifr.ifr_name) - 1] = '\0'; + + /* We return TRUE iff the ioctl succeeded and the interface is UP. */ + if (ioctl(sock, SIOCGIFFLAGS, &ifr) == -1) { + retcode = FALSE; + } else if (ifr.ifr_flags & IFF_UP) { + retcode = TRUE; + } + + close(sock); + + return retcode; +} + +/* Very, very minimal hangup function. This just attempts to hang up a device + * that should already be hung up, so it does not need to be bulletproof. */ +static void +hangup(shvarFile *ifcfg) { + int fd; + char *line; + struct termios original_ts, ts; + + line = svGetValue(ifcfg, "MODEMPORT"); + if (line == NULL) + return; + + fd = open(line, O_RDWR | O_NOCTTY | O_NONBLOCK); + if (fd != -1) { + if (tcgetattr(fd, &ts) != -1) { + original_ts = ts; + write(fd, "\r", 1); /* tickle modems that do not like dropped DTR */ + usleep(1000); + cfsetospeed(&ts, B0); + tcsetattr(fd, TCSANOW, &ts); + usleep(100000); + tcsetattr(fd, TCSANOW, &original_ts); + } + close(fd); + } + free(line); +} + +int +main(int argc, char **argv) { + int status; + pid_t waited; + char *device, *real_device, *physicalDevice = NULL; + char *boot = NULL; + shvarFile *ifcfg; + sigset_t blockedsigs, unblockedsigs; + int pppdPid = 0; + int timeout = 30; + char *temp; + gboolean dying = FALSE; + int sendsig; + gboolean connectedOnce = FALSE; + int maxfail = 0; // MAXFAIL Patch + + if (argc < 2) { + fprintf (stderr, "usage: ppp-watch [boot]\n"); + exit(30); + } + + if (strncmp(argv[1], "ifcfg-", 6) == 0) { + device = argv[1] + 6; + } else { + device = argv[1]; + } + + detach(device); /* Prepare a child process to monitor pppd. When we + return, we'll be in the child. */ + + if ((argc > 2) && (strcmp("boot", argv[2]) == 0)) { + boot = argv[2]; + } + + ifcfg = shvarfilesGet(device); + if (ifcfg == NULL) + failureExit(28); + + real_device = svGetValue(ifcfg, "DEVICE"); + if (real_device == NULL) + real_device = device; + + doPidFile(real_device); + + /* We'll want to know which signal interrupted our sleep below, so + * attach a signal handler to these. */ + set_signal(SIGTERM, signal_tracker); + set_signal(SIGINT, signal_tracker); + set_signal(SIGHUP, signal_tracker); + set_signal(SIGIO, signal_tracker); + set_signal(SIGCHLD, signal_tracker); + + /* We time out only if we're being run at boot-time. */ + if (boot) { + temp = svGetValue(ifcfg, "BOOTTIMEOUT"); + if (temp) { + timeout = atoi(temp); + if (timeout < 1) timeout = 1; + free(temp); + } else { + timeout = 30; + } + set_signal(SIGALRM, signal_tracker); + alarm(timeout); + } + + /* Register us to get a signal when something changes. Yes, that's vague. */ + fork_exec(TRUE, "/sbin/netreport", NULL, NULL, NULL); + + /* Reset theSigchld, which should have been triggered by netreport. */ + theSigchld = 0; + + /* We don't set up the procmask until after we have received the netreport + * signal. Do so now. */ + sigemptyset(&blockedsigs); + sigaddset(&blockedsigs, SIGTERM); + sigaddset(&blockedsigs, SIGINT); + sigaddset(&blockedsigs, SIGHUP); + sigaddset(&blockedsigs, SIGIO); + sigaddset(&blockedsigs, SIGCHLD); + if (boot) { + sigaddset(&blockedsigs, SIGALRM); + } + sigprocmask(SIG_BLOCK, &blockedsigs, NULL); + + sigfillset(&unblockedsigs); + sigdelset(&unblockedsigs, SIGTERM); + sigdelset(&unblockedsigs, SIGINT); + sigdelset(&unblockedsigs, SIGHUP); + sigdelset(&unblockedsigs, SIGIO); + sigdelset(&unblockedsigs, SIGCHLD); + if (boot) { + sigdelset(&unblockedsigs, SIGALRM); + } + sigprocmask(SIG_UNBLOCK, &unblockedsigs, NULL); + + /* Initialize the retry timeout using the RETRYTIMEOUT setting. */ + temp = svGetValue(ifcfg, "RETRYTIMEOUT"); + if (temp) { + timeout = atoi(temp); + free(temp); + } else { + timeout = 30; + } + + /* Start trying to bring the interface up. */ + fork_exec(FALSE, IFUP_PPP, "daemon", device, boot); + + while (TRUE) { + /* Wait for a signal. */ + if (!theSigterm && + !theSigint && + !theSighup && + !theSigio && + !theSigchld && + !theSigalrm) { + sigsuspend(&unblockedsigs); + } + + /* If we got SIGTERM or SIGINT, give up and hang up. */ + if (theSigterm || theSigint) { + theSigterm = theSigint = 0; + + /* If we've already tried to exit this way, use SIGKILL instead + * of SIGTERM, because pppd's just being stubborn. */ + if (dying) { + sendsig = SIGKILL; + } else { + sendsig = SIGTERM; + } + dying = TRUE; + + /* Get the pid of our child pppd. */ + pppLogicalToPhysical(&pppdPid, device, NULL); + + /* We don't know what our child pid is. This is very confusing. */ + if (!pppdPid) { + failureExit(35); + } + + /* Die, pppd, die. */ + kill(pppdPid, sendsig); + if (sendsig == SIGKILL) { + kill(-pppdPid, SIGTERM); /* Give it a chance to die nicely, then + kill its whole process group. */ + usleep(2500000); + kill(-pppdPid, sendsig); + hangup(ifcfg); + failureExit(32); + } + } + + /* If we got SIGHUP, reload and redial. */ + if (theSighup) { + theSighup = 0; + + /* Free and reload the configuration structure. */ + if (ifcfg->parent) + svCloseFile(ifcfg->parent); + svCloseFile(ifcfg); + ifcfg = shvarfilesGet(device); + + /* Get the PID of our child pppd. */ + pppLogicalToPhysical(&pppdPid, device, NULL); + kill(pppdPid, SIGTERM); + + /* We'll redial when the SIGCHLD arrives, even if PERSIST is + * not set (the latter handled by clearing the "we've connected + * at least once" flag). */ + connectedOnce = FALSE; + + /* We don't want to delay before redialing, either, so cut + * the retry timeout to zero. */ + timeout = 0; + } + + /* If we got a SIGIO (from netreport, presumably), check if the + * interface is up and return zero (via our parent) if it is. */ + if (theSigio) { + theSigio = 0; + + pppLogicalToPhysical(NULL, device, &physicalDevice); + if (physicalDevice) { + if (interfaceIsUp(physicalDevice)) { + /* The interface is up, so report a success to a parent if + * we have one. Any errors after this we just swallow. */ + relay_exitcode(0); + connectedOnce = TRUE; + } + free(physicalDevice); + } + } + + /* If we got a SIGCHLD, then pppd died (possibly because we killed it), + * and we need to restart it after timeout seconds. */ + if (theSigchld) { + theSigchld = 0; + + /* Find its pid, which is also its process group ID. */ + waited = waitpid(-1, &status, 0); + if (waited == -1) { + continue; + } + + /* Now, we need to kill any children of pppd still in pppd's + * process group, in case they are hanging around. + * pppd is dead (we just waited for it) but there is no + * guarantee that its children are dead, and they will + * hold the modem if we do not get rid of them. + * We have kept the old pid/pgrp around in pppdPid. */ + if (pppdPid) { + kill(-pppdPid, SIGTERM); /* give it a chance to die nicely */ + usleep(2500000); + kill(-pppdPid, SIGKILL); + hangup(ifcfg); + } + pppdPid = 0; + + /* Bail if the child exitted abnormally or we were already + * signalled to kill it. */ + if (!WIFEXITED(status)) { + failureExit(29); + } + if (dying) { + failureExit(WEXITSTATUS(status)); + } + + /* Error conditions from which we do not expect to recover + * without user intervention -- do not fill up the logs. */ + switch (WEXITSTATUS(status)) { + case 1: case 2: case 3: case 4: case 6: + case 7: case 9: case 14: case 17: + failureExit(WEXITSTATUS(status)); + break; + default: + break; + } + + /* PGB 08/20/02: We no longer retry connecting MAXFAIL + times on a failed connect script unless RETRYCONNECT is + true. */ + if ((WEXITSTATUS(status) == 8) && + !svTrueValue(ifcfg, "RETRYCONNECT", FALSE)) { + failureExit(WEXITSTATUS(status)); + } + + /* If we've never connected, or PERSIST is set, dial again, up + * to MAXFAIL times. */ + if ((WEXITSTATUS(status) == 8) || + !connectedOnce || + svTrueValue(ifcfg, "PERSIST", FALSE)) { + /* If we've been connected (i.e., if we didn't force a redial, + * but the connection went down) wait for DISCONNECTTIMEOUT + * seconds before redialing. */ + if (connectedOnce) { + connectedOnce = FALSE; + temp = svGetValue(ifcfg, "DISCONNECTTIMEOUT"); + if (temp) { + timeout = atoi(temp); + free(temp); + } else { + timeout = 2; + } + } + sigprocmask(SIG_UNBLOCK, &blockedsigs, NULL); + sleep(timeout); + sigprocmask(SIG_BLOCK, &blockedsigs, NULL); + if (!theSigterm && + !theSigint && + !theSighup && + !theSigio && + !theSigchld && + !theSigalrm) { + fork_exec(FALSE, IFUP_PPP, "daemon", device, boot); + } + /* Reinitialize the retry timeout. */ + temp = svGetValue(ifcfg, "RETRYTIMEOUT"); + if (temp) { + timeout = atoi(temp); + free(temp); + } else { + timeout = 30; + } +// Scott Sharkey +// MAXFAIL Patch... + temp = svGetValue(ifcfg, "MAXFAIL"); + if (temp) { + maxfail = atoi(temp); + free(temp); + } else { + maxfail = 0; + } + if ( maxfail != 0 ) { + dialCount++; + if ( dialCount >= maxfail ) + failureExit(WEXITSTATUS(status)); + } + } else { + failureExit(WEXITSTATUS(status)); + } + } + + /* We timed out, and we're running at boot-time. */ + if (theSigalrm) { + failureExit(34); + } + } +} diff --git a/src/process.c b/src/process.c new file mode 100644 index 0000000..475d188 --- /dev/null +++ b/src/process.c @@ -0,0 +1,324 @@ +/* + * Copyright (c) 1999-2003 Red Hat, Inc. All rights reserved. + * + * This software may be freely redistributed under the terms of the GNU + * public license. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include + +#include "initlog.h" +#include "process.h" + +extern regex_t **regList; + +int forkCommand(char **args, int *outfd, int *errfd, int *cmdfd, int quiet) { + /* Fork command 'cmd', returning pid, and optionally pointer + * to open file descriptor fd */ + int fdout=-1, fderr=-1, fdcmd=-1, pid; + int outpipe[2], errpipe[2], fdpipe[2]; + int ourpid; + + if ( (pipe(outpipe)==-1) || (pipe(errpipe)==-1) || (pipe(fdpipe)==-1) ) { + perror("pipe"); + return -1; + } + + if (outfd) { + fdout = outpipe[1]; + *outfd = outpipe[0]; + } else { + if (!quiet) + fdout=dup(1); + } + if (errfd) { + fderr = errpipe[1]; + *errfd = errpipe[0]; + } else { + if (!quiet) + fderr=dup(2); + } + + if (cmdfd) { + *cmdfd = fdpipe[0]; + fdcmd = fdpipe[1]; + } else { + fdcmd = open("/dev/null",O_WRONLY); + } + if (fdout==-1 || fderr==-1 || fdcmd==-1) + return -1; + ourpid = getpid(); + if ((pid = fork())==-1) { + perror("fork"); + return -1; + } + /* We exec the command normally as the child. However, if we're getting passed + * back arguments via an fd, we'll exec it as the parent. Therefore, if Bill + * fucks up and we segfault or something, we don't kill rc.sysinit. */ + if ( (cmdfd&&!pid) || (pid &&!cmdfd)) { + /* parent */ + close(fdout); + close(fderr); + close(fdcmd); + if (!pid) + return ourpid; + else + return pid; + } else { + /* kid */ + int sc_open_max; + + if (outfd) { + if ( (dup2(fdout,1)==-1) ) { + perror("dup2"); + exit(-1); + } + } else if (quiet) + if ((dup2(open("/dev/null",O_WRONLY),1))==-1) { + perror("dup2"); + exit(-1); + } + + if (errfd) { + if ((dup2(fderr,2)==-1)) { + perror("dup2"); + exit(-1); + } + } else if (quiet) + if ((dup2(open("/dev/null",O_WRONLY),2))==-1) { + perror("dup2"); + exit(-1); + } + + + if ((dup2(fdcmd,CMD_FD)==-1)) { + perror("dup2"); + exit(-1); + } + close(fdout); + close(fderr); + close(fdcmd); + if (outfd) + close(*outfd); + if (errfd) + close(*errfd); + if (cmdfd) + close(*cmdfd); + + /* close up extra fds, and hope this doesn't break anything */ + sc_open_max = sysconf(_SC_OPEN_MAX); + if(sc_open_max > 1) { + int fd; + for(fd = 3; fd < sc_open_max; fd++) { + if (!(cmdfd && fd == CMD_FD)) + close(fd); + } + } + + execvp(args[0],args); + perror("execvp"); + exit(-1); + } +} + +int monitor(char *cmdname, int pid, int numfds, int *fds, int reexec, int quiet, int debug) { + struct pollfd *pfds; + char *outbuf=NULL; + char *tmpstr=NULL; + int x,y,rc=-1; + int done=0; + int output=0; + char **cmdargs=NULL; + char **tmpargs=NULL; + int cmdargc; + char *procpath = NULL; + + if (reexec) { + procpath=malloc(20*sizeof(char)); + snprintf(procpath,20,"/proc/%d",pid); + } + + pfds = malloc(numfds*sizeof(struct pollfd)); + for (x=0;x= '0' && cmdname[1] <= '9' ) && + ( cmdname[2] >= '0' && cmdname[2] <= '9' ) ) + cmdname+=3; + if (!reexec) { + pid=forkCommand(args,&fds[0],&fds[1],NULL,quiet); + if (pid == -1) + return -1; + x=monitor(cmdname,pid,2,fds,reexec,quiet,debug); + } else { + setenv("IN_INITLOG","yes",1); + pid=forkCommand(args,NULL,NULL,&fds[0],quiet); + if (pid == -1) + return -1; + unsetenv("IN_INITLOG"); + x=monitor(cmdname,pid,1,&fds[0],reexec,quiet,debug); + } + return x; +} diff --git a/src/process.h b/src/process.h new file mode 100644 index 0000000..ef98f78 --- /dev/null +++ b/src/process.h @@ -0,0 +1,9 @@ +#ifndef PROCESS_H +#define PROCESS_H + + +#define CMD_FD 21 + +int runCommand(char *cmd, int reexec, int quiet, int debug); + +#endif diff --git a/src/resolvesymlink.c b/src/resolvesymlink.c new file mode 100644 index 0000000..5e07a81 --- /dev/null +++ b/src/resolvesymlink.c @@ -0,0 +1,17 @@ +#include +#include +#include +#include + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +int main(int argc, char ** argv) { + char *buf = calloc (MAXPATHLEN+1, sizeof(char)); + + if (argc<1) return 1; + (void) readlink (argv[1], buf, MAXPATHLEN); + fprintf (stdout, "%s", buf); + exit (0); + } diff --git a/src/run-parts.c b/src/run-parts.c new file mode 100644 index 0000000..89b7d1c --- /dev/null +++ b/src/run-parts.c @@ -0,0 +1,655 @@ +/* run-parts: run a bunch of scripts in a directory + * + * Debian run-parts program + * Copyright (C) 1996 Jeff Noxon , + * Copyright (C) 1996-1999 Guy Maor + * Copyright (C) 2002-2012 Clint Adams + * + * This is free software; see the GNU General Public License version 2 + * or later for copying conditions. There is NO warranty. + * + * Based on run-parts.pl version 0.2, Copyright (C) 1994 Ian Jackson. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef HAVE_GETOPT_H +#include +#endif /* HAVE_GETOPT_H */ +#include +#include +#include +#include +#include +#include + +#define RUNPARTS_NORMAL 0 +#define RUNPARTS_ERE 1 +#define RUNPARTS_LSBSYSINIT 100 + +int test_mode = 0; +int list_mode = 0; +int verbose_mode = 0; +int report_mode = 0; +int reverse_mode = 0; +int exitstatus = 0; +int regex_mode = 0; +int exit_on_error_mode = 0; +int new_session_mode = 0; + +int argcount = 0, argsize = 0; +char **args = 0; + +char *custom_ere; +regex_t hierre, tradre, excsre, classicalre, customre; + +static void catch_signals(); +static void restore_signals(); + +static char* regex_get_error(int errcode, regex_t *compiled); +static void regex_compile_pattern(void); +static void regex_clean(void); + +void error(char *format, ...) +{ + va_list ap; + + fprintf(stderr, "run-parts: "); + + va_start(ap, format); + vfprintf(stderr, format, ap); + va_end(ap); + + fprintf(stderr, "\n"); +} + + +void version() +{ + fprintf(stderr, "Debian run-parts program, version " PACKAGE_VERSION + "\nCopyright (C) 1994 Ian Jackson, Copyright (C) 1996 Jeff Noxon.\n" + "Copyright (C) 1996,1997,1998,1999 Guy Maor\n" + "Copyright (C) 2002-2012 Clint Adams\n" + "This is free software; see the GNU General Public License version 2\n" + "or later for copying conditions. There is NO warranty.\n"); + exit(0); +} + + +void usage() +{ + fprintf(stderr, "Usage: run-parts [OPTION]... DIRECTORY\n" + " --test print script names which would run, but don't run them.\n" + " --list print names of all valid files (can not be used with\n" + " --test)\n" + " -v, --verbose print script names before running them.\n" + " --report print script names if they produce output.\n" + " --reverse reverse execution order of scripts.\n" + " --exit-on-error exit as soon as a script returns with a non-zero exit\n" + " code.\n" + " --lsbsysinit validate filenames based on LSB sysinit specs.\n" + " --new-session run each script in a separate process session\n" + " --regex=PATTERN validate filenames based on POSIX ERE pattern PATTERN.\n" + " -u, --umask=UMASK sets umask to UMASK (octal), default is 022.\n" + " -a, --arg=ARGUMENT pass ARGUMENT to scripts, use once for each argument.\n" + " -V, --version output version information and exit.\n" + " -h, --help display this help and exit.\n"); + exit(0); +} + + +/* The octal conversion in libc is not foolproof; it will take the 8 and 9 + * digits under some circumstances. We'll just have to live with it. + */ +void set_umask() +{ + int mask, result; + + result = sscanf(optarg, "%o", &mask); + if ((result != 1) || (mask > 07777) || (mask < 0)) { + error("bad umask value"); + exit(1); + } + + umask(mask); +} + +/* Add an argument to the commands that we will call. Called once for + every argument. */ +void add_argument(char *newarg) +{ + if (argcount + 1 >= argsize) { + argsize = argsize ? argsize * 2 : 4; + args = realloc(args, argsize * (sizeof(char *))); + if (!args) { + error("failed to reallocate memory for arguments: %s", strerror(errno)); + exit(1); + } + } + args[argcount++] = newarg; + args[argcount] = 0; +} + +/* True or false? Is this a valid filename? */ +int valid_name(const struct dirent *d) +{ + char *s; + unsigned int retval; + + s = (char *)&(d->d_name); + + if (regex_mode == RUNPARTS_ERE) + retval = !regexec(&customre, s, 0, NULL, 0); + + else if (regex_mode == RUNPARTS_LSBSYSINIT) { + + if (!regexec(&hierre, s, 0, NULL, 0)) + retval = regexec(&excsre, s, 0, NULL, 0); + + else + retval = !regexec(&tradre, s, 0, NULL, 0); + + } else { + if (!regexec(&classicalre, s, 0, NULL, 0)) { + retval = regexec(&excsre, s, 0, NULL, 0); + } + } + + return retval; +} + +/* Execute a file */ +void run_part(char *progname) +{ + int result, waited; + int pid, r; + int pout[2], perr[2]; + + waited = 0; + + if (report_mode && (pipe(pout) || pipe(perr))) { + error("pipe: %s", strerror(errno)); + exit(1); + } + if ((pid = fork()) < 0) { + error("failed to fork: %s", strerror(errno)); + exit(1); + } + else if (!pid) { + restore_signals(); + if (new_session_mode) + setsid(); + if (report_mode) { + if (dup2(pout[1], STDOUT_FILENO) == -1 || + dup2(perr[1], STDERR_FILENO) == -1) { + error("dup2: %s", strerror(errno)); + exit(1); + } + close(pout[0]); + close(perr[0]); + close(pout[1]); + close(perr[1]); + } + args[0] = progname; + execv(progname, args); + error("failed to exec %s: %s", progname, strerror(errno)); + exit(1); + } + + if (report_mode) { + fd_set set; + sigset_t tempmask; + struct timespec zero_timeout; + struct timespec *the_timeout; + int max, printflag; + ssize_t c; + char buf[4096]; + + sigemptyset(&tempmask); + sigprocmask(0, NULL, &tempmask); + sigdelset(&tempmask, SIGCHLD); + + memset(&zero_timeout, 0, sizeof(zero_timeout)); + the_timeout = NULL; + + close(pout[1]); + close(perr[1]); + max = pout[0] > perr[0] ? pout[0] + 1 : perr[0] + 1; + printflag = 0; + + while (pout[0] >= 0 || perr[0] >= 0) { + if (!waited) { + r = waitpid(pid, &result, WNOHANG); + if (r == -1) { + error("waitpid: %s", strerror(errno)); + exit(1); + } + if (r != 0 && (WIFEXITED(result) || WIFSIGNALED(result))) { + /* If the process dies, set a zero timeout. Rarely, some processes + * leak file descriptors (e.g., by starting a naughty daemon). + * select() would wait forever since the pipes wouldn't close. + * We loop, with a zero timeout, until there's no data left, then + * give up. This shouldn't affect non-leaky processes. */ + waited = 1; + the_timeout = &zero_timeout; + } + } + + FD_ZERO(&set); + if (pout[0] >= 0) + FD_SET(pout[0], &set); + if (perr[0] >= 0) + FD_SET(perr[0], &set); + r = pselect(max, &set, 0, 0, the_timeout, &tempmask); + + if (r < 0) { + if (errno == EINTR) + continue; + + error("select: %s", strerror(errno)); + exit(1); + } + else if (r > 0) { + /* If STDOUT or STDERR get closed / full, we still run to completion + * (and just ignore that we can't output process output any more). + * Perhaps we should instead kill the child process we are running + * if that happens. + * For now partial writes are not retried to complete - that can + * and should be done, but needs care to ensure that we don't hang + * if the fd doesn't accept more data ever - or we need to decide that + * waiting is the appropriate thing to do. + */ + int ignored; + if (pout[0] >= 0 && FD_ISSET(pout[0], &set)) { + c = read(pout[0], buf, sizeof(buf)); + if (c > 0) { + if (!printflag) { + printf("%s:\n", progname); + fflush(stdout); + printflag = 1; + } + ignored = write(STDOUT_FILENO, buf, c); + } + else if (c == 0) { + close(pout[0]); + pout[0] = -1; + } + else if (c < 0) { + close(pout[0]); + pout[0] = -1; + error("failed to read from stdout pipe: %s", strerror (errno)); + } + } + if (perr[0] >= 0 && FD_ISSET(perr[0], &set)) { + c = read(perr[0], buf, sizeof(buf)); + if (c > 0) { + if (!printflag) { + fprintf(stderr, "%s:\n", progname); + fflush(stderr); + printflag = 1; + } + ignored = write(STDERR_FILENO, buf, c); + } + else if (c == 0) { + close(perr[0]); + perr[0] = -1; + } + else if (c < 0) { + close(perr[0]); + perr[0] = -1; + error("failed to read from error pipe: %s", strerror (errno)); + } + } + } + else if (r == 0 && waited) { + /* Zero timeout, no data left. */ + close(perr[0]); + perr[0] = -1; + close(pout[0]); + pout[0] = -1; + } + else { + /* assert(FALSE): select was called with infinite timeout, so + it either returns successfully or is interrupted */ + } /*if */ + } /*while */ + } + + if (!waited) { + r = waitpid(pid, &result, 0); + + if (r == -1) { + error("waitpid: %s", strerror(errno)); + exit(1); + } + } + + if (WIFEXITED(result) && WEXITSTATUS(result)) { + error("%s exited with return code %d", progname, WEXITSTATUS(result)); + exitstatus = 1; + } + else if (WIFSIGNALED(result)) { + error("%s exited because of uncaught signal %d", progname, + WTERMSIG(result)); + exitstatus = 1; + } +} + +static void handle_signal(int s) +{ + /* Do nothing */ +} + +/* Catch SIGCHLD with an empty function to interrupt select() */ +static void catch_signals() +{ + struct sigaction act; + sigset_t set; + + memset(&act, 0, sizeof(act)); + act.sa_handler = handle_signal; + act.sa_flags = SA_NOCLDSTOP; + sigaction(SIGCHLD, &act, NULL); + + sigemptyset(&set); + sigaddset(&set, SIGCHLD); + sigprocmask(SIG_BLOCK, &set, NULL); +} + +/* Unblock signals before execing a child */ +static void restore_signals() +{ + sigset_t set; + sigemptyset(&set); + sigaddset(&set, SIGCHLD); + sigprocmask(SIG_UNBLOCK, &set, NULL); +} + +/* Find the parts to run & call run_part() */ +void run_parts(char *dirname) +{ + struct dirent **namelist; + char *filename; + size_t filename_length, dirname_length; + int entries, i, result; + struct stat st; + + /* dirname + "/" */ + dirname_length = strlen(dirname) + 1; + /* dirname + "/" + ".." + "\0" (This will save one realloc.) */ + filename_length = dirname_length + 2 + 1; + if (!(filename = malloc(filename_length))) { + error("failed to allocate memory for path: %s", strerror(errno)); + exit(1); + } + strcpy(filename, dirname); + strcat(filename, "/"); + + /* scandir() isn't POSIX, but it makes things easy. */ + entries = scandir(dirname, &namelist, valid_name, alphasort); + if (entries < 0) { + error("failed to open directory %s: %s", dirname, strerror(errno)); + exit(1); + } + + i = reverse_mode ? 0 : entries; + for (i = reverse_mode ? (entries - 1) : 0; + reverse_mode ? (i >= 0) : (i < entries); reverse_mode ? i-- : i++) { + if (filename_length < dirname_length + strlen(namelist[i]->d_name) + 1) { + filename_length = dirname_length + strlen(namelist[i]->d_name) + 1; + if (!(filename = realloc(filename, filename_length))) { + error("failed to reallocate memory for path: %s", strerror(errno)); + exit(1); + } + } + strcpy(filename + dirname_length, namelist[i]->d_name); + + strcpy(filename, dirname); + strcat(filename, "/"); + strcat(filename, namelist[i]->d_name); + + result = stat(filename, &st); + if (result < 0) { + error("failed to stat component %s: %s", filename, strerror(errno)); + if (exit_on_error_mode) { + exit(1); + } + else + continue; + } + + if (S_ISREG(st.st_mode)) { + if (!access(filename, X_OK)) { + if (test_mode) { + printf("%s\n", filename); + } + else if (list_mode) { + if (!access(filename, R_OK)) + printf("%s\n", filename); + } + else { + if (verbose_mode) + if (argcount) { + char **a = args; + + fprintf(stderr, "run-parts: executing %s", filename); + while(*(++a)) + fprintf(stderr, " %s", *a); + fprintf(stderr, "\n"); + } else { + fprintf(stderr, "run-parts: executing %s\n", filename); + } + run_part(filename); + if (exitstatus != 0 && exit_on_error_mode) return; + } + } + else if (!access(filename, R_OK)) { + if (list_mode) { + printf("%s\n", filename); + } + } + else if (S_ISLNK(st.st_mode)) { + if (!list_mode) { + error("run-parts: component %s is a broken symbolic link\n",filename); + exitstatus = 1; + } + } + } + else if (!S_ISDIR(st.st_mode)) { + if (!list_mode) { + error("run-parts: component %s is not an executable plain file\n", + filename); + exitstatus = 1; + } + } + + free(namelist[i]); + } + free(namelist); + free(filename); +} + +/* Process options */ +int main(int argc, char *argv[]) +{ + custom_ere = NULL; + umask(022); + add_argument(0); + + for (;;) { + int c; + int option_index = 0; + + static struct option long_options[] = { + {"test", 0, &test_mode, 1}, + {"list", 0, &list_mode, 1}, + {"verbose", 0, 0, 'v'}, + {"report", 0, &report_mode, 1}, + {"reverse", 0, &reverse_mode, 1}, + {"umask", 1, 0, 'u'}, + {"arg", 1, 0, 'a'}, + {"help", 0, 0, 'h'}, + {"version", 0, 0, 'V'}, + {"lsbsysinit", 0, ®ex_mode, RUNPARTS_LSBSYSINIT}, + {"regex", 1, ®ex_mode, RUNPARTS_ERE}, + {"exit-on-error", 0, &exit_on_error_mode, 1}, + {"new-session", 0, &new_session_mode, 1}, + {0, 0, 0, 0} + }; + + c = getopt_long(argc, argv, "u:ha:vV", long_options, &option_index); + if (c == EOF) + break; + switch (c) { + case 0: + if(option_index==10) { /* hardcoding this will lead to trouble */ + custom_ere = strdup(optarg); + } + break; + case 'u': + set_umask(); + break; + case 'a': + add_argument(optarg); + break; + case 'h': + usage(); + break; + case 'v': + verbose_mode = 1; + break; + case 'V': + version(); + break; + default: + fprintf(stderr, "Try `run-parts --help' for more information.\n"); + exit(1); + } + } + + /* We require exactly one argument: the directory name */ + if (optind != (argc - 1)) { + error("missing operand"); + fprintf(stderr, "Try `run-parts --help' for more information.\n"); + exit(1); + } else if (list_mode && test_mode) { + error("--list and --test can not be used together"); + fprintf(stderr, "Try `run-parts --help' for more information.\n"); + exit(1); + } else { + catch_signals(); + regex_compile_pattern(); + run_parts(argv[optind]); + regex_clean(); + + free(args); + free(custom_ere); + + return exitstatus; + } +} + +/* + * Compile patterns used by the application + * + * In order for a string to be matched by a pattern, this pattern must be + * compiled with the regcomp function. If an error occurs, the application + * exits and displays the error. + */ +static void +regex_compile_pattern (void) +{ + int err; + regex_t *pt_regex; + + if (regex_mode == RUNPARTS_ERE) { + + if ((err = regcomp(&customre, custom_ere, + REG_EXTENDED | REG_NOSUB)) != 0) + pt_regex = &customre; + + } else if (regex_mode == RUNPARTS_LSBSYSINIT) { + + if ( (err = regcomp(&hierre, "^_?([a-z0-9_.]+-)+[a-z0-9]+$", + REG_EXTENDED | REG_NOSUB)) != 0) + pt_regex = &hierre; + + else if ( (err = regcomp(&excsre, "^[a-z0-9-].*(\.rpm(save|new|orig)|~|,v)$", + REG_EXTENDED | REG_NOSUB)) != 0) + pt_regex = &excsre; + + else if ( (err = regcomp(&tradre, "^[a-z0-9][a-z0-9-]*$", REG_NOSUB)) + != 0) + pt_regex = &tradre; + + } else if ( (err = regcomp(&classicalre, "^.+$", + REG_EXTENDED | REG_NOSUB)) != 0) + pt_regex = &classicalre; + else if ( (err = regcomp(&excsre, "^[.]|(\.rpm(save|new|orig)|~|,v)$", + REG_EXTENDED | REG_NOSUB)) != 0) + pt_regex = &excsre; + + if (err != 0) { + fprintf(stderr, "Unable to build regexp: %s", \ + regex_get_error(err, pt_regex)); + exit(1); + } +} + +/* + * Get a regex error. + * + * This function allocates a buffer to store the regex error description. + * If a buffer cannot be allocated, then the use of xmalloc will end the + * program. + * + * @errcode: return error code from a one of the regex functions + * @compiled: compile pattern which causes the failure + * + * It returns a pointer on the current regex error description. + */ +static char * +regex_get_error(int errcode, regex_t *compiled) +{ + size_t length; + char *buf; + + length = regerror(errcode, compiled, NULL, 0); + buf = malloc(length); + if (buf == 0) { + error("Virtual memory exhausted\n"); + exit(1); + } + + regerror(errcode, compiled, buf, length); + + return buf; +} + +/* + * Clean the compiled patterns according to the current regex_mode + */ +static void +regex_clean(void) +{ + if (regex_mode == RUNPARTS_ERE) + regfree(&customre); + + else if (regex_mode == RUNPARTS_LSBSYSINIT) { + regfree(&hierre); + regfree(&excsre); + regfree(&tradre); + + } else { + regfree(&classicalre); + regfree(&excsre); + } +} diff --git a/src/setuidgid.c b/src/setuidgid.c new file mode 100644 index 0000000..9c57cf6 --- /dev/null +++ b/src/setuidgid.c @@ -0,0 +1,132 @@ +/* + Simple wrapper to run a command with different uid/gid. + + Based on the implementation in freedt: + Copyright (C) 2003 Adam Sampson + + 2010-05-07 – Jacek Konieczny updated for standalone compilation + and included in PLD rc-scripts + + 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. + + This program 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 program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +const char *progname = "setuidgid"; +const char *proghelp = + "Usage: setuidgid [OPTIONS] account command ...\n" + "Run a command under the uid and gid of an account.\n\n" + "-s Also set supplementary groups\n"; + +void die(const char *msg) { + fprintf(stderr, "%s: %s\n", progname, msg); + exit(1); +} +void die2(const char *msg1, const char *msg2) { + fprintf(stderr, "%s: %s: %s\n", progname, msg1, msg2); + exit(1); +} +void show_version() { + fprintf(stderr, "%s $Rev$ (PLD Linux rc-scripts)\n", progname); +} +void version() { + show_version(); + exit(0); +} +void help(int retval) { + show_version(); + fprintf(stderr, "\n%s" + "-V Show version information\n" + "-h Show usage information\n", proghelp); + exit(retval); +} + +int main(int argc, char **argv) { + struct passwd *p; + int use_supp = 0; + + while (1) { + int c = getopt(argc, argv, "+V?hs"); + if (c == -1) + break; + + switch (c) { + case 's': + use_supp = 1; + break; + case 'V': + version(); + case 'h': + case '?': + help(0); + default: + help(1); + } + } + + if ((argc - optind) < 2) + help(1); + + p = getpwnam(argv[optind]); + if (!p) + die("no such account"); + if (setgid(p->pw_gid) < 0) + die("unable to setgid"); + + if (use_supp) { + gid_t groups[NGROUPS_MAX]; + size_t n = 0; + + setgrent(); + while (1) { + char **p; + struct group *g = getgrent(); + if (g == NULL) + break; + + for (p = g->gr_mem; *p != NULL; p++) { + if (strcmp(*p, argv[optind]) == 0) { + if (n >= NGROUPS_MAX) + die("too many groups"); + groups[n++] = g->gr_gid; + } + } + } + + if (setgroups(n, groups) < 0) + die("unable to setgroups"); + } else { + if (setgroups(1, &p->pw_gid) < 0) + die("unable to setgroups"); + } + + if (setuid(p->pw_uid) < 0) + die("unable to setuid"); + + ++optind; + execvp(argv[optind], &argv[optind]); + die2(argv[optind], "unable to exec"); + + return 0; /* NOTREACHED */ +} + diff --git a/src/shvar.c b/src/shvar.c new file mode 100644 index 0000000..765a77e --- /dev/null +++ b/src/shvar.c @@ -0,0 +1,393 @@ +/* + * shvar.c + * + * Implementation of non-destructively reading/writing files containing + * only shell variable declarations and full-line comments. + * + * Includes explicit inheritance mechanism intended for use with + * Red Hat Linux ifcfg-* files. There is no protection against + * inheritance loops; they will generally cause stack overflows. + * Furthermore, they are only intended for one level of inheritance; + * the value setting algorithm assumes this. + * + * Copyright 1999,2000 Red Hat, Inc. + * + * This 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. + * + * This program 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 program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "shvar.h" + +/* Open the file , returning a shvarFile on success and NULL on failure. + Add a wrinkle to let the caller specify whether or not to create the file + (actually, return a structure anyway) if it doesn't exist. */ +static shvarFile * +svOpenFile(const char *name, gboolean create) +{ + shvarFile *s = NULL; + int closefd = 0; + + s = g_malloc0(sizeof(shvarFile)); + + s->fd = open(name, O_RDWR); /* NOT O_CREAT */ + if (s->fd == -1) { + /* try read-only */ + s->fd = open(name, O_RDONLY); /* NOT O_CREAT */ + if (s->fd != -1) closefd = 1; + } + s->fileName = g_strdup(name); + + if (s->fd != -1) { + struct stat buf; + char *p, *q; + + if (fstat(s->fd, &buf) < 0) goto bail; + s->arena = g_malloc0(buf.st_size + 1); + + if (read(s->fd, s->arena, buf.st_size) < 0) goto bail; + + /* we'd use g_strsplit() here, but we want a list, not an array */ + for(p = s->arena; (q = strchr(p, '\n')) != NULL; p = q + 1) { + s->lineList = g_list_append(s->lineList, g_strndup(p, q - p)); + } + + /* closefd is set if we opened the file read-only, so go ahead and + close it, because we can't write to it anyway */ + if (closefd) { + close(s->fd); + s->fd = -1; + } + + return s; + } + + if (create) { + return s; + } + +bail: + if (s->fd != -1) close(s->fd); + if (s->arena) g_free (s->arena); + if (s->fileName) g_free (s->fileName); + g_free (s); + return NULL; +} + +/* Open the file , return shvarFile on success, NULL on failure */ +shvarFile * +svNewFile(const char *name) +{ + return svOpenFile(name, FALSE); +} + +/* Create a new file structure, returning actual data if the file exists, + * and a suitable starting point if it doesn't. */ +shvarFile * +svCreateFile(const char *name) +{ + return svOpenFile(name, TRUE); +} + +/* remove escaped characters in place */ +static void +unescape(char *s) { + int len, i; + + len = strlen(s); + if ((s[0] == '"' || s[0] == '\'') && s[0] == s[len-1]) { + i = len - 2; + memmove(s, s+1, i); + s[i+1] = '\0'; + len = i; + } + for (i = 0; i < len; i++) { + if (s[i] == '\\') { + memmove(s+i, s+i+1, len-(i+1)); + len--; + } + s[len] = '\0'; + } +} + + +/* create a new string with all necessary characters escaped. + * caller must free returned string + */ +static const char escapees[] = "\"'\\$~`"; /* must be escaped */ +static const char spaces[] = " \t|&;()<>"; /* only require "" */ +static char * +escape(const char *s) { + char *new; + int i, j, mangle = 0, space = 0; + int newlen, slen; + static int esclen, splen; + + if (!esclen) esclen = strlen(escapees); + if (!splen) splen = strlen(spaces); + slen = strlen(s); + + for (i = 0; i < slen; i++) { + if (strchr(escapees, s[i])) mangle++; + if (strchr(spaces, s[i])) space++; + } + if (!mangle && !space) return strdup(s); + + newlen = slen + mangle + 3; /* 3 is extra ""\0 */ + new = g_malloc0(newlen); + if (!new) return NULL; + + j = 0; + new[j++] = '"'; + for (i = 0; i < slen; i++) { + if (strchr(escapees, s[i])) { + new[j++] = '\\'; + } + new[j++] = s[i]; + } + new[j++] = '"'; + g_assert(j == slen + mangle + 2); /* j is the index of the '\0' */ + + return new; +} + +/* Get the value associated with the key, and leave the current pointer + * pointing at the line containing the value. The char* returned MUST + * be freed by the caller. + */ +char * +svGetValue(shvarFile *s, const char *key) +{ + char *value = NULL; + char *line; + char *keyString; + int len; + + g_assert(s); + g_assert(key); + + keyString = g_malloc0(strlen(key) + 2); + strcpy(keyString, key); + keyString[strlen(key)] = '='; + len = strlen(keyString); + + for (s->current = s->lineList; s->current; s->current = s->current->next) { + line = s->current->data; + if (!strncmp(keyString, line, len)) { + value = g_strdup(line + len); + unescape(value); + break; + } + } + g_free(keyString); + + if (value) { + if (value[0]) { + return value; + } else { + g_free(value); + return NULL; + } + } + if (s->parent) value = svGetValue(s->parent, key); + return value; +} + +/* return 1 if resolves to any truth value (e.g. "yes", "y", "true") + * return 0 if resolves to any non-truth value (e.g. "no", "n", "false") + * return otherwise + */ +int +svTrueValue(shvarFile *s, const char *key, int def) +{ + char *tmp; + int returnValue = def; + + tmp = svGetValue(s, key); + if (!tmp) return returnValue; + + if ( (!strcasecmp("yes", tmp)) || + (!strcasecmp("true", tmp)) || + (!strcasecmp("t", tmp)) || + (!strcasecmp("y", tmp)) ) returnValue = 1; + else + if ( (!strcasecmp("no", tmp)) || + (!strcasecmp("false", tmp)) || + (!strcasecmp("f", tmp)) || + (!strcasecmp("n", tmp)) ) returnValue = 0; + + g_free (tmp); + return returnValue; +} + + +/* Set the variable equal to the value . + * If does not exist, and the pointer is set, append + * the key=value pair after that line. Otherwise, prepend the pair + * to the top of the file. Here's the algorithm, as the C code + * seems to be rather dense: + * + * if (value == NULL), then: + * if val2 (parent): change line to key= or append line key= + * if val1 (this) : delete line + * else noop + * else use this table: + * val2 + * NULL value other + * v NULL append line noop append line + * a + * l value noop noop noop + * 1 + * other change line delete line change line + * + * No changes are ever made to the parent config file, only to the + * specific file passed on the command line. + * + */ +void +svSetValue(shvarFile *s, const char *key, const char *value) +{ + char *newval = NULL, *val1 = NULL, *val2 = NULL; + char *keyValue; + + g_assert(s); + g_assert(key); + /* value may be NULL */ + + if (value) newval = escape(value); + keyValue = g_strdup_printf("%s=%s", key, newval ? newval : ""); + + val1 = svGetValue(s, key); + if (val1 && newval && !strcmp(val1, newval)) goto bail; + if (s->parent) val2 = svGetValue(s->parent, key); + + if (!newval || !newval[0]) { + /* delete value somehow */ + if (val2) { + /* change/append line to get key= */ + if (s->current) s->current->data = keyValue; + else s->lineList = g_list_append(s->lineList, keyValue); + s->freeList = g_list_append(s->freeList, keyValue); + s->modified = 1; + } else if (val1) { + /* delete line */ + s->lineList = g_list_remove_link(s->lineList, s->current); + g_list_free_1(s->current); + s->modified = 1; + goto bail; /* do not need keyValue */ + } + goto end; + } + + if (!val1) { + if (val2 && !strcmp(val2, newval)) goto end; + /* append line */ + s->lineList = g_list_append(s->lineList, keyValue); + s->freeList = g_list_append(s->freeList, keyValue); + s->modified = 1; + goto end; + } + + /* deal with a whole line of noops */ + if (val1 && !strcmp(val1, newval)) goto end; + + /* At this point, val1 && val1 != value */ + if (val2 && !strcmp(val2, newval)) { + /* delete line */ + s->lineList = g_list_remove_link(s->lineList, s->current); + g_list_free_1(s->current); + s->modified = 1; + goto bail; /* do not need keyValue */ + } else { + /* change line */ + if (s->current) s->current->data = keyValue; + else s->lineList = g_list_append(s->lineList, keyValue); + s->freeList = g_list_append(s->freeList, keyValue); + s->modified = 1; + } + +end: + if (newval) free(newval); + if (val1) free(val1); + if (val2) free(val2); + return; + +bail: + if (keyValue) free (keyValue); + goto end; +} + +/* Write the current contents iff modified. Returns -1 on error + * and 0 on success. Do not write if no values have been modified. + * The mode argument is only used if creating the file, not if + * re-writing an existing file, and is passed unchanged to the + * open() syscall. + */ +int +svWriteFile(shvarFile *s, int mode) +{ + FILE *f; + int tmpfd; + + if (s->modified) { + if (s->fd == -1) + s->fd = open(s->fileName, O_WRONLY|O_CREAT, mode); + if (s->fd == -1) + return -1; + if (ftruncate(s->fd, 0) < 0) + return -1; + + tmpfd = dup(s->fd); + f = fdopen(tmpfd, "w"); + fseek(f, 0, SEEK_SET); + for (s->current = s->lineList; s->current; s->current = s->current->next) { + char *line = s->current->data; + fprintf(f, "%s\n", line); + } + fclose(f); + } + + return 0; +} + + +/* Close the file descriptor (if open) and delete the shvarFile. + * Returns -1 on error and 0 on success. + */ +int +svCloseFile(shvarFile *s) +{ + + g_assert(s); + + if (s->fd != -1) close(s->fd); + + g_free(s->arena); + for (s->current = s->freeList; s->current; s->current = s->current->next) { + g_free(s->current->data); + } + g_free(s->fileName); + g_list_free(s->freeList); + g_list_free(s->lineList); /* implicitly frees s->current */ + g_free(s); + return 0; +} diff --git a/src/shvar.h b/src/shvar.h new file mode 100644 index 0000000..50d1068 --- /dev/null +++ b/src/shvar.h @@ -0,0 +1,103 @@ +/* + * shvar.h + * + * Interface for non-destructively reading/writing files containing + * only shell variable declarations and full-line comments. + * + * Includes explicit inheritance mechanism intended for use with + * Red Hat Linux ifcfg-* files. There is no protection against + * inheritance loops; they will generally cause stack overflows. + * Furthermore, they are only intended for one level of inheritance; + * the value setting algorithm assumes this. + * + * Copyright 1999 Red Hat, Inc. + * + * This 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. + * + * This program 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 program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ +#ifndef _SHVAR_H +#define _SHVAR_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +typedef struct _shvarFile shvarFile; +struct _shvarFile { + char *fileName; /* read-only */ + int fd; /* read-only */ + char *arena; /* ignore */ + GList *lineList; /* read-only */ + GList *freeList; /* ignore */ + GList *current; /* set implicitly or explicitly, + points to element of lineList */ + shvarFile *parent; /* set explicitly */ + int modified; /* ignore */ +}; + + +/* Create the file , return shvarFile on success, NULL on failure */ +shvarFile * +svCreateFile(const char *name); + +/* Open the file , return shvarFile on success, NULL on failure */ +shvarFile * +svNewFile(const char *name); + +/* Get the value associated with the key, and leave the current pointer + * pointing at the line containing the value. The char* returned MUST + * be freed by the caller. + */ +char * +svGetValue(shvarFile *s, const char *key); + +/* return 1 if resolves to any truth value (e.g. "yes", "y", "true") + * return 0 if resolves to any non-truth value (e.g. "no", "n", "false") + * return otherwise + */ +int +svTrueValue(shvarFile *s, const char *key, int def); + +/* Set the variable equal to the value . + * If does not exist, and the pointer is set, append + * the key=value pair after that line. Otherwise, prepend the pair + * to the top of the file. + */ +void +svSetValue(shvarFile *s, const char *key, const char *value); + + +/* Write the current contents iff modified. Returns -1 on error + * and 0 on success. Do not write if no values have been modified. + * The mode argument is only used if creating the file, not if + * re-writing an existing file, and is passed unchanged to the + * open() syscall. + */ +int +svWriteFile(shvarFile *s, int mode); + +/* Close the file descriptor (if open) and delete the shvarFile. + * Returns -1 on error and 0 on success. + */ +int +svCloseFile(shvarFile *s); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* ! _SHVAR_H */ diff --git a/src/start-stop-daemon.c b/src/start-stop-daemon.c new file mode 100644 index 0000000..7de9a19 --- /dev/null +++ b/src/start-stop-daemon.c @@ -0,0 +1,1367 @@ +/* + * A rewrite of the original Debian's start-stop-daemon Perl script + * in C (faster - it is executed many times during system startup). + * + * Written by Marek Michalkiewicz , + * public domain. Based conceptually on start-stop-daemon.pl, by Ian + * Jackson . May be used and distributed + * freely for any purpose. Changes by Christian Schwarz + * , to make output conform to the Debian + * Console Message Standard, also placed in public domain. Minor + * changes by Klee Dienes , also placed in the Public + * Domain. + * + * Changes by Ben Collins , added --chuid, --background + * and --make-pidfile options, placed in public domain aswell. + * + * Port to OpenBSD by Sontri Tomo Huynh + * and Andreas Schuldei + * + * Changes by Ian Jackson: added --retry (and associated rearrangements). + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#if defined(linux) +# define OSLinux +#elif defined(__GNU__) +# define OSHURD +#elif defined(__sparc__) +# define OSsunos +#elif defined(OPENBSD) || defined(__OpenBSD__) +# define OSOpenBSD +#elif defined(hpux) +# define OShpux +#elif defined(__FreeBSD__) +# define OSFreeBSD +#elif defined(__NetBSD__) +# define OSNetBSD +#else +# error Unknown architecture - cannot build start-stop-daemon +#endif + +#define MIN_POLL_INTERVAL 20000 /*us*/ + +#if defined(OSHURD) +# include +# include +#endif + +#if defined(OSOpenBSD) || defined(OSFreeBSD) || defined(OSNetBSD) +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#endif + +#if HAVE_SYS_CAPABILITY_H +#include +#include +#endif + +#if defined(OShpux) +#include +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_ERROR_H +# include +#endif + +static int testmode = 0; +static int quietmode = 0; +static int exitnodo = 1; +static int start = 0; +static int stop = 0; +static int background = 0; +static int mpidfile = 0; +static int signal_nr = 15; +static const char *signal_str = NULL; +static int user_id = -1; +static int runas_uid = -1; +static int runas_gid = -1; +static const char *userspec = NULL; +static char *changeuser = NULL; +static const char *changegroup = NULL; +static char *changeroot = NULL; +static const char *changedir = "/"; +static const char *cmdname = NULL; +static char *execname = NULL; +static char *startas = NULL; +static const char *pidfile = NULL; +static char what_stop[1024]; +static const char *schedule_str = NULL; +static const char *progname = ""; +static int nicelevel = 0; +static char *caplist = NULL; + +static struct stat exec_stat; +#if defined(OSHURD) +static struct proc_stat_list *procset = NULL; +#endif + + +struct pid_list { + struct pid_list *next; + pid_t pid; +}; + +static struct pid_list *found = NULL; +static struct pid_list *killed = NULL; + +struct schedule_item { + enum { sched_timeout, sched_signal, sched_goto, sched_forever } type; + int value; /* seconds, signal no., or index into array */ + /* sched_forever is only seen within parse_schedule and callees */ +}; + +static int schedule_length; +static struct schedule_item *schedule = NULL; + +static void *xmalloc(int size); +static void push(struct pid_list **list, pid_t pid); +static void do_help(void); +static void parse_options(int argc, char * const *argv); +static int pid_is_user(pid_t pid, uid_t uid); +static int pid_is_cmd(pid_t pid, const char *name); +static void check(pid_t pid); +static void do_pidfile(const char *name); +static void do_stop(int signal_nr, int quietmode, + int *n_killed, int *n_notkilled, int retry_nr); +#if defined(OSLinux) || defined(OShpux) +static int pid_is_exec(pid_t pid, const struct stat *esb); +#endif + + +#ifdef __GNUC__ +static void fatal(const char *format, ...) + NONRETURNPRINTFFORMAT(1, 2); +static void badusage(const char *msg) + NONRETURNING; +#else +static void fatal(const char *format, ...); +static void badusage(const char *msg); +#endif + +/* This next part serves only to construct the TVCALC macro, which + * is used for doing arithmetic on struct timeval's. It works like this: + * TVCALC(result, expression); + * where result is a struct timeval (and must be an lvalue) and + * expression is the single expression for both components. In this + * expression you can use the special values TVELEM, which when fed a + * const struct timeval* gives you the relevant component, and + * TVADJUST. TVADJUST is necessary when subtracting timevals, to make + * it easier to renormalise. Whenver you subtract timeval elements, + * you must make sure that TVADJUST is added to the result of the + * subtraction (before any resulting multiplication or what have you). + * TVELEM must be linear in TVADJUST. + */ +typedef long tvselector(const struct timeval*); +static long tvselector_sec(const struct timeval *tv) { return tv->tv_sec; } +static long tvselector_usec(const struct timeval *tv) { return tv->tv_usec; } +#define TVCALC_ELEM(result, expr, sec, adj) \ +{ \ + const long TVADJUST = adj; \ + long (*const TVELEM)(const struct timeval*) = tvselector_##sec; \ + (result).tv_##sec = (expr); \ +} +#define TVCALC(result,expr) \ +do { \ + TVCALC_ELEM(result, expr, sec, (-1)); \ + TVCALC_ELEM(result, expr, usec, (+1000000)); \ + (result).tv_sec += (result).tv_usec / 1000000; \ + (result).tv_usec %= 1000000; \ +} while(0) + + +static void +fatal(const char *format, ...) +{ + va_list arglist; + + fprintf(stderr, "%s: ", progname); + va_start(arglist, format); + vfprintf(stderr, format, arglist); + va_end(arglist); + putc('\n', stderr); + exit(2); +} + + +static void * +xmalloc(int size) +{ + void *ptr; + + ptr = malloc(size); + if (ptr) + return ptr; + fatal("malloc(%d) failed", size); +} + + +static void +xgettimeofday(struct timeval *tv) +{ + if (gettimeofday(tv,0) != 0) + fatal("gettimeofday failed: %s", strerror(errno)); +} + + +static void +push(struct pid_list **list, pid_t pid) +{ + struct pid_list *p; + + p = xmalloc(sizeof(*p)); + p->next = *list; + p->pid = pid; + *list = p; +} + +static void +clear(struct pid_list **list) +{ + struct pid_list *here, *next; + + for (here = *list; here != NULL; here = next) { + next = here->next; + free(here); + } + + *list = NULL; +} + +static void +do_help(void) +{ + printf( +"start-stop-daemon VERSION for Debian - small and fast C version written by\n" +"Marek Michalkiewicz , public domain.\n" +"\n" +"Usage:\n" +" start-stop-daemon -S|--start options ... -- arguments ...\n" +" start-stop-daemon -K|--stop options ...\n" +" start-stop-daemon -H|--help\n" +" start-stop-daemon -V|--version\n" +"\n" +"Options (at least one of --exec|--pidfile|--user is required):\n" +" -x|--exec program to start/check if it is running\n" +" -p|--pidfile pid file to check\n" +" -c|--chuid \n" +" change to this user/group before starting process\n" +" -u|--user | stop processes owned by this user\n" +" -g|--group run process as this group\n" +" -n|--name stop processes with this name\n" +" -s|--signal signal to send (default TERM)\n" +" -a|--startas program to start (default is )\n" +" -D|--dropcap drop theses capabilities\n" +" -C|--chdir Change to (default is /)\n" +" -N|--nicelevel add incr to the process's nice level\n" +" -b|--background force the process to detach\n" +" -m|--make-pidfile create the pidfile before starting\n" +" -R|--retry check whether processes die, and retry\n" +" -t|--test test mode, don't do anything\n" +" -o|--oknodo exit status 0 (not 1) if nothing done\n" +" -q|--quiet be more quiet\n" +" -v|--verbose be more verbose\n" +"Retry is |//... where is one of\n" +" -|[-] send that signal\n" +" wait that many seconds\n" +" forever repeat remainder forever\n" +"or may be just , meaning //KILL/\n" +"\n" +"Exit status: 0 = done 1 = nothing done (=> 0 if --oknodo)\n" +" 3 = trouble 2 = with --retry, processes wouldn't die\n"); +} + + +static void +badusage(const char *msg) +{ + if (msg) + fprintf(stderr, "%s: %s\n", progname, msg); + fprintf(stderr, "Try `%s --help' for more information.\n", progname); + exit(3); +} + +struct sigpair { + const char *name; + int signal; +}; + +const struct sigpair siglist[] = { + { "ABRT", SIGABRT }, + { "ALRM", SIGALRM }, + { "FPE", SIGFPE }, + { "HUP", SIGHUP }, + { "ILL", SIGILL }, + { "INT", SIGINT }, + { "KILL", SIGKILL }, + { "PIPE", SIGPIPE }, + { "QUIT", SIGQUIT }, + { "SEGV", SIGSEGV }, + { "TERM", SIGTERM }, + { "USR1", SIGUSR1 }, + { "USR2", SIGUSR2 }, + { "CHLD", SIGCHLD }, + { "CONT", SIGCONT }, + { "STOP", SIGSTOP }, + { "TSTP", SIGTSTP }, + { "TTIN", SIGTTIN }, + { "TTOU", SIGTTOU } +}; + +static int parse_integer(const char *string, int *value_r) { + unsigned long ul; + char *ep; + + if (!string[0]) + return -1; + + ul= strtoul(string,&ep,10); + if (ul > INT_MAX || *ep != '\0') + return -1; + + *value_r= ul; + return 0; +} + +static int parse_signal(const char *signal_str, int *signal_nr) +{ + unsigned int i; + + if (parse_integer(signal_str, signal_nr) == 0) + return 0; + + for (i = 0; i < sizeof (siglist) / sizeof (siglist[0]); i++) { + if (strcmp (signal_str, siglist[i].name) == 0) { + *signal_nr = siglist[i].signal; + return 0; + } + } + return -1; +} + +static void +parse_schedule_item(const char *string, struct schedule_item *item) { + const char *after_hyph; + + if (!strcmp(string,"forever")) { + item->type = sched_forever; + } else if (isdigit(string[0])) { + item->type = sched_timeout; + if (parse_integer(string, &item->value) != 0) + badusage("invalid timeout value in schedule"); + } else if ((after_hyph = string + (string[0] == '-')) && + parse_signal(after_hyph, &item->value) == 0) { + item->type = sched_signal; + } else { + badusage("invalid schedule item (must be [-], " + "-, or `forever'"); + } +} + +static void +parse_schedule(const char *schedule_str) { + char item_buf[20]; + const char *slash; + int count, repeatat; + ptrdiff_t str_len; + + count = 0; + for (slash = schedule_str; *slash; slash++) + if (*slash == '/') + count++; + + schedule_length = (count == 0) ? 4 : count+1; + schedule = xmalloc(sizeof(*schedule) * schedule_length); + + if (count == 0) { + schedule[0].type = sched_signal; + schedule[0].value = signal_nr; + parse_schedule_item(schedule_str, &schedule[1]); + if (schedule[1].type != sched_timeout) { + badusage ("--retry takes timeout, or schedule list" + " of at least two items"); + } + schedule[2].type = sched_signal; + schedule[2].value = SIGKILL; + schedule[3]= schedule[1]; + } else { + count = 0; + repeatat = -1; + while (schedule_str != NULL) { + slash = strchr(schedule_str,'/'); + str_len = slash ? slash - schedule_str : strlen(schedule_str); + if (str_len >= (ptrdiff_t)sizeof(item_buf)) + badusage("invalid schedule item: far too long" + " (you must delimit items with slashes)"); + memcpy(item_buf, schedule_str, str_len); + item_buf[str_len] = 0; + schedule_str = slash ? slash+1 : NULL; + + parse_schedule_item(item_buf, &schedule[count]); + if (schedule[count].type == sched_forever) { + if (repeatat >= 0) + badusage("invalid schedule: `forever'" + " appears more than once"); + repeatat = count; + continue; + } + count++; + } + if (repeatat >= 0) { + schedule[count].type = sched_goto; + schedule[count].value = repeatat; + count++; + } + assert(count == schedule_length); + } +} + +#ifdef HAVE_SYS_CAPABILITY_H +static void +remove_capabilities(char *capstr) { + cap_value_t capval; + char *savedptr, *ptr; + cap_t caps; + + caps = cap_get_proc(); + if (caps == NULL) { + fatal("Unable to retrieve my capabilities"); + } + + ptr = strtok_r(capstr, ",", &savedptr); + while (ptr) { + if (cap_from_name(ptr, &capval) != 0) { + errno = EINVAL; + fatal("Unable to parse this capability : \"%s\"", ptr); + } + + if (prctl(PR_CAPBSET_DROP, capval, 0, 0) != 0) { + fatal("Unable to drop this capability: %s", ptr); + } + + if (cap_set_flag(caps, CAP_INHERITABLE, 1, (cap_value_t *)&capval, CAP_CLEAR) != 0) { + fatal("Unable to clear the capability %s", ptr); + } + + ptr = strtok_r(NULL, ",", &savedptr); + } + + if (cap_set_proc(caps) != 0) { + fatal("Unable to remove theses capabilities from the inherited set\n"); + } + + if (cap_free(caps) == -1) { + fatal("Cannot free the capability"); + } +} +#endif + +static void +parse_options(int argc, char * const *argv) +{ + static struct option longopts[] = { + { "help", 0, NULL, 'H'}, + { "stop", 0, NULL, 'K'}, + { "start", 0, NULL, 'S'}, + { "version", 0, NULL, 'V'}, + { "startas", 1, NULL, 'a'}, + { "name", 1, NULL, 'n'}, + { "oknodo", 0, NULL, 'o'}, + { "pidfile", 1, NULL, 'p'}, + { "quiet", 0, NULL, 'q'}, + { "signal", 1, NULL, 's'}, + { "test", 0, NULL, 't'}, + { "user", 1, NULL, 'u'}, + { "group", 1, NULL, 'g'}, + { "chroot", 1, NULL, 'r'}, + { "dropcap", 1, NULL, 'D'}, + { "verbose", 0, NULL, 'v'}, + { "exec", 1, NULL, 'x'}, + { "chuid", 1, NULL, 'c'}, + { "nicelevel", 1, NULL, 'N'}, + { "background", 0, NULL, 'b'}, + { "make-pidfile", 0, NULL, 'm'}, + { "retry", 1, NULL, 'R'}, + { "chdir", 1, NULL, 'd'}, + { NULL, 0, NULL, 0} + }; + int c; + + for (;;) { + c = getopt_long(argc, argv, "HKSVa:n:op:qr:s:tu:vx:c:N:bmR:g:d:D", + longopts, (int *) 0); + if (c == -1) + break; + switch (c) { + case 'H': /* --help */ + do_help(); + exit(0); + case 'K': /* --stop */ + stop = 1; + break; + case 'S': /* --start */ + start = 1; + break; + case 'V': /* --version */ + printf("start-stop-daemon " VERSION "\n"); + exit(0); + case 'a': /* --startas */ + startas = optarg; + break; + case 'n': /* --name */ + cmdname = optarg; + break; + case 'o': /* --oknodo */ + exitnodo = 0; + break; + case 'p': /* --pidfile */ + pidfile = optarg; + break; + case 'q': /* --quiet */ + quietmode = 1; + break; + case 's': /* --signal */ + signal_str = optarg; + break; + case 't': /* --test */ + testmode = 1; + break; + case 'u': /* --user | */ + userspec = optarg; + break; + case 'v': /* --verbose */ + quietmode = -1; + break; + case 'x': /* --exec */ + execname = optarg; + break; + case 'c': /* --chuid | */ + /* we copy the string just in case we need the + * argument later. */ + changeuser = strdup(optarg); + changeuser = strtok(changeuser, ":"); + changegroup = strtok(NULL, ":"); + break; + case 'g': /* --group | */ + changegroup = optarg; + break; + case 'r': /* --chroot /new/root */ + changeroot = optarg; + break; + case 'D': /* --dropcap cap_net_raw,cap_mac_admin */ +#ifdef HAVE_SYS_CAPABILITY_H + caplist = optarg; +#else + badusage("Capabilities are not supported on your OS"); +#endif + break; + case 'N': /* --nice */ + nicelevel = atoi(optarg); + break; + case 'b': /* --background */ + background = 1; + break; + case 'm': /* --make-pidfile */ + mpidfile = 1; + break; + case 'R': /* --retry | */ + schedule_str = optarg; + break; + case 'd': /* --chdir /new/dir */ + changedir = optarg; + break; + default: + badusage(NULL); /* message printed by getopt */ + } + } + + if (signal_str != NULL) { + if (parse_signal (signal_str, &signal_nr) != 0) + badusage("signal value must be numeric or name" + " of signal (KILL, INT, ...)"); + } + + if (schedule_str != NULL) { + parse_schedule(schedule_str); + } + + if (start == stop) + badusage("need one of --start or --stop"); + + if (!execname && !pidfile && !userspec && !cmdname) + badusage("need at least one of --exec, --pidfile, --user or --name"); + + if (!startas) + startas = execname; + + if (start && !startas) + badusage("--start needs --exec or --startas"); + + if (mpidfile && pidfile == NULL) + badusage("--make-pidfile is only relevant with --pidfile"); + + if (background && !start) + badusage("--background is only relevant with --start"); + +} + +#if defined(OSLinux) +static int +pid_is_exec(pid_t pid, const struct stat *esb) +{ + struct stat sb; + char buf[32]; + + sprintf(buf, "/proc/%d/exe", pid); + if (stat(buf, &sb) != 0) + return 0; + return (sb.st_dev == esb->st_dev && sb.st_ino == esb->st_ino); +} + + +static int +pid_is_user(pid_t pid, uid_t uid) +{ + struct stat sb; + char buf[32]; + + sprintf(buf, "/proc/%d", pid); + if (stat(buf, &sb) != 0) + return 0; + return (sb.st_uid == uid); +} + + +static int +pid_is_cmd(pid_t pid, const char *name) +{ + char buf[32]; + FILE *f; + int c; + + sprintf(buf, "/proc/%d/stat", pid); + f = fopen(buf, "r"); + if (!f) + return 0; + while ((c = getc(f)) != EOF && c != '(') + ; + if (c != '(') { + fclose(f); + return 0; + } + /* this hopefully handles command names containing ')' */ + while ((c = getc(f)) != EOF && c == *name) + name++; + fclose(f); + return (c == ')' && *name == '\0'); +} +#endif /* OSLinux */ + + +#if defined(OSHURD) +static void +init_procset(void) +{ + struct ps_context *context; + error_t err; + + err = ps_context_create(getproc(), &context); + if (err) + error(1, err, "ps_context_create"); + + err = proc_stat_list_create(context, &procset); + if (err) + error(1, err, "proc_stat_list_create"); + + err = proc_stat_list_add_all(procset, 0, 0); + if (err) + error(1, err, "proc_stat_list_add_all"); +} + +static struct proc_stat * +get_proc_stat (pid_t pid, ps_flags_t flags) +{ + struct proc_stat *ps; + ps_flags_t wanted_flags = PSTAT_PID | flags; + + if (!procset) + init_procset(); + + ps = proc_stat_list_pid_proc_stat(procset, pid); + if (!ps) + return NULL; + if (proc_stat_set_flags(ps, wanted_flags)) + return NULL; + if ((proc_stat_flags(ps) & wanted_flags) != wanted_flags) + return NULL; + + return ps; +} + +static int +pid_is_user(pid_t pid, uid_t uid) +{ + struct proc_stat *ps; + + ps = get_proc_stat(pid, PSTAT_OWNER_UID); + return ps && proc_stat_owner_uid(ps) == uid; +} + +static int +pid_is_cmd(pid_t pid, const char *name) +{ + struct proc_stat *ps; + + ps = get_proc_stat(pid, PSTAT_ARGS); + return ps && !strcmp(proc_stat_args(ps), name); +} + +static int +pid_is_running(pid_t pid) +{ + return get_proc_stat(pid, 0) != NULL; +} + +#else /* !OSHURD */ + +static int +pid_is_running(pid_t pid) +{ + struct stat sb; + char buf[32]; + + sprintf(buf, "/proc/%d", pid); + if (stat(buf, &sb) != 0) { + if (errno!=ENOENT) + fatal("Error stating %s: %s", buf, strerror(errno)); + return 0; + } + + return 1; +} + +#endif /* OSHURD */ + +static void +check(pid_t pid) +{ +#if defined(OSLinux) || defined(OShpux) + if (execname && !pid_is_exec(pid, &exec_stat)) +#elif defined(OSHURD) || defined(OSFreeBSD) || defined(OSNetBSD) + /* I will try this to see if it works */ + if (execname && !pid_is_cmd(pid, execname)) +#endif + return; + if (userspec && !pid_is_user(pid, user_id)) + return; + if (cmdname && !pid_is_cmd(pid, cmdname)) + return; + if (start && !pid_is_running(pid)) + return; + if (stop && pid_is_running(pid)) + push(&found, pid); +} + +static void +do_pidfile(const char *name) +{ + FILE *f; + pid_t pid; + + f = fopen(name, "r"); + if (f) { + if (fscanf(f, "%d", &pid) == 1) + check(pid); + fclose(f); + } else if (errno != ENOENT) + fatal("open pidfile %s: %s", name, strerror(errno)); + +} + +/* WTA: this needs to be an autoconf check for /proc/pid existance. + */ + +#if defined(OSLinux) || defined (OSsunos) || defined(OSfreebsd) +static void +do_procinit(void) +{ + DIR *procdir; + struct dirent *entry; + int foundany; + pid_t pid; + + procdir = opendir("/proc"); + if (!procdir) + fatal("opendir /proc: %s", strerror(errno)); + + foundany = 0; + while ((entry = readdir(procdir)) != NULL) { + if (sscanf(entry->d_name, "%d", &pid) != 1) + continue; + foundany++; + check(pid); + } + closedir(procdir); + if (!foundany) + fatal("nothing in /proc - not mounted?"); +} +#endif /* OSLinux */ + + +#if defined(OSHURD) +static int +check_proc_stat (struct proc_stat *ps) +{ + check(ps->pid); + return 0; +} + +static void +do_procinit(void) +{ + if (!procset) + init_procset(); + + proc_stat_list_for_each (procset, check_proc_stat); +} +#endif /* OSHURD */ + + +#if defined(OSOpenBSD) || defined(OSFreeBSD) || defined(OSNetBSD) +static int +pid_is_cmd(pid_t pid, const char *name) +{ + kvm_t *kd; + int nentries, argv_len=0; + struct kinfo_proc *kp; + char errbuf[_POSIX2_LINE_MAX], buf[_POSIX2_LINE_MAX]; + char **pid_argv_p; + char *start_argv_0_p, *end_argv_0_p; + + + kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, errbuf); + if (kd == 0) + errx(1, "%s", errbuf); + if ((kp = kvm_getprocs(kd, KERN_PROC_PID, pid, &nentries)) == 0) + errx(1, "%s", kvm_geterr(kd)); + if ((pid_argv_p = kvm_getargv(kd, kp, argv_len)) == 0) + errx(1, "%s", kvm_geterr(kd)); + + start_argv_0_p = *pid_argv_p; + /* find and compare string */ + + /* find end of argv[0] then copy and cut of str there. */ + if ((end_argv_0_p = strchr(*pid_argv_p, ' ')) == 0 ) + /* There seems to be no space, so we have the command + * allready in its desired form. */ + start_argv_0_p = *pid_argv_p; + else { + /* Tests indicate that this never happens, since + * kvm_getargv itselfe cuts of tailing stuff. This is + * not what the manpage says, however. */ + strncpy(buf, *pid_argv_p, (end_argv_0_p - start_argv_0_p)); + buf[(end_argv_0_p - start_argv_0_p) + 1] = '\0'; + start_argv_0_p = buf; + } + + if (strlen(name) != strlen(start_argv_0_p)) + return 0; + return (strcmp(name, start_argv_0_p) == 0) ? 1 : 0; +} + +static int +pid_is_user(pid_t pid, uid_t uid) +{ + kvm_t *kd; + int nentries; /* Value not used */ + uid_t proc_uid; + struct kinfo_proc *kp; + char errbuf[_POSIX2_LINE_MAX]; + + + kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, errbuf); + if (kd == 0) + errx(1, "%s", errbuf); + if ((kp = kvm_getprocs(kd, KERN_PROC_PID, pid, &nentries)) == 0) + errx(1, "%s", kvm_geterr(kd)); + if (kp->kp_proc.p_cred ) + kvm_read(kd, (u_long)&(kp->kp_proc.p_cred->p_ruid), + &proc_uid, sizeof(uid_t)); + else + return 0; + return (proc_uid == (uid_t)uid); +} + +static int +pid_is_exec(pid_t pid, const char *name) +{ + kvm_t *kd; + int nentries; + struct kinfo_proc *kp; + char errbuf[_POSIX2_LINE_MAX], *pidexec; + + kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, errbuf); + if (kd == 0) + errx(1, "%s", errbuf); + if ((kp = kvm_getprocs(kd, KERN_PROC_PID, pid, &nentries)) == 0) + errx(1, "%s", kvm_geterr(kd)); + pidexec = (&kp->kp_proc)->p_comm; + if (strlen(name) != strlen(pidexec)) + return 0; + return (strcmp(name, pidexec) == 0) ? 1 : 0; +} + + +static void +do_procinit(void) +{ + /* Nothing to do */ +} + +#endif /* OSOpenBSD */ + + +#if defined(OShpux) +static int +pid_is_user(pid_t pid, uid_t uid) +{ + struct pst_status pst; + + if (pstat_getproc(&pst, sizeof(pst), (size_t) 0, (int) pid) < 0) + return 0; + return ((uid_t) pst.pst_uid == uid); +} + +static int +pid_is_cmd(pid_t pid, const char *name) +{ + struct pst_status pst; + + if (pstat_getproc(&pst, sizeof(pst), (size_t) 0, (int) pid) < 0) + return 0; + return (strcmp(pst.pst_ucomm, name) == 0); +} + +static int +pid_is_exec(pid_t pid, const struct stat *esb) +{ + struct pst_status pst; + + if (pstat_getproc(&pst, sizeof(pst), (size_t) 0, (int) pid) < 0) + return 0; + return ((dev_t) pst.pst_text.psf_fsid.psfs_id == esb->st_dev + && (ino_t) pst.pst_text.psf_fileid == esb->st_ino); +} + +static void +do_procinit(void) +{ + struct pst_status pst[10]; + int i, count; + int idx = 0; + + while ((count = pstat_getproc(pst, sizeof(pst[0]), 10, idx)) > 0) { + for (i = 0; i < count; i++) + check(pst[i].pst_pid); + idx = pst[count - 1].pst_idx + 1; + } +} +#endif /* OShpux */ + + +static void +do_findprocs(void) +{ + clear(&found); + + if (pidfile) + do_pidfile(pidfile); + else + do_procinit(); +} + +/* return 1 on failure */ +static void +do_stop(int signal_nr, int quietmode, int *n_killed, int *n_notkilled, int retry_nr) +{ + struct pid_list *p; + + do_findprocs(); + + *n_killed = 0; + *n_notkilled = 0; + + if (!found) + return; + + clear(&killed); + + for (p = found; p; p = p->next) { + if (testmode) { + printf("Would send signal %d to %d.\n", + signal_nr, p->pid); + (*n_killed)++; + } else if (kill(p->pid, signal_nr) == 0) { + push(&killed, p->pid); + (*n_killed)++; + } else { + printf("%s: warning: failed to kill %d: %s\n", + progname, p->pid, strerror(errno)); + (*n_notkilled)++; + } + } + if (quietmode < 0 && killed) { + printf("Stopped %s (pid", what_stop); + for (p = killed; p; p = p->next) + printf(" %d", p->pid); + putchar(')'); + if (retry_nr > 0) + printf(", retry #%d", retry_nr); + printf(".\n"); + } +} + + +static void +set_what_stop(const char *str) +{ + strncpy(what_stop, str, sizeof(what_stop)); + what_stop[sizeof(what_stop)-1] = '\0'; +} + +static int +run_stop_schedule(void) +{ + int r, position, n_killed, n_notkilled, value, ratio, anykilled, retry_nr; + struct timeval stopat, before, after, interval, maxinterval; + + if (testmode) { + if (schedule != NULL) { + printf("Ignoring --retry in test mode\n"); + schedule = NULL; + } + } + + if (cmdname) + set_what_stop(cmdname); + else if (execname) + set_what_stop(execname); + else if (pidfile) + sprintf(what_stop, "process in pidfile `%.200s'", pidfile); + else if (userspec) + sprintf(what_stop, "process(es) owned by `%.200s'", userspec); + else + fatal("internal error, please report"); + + anykilled = 0; + retry_nr = 0; + + if (schedule == NULL) { + do_stop(signal_nr, quietmode, &n_killed, &n_notkilled, 0); + if (n_notkilled > 0 && quietmode <= 0) + printf("%d pids were not killed\n", n_notkilled); + if (n_killed) + anykilled = 1; + goto x_finished; + } + + for (position = 0; position < schedule_length; ) { + value= schedule[position].value; + n_notkilled = 0; + + switch (schedule[position].type) { + + case sched_goto: + position = value; + continue; + + case sched_signal: + do_stop(value, quietmode, &n_killed, &n_notkilled, retry_nr++); + if (!n_killed) + goto x_finished; + else + anykilled = 1; + goto next_item; + + case sched_timeout: + /* We want to keep polling for the processes, to see if they've exited, + * or until the timeout expires. + * + * This is a somewhat complicated algorithm to try to ensure that we + * notice reasonably quickly when all the processes have exited, but + * don't spend too much CPU time polling. In particular, on a fast + * machine with quick-exiting daemons we don't want to delay system + * shutdown too much, whereas on a slow one, or where processes are + * taking some time to exit, we want to increase the polling + * interval. + * + * The algorithm is as follows: we measure the elapsed time it takes + * to do one poll(), and wait a multiple of this time for the next + * poll. However, if that would put us past the end of the timeout + * period we wait only as long as the timeout period, but in any case + * we always wait at least MIN_POLL_INTERVAL (20ms). The multiple + * (`ratio') starts out as 2, and increases by 1 for each poll to a + * maximum of 10; so we use up to between 30% and 10% of the + * machine's resources (assuming a few reasonable things about system + * performance). + */ + xgettimeofday(&stopat); + stopat.tv_sec += value; + ratio = 1; + for (;;) { + xgettimeofday(&before); + if (timercmp(&before,&stopat,>)) + goto next_item; + + do_stop(0, 1, &n_killed, &n_notkilled, 0); + if (!n_killed) + goto x_finished; + + xgettimeofday(&after); + + if (!timercmp(&after,&stopat,<)) + goto next_item; + + if (ratio < 10) + ratio++; + + TVCALC(interval, ratio * (TVELEM(&after) - TVELEM(&before) + TVADJUST)); + TVCALC(maxinterval, TVELEM(&stopat) - TVELEM(&after) + TVADJUST); + + if (timercmp(&interval,&maxinterval,>)) + interval = maxinterval; + + if (interval.tv_sec == 0 && + interval.tv_usec <= MIN_POLL_INTERVAL) + interval.tv_usec = MIN_POLL_INTERVAL; + + r = select(0,0,0,0,&interval); + if (r < 0 && errno != EINTR) + fatal("select() failed for pause: %s", + strerror(errno)); + } + + default: + assert(!"schedule[].type value must be valid"); + + } + + next_item: + position++; + } + + if (quietmode <= 0) + printf("Program %s, %d process(es), refused to die.\n", + what_stop, n_killed); + + return 2; + +x_finished: + if (!anykilled) { + if (quietmode <= 0) + printf("No %s found running; none killed.\n", what_stop); + return exitnodo; + } else { + return 0; + } +} + + +int main(int argc, char **argv) NONRETURNING; +int +main(int argc, char **argv) +{ + int devnull_fd = -1; +#ifdef HAVE_TIOCNOTTY + int tty_fd = -1; +#endif + progname = argv[0]; + + parse_options(argc, argv); + argc -= optind; + argv += optind; + + if (execname && stat(execname, &exec_stat)) + fatal("stat %s: %s", execname, strerror(errno)); + + if (userspec && sscanf(userspec, "%d", &user_id) != 1) { + struct passwd *pw; + + pw = getpwnam(userspec); + if (!pw) + fatal("user `%s' not found\n", userspec); + + user_id = pw->pw_uid; + } + + if (changegroup && sscanf(changegroup, "%d", &runas_gid) != 1) { + struct group *gr = getgrnam(changegroup); + if (!gr) + fatal("group `%s' not found\n", changegroup); + runas_gid = gr->gr_gid; + } + if (changeuser && sscanf(changeuser, "%d", &runas_uid) != 1) { + struct passwd *pw = getpwnam(changeuser); + if (!pw) + fatal("user `%s' not found\n", changeuser); + runas_uid = pw->pw_uid; + if (changegroup == NULL) { /* pass the default group of this user */ + changegroup = ""; /* just empty */ + runas_gid = pw->pw_gid; + } + } + + if (stop) { + int i = run_stop_schedule(); + exit(i); + } + + do_findprocs(); + + if (found) { + if (quietmode <= 0) + printf("%s already running.\n", execname ? execname : "process"); + exit(exitnodo); + } + if (testmode) { + printf("Would start %s ", startas); + while (argc-- > 0) + printf("%s ", *argv++); + if (changeuser != NULL) { + printf(" (as user %s[%d]", changeuser, runas_uid); + if (changegroup != NULL) + printf(", and group %s[%d])", changegroup, runas_gid); + else + printf(")"); + } + if (changeroot != NULL) + printf(" in directory %s", changeroot); + if (nicelevel) + printf(", and add %i to the priority", nicelevel); + printf(".\n"); + exit(0); + } + if (quietmode < 0) + printf("Starting %s...\n", startas); + *--argv = startas; + if (background) { /* ok, we need to detach this process */ + int i; + if (quietmode < 0) + printf("Detaching to start %s...", startas); + i = fork(); + if (i<0) { + fatal("Unable to fork.\n"); + } + if (i) { /* parent */ + if (quietmode < 0) + printf("done.\n"); + exit(0); + } + /* child continues here */ + +#ifdef HAVE_TIOCNOTTY + tty_fd=open("/dev/tty", O_RDWR); +#endif + devnull_fd=open("/dev/null", O_RDWR); + } + if (nicelevel) { + errno=0; + if ((nice(nicelevel)==-1) && (errno!=0)) + fatal("Unable to alter nice level by %i: %s", nicelevel, + strerror(errno)); + } + if (mpidfile && pidfile != NULL) { /* user wants _us_ to make the pidfile :) */ + FILE *pidf = fopen(pidfile, "w"); + pid_t pidt = getpid(); + if (pidf == NULL) + fatal("Unable to open pidfile `%s' for writing: %s", pidfile, + strerror(errno)); + fprintf(pidf, "%d\n", pidt); + fclose(pidf); + } + if (changeroot != NULL) { + if (chdir(changeroot) < 0) + fatal("Unable to chdir() to %s", changeroot); + if (chroot(changeroot) < 0) + fatal("Unable to chroot() to %s", changeroot); + } + if (chdir(changedir) < 0) + fatal("Unable to chdir() to %s", changedir); + if (changeuser != NULL) { + if (setgid(runas_gid)) + fatal("Unable to set gid to %d", runas_gid); + if (initgroups(changeuser, runas_gid)) + fatal("Unable to set initgroups() with gid %d", runas_gid); + if (setuid(runas_uid)) + fatal("Unable to set uid to %s", changeuser); + } + if (background) { /* continue background setup */ + int i; +#ifdef HAVE_TIOCNOTTY + /* change tty */ + ioctl(tty_fd, TIOCNOTTY, 0); + close(tty_fd); +#endif + umask(022); /* set a default for dumb programs */ + dup2(devnull_fd,0); /* stdin */ + dup2(devnull_fd,1); /* stdout */ + dup2(devnull_fd,2); /* stderr */ +#if defined(OShpux) + /* now close all extra fds */ + for (i=sysconf(_SC_OPEN_MAX)-1; i>=3; --i) close(i); +#else + /* now close all extra fds */ + for (i=getdtablesize()-1; i>=3; --i) close(i); +#endif + + /* create a new session */ +#ifdef HAVE_SETSID + setsid(); +#else + setpgid(0,0); +#endif + } + +#ifdef HAVE_SYS_CAPABILITY_H + if (caplist) { + remove_capabilities(caplist); + } +#endif + + execv(startas, argv); + fatal("Unable to start %s: %s", startas, strerror(errno)); +} + diff --git a/src/testd.c b/src/testd.c new file mode 100644 index 0000000..b2a5c7e --- /dev/null +++ b/src/testd.c @@ -0,0 +1,9 @@ +#include +#include +#include + +int main() { + signal(SIGTERM, SIG_IGN); + while (1) sleep(20); + exit(0); +} diff --git a/src/testdinit b/src/testdinit new file mode 100755 index 0000000..a54ed71 --- /dev/null +++ b/src/testdinit @@ -0,0 +1,44 @@ +#!/bin/sh +# +# testd This shell script takes care of starting and stopping +# testd (example daemon). +# + +# Source function library. +. /etc/rc.d/init.d/functions + +# See how we were called. +case "$1" in + start) + # Start daemons. + echo -n "Starting testd: " + testd & + echo + touch /var/lock/subsys/testd + ;; + stop) + # Stop daemons. + echo -n "Shutting down testd: " + killproc testd + echo + rm -f /var/lock/subsys/testd + ;; + status) + # Am I alive? + status testd + exit $? + ;; + restart) + echo -n "Shutting down testd: " + killproc testd + echo + echo -n "Starting testd: " + testd & + echo + ;; + *) + echo "Usage: testd {start|stop|status|restart}" + exit 1 +esac + +exit 0 diff --git a/src/usernetctl.c b/src/usernetctl.c new file mode 100644 index 0000000..3b35f93 --- /dev/null +++ b/src/usernetctl.c @@ -0,0 +1,242 @@ +/* + * Copyright (c) 1997-2003 Red Hat, Inc. All rights reserved. + * + * This software may be freely redistributed under the terms of the GNU + * public license. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* This will be running setuid root, so be careful! */ +static const char * safeEnviron[] = { + "PATH=/bin:/sbin:/usr/bin:/usr/sbin", + "HOME=/root", + NULL +}; + +#define FOUND_FALSE -1 +#define NOT_FOUND 0 +#define FOUND_TRUE 1 + +#ifndef SBINDIR +#define SBINDIR "/sbin" +#endif + +static void +usage(void) { + fprintf(stderr, "usage: usernetctl \n"); + exit(1); +} + +static size_t +testSafe(char *ifaceConfig, int fd) { + struct stat sb; + + /* These shouldn't be symbolic links -- anal, but that's fine w/ mkj. */ + if (fstat(fd, &sb)) { + fprintf(stderr, "failed to stat %s: %s\n", ifaceConfig, + strerror(errno)); + exit(1); + } + + /* Safety/sanity checks. */ + if (!S_ISREG(sb.st_mode)) { + fprintf(stderr, "%s is not a normal file\n", ifaceConfig); + exit(1); + } + + if (sb.st_uid) { + fprintf(stderr, "%s should be owned by root\n", ifaceConfig); + exit(1); + } + + if (sb.st_mode & S_IWOTH) { + fprintf(stderr, "%s should not be world writeable\n", ifaceConfig); + exit(1); + } + + return sb.st_size; +} + + +static int +userCtl(char *file) { + char *buf; + char *contents = NULL; + char *chptr = NULL; + char *next = NULL; + int fd = -1, retval = NOT_FOUND; + size_t size = 0; + + /* Open the file and then test it to see if we like it. This way + we avoid switcheroo attacks. */ + if ((fd = open(file, O_RDONLY)) == -1) { + fprintf(stderr, "failed to open %s: %s\n", file, strerror(errno)); + exit(1); + } + + size = testSafe(file, fd); + if (size > INT_MAX) { + fprintf(stderr, "file %s is too big\n", file); + exit(1); + } + + buf = contents = malloc(size + 2); + if (contents == NULL) { + fprintf(stderr, "failed to allocate memory\n"); + exit(1); + } + + if (read(fd, contents, size) != size) { + perror("error reading device configuration"); + exit(1); + } + close(fd); + + contents[size] = '\n'; + contents[size + 1] = '\0'; + + /* Each pass parses a single line (until an answer is found), The contents + pointer itself points to the beginning of the current line. */ + while (*contents) { + chptr = contents; + while (*chptr != '\n') chptr++; + next = chptr + 1; + while (chptr >= contents && isspace(*chptr)) chptr--; + *(++chptr) = '\0'; + + if (!strncasecmp(contents, "USERCTL=", 8)) { + contents += 8; + if ((contents[0] == '"' && + contents[strlen(contents) - 1] == '"') || + (contents[0] == '\'' && + contents[strlen(contents) - 1] == '\'')) + { + contents++; + contents[strlen(contents) - 1] = '\0'; + } + + if (!strcasecmp(contents, "yes") || !strcasecmp(contents, "true")) + retval = FOUND_TRUE; + else + retval = FOUND_FALSE; + + break; + } + + contents = next; + } + + free(buf); + + return retval; +} + +int +main(int argc, char ** argv) { + char * ifaceConfig; + char * chptr; + char * cmd = NULL; + int report = 0; + char tmp; + + if (argc != 3) usage(); + + if (!strcmp(argv[2], "up")) { + cmd = SBINDIR "/ifup"; + } else if (!strcmp(argv[2], "down")) { + cmd = SBINDIR "/ifdown"; + } else if (!strcmp(argv[2], "report")) { + report = 1; + } else { + usage(); + } + + if (chdir("/etc/sysconfig/interfaces")) { + fprintf(stderr, "error switching to /etc/sysconfig/interfaces: " + "%s\n", strerror(errno)); + exit(1); + } + + /* force the interface configuration to be in the current directory */ + chptr = ifaceConfig = argv[1]; + while (*chptr) { + if (*chptr == '/') + ifaceConfig = chptr + 1; + chptr++; + } + + /* automatically prepend "ifcfg-" if it is not specified */ + if (strncmp(ifaceConfig, "ifcfg-", 6)) { + char *temp; + size_t len = strlen(ifaceConfig); + + /* Make sure a wise guys hasn't tried an integer wrap-around or + stack overflow attack. There's no way it could refer to anything + bigger than the largest filename, so cut 'em off there. */ + if (len > PATH_MAX) + exit(1); + + temp = (char *) alloca(len + 7); + strcpy(temp, "ifcfg-"); + /* strcat is safe because we got the length from strlen */ + strcat(temp, ifaceConfig); + ifaceConfig = temp; + } + + if(getuid() != 0) + switch (userCtl(ifaceConfig)) { + char *dash; + + case NOT_FOUND: + /* a `-' will be found at least in "ifcfg-" */ + dash = strrchr(ifaceConfig, '-'); + if (*(dash-1) != 'g') { + /* This was a clone configuration; ask the parent config */ + tmp = *dash; + *dash = '\0'; + if (userCtl(ifaceConfig) == FOUND_TRUE) { + /* exit the switch; users are allowed to control */ + *dash = tmp; + break; + } + *dash = tmp; + } + /* else fall through */ + case FOUND_FALSE: + if (! report) + fprintf(stderr, + "Users are not allowed to control this interface.\n"); + exit(1); + break; + } + + /* looks good to me -- let's go for it if we are changing the interface, + * report good status to the user otherwise */ + + if (report) + exit(0); + + /* pppd wants the real uid to be the same as the effective (god only + knows why when it works fine setuid out of the box) */ + setuid(geteuid()); + + execle(cmd, cmd, ifaceConfig, NULL, safeEnviron); + fprintf(stderr, "exec of %s failed: %s\n", cmd, strerror(errno)); + + exit(1); +} diff --git a/src/usleep.c b/src/usleep.c new file mode 100644 index 0000000..13e55b7 --- /dev/null +++ b/src/usleep.c @@ -0,0 +1,71 @@ +/* + * usleep.c Sleep for the specified number of microseconds + * + * Usage: usleep [ microseconds ] + * + * Copyright 2001 Werner Fink, 2001 SuSE GmbH Nuernberg, Germany. + * Copyright 2005 Werner Fink, 2005 SUSE LINUX Products GmbH, Germany. + * + * 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. + * + * Author: Werner Fink + */ + +#ifndef __USE_STRING_INLINES +# define __USE_STRING_INLINES +#endif +#ifdef __NO_STRING_INLINES +# undef __NO_STRING_INLINES +#endif +#include +#include +#include +#include +#include +#ifdef _POSIX_PRIORITY_SCHEDULING +# include +#endif +#define USAGE "Usage:\t%s [ microseconds ]\n", we_are + +static char *we_are; +int main(int argc, char **argv) +{ + unsigned long int usec = 1; + + if (argc > 2) + goto err; + + if (argc > 1) { + char *endptr; + usec = strtoul(argv[1], &endptr, 10); + if (*endptr != '\0') + goto err; + } + + if (usec) + usleep(usec); +#ifdef _POSIX_PRIORITY_SCHEDULING + else + (void)sched_yield(); +#endif + _exit(0); + + /* Do this at the end for speed */ +err: + we_are = basename(argv[0]); + fprintf(stderr, USAGE); + + if (argc > 1 && *(argv[1]) == '-') { + argv[1]++; + if (!strcmp(argv[1], "-help") || *(argv[1]) == 'h' || *(argv[1]) == '?') { + fprintf(stderr, "Sleep for the specified number of microseconds.\n\n"); + fprintf(stderr, "Help options:\n"); + fprintf(stderr, " -h, -?, --help display this help and exit.\n"); + exit (0); + } + } + exit (1); +} diff --git a/sysconfig/Makefile.am b/sysconfig/Makefile.am new file mode 100644 index 0000000..ad69648 --- /dev/null +++ b/sysconfig/Makefile.am @@ -0,0 +1,21 @@ +@SET_MAKE@ + +SUBDIRS = interfaces hwprofiles cpusets + +sysconfigdir = @sysconfigdir@ + +sysconfig_DATA = \ + init-colors \ + hwprof \ + system \ + network \ + static-routes \ + static-routes6 \ + static-nat \ + static-arp \ + i18n + +noinst_DATA = \ + init-colors.gentoo + +EXTRA_DIST = $(sysconfig_DATA) $(noinst_DATA) diff --git a/sysconfig/cpusets/Makefile.am b/sysconfig/cpusets/Makefile.am new file mode 100644 index 0000000..bb5d314 --- /dev/null +++ b/sysconfig/cpusets/Makefile.am @@ -0,0 +1,7 @@ +@SET_MAKE@ + +cpusetsdir = @sysconfigdir@/cpusets + +cpusets_DATA = cpuset-test + +EXTRA_DIST = $(cpusets_DATA) diff --git a/sysconfig/cpusets/cpuset-test b/sysconfig/cpusets/cpuset-test new file mode 100644 index 0000000..c1582ad --- /dev/null +++ b/sysconfig/cpusets/cpuset-test @@ -0,0 +1,25 @@ +# Name of the cpuset +NAME=test + +# list of CPUs in that cpuset +CPUS=1-2 + +# list of Memory Nodes in that cpuset +MEMS=1-2 + +# If a cpuset is cpu or mem exclusive, no other cpuset, other than a direct +# ancestor or descendent, may share any of the same CPUs or Memory Nodes. + +# is cpu placement exclusive? +CPU_EXCLUSIVE=1 + +# is memory placement exclusive? +MEM_EXCLUSIVE=1 + +# +#NOTIFY_ON_RELEASE=0 + +# PIDs of tasks in this cpuset +#TASKS= + +ONBOOT=no diff --git a/sysconfig/hwprof b/sysconfig/hwprof new file mode 100644 index 0000000..b16b8dd --- /dev/null +++ b/sysconfig/hwprof @@ -0,0 +1,4 @@ +# Hardware Profiles configuration + +# Ask for profile if not found +ASKFORPROFILE=no diff --git a/sysconfig/hwprofiles/Makefile.am b/sysconfig/hwprofiles/Makefile.am new file mode 100644 index 0000000..55ed8f2 --- /dev/null +++ b/sysconfig/hwprofiles/Makefile.am @@ -0,0 +1,7 @@ +@SET_MAKE@ + +hwprofilesdir = @sysconfigdir@/hwprofiles + +noinst_DATA = files + +EXTRA_DIST = $(noinst_DATA) diff --git a/sysconfig/hwprofiles/files b/sysconfig/hwprofiles/files new file mode 100644 index 0000000..5695211 --- /dev/null +++ b/sysconfig/hwprofiles/files @@ -0,0 +1,15 @@ +/etc/cups/ppd/* +/etc/cups/printers.conf +/etc/sysconfig/interfaces/ifcfg-eth0 +/etc/X11/XF86Config +/etc/X11/xorg.conf +/etc/sysconfig/system +/etc/sysconfig/network +/etc/sysconfig/mouse +/etc/hosts +/etc/resolv.conf +/etc/modules.conf +/etc/modules +/etc/printcap +/etc/fstab +/etc/sysconfig/fbset diff --git a/sysconfig/i18n b/sysconfig/i18n new file mode 100644 index 0000000..83e4e19 --- /dev/null +++ b/sysconfig/i18n @@ -0,0 +1,10 @@ + +# NOTE: Do not use expressions here, systemd does not expand them: +# LANG="${LANG:-en_US.UTF-8}" +# +#LANG=en_US.UTF-8 +#LANG=pl_PL.UTF-8 + +# list of locales to build if glibc-localedb-all package is not installed +# enable, install "localedb-src" package and execute "localedb-gen" +#SUPPORTED_LOCALES="C.UTF-8/UTF-8 en_US.UTF-8/UTF-8 en_US/ISO-8859-1" diff --git a/sysconfig/init-colors b/sysconfig/init-colors new file mode 100644 index 0000000..500e22e --- /dev/null +++ b/sysconfig/init-colors @@ -0,0 +1,12 @@ +# Default PLD Linux colors. + +CBRACKETS="$CYAN" # brackets [ ] color +CDONE="$GREEN" # DONE and WORK color +CBUSY="$MAGENTA" # BUSY color +CFAIL="$RED" # FAIL and DIED color +CPOWEREDBY="$CYAN" # "Powered by" color +CPLD="$GREEN" # "PLD Linux Distribution" color +CI="$RED" # Capital I color (press I to enter interactive startup) +CRESMAN="$GREEN" # "Resource Manager" color +CHARS="" # Characters displayed on the beginning of show line +CCHARS="$NORMAL" # Color of these characters (look at /usr/share/doc/rc-scripts-*/init-colors.gentoo.gz example) diff --git a/sysconfig/init-colors.gentoo b/sysconfig/init-colors.gentoo new file mode 100644 index 0000000..8987a5b --- /dev/null +++ b/sysconfig/init-colors.gentoo @@ -0,0 +1,12 @@ +# Gentoo colors, copy this file as: /etc/sysconfig/init-colors + +CBRACKETS="$BLUE $BOLD" # brackets [ ] color +CDONE="$GREEN $BOLD" # DONE and WORK color +CBUSY="$MAGENTA $BOLD" # BUSY color +CFAIL="$RED $BOLD" # FAIL and DIED color +CPOWEREDBY="$BLUE $BOLD" # "Powered by" color +CPLD="$GREEN $BOLD" # "PLD Linux Distribution" color +CI="$RED $BOLD" # Capital I color (press I to enter interactive startup) +CRESMAN="$GREEN $BOLD" # "Resource Manager" color +CHARS=" * " # Characters displayed on the beginning of show line +CCHARS="$GREEN $BOLD" # Color of these characters diff --git a/sysconfig/interfaces/Makefile.am b/sysconfig/interfaces/Makefile.am new file mode 100644 index 0000000..6c76f24 --- /dev/null +++ b/sysconfig/interfaces/Makefile.am @@ -0,0 +1,32 @@ +@SET_MAKE@ + +SUBDIRS = data up.d down.d + +interfacesdir = @sysconfigdir@/interfaces + +interfaces_DATA = ifcfg-eth0 + +noinst_DATA = \ + ifcfg-br0 \ + ifcfg-description \ + ifcfg-eth0.1 \ + ifcfg-irda0 \ + ifcfg-irlan0 \ + ifcfg-ppp0.pppoe \ + ifcfg-ppp0.kou \ + ifcfg-ppp0.callback \ + ifcfg-ppp0.eagle-usb-neostrada \ + ifcfg-ppp0.gprs-idea \ + ifcfg-ppp0.gprs-plusgsm \ + ifcfg-ppp0.leased1 \ + ifcfg-ppp0.leased2 \ + ifcfg-ppp0.speedtouch-neostrada \ + ifcfg-ppp0.tpsa \ + ifcfg-ppp0.ueagle-neostrada \ + ifcfg-ppp0.ueagle4-neostrada \ + ifcfg-sl0 \ + tnlcfg-description \ + tnlcfg-icm + + +EXTRA_DIST = $(interfaces_DATA) $(noinst_DATA) diff --git a/sysconfig/interfaces/data/Makefile.am b/sysconfig/interfaces/data/Makefile.am new file mode 100644 index 0000000..36cefab --- /dev/null +++ b/sysconfig/interfaces/data/Makefile.am @@ -0,0 +1,15 @@ +@SET_MAKE@ + +interfacesdatadir = @sysconfigdir@/interfaces/data + +interfacesdata_DATA = + +noinst_DATA = \ + chat-ppp0.kou \ + chat-ppp0.kou-disconnect \ + chat-ppp0.callback \ + chat-ppp0.leased1 \ + chat-ppp0.tpsa \ + chat-ppp0.gprs-plusgsm + +EXTRA_DIST = $(interfacesdata_DATA) $(noinst_DATA) diff --git a/sysconfig/interfaces/data/chat-ppp0.callback b/sysconfig/interfaces/data/chat-ppp0.callback new file mode 100644 index 0000000..59f304f --- /dev/null +++ b/sysconfig/interfaces/data/chat-ppp0.callback @@ -0,0 +1,23 @@ +# (c) 1999 Grzegorz Stanislawski +# Script for dialing to host with 'modem level' callback serurity enabled +# as performed by USRobotics Courier modem +ABORT BUSY +ABORT NO\\sDIAL +ABORT NO\\sCARRIER +TIMEOUT 60 +'' atz +OK $INITSTRING +OK atdt $PHONE +CONNECT \\c +\)? $CBPASSWORD +umber $CBPHONE +HANGUP OFF +CLR_ABORT NO\\sCARRIER +NO\\sCARRIER \\c +TIMEOUT 120 +RING ATA +ABORT NO\\sCARRIER +CONNECT \\c +HANGUP ON +ogin: $USER +assword: $PASSWORD diff --git a/sysconfig/interfaces/data/chat-ppp0.gprs-idea b/sysconfig/interfaces/data/chat-ppp0.gprs-idea new file mode 100644 index 0000000..626482b --- /dev/null +++ b/sysconfig/interfaces/data/chat-ppp0.gprs-idea @@ -0,0 +1,7 @@ +ABORT BUSY +ABORT ERROR +ABORT "NO CARRIER" +"" AT +OK $INITSTRING +OK-AT-OK ATD"$PHONE" +CONNECT diff --git a/sysconfig/interfaces/data/chat-ppp0.gprs-playmobile b/sysconfig/interfaces/data/chat-ppp0.gprs-playmobile new file mode 100644 index 0000000..83a3f7c --- /dev/null +++ b/sysconfig/interfaces/data/chat-ppp0.gprs-playmobile @@ -0,0 +1,10 @@ +TIMEOUT 10 +ABORT 'BUSY' +ABORT 'NO ANSWER' +ABORT 'ERROR' +"" ATZ +OK 'AT+CGDCONT=1,"IP","","0.0.0.0",0,0;+CGQMIN=1,0,0, 0,0,0;+CGQREQ=1,0,0,0,0,0;+CGEQREQ=1,4,0,0,0,0,2,0 ,"0E0","0E0",3,0,0;+CGEQMIN=1,3,0,0,0,0,0,0,"0E0", "0E0",2,0,0' +ABORT 'NO CARRIER' +OK 'ATDT*99#' + +CONNECT '' diff --git a/sysconfig/interfaces/data/chat-ppp0.gprs-plusgsm b/sysconfig/interfaces/data/chat-ppp0.gprs-plusgsm new file mode 100644 index 0000000..4d25b22 --- /dev/null +++ b/sysconfig/interfaces/data/chat-ppp0.gprs-plusgsm @@ -0,0 +1,10 @@ +ABORT "BUSY" +ABORT "ERROR" +ABORT "NO CARRIER" +ABORT "NO DIALTONE" +ABORT "NO ANSWER" +ABORT "Username/Password Incorrect" +"" ATZ +OK AT+CGDCONT=1,"IP","www.plusgsm.pl","",0,0 +OK "ATD*99***1#" +CONNECT '' diff --git a/sysconfig/interfaces/data/chat-ppp0.kou b/sysconfig/interfaces/data/chat-ppp0.kou new file mode 100644 index 0000000..e4861a0 --- /dev/null +++ b/sysconfig/interfaces/data/chat-ppp0.kou @@ -0,0 +1,8 @@ +ABORT BUSY +ABORT ERROR +ABORT 'NO CARRIER' + +TIMEOUT 60 + +'' ATZ +OK ATDT#777 diff --git a/sysconfig/interfaces/data/chat-ppp0.kou-disconnect b/sysconfig/interfaces/data/chat-ppp0.kou-disconnect new file mode 100644 index 0000000..bf8e1c9 --- /dev/null +++ b/sysconfig/interfaces/data/chat-ppp0.kou-disconnect @@ -0,0 +1,8 @@ +ABORT BUSY +ABORT ERROR +ABORT 'NO CARRIER' +ABORT 'NO DIALTONE' +SAY "\nSending interruption to CDMA modem\n" +"" "\K" +"" "+++ATH" +SAY "\nCDMA connection interrupted\n" diff --git a/sysconfig/interfaces/data/chat-ppp0.leased1 b/sysconfig/interfaces/data/chat-ppp0.leased1 new file mode 100644 index 0000000..dbf4aec --- /dev/null +++ b/sysconfig/interfaces/data/chat-ppp0.leased1 @@ -0,0 +1,8 @@ +# (c) 1999 Grzegorz Stanislawski +# chat script for setting up hardwired (leased) serial line. +# refer to ifcfg-ppp0.leased1 for more info +REPORT CONNECT +ABORT 'NO CARRIER' +'' \\r$INITSTRING +OK '' +CONNECT diff --git a/sysconfig/interfaces/data/chat-ppp0.tpsa b/sysconfig/interfaces/data/chat-ppp0.tpsa new file mode 100644 index 0000000..6090923 --- /dev/null +++ b/sysconfig/interfaces/data/chat-ppp0.tpsa @@ -0,0 +1,13 @@ +# (c) 1999 Grzegorz Stanislawski +# Script for dialing in to Public Internet Access by TPSA (0202122) + +ABORT BUSY +ABORT NO\\sDIAL +ABORT NO\\sCARRIER +TIMEOUT 60 +'' atz +OK $INITSTRING +OK atdt$PHONE +CONNECT \\c +ame: $USER +ord: $PASSWORD diff --git a/sysconfig/interfaces/down.d/Makefile.am b/sysconfig/interfaces/down.d/Makefile.am new file mode 100644 index 0000000..fed9958 --- /dev/null +++ b/sysconfig/interfaces/down.d/Makefile.am @@ -0,0 +1,3 @@ +@SET_MAKE@ + +SUBDIRS = all ip ipx ppp tnl diff --git a/sysconfig/interfaces/down.d/all/Makefile.am b/sysconfig/interfaces/down.d/all/Makefile.am new file mode 100644 index 0000000..89e512c --- /dev/null +++ b/sysconfig/interfaces/down.d/all/Makefile.am @@ -0,0 +1,8 @@ +@SET_MAKE@ + +alldowndir= @downdir@/all + +alldown_SCRIPTS = +noinst_SCRIPTS = thetouch + +EXTRA_DIST = $(alldown_SCRIPTS) $(noinst_SCRIPTS) diff --git a/sysconfig/interfaces/down.d/all/thetouch b/sysconfig/interfaces/down.d/all/thetouch new file mode 100755 index 0000000..5b94f29 --- /dev/null +++ b/sysconfig/interfaces/down.d/all/thetouch @@ -0,0 +1,5 @@ +#! /bin/sh +# This script will run every time some interface will go down +# using ifup or ifdown. +# + diff --git a/sysconfig/interfaces/down.d/ip/Makefile.am b/sysconfig/interfaces/down.d/ip/Makefile.am new file mode 100644 index 0000000..4ba0661 --- /dev/null +++ b/sysconfig/interfaces/down.d/ip/Makefile.am @@ -0,0 +1,7 @@ +@SET_MAKE@ + +ipdowndir = @downdir@/ip + +ipdown_SCRIPTS = + +EXTRA_DIST = $(ipdown_SCRIPTS) diff --git a/sysconfig/interfaces/down.d/ipx/Makefile.am b/sysconfig/interfaces/down.d/ipx/Makefile.am new file mode 100644 index 0000000..18363b2 --- /dev/null +++ b/sysconfig/interfaces/down.d/ipx/Makefile.am @@ -0,0 +1,7 @@ +@SET_MAKE@ + +ipxdowndir = @downdir@/ipx + +ipxdown_SCRIPTS = + +EXTRA_DIST = $(ipxdown_SCRIPTS) diff --git a/sysconfig/interfaces/down.d/ppp/Makefile.am b/sysconfig/interfaces/down.d/ppp/Makefile.am new file mode 100644 index 0000000..e381269 --- /dev/null +++ b/sysconfig/interfaces/down.d/ppp/Makefile.am @@ -0,0 +1,7 @@ +@SET_MAKE@ + +pppdowndir= @downdir@/ppp + +pppdown_SCRIPTS = logger + +EXTRA_DIST = $(pppdown_SCRIPTS) diff --git a/sysconfig/interfaces/down.d/ppp/logger b/sysconfig/interfaces/down.d/ppp/logger new file mode 100644 index 0000000..79f00a9 --- /dev/null +++ b/sysconfig/interfaces/down.d/ppp/logger @@ -0,0 +1,5 @@ +#!/bin/sh +# You can put here anything :) +# +echo " Disconnect time: $(date) from $PPP_REMOTE " >> /var/log/ppp.log +echo "+---------------------------------------------------------------+" >> /var/log/ppp.log diff --git a/sysconfig/interfaces/down.d/tnl/Makefile.am b/sysconfig/interfaces/down.d/tnl/Makefile.am new file mode 100644 index 0000000..e4aeb54 --- /dev/null +++ b/sysconfig/interfaces/down.d/tnl/Makefile.am @@ -0,0 +1,7 @@ +@SET_MAKE@ + +tnldowndir = @downdir@/tnl + +tnldown_SCRIPTS = + +EXTRA_DIST = $(tnldown_SCRIPTS) diff --git a/sysconfig/interfaces/ifcfg-bond0 b/sysconfig/interfaces/ifcfg-bond0 new file mode 100644 index 0000000..eec9798 --- /dev/null +++ b/sysconfig/interfaces/ifcfg-bond0 @@ -0,0 +1,23 @@ +# bonding setup + +# filename: ifcfg-bond0 +DEVICE=bond0 +IPADDR=192.168.0.1/24 +IPADDR1=10.10.0.1/21 +BOOTPROTO=none +ONBOOT=yes + +# additionally create ifcfg-eth0 and ifcfg-eth1 as: +# filename: ifcfg-eth0 +#DEVICE=eth0 +#SLAVE=yes +#MASTER=bond0 +#BOOTPROTO=none +#ONBOOT=yes + +# filename: ifcfg-eth1 +#DEVICE=eth1 +#SLAVE=yes +#MASTER=bond0 +#BOOTPROTO=none +#ONBOOT=yes diff --git a/sysconfig/interfaces/ifcfg-br0 b/sysconfig/interfaces/ifcfg-br0 new file mode 100644 index 0000000..aa5b394 --- /dev/null +++ b/sysconfig/interfaces/ifcfg-br0 @@ -0,0 +1,6 @@ +# +DEVICE=br0 +IPADDR=195.164.211.2 +ONBOOT=yes +BRIDGE_DEVS="eth0 eth1" +SPANNING_TREE=yes diff --git a/sysconfig/interfaces/ifcfg-description b/sysconfig/interfaces/ifcfg-description new file mode 100644 index 0000000..3986ef9 --- /dev/null +++ b/sysconfig/interfaces/ifcfg-description @@ -0,0 +1,240 @@ + +DEVICE= + +[ BOOTPRIO=number ] + ifcfg-* interfaces are configured in BOOTPRIO order starting + from lowest value first. You need to set BOOTPRIO in _all_ your + ifcfg* files because if you won't do that only these interfaces + with BOOTPRIO variable will be configured. Use the same schema + when setting variable for example BOOTPRIO=number + or BOOTPRIO="number" because sorting is done by sort command. + +[ BOOTPROTO={none|bootp|dhcp|pump} ] + You can specify which dhcp client to use with the DHCP_CLIENT, if + the DHCP_CLIENT is not specified we trying to launch in order : + /sbin/dhcpcd + /sbin/dhclient + /sbin/dhcpxd + /sbin/pump + if you have a preferred client define the DHCP_CLIENT variable. + You can also pass some options to dhcp client via DHCP_OPTIONS. + +[ BOOTPROTO6={none|dhcp6|v4compat} + dhcp6 isn't supported, yet. + v4compat uses available IPv4 addresses (ie. from DHCPv4) + and then convert them to IPv6 (IPv4-compatible) to use with + automatic tunnels + + +IPADDR="(IPv4 or IPv6 address)/prefix" +IP_AOPTS="broadcast xxx etc" (by default broadcast is autocalculated) +IP_ROPTS="" +IP_LABEL="" + +IPADDR1= +IP_AOPTS1= options for ip addr add +IP_ROPTS1= options for ip route add (currently used only for IP4_PRIM_IF) +IP_LABEL1= IPv6 address label as per RFC 3484 (ip addrlabel ...) + +IP4_PRIM_IF="1" # number of primary IPv4 interface (IPADDRx) +IP4_SRC_IF="1" # number of IPv4 address for ip's ,,src'' parameter +IP6_PRIM_IF="" # + +[ ONBOOT={no|yes} ] +[ HOTPLUG={no|yes} ] - bring up from hotplug (udev for example) (default to no) +[ MULTICAST={|no|yes} ] - for eth automatically set to yes +[ ARP={no|yes} ] - for eth automatically set to yes +[ IPV6_DISABLE_AUTOCONF={yes|no} ] - disable IPv6 autoconfiguration + +[ IPX=yes|no ] +if IPX=yes ; then + + IPXNETNUM_{802_2,802_2TR,802_3,EtherII,SNAP} + IPXPRIMARY_{802_2,802_2TR,802_3,EtherII,SNAP}=yes|no + IPXACTIVE_{802_2,802_2TR,802_3,EtherII,SNAP}=yes|no +fi + +[ MTU= ] +[ METRIC= ] +[ PROXYARP={yes|no} ] + +QDISC=[sfq|teql0|red|prio|...] (queueing discipline) +QDISC_CLASS=[htb|cbq|none] (use cbq|htb as class based discipline; + if none specified and bandwidth_out present + then tbf is used) +BANDWIDTH_IN=[upstream limit in kilobites, supported on 2.4 only] +BANDWIDTH_OUT=[downstream limit in kilobites] + +VLAN_REORDER_HDR=[0|1] When this is set, the VLAN device will move the + ethernet header around to make it look exactly like a + real ethernet device. This may help programs such + as DHCPd which read the raw ethernet packet and + make assumptions about the location of bytes. + If you don't need it, don't turn it on, because there + will be at least a small performance degradation. + Default is ON. + +[ VLAN_GVRP=yes|no ] Enable GVRP. + +[ DEFAULTHANDLING=yes|no ] (used in configuration for ATM interfaces, + obsolete variable) +[ HANDLING=0|1|2|3 ] (0 is default; used ie. in ATM configuration, for + details see ifup script) + +if DEVICE=eth*; then + + [ MEDIA={auto|10baseT|10base2|AUI} ] + [ MACADDR= ] + + if macvlan + MACVLAN_DEV= + MACVLAN_MACADDR= + fi + + + if DEVICE=wireless interface (man iwconfig(8)) + WLAN_UPEARLY=| Up device before setting any WLAN parameters + (needed for some drivers) + WLAN_ESSID=|any|off + WLAN_NWID=|off + WLAN_FREQ= (2.422G) + WLAN_CHANNEL= (3) + WLAN_SENS= + WLAN_MODE=ad-hoc|managed|master|repeater|secondary|auto + WLAN_AP=|any|auto|off + WLAN_NICKNAME=|auto|fixed + WLAN_RTS_THRESHOLD=|auto|fixed|off + WLAN_FRAGMENTATION_THRESHOLD=|auto|fixed|off + WLAN_KEY=XXXX-XXXX-XXXX-XXXX|XXXXXXXX|s: + if WLAN_KEY; then + WLAN_KEY_1=... + WLAN_KEY_2=... + WLAN_KEY_3=... + WLAN_KEY_4=... + WLAN_KEY_CURRENT=index + fi + WLAN_ENCRYPTION=on|off|open|restricted + WLAN_POWER=period |timeout |on|off|all|unicast|multicast + WLAN_TXPOWER=|mW|auto|on|off + WLAN_RETRY=limit |lifetime + WLAN_COMMIT=yes|no (some cards require manual commit of changes) + if WLAN_WPA=yes; then + WLAN_WPA_WAIT_TIMEOUT= + WLAN_WPA_DRIVER= + WLAN_WPA_CONFIG= + WLAN_WPA_OPTIONS=[additional wpa_supplicant options] + fi + fi + +elif DEVICE=ppp* || DEVICE=sl* ; then + + PERSIST=yes|no + MODEMPORT= + LINESPEED= + DEFABORT=yes|no + DIRECT_CONNECT=yes|no (direct connection without chat/wvdial used for example + on SDI or leased lines) + + if DEVICE=ppp* ; then + + AUTH=yes|no + PEERDNS=yes|no + DEFROUTE=yes|no + ESCAPECHARS=yes|no + SYNC=yes|no (yes implies "sync" option) + HOLDOFF=30 + HARDFLOWCTL=yes|no (yes implies "modem crtscts" options) + PPPOPTIONS= + PAPNAME=<"name $PAPNAME" on pppd command line> + REMIP= + REMIP6= + MRU= + DISCONNECTTIMEOUT= + RETRYTIMEOUT= + INITSCRIPT= + DATAFORCHAT= + = (for chat script) + IPV6_PPP=yes|no (use IPv6 for ppp ?) + if IPV6_PPP = yes ; then + IPV6_CP_USEV4=yes|no (use local IPv4 mapped addresses + as IPv6 addresses) + IPV6_CP_PERSISTENT=yes|no (use EUI-48 addresses + as IPv6 addresses; not + supported on Linux, yet) + or by default use address specified by IP6_PRIM_IF + and REMIP6 + fi + PPPOA=yes|no (generic PPP over ATM) + if PPPOA = yes ; then + PPPOA_VPI= + PPPOA_VCI= + fi + PPPOE_DEV= (PPP over Ethernet device) + if PPPOE_DEV exists ; then + PPPOE_KERNEL=yes|no (use or not kernel space PPPoE support) + PPPOE_OPT= (used only with userspace pppoe program) + fi + PPPOA_EAGLE=yes|no (eagle-usb support) + if PPPOA_EAGLE = yes ; then + PPPOA_OPT= (used only with userspace pppoa program) + fi + PPPOA_SPEEDTOUCH=yes|no (speedtouch support) + if PPPOA_SPEEDTOUCH = yes ; then + PPPOA_KERNEL=yes|no (use or not kernel space PPPoA support) + PPPOA_VPI= + PPPOA_VCI= + PPPOA_OPT= (used only with userspace pppoa program) + fi + UNIT=yes|no (pass unit option to pppd (depends on DEVICE name) + defaults to yes) + WVDIALSECT= (section in wvdial config maybe) + fi + + if DEVICE=sl* ; then (SLIP) + PROTOCOL=slip|cslip|adaptive + REMIP= + REMIP6= + fi + +elif DEVICE=br* ; then /* Bridge */ + + BRIDGE_DEVS= + Note: separation configuration for devices in this list + should be avoided ! + AGEING= + GCINT= + + SPANNING_TREE=yes|no (enable SPT - Spanning Tree Protocol) + if SPANNING_TREE=yes ; then + BRIDGEPRIO= + FD= + HELLO= + MAXAGE= + PATHCOST_PORT= + PATHCOST= + Note: both PATHCOST_PORT and PATHCOST must be + specified to set cost of port + PORTPRIO_PORT= + PORTPRIO= + Note: see note above + fi +elif DEVICE=irda* ; then /* IrDA */ + + IRDAPORT= + DONGLE= + DISCOVERY=yes|no (starts discovery of remote IrDA devices) +fi + +# You can also run some other programs *after* device has been brought up or down. +# Just create functions run_up() and run_down(). +run_up() +{ + echo "This will be executed after device is brought up!" +} + +run_down() +{ + echo "This will be executed after device is brought down!" +} diff --git a/sysconfig/interfaces/ifcfg-eth0 b/sysconfig/interfaces/ifcfg-eth0 new file mode 100644 index 0000000..e307654 --- /dev/null +++ b/sysconfig/interfaces/ifcfg-eth0 @@ -0,0 +1,40 @@ +# Config for Ethernet card. +# + +# Name of the device. Must match filename suffix. +DEVICE=eth0 + +# IP addresses/address prefix +# where prefix: +# 24 - resembles netmask 255.255.255.0 +# 16 - resembles netmask 255.255.0.0 +# etc. +# IPADDR may be either IPv4 or IPv6 +# you may have up to 256 addresses set up +#IPADDR=192.168.0.1/24 +#IPADDR1=192.168.0.2/24 +#IPADDR2=192.168.0.3/24 +#IPADDR3=192.168.0.4/24 + +# you may select which of the above addresses +# is primary for this interface (it'd be IPADDR1 in the example below) +#IP4_PRIM_IF="1" + +# activate on boot? yes|no +# you must set it to 'yes' if you want to have this up after bootup +ONBOOT=yes + +# dhcp|pump|none +BOOTPROTO=dhcp + +# pass parameters to dhcp client +#DHCP_OPTIONS="-R" + +# sane qdisc +QDISC=sfq + +# configure a 6to4 tunnel? +#ENABLE_6TO4=yes + +# ethtool options like WoL +#ETHTOOL_OPTS="wol g" diff --git a/sysconfig/interfaces/ifcfg-eth0.1 b/sysconfig/interfaces/ifcfg-eth0.1 new file mode 100644 index 0000000..14d0b3f --- /dev/null +++ b/sysconfig/interfaces/ifcfg-eth0.1 @@ -0,0 +1,9 @@ +# VLAN device +# + +DEVICE=eth0.1 +IPADDR1=192.168.0.2/32 +IPADDR2=3ffe:bbb:ccc:ddd::5/64 +IP4_PRIM_IF=1 +MUTLICAST=no +ONBOOT=yes diff --git a/sysconfig/interfaces/ifcfg-irda0 b/sysconfig/interfaces/ifcfg-irda0 new file mode 100644 index 0000000..0ef6763 --- /dev/null +++ b/sysconfig/interfaces/ifcfg-irda0 @@ -0,0 +1,10 @@ +# Read /usr/share/doc/irda-utils-*/README.irattach.gz for more +# informations about options below. +# +DEVICE=irda0 +IPADDR=192.168.0.10 +ONBOOT=yes +IRDAPORT=/dev/ttyS1 +DONGLE=esi +DISCOVERY=yes + diff --git a/sysconfig/interfaces/ifcfg-irlan0 b/sysconfig/interfaces/ifcfg-irlan0 new file mode 100644 index 0000000..346f833 --- /dev/null +++ b/sysconfig/interfaces/ifcfg-irlan0 @@ -0,0 +1,5 @@ +# alias irlan0 irlan +# +DEVICE=irlan0 +BOOTPROTO=dhcp +ONBOOT=yes diff --git a/sysconfig/interfaces/ifcfg-ppp0.callback b/sysconfig/interfaces/ifcfg-ppp0.callback new file mode 100644 index 0000000..3dd7a41 --- /dev/null +++ b/sysconfig/interfaces/ifcfg-ppp0.callback @@ -0,0 +1,26 @@ +# +DEVICE=ppp0 +CHATSCRIPT=/etc/sysconfig/interfaces/data/chat-ppp0.callback +ONBOOT=no +HARDFLOWCTL=yes +MODEMPORT=/dev/ttyS1 +LINESPEED=115200 +DEBUG=yes +PERSIST=no +HOLDOFF=10 +#demand option not finished yet ;-( +DEMAND=no +#ACTIVEFILTER= +#IDLE= +PHONE=phone +INITSTRING=ATe0s2=255 +#CBPASSWORD and CBPHONE is ysed (by me) in callback. +#see included chat-ppp0 for example of +#"modem level" callback (on USRobotics Courier) +CBPASSWORD=cbpassword +CBPHONE=myphone +USER=user +PASSWORD=password +DATAFORCHAT="CBPASSWORD CBPHONE PHONE USER PASSWORD INITSTRING" + +REPORTFILE=/var/log/ppp0.log diff --git a/sysconfig/interfaces/ifcfg-ppp0.eagle-usb-neostrada b/sysconfig/interfaces/ifcfg-ppp0.eagle-usb-neostrada new file mode 100644 index 0000000..0582ae7 --- /dev/null +++ b/sysconfig/interfaces/ifcfg-ppp0.eagle-usb-neostrada @@ -0,0 +1,14 @@ +# +DEVICE=ppp0 +ONBOOT=yes +PPPOA_EAGLE=yes +AUTH=no +MTU=1452 +PERSIST=yes +DEFROUTE=yes +USEPEERDNS=yes +PAPNAME=XXX@neostrada.pl +# put password in /etc/ppp/pap-secrets or install +# ppp-plugin-ifcfg-password and uncommend following lines +# PLUGIN_IFCFG_PASSWORD=yes +# PASSWORD=YYYY diff --git a/sysconfig/interfaces/ifcfg-ppp0.gprs-idea b/sysconfig/interfaces/ifcfg-ppp0.gprs-idea new file mode 100644 index 0000000..6ba60fe --- /dev/null +++ b/sysconfig/interfaces/ifcfg-ppp0.gprs-idea @@ -0,0 +1,27 @@ +# +DEVICE=ppp0 +CHATSCRIPT=/etc/sysconfig/interfaces/data/chat-ppp0.gprs-idea +ONBOOT=no +HARDFLOWCTL=no +# ircomm0 for IRDA, rfcomm0 for BlueTooth +MODEMPORT=/dev/ircomm0 +# MODEMPORT=/dev/bluetooth/rfcomm/0 +LINESPEED=115200 +AUTH=no +DEBUG=yes +DEFROUTE=yes +PERSIST=yes +HOLDOFF=1 +MTU=296 +#demand option not finished yet ;-( +DEMAND=no +PHONE='*99***1#' +#or +#PHONE='*99#' +USER=idea +PASSWORD=idea +INITSTRING='AT+CGDCONT=1,"IP","www.idea.pl","",0,0' +DATAFORCHAT="USER PASSWORD INITSTRING PHONE" +PPPOPTIONS="noipdefault noproxyarp lcp-echo-failure 0 lcp-echo-interval 0 local" +PLUGIN_IFCFG_PASSWORD=yes +REPORTFILE=/var/log/ppp0.log diff --git a/sysconfig/interfaces/ifcfg-ppp0.gprs-playmobile b/sysconfig/interfaces/ifcfg-ppp0.gprs-playmobile new file mode 100644 index 0000000..906256c --- /dev/null +++ b/sysconfig/interfaces/ifcfg-ppp0.gprs-playmobile @@ -0,0 +1,24 @@ +# +DEVICE=ppp0 +CHATSCRIPT=/etc/sysconfig/interfaces/chat-ppp0.gprs-playmobile +ONBOOT=no +HARDFLOWCTL=no +# ttyUSB0 or tts/USB0 for USB modems, ircomm0 for IRDA, rfcomm0 for BlueTooth +MODEMPORT=/dev/ttyUSB0 +# MODEMPORT=/dev/bluetooth/rfcomm/0 +LINESPEED=115200 +AUTH=no +DEBUG=yes +DEFROUTE=yes +PERSIST=yes +HOLDOFF=1 +#MTU=296 +#demand option not finished yet ;-( +DEMAND=no +PHONE='*99***1#' +#or +#PHONE='*99#' +INITSTRING='AT+CGDCONT=1,"IP","","0.0.0.0",0,0;+CGQMIN=1,0,0, 0,0,0;+CGQREQ=1,0,0,0,0,0;+CGEQREQ=1,4,0,0,0,0,2,0 ,"0E0","0E0",3,0,0;+CGEQMIN=1,3,0,0,0,0,0,0,"0E0", "0E0",2,0,0' +DATAFORCHAT="INITSTRING PHONE" +PPPOPTIONS="noipdefault noproxyarp lcp-echo-failure 0 lcp-echo-interval 0 local" +REPORTFILE=/var/log/ppp0.log diff --git a/sysconfig/interfaces/ifcfg-ppp0.gprs-plusgsm b/sysconfig/interfaces/ifcfg-ppp0.gprs-plusgsm new file mode 100644 index 0000000..fc8df35 --- /dev/null +++ b/sysconfig/interfaces/ifcfg-ppp0.gprs-plusgsm @@ -0,0 +1,25 @@ +# +DEVICE=ppp0 +CHATSCRIPT=/etc/sysconfig/interfaces/data/chat-ppp0 +ONBOOT=no +HARDFLOWCTL=yes +# ircomm0 for IRDA, rfcomm0 for BlueTooth +MODEMPORT=/dev/ircomm0 +LINESPEED=115200 +AUTH=no +#QDISC="sfq quantum 1500b perturb 5" +DEBUG=yes +DEFROUTE=yes +PERSIST=no +HOLDOFF=10 +#demand option not finished yet ;-( +DEMAND=no +#ACTIVEFILTER= +#IDLE= +PHONE='*99***1#' +USER=plusgsm +PASSWORD=plusgsm +INITSTRING='AT+CGDCONT=1,"IP","www.plusgsm.pl","",0,0' +DATAFORCHAT="USER PASSWORD INITSTRING PHONE" + +REPORTFILE=/var/log/ppp0.log diff --git a/sysconfig/interfaces/ifcfg-ppp0.kou b/sysconfig/interfaces/ifcfg-ppp0.kou new file mode 100644 index 0000000..8466705 --- /dev/null +++ b/sysconfig/interfaces/ifcfg-ppp0.kou @@ -0,0 +1,19 @@ + +DEVICE=ppp0 + +MODEMPORT=/dev/tts/USB0 +LINESPEED=460800 + +# Your ESN of the device. +# You should also add to chap secrets a line: +# ESN * "cdma" * +PAPNAME=#ESN + +ONBOOT=yes +AUTH=no +PERSIST=yes +DEFROUTE=yes +USEPEERDNS=yes +DEBUG=no + +CHATSCRIPT=/etc/sysconfig/interfaces/data/chat-ppp0.kou diff --git a/sysconfig/interfaces/ifcfg-ppp0.leased1 b/sysconfig/interfaces/ifcfg-ppp0.leased1 new file mode 100644 index 0000000..886e619 --- /dev/null +++ b/sysconfig/interfaces/ifcfg-ppp0.leased1 @@ -0,0 +1,30 @@ +# (c) 1999 Grzegorz Stanislawski +# config file for setting up hardwired (leased) serial line. +# This configuration uses chats with modem, so You have to have an inteligent +# modem (AT commands compatible). +# But You can monitor connection speed. +# +DEVICE=ppp0 +CHATSCRIPT=/etc/sysconfig/interfaces/data/chat-ppp0.leased1 +ONBOOT=yes +IPADDR=192.168.255.254/30 +REMIP=192.168.255.253 +HARDFLOWCTL=yes +MODEMPORT=/dev/ttyS1 +LINESPEED=115200 +DEBUG=no +PERSIST=yes +HOLDOFF=10 +#demand option not finished yet ;-( +DEMAND=no +#ACTIVEFILTER= +#IDLE= +# one end is "calling" +INITSTRING="ATs0=0&l1" +# while other is "receiving" +#INITSTRING="ATs0=1&l1" +#if your modem doesn't support AT&L1 command try with ATD on one side +#and ATA on the other. +DATAFORCHAT="INITSTRING" + +REPORTFILE=/var/log/ppp0.log diff --git a/sysconfig/interfaces/ifcfg-ppp0.leased2 b/sysconfig/interfaces/ifcfg-ppp0.leased2 new file mode 100644 index 0000000..105cae3 --- /dev/null +++ b/sysconfig/interfaces/ifcfg-ppp0.leased2 @@ -0,0 +1,29 @@ +# (c) 1999 Grzegorz Stanislawski +# config file for setting up hardwired (leased) serial line. +# This config assumes "transparent" modem (in ex. goramo), null modem +# cable or current loop. +# Advantage is smaller logfiles and slower 'pid spinning' (no chat is +# executed) +# You can configure Your AT Hayes compatibile modem to transparent mode +# using ATS0=0&L1&S5&W on master "calling" side and ATS0=1&L1&S5&W on +# slave "reciving" side +# Note: After commiting last &W You won't be able to talk to Your modem +# until You reset it to factory defaults using some jumper. +# if You don't have any jumper YOU HAVE BEEN WARNED. +# +DEVICE=ppp0 +ONBOOT=yes +IPADDR=192.168.255.254/30 +REMIP=192.168.255.253 +HARDFLOWCTL=yes +MODEMPORT=/dev/ttyS1 +LINESPEED=115200 +DEBUG=no +PERSIST=yes +HOLDOFF=10 +#demand option not finished yet ;-( +DEMAND=no +#ACTIVEFILTER= +#IDLE= + +REPORTFILE=/var/log/ppp0.log diff --git a/sysconfig/interfaces/ifcfg-ppp0.pppoe b/sysconfig/interfaces/ifcfg-ppp0.pppoe new file mode 100644 index 0000000..94e4d9f --- /dev/null +++ b/sysconfig/interfaces/ifcfg-ppp0.pppoe @@ -0,0 +1,29 @@ +# name of the device +DEVICE=ppp0 + +# add the password in /etc/ppp/chap-secrets +PAPNAME=adslusername + +AUTH=no +IPV6_PPP=no +PPPOE_DEV=eth1 +PPPOE_KERNEL=yes +#PPPOE_OPTS="persist" +HARDFLOWCTL=yes +DEBUG=no +PERSIST=no +HOLDOFF=10 +DEMAND=no +DEFROUTE=yes +PEERDNS=yes + +# you may select which of the above addresses +# is primary for this interface (it'd be IPADDR1 in the example below) +#IP4_PRIM_IF="1" + +# activate on boot? yes|no +# you must set it to 'yes' if you want to have this up after bootup +ONBOOT=yes + +# dhcp|pump|none +BOOTPROTO=none diff --git a/sysconfig/interfaces/ifcfg-ppp0.speedtouch-neostrada b/sysconfig/interfaces/ifcfg-ppp0.speedtouch-neostrada new file mode 100644 index 0000000..77f1258 --- /dev/null +++ b/sysconfig/interfaces/ifcfg-ppp0.speedtouch-neostrada @@ -0,0 +1,24 @@ +# +DEVICE=ppp0 +ONBOOT=yes +PPPOA_SPEEDTOUCH=yes +PPPOA_KERNEL=yes +PPPOA_VPI=0 +PPPOA_VCI=35 + +# If using kernel mode, make sure /lib/firmware/speedtch-{1,2}.bin exists +# and don't define this variable. +# Preferably, build speedtouch-firmware from CVS. +#PPPOA_FIRMWARE="/usr/share/speedtouch/mgmt.o" + +AUTH=no +#MTU=1452 +PERSIST=yes +DEFROUTE=yes +USEPEERDNS=yes +#PAPNAME="rejestracja@neostrada.pl" +PAPNAME="XXX@neostrada.pl" +# put password in /etc/ppp/pap-secrets or install +# ppp-plugin-ifcfg-password and uncommend following lines +# PLUGIN_IFCFG_PASSWORD=yes +# PASSWORD="YYYY" diff --git a/sysconfig/interfaces/ifcfg-ppp0.tpsa b/sysconfig/interfaces/ifcfg-ppp0.tpsa new file mode 100644 index 0000000..a2b02f3 --- /dev/null +++ b/sysconfig/interfaces/ifcfg-ppp0.tpsa @@ -0,0 +1,23 @@ +# +DEVICE=ppp0 +CHATSCRIPT=/etc/sysconfig/interfaces/data/chat-ppp0.tpsa +ONBOOT=no +HARDFLOWCTL=yes +MODEMPORT=/dev/ttyS1 +LINESPEED=115200 +AUTH=no +QDISC="sfq quantum 1500b perturb 5" +DEBUG=yes +PERSIST=no +HOLDOFF=10 +#demand option not finished yet ;-( +DEMAND=no +#ACTIVEFILTER= +#IDLE= +PHONE=0w202122 +USER=ppp +PASSWORD=ppp +INITSTRING=ATe0s2=255 +DATAFORCHAT="USER PASSWORD INITSTRING PHONE" + +REPORTFILE=/var/log/ppp0.log diff --git a/sysconfig/interfaces/ifcfg-ppp0.ueagle-neostrada b/sysconfig/interfaces/ifcfg-ppp0.ueagle-neostrada new file mode 100644 index 0000000..d875e64 --- /dev/null +++ b/sysconfig/interfaces/ifcfg-ppp0.ueagle-neostrada @@ -0,0 +1,17 @@ +# +DEVICE="ppp0" +PERSIST="yes" +USER="XXXXXXXXXXXXXX@neostrada.pl" +ONBOOT="no" + +PERSIST=yes +DEFROUTE=yes +USEPEERDNS=yes +AUTH=no +MTU=1452 +DEBUG=yes +MAXFAIL=0 + +PPPOA=yes +PPPOA_VPI=0 +PPPOA_VCI=35 diff --git a/sysconfig/interfaces/ifcfg-ppp0.ueagle4-neostrada b/sysconfig/interfaces/ifcfg-ppp0.ueagle4-neostrada new file mode 100644 index 0000000..ac8f64b --- /dev/null +++ b/sysconfig/interfaces/ifcfg-ppp0.ueagle4-neostrada @@ -0,0 +1,24 @@ +# +DEVICE="ppp0" +ONBOOT="no" + +PAPNAME="xxxxxxx@neostrada.pl" + +HARDFLOWCTL=no +DEFROUTE=yes +USEPEERDNS=yes +AUTH=no +#MTU=1452 +SYNC=yes + +PPPOA=yes +PPPOA_VPI=0 +PPPOA_VCI=35 + +PERSIST=yes +MAXFAIL=0 +HOLDOFF=4 + +PPPOPTIONS="noipdefault noaccomp nopcomp noccp" + +DEBUG=yes diff --git a/sysconfig/interfaces/ifcfg-sl0 b/sysconfig/interfaces/ifcfg-sl0 new file mode 100644 index 0000000..673ab0e --- /dev/null +++ b/sysconfig/interfaces/ifcfg-sl0 @@ -0,0 +1,12 @@ +# +DEVICE=sl0 +IPADDR=195.164.211.2 +ONBOOT=yes +MODEMPORT=/dev/ttyS0 +LINESPEED=57600 +REMIP=194.181.19.1 +MTU=296 +PROTOCOL=slip +# say no for dip && modem connection +# say yes for direct connection to for example router via slattach +DIRECT_CONNECT=yes diff --git a/sysconfig/interfaces/tnlcfg-description b/sysconfig/interfaces/tnlcfg-description new file mode 100644 index 0000000..0aec5cb --- /dev/null +++ b/sysconfig/interfaces/tnlcfg-description @@ -0,0 +1,41 @@ +# +# In this file you can also put all configuration data instead +# of using second file named ifcfg-tunnel_name. + +MODE={ipip|gre|sit|ipxip} +ONBOOT=yes|no +DEVICE= +if MODE=ipxip ; then + ? +elif MODE=ipip || MODE=gre || MODE=sit ; then + + REMOTEADDR= + [ LOCALADDR= ] + [ BIND_DEV= ] do jakiego device przybindować (ma związek z routingiem itp) + + [ TTL= ] + [ TOS= ] + [ PMTUDISC={no|yes} ] + + if MODE=gre ; then + + [ KEY= ] + [ IKEY= ] + [ OKEY= ] + [ ISEQ={no|yes} ] + [ ISEQ={no|yes} ] + [ OSEQ={no|yes} ] + [ CSUM={no|yes} ] + [ ICSUM={no|yes} ] + [ OCSUM={no|yes} ] + fi + +else MODE=four ; then + + REMOTEADDR= + LOCALADDR= + + [ PRIORITY= ] + [ HOPLIMIT= ] + [ ENCAPLIMIT= ] +fi diff --git a/sysconfig/interfaces/tnlcfg-icm b/sysconfig/interfaces/tnlcfg-icm new file mode 100644 index 0000000..21e429f --- /dev/null +++ b/sysconfig/interfaces/tnlcfg-icm @@ -0,0 +1,20 @@ +MODE=sit +DEVICE=icm +REMOTEADDR=193.219.28.246 +LOCALADDR=156.17.210.110 +IPADDR1="3ffe:8010:70::2/126" +IP6_PRIM_IF=1 +BIND_DEV=eth0 +TTL=64 +ONBOOT=yes +#TOS= +#SEQ={no|yes} ] +#ISEQ={no|yes} ] +#OSEQ={no|yes} ] +#KEY= ] +#IKEY= ] +#OKEY= ] +#CSUM={no|yes} ] +#ICSUM={no|yes} ] +#OCSUM={no|yes} ] +#PMTUDISC={no|yes} ] diff --git a/sysconfig/interfaces/up.d/Makefile.am b/sysconfig/interfaces/up.d/Makefile.am new file mode 100644 index 0000000..cd1f744 --- /dev/null +++ b/sysconfig/interfaces/up.d/Makefile.am @@ -0,0 +1,4 @@ +@SET_MAKE@ + +SUBDIRS = all ip ipx ppp tnl + diff --git a/sysconfig/interfaces/up.d/all/Makefile.am b/sysconfig/interfaces/up.d/all/Makefile.am new file mode 100644 index 0000000..3bd6864 --- /dev/null +++ b/sysconfig/interfaces/up.d/all/Makefile.am @@ -0,0 +1,8 @@ +@SET_MAKE@ + +allupdir = @updir@/all + +allup_SCRIPTS = +noinst_SCRIPTS = thetouch + +EXTRA_DIST = $(allup_SCRIPTS) $(noinst_SCRIPTS) diff --git a/sysconfig/interfaces/up.d/all/thetouch b/sysconfig/interfaces/up.d/all/thetouch new file mode 100755 index 0000000..4036c67 --- /dev/null +++ b/sysconfig/interfaces/up.d/all/thetouch @@ -0,0 +1,5 @@ +#! /bin/sh +# This script will run every time some interface will go up +# using ifup or ifdown. +# + diff --git a/sysconfig/interfaces/up.d/ip/Makefile.am b/sysconfig/interfaces/up.d/ip/Makefile.am new file mode 100644 index 0000000..aae2158 --- /dev/null +++ b/sysconfig/interfaces/up.d/ip/Makefile.am @@ -0,0 +1,7 @@ +@SET_MAKE@ + +ipupdir = @updir@/ip + +ipup_SCRIPTS = + +EXTRA_DIST = $(ipup_SCRIPTS) diff --git a/sysconfig/interfaces/up.d/ipx/Makefile.am b/sysconfig/interfaces/up.d/ipx/Makefile.am new file mode 100644 index 0000000..d286c2b --- /dev/null +++ b/sysconfig/interfaces/up.d/ipx/Makefile.am @@ -0,0 +1,7 @@ +@SET_MAKE@ + +ipxupdir = @updir@/ipx + +ipxup_SCRIPTS = + +EXTRA_DIST = $(ipxup_SCRIPTS) diff --git a/sysconfig/interfaces/up.d/ppp/Makefile.am b/sysconfig/interfaces/up.d/ppp/Makefile.am new file mode 100644 index 0000000..18f3b25 --- /dev/null +++ b/sysconfig/interfaces/up.d/ppp/Makefile.am @@ -0,0 +1,7 @@ +@SET_MAKE@ + +pppupdir = @updir@/ppp + +pppup_SCRIPTS = logger + +EXTRA_DIST = $(pppup_SCRIPTS) diff --git a/sysconfig/interfaces/up.d/ppp/logger b/sysconfig/interfaces/up.d/ppp/logger new file mode 100644 index 0000000..4a36a22 --- /dev/null +++ b/sysconfig/interfaces/up.d/ppp/logger @@ -0,0 +1,5 @@ +#!/bin/sh +# You can put here anything :) +# +echo "+---------------------------------------------------------------+" >> /var/log/ppp.log +echo " Connect time: $(date) with $PPP_REMOTE " >> /var/log/ppp.log diff --git a/sysconfig/interfaces/up.d/tnl/Makefile.am b/sysconfig/interfaces/up.d/tnl/Makefile.am new file mode 100644 index 0000000..ffbe34f --- /dev/null +++ b/sysconfig/interfaces/up.d/tnl/Makefile.am @@ -0,0 +1,7 @@ +@SET_MAKE@ + +tnlupdir = @updir@/tnl + +tnlup_SCRIPTS = + +EXTRA_DIST = $(tnlup_SCRIPTS) diff --git a/sysconfig/network b/sysconfig/network new file mode 100644 index 0000000..e71987a --- /dev/null +++ b/sysconfig/network @@ -0,0 +1,68 @@ +###################################################################### +# MAIN PART + +# Do you need IPv4 or IPv6 networking ? +NETWORKING=yes + +# Do you need IPv4 networking ? +IPV4_NETWORKING=yes + +# Do you want IPv4 forwarding ? +# then set it in /etc/sysctl.conf + +# Set hostname here +HOSTNAME=pldmachine + +# Allow udev to create /etc/sysconfig/interfaces/ifcfg-* automatically? +# See /lib/udev/net_helper for details. +AUTOMATIC_IFCFG=no + +# Set NIS domain name here if you use NIS +# Note: DNS domain name should be set in /etc/hosts or DNS/NIS service, not here +NISDOMAIN= + +# Traditional setup of gateway. This is obsolete, consider using static-routes +# instead. However this is really enough for most users. +GATEWAY= +GATEWAYDEV= + +# Do you want to use IPX networking ? +IPX=no +IPXAUTOPRIMARY= +IPXAUTOFRAME= +IPXINTERNALNETNUM= +IPXINTERNALNODENUM= + +# Do you need IPv6 networking ? +IPV6_NETWORKING=yes + +# Do you want IPv6 forwarding ? +# then set it in /etc/sysctl.conf + +# Enable tunnel interfaces configuration ? +IPV6_TUNNELCONFIG=yes + +# Global route for IPv6 host with IPv6 forwarding +IPV6_GLOBALROUTEGW= +IPV6_GLOBALROUTEDEV= + +# Other + +# Do you want set static ARP table (based on /etc/ethers config file) ? +STATIC_ARP=no + +# Do you want set static RARP table (based on /etc/ethers config file) ? +STATIC_RARP=no + +# Specify interface on which you want to enable tleds software +# (also you need tleds package installed) -- default set to no +TLEDS_DEV=no + +# enable globally for all network interfaces. +# bring up from hotplug (udev for example) (default to no) +#HOTPLUG=yes + +# set up Zeroconf routes for communication via/with IPv4ALL link-local +# addresses +ZEROCONF=yes + diff --git a/sysconfig/static-arp b/sysconfig/static-arp new file mode 100644 index 0000000..64d5b60 --- /dev/null +++ b/sysconfig/static-arp @@ -0,0 +1,3 @@ +# dev mac ip state opts +# eth0 00:80:48:12:c2:3c 192.168.10.10 permanent +#eth1 00:80:48:12:c2:44 12.12.12.12 permanent diff --git a/sysconfig/static-nat b/sysconfig/static-nat new file mode 100644 index 0000000..1365fbb --- /dev/null +++ b/sysconfig/static-nat @@ -0,0 +1,3 @@ +# [/] via +# 192.168.1.1 via 1.1.1.1 +# 192.168.2.1/24 via 1.1.1.1 diff --git a/sysconfig/static-routes b/sysconfig/static-routes new file mode 100644 index 0000000..61b35d3 --- /dev/null +++ b/sysconfig/static-routes @@ -0,0 +1,12 @@ +# Entry format for ip rule: +# +# Entry format for static route: +# / +# +# Combined example: + +#from 192.168.2.0/24 table 10 +#eth0 default via 192.168.2.1 table 10 +# +# route 10.12.0.34 via 192.168.2.3 via any interface +#any 10.12.0.34 via 192.168.2.3 diff --git a/sysconfig/static-routes6 b/sysconfig/static-routes6 new file mode 100644 index 0000000..3c1a7ca --- /dev/null +++ b/sysconfig/static-routes6 @@ -0,0 +1,14 @@ +# IPv6 specific rules and routes + +# Entry format for ip rule: +# +# Entry format for static route: +# / +# +# Combined example: + +#from fec0:2::/32 table 10 +#eth0 default via fec0:2::1 table 10 +# +# route fec0:12::34 via fec0:2::3 via any interface +#any fec0:12::34 via fec0:2::3 diff --git a/sysconfig/system b/sysconfig/system new file mode 100644 index 0000000..0734c41 --- /dev/null +++ b/sysconfig/system @@ -0,0 +1,137 @@ + +# Do you want colorized starting scripts ? +COLOR_INIT=yes + +# Print status at which column +#INIT_COL=67 + +# Do you want fast boot? (without NLS, excessive logging and fancy +# terminals support) +FASTRC=no + +# Messages with a higher priority than this will be printed +# to the console (default 1) +CONSOLE_LOGLEVEL=1 + +# On errors (when system is starting) run sulogin instead of shell ? +RUN_SULOGIN_ON_ERR=yes + +# Default run nice level for all services if $SERVICE_RUN_NICE_LEVEL is not +# defined in /etc/sysconfig/. +DEFAULT_SERVICE_RUN_NICE_LEVEL=+0 + +# Default limits set before running daemons (hard and soft) if +# $SERVICE_LIMITS are not defined in /etc/sysconfig/ +# +# Use "-u" for process limits (automatically translated to "-p" for ksh). +# Use "-Sx" or "-Hx" to set only soft or hard "x" limit. +# +# Advised limits are: +# "-u unlimited" to make sure daemons will be able to fork; +# "-c 0" to make sure it doesn't core dump anywhere; while this could mask +# problems with the daemon, it also closes some security problems; +# users' limits are set via pam_limits. +DEFAULT_SERVICE_LIMITS="-u unlimited -c 0" + +# Default umask for all services if $SERVICE_UMASK is not defined in +# /etc/sysconfig/. +DEFAULT_SERVICE_UMASK=022 + +# Setup PNP using userspace tools? +RUN_USERPNP=no +# Setup kernel space PNP (2.4.x) +RUN_KERNELPNP=no + +# Do not allow users to login when system is starting +# (but allow when it end "starting" process) ? +DELAY_LOGIN=yes + +# Clean /tmp at startup ? +CLEAN_TMP=yes + +# Try to setup proper symlinks in /boot (based on kernel version) ? +SET_SLINKS=yes + +# Run depmod at startup ? +# Values: +# yes/no - as usually +# ifmissing - if modules.dep is missing +RUN_DEPMOD=ifmissing + +# Run /sbin/ldconfig at startup ? +RUN_LDCONFIG=no + +# Start udev (udev-core required)? +START_UDEV=yes + +# EVMS/LVM options +# Extensible Firmware Interface GUID Partition Table segment manager +EVMS_GUID_PTABLE=no + +# Use EVMS for Linux LVM volumes +EVMS_LVM=no + +# Create symlinks for LVM volumes (/dev/evms/lvm/* -> /dev/*) +EVMS_LVM_COMPAT_NODES=yes + +# EVMS AIX LVM volumes +EVMS_AIX=no + +# EVMS OS/2 LVM volumes +EVMS_OS2=no + +# Set to 'yes' to allow probing for devices with swap signatures +AUTOSWAP=no + +# LVM2 +# disable if your only LVM volume is rootfs started on initrd and want faster startup +LVM2=yes + +# DMRAID +# disable if do not want DMRAID being initalized by rc.sysinit +DMRAID=yes + +# mdadm +# disable if do not want mdadm being initalized by rc.sysinit +MDADM=yes + +# Disable dm-multipath and friends here if you plan to use +# non standard drivers (ex. DELL MPP RDAC driver) +DM_MULTIPATH=yes + +# Set to anything other than 'no' to allow hotkey interactive startup... +RC_PROMPT=yes + +# List of chroots separated by space (to handle processes inside/outside +# chroot properly) +#SYSTEM_CHROOTS= + +# List (space separated) of special mount points that must not be unmounted +# on system shutdown. +# May contain regular expressions (eg. "/dev/rootunion/.*") +#UMOUNT_IGNORE= + +# Enable cpusets support? +CPUSETS=no + +# Enable this system as vserver guest (yes/no/detect) +VSERVER=detect + +# Vserver isolation only networking inside of guest (yes/no/detect) +VSERVER_ISOLATION_NET=detect + +# Enable selinux support (yes/no/detect) +# 'yes' behaves as 'detect' +SELINUX=detect + +# Enable HWPROFILES support? +HWPROFILES=no + +# Enable syslogging for rc-scripts +RC_LOGGING=yes + +# Include machine uptime counter in all show messages +RC_UPTIME=no + +# Disable console logging by blogd +RC_BOOTLOG=yes diff --git a/sysctl.conf b/sysctl.conf new file mode 100644 index 0000000..d918cd5 --- /dev/null +++ b/sysctl.conf @@ -0,0 +1,210 @@ +### IPV4 NETWORKING + +# Disables IPv4 packet forwarding +net.ipv4.ip_forward = 0 + +# Enables source route verification +net.ipv4.conf.all.rp_filter = 1 +net.ipv4.conf.default.rp_filter = 1 + +# Accept ICMP redirect messages (suggested 1 for hosts and 0 for routers) +# net.ipv4.conf.all.accept_redirects = 1 + +# Accept source routed packages (suggested 0 for hosts and 1 for routers) +# net.ipv4.conf.all.accept_source_route = 1 + +# Log packets with source addresses with no known route to kernel log +# net.ipv4.conf.all.log_martians = 1 + +# Do multicast routing ? The kernel needs to be compiled with +# CONFIG_MROUTE and a multicast routing daemon is required. +# net.ipv4.conf.all.mc_forwarding = 1 + +# If you get message "Neighbour table overflow" try to play with this values. +# Needed in huge networks. These example values are sufficent in networks with +# mask 21. +# net.ipv4.neigh.default.gc_thresh3 = 4096 +# net.ipv4.neigh.default.gc_thresh2 = 2048 +# net.ipv4.neigh.default.gc_thresh1 = 512 +# net.ipv6.neigh.default.gc_thresh3 = 1024 +# net.ipv6.neigh.default.gc_thresh2 = 512 +# net.ipv6.neigh.default.gc_thresh1 = 128 + +# Do proxy ARP ? +# net.ipv4.conf.all.proxy_arp = 1 + +# Accept ICMP redirect messages only for gateways, listed in +# default gateway list ? +# net.ipv4.conf.all.secure_redirects = 1 + +# Send ICMP redirects to other hosts ? +# net.ipv4.conf.all.send_redirects = 1 + +# Ignore all ICMP echo requests ? +# net.ipv4.icmp_echo_ignore_all = 1 + +# Ignore ICMP echo requests to broadcast and multicast addresses ? +# net.ipv4.icmp_echo_ignore_broadcasts = 1 + +# Enable MTU discovery patch ? (KERNEL MUST SUPPORT THIS) +# MTU (maximal transfer unit) is the size of the chunks we send out +# over the net. "Path MTU Discovery" means that, instead of always +# sending very small chunks, we start out sending big ones and if we +# then discover that some host along the way likes its chunks smaller, +# we adjust to a smaller size. +# net.ipv4.ip_no_pmtu_disc = 1 + +# Enable debugging of IP masquerading ? +# net.ipv4.ip_masq_debug = 1 + +# Bug-to-bug compatibility with some broken printers. On retransmit +# try to send bigger packets to work around bugs in certain TCP +# stacks. Can be turned off by setting IPV4_RETRANS_COLLAPSE to ,,yes''. +# net.ipv4.tcp_retrans_collapse = 1 + +# Disable select acknowledgments after RFC2018 ? +# TCP may experience poor performance when multiple packets are lost +# from one window of data. With the limited information available +# from cumulative acknowledgments, a TCP sender can only learn about a +# single lost packet per round trip time. An aggressive sender could +# choose to retransmit packets early, but such retransmitted segments +# may have already been successfully received. +# net.ipv4.tcp_sack = 0 + +# Disable timestamps as defined in RFC1323 ? +# Timestamps are designed to provide compatible interworking with +# TCP's that do not implement the TCP Extensions for High Performance +# net.ipv4.tcp_timestamps = 0 + +# Enable the strict RFC793 interpretation of the TCP urgent pointer field. +# net.ipv4.tcp_stdurg = 1 + +# Enable tcp_syncookies +# net.ipv4.tcp_syncookies = 1 + +# Disable window scaling as defined in RFC1323 ? +# The window scale extension expands the definition of the TCP +# window to 32 bits and then uses a scale factor to carry this +# 32-bit value in the 16-bit Window field of the TCP header. +# net.ipv4.tcp_window_scaling = 0 + +# Enable dynamic socket address rewriting on interface address change. +# This is useful for dialup interface with changing IP addresses. +# sys.net.ipv4.ip_dynaddr = 7 + +# Range of ports used by TCP and UDP to choose the local +# port. Contains two numbers, the first number is the lowest port, +# the second number the highest local port. Default is "1024 4999". +# Should be changed to "32768 61000" for high-usage systems. +# net.ipv4.ip_local_port_range = 4096 61000 + +# Disables automatic defragmentation (needed for masquerading, LVS) +# Non existant on Linux 2.4 +# net.ipv4.ip_always_defrag = 0 + +### IPV6 NETWORKING + +# Disables IPv6 packet forwarding +# net.ipv6.conf.all.forwarding = 0 + +# Do you want IPv6 address autoconfiguration? Kernel default is yes. +# net.ipv6.conf.all.autoconf = 0 +# net.ipv6.conf.default.autoconf = 0 + +# Do you want kernel to add default route for IPv6 interfaces if +# there is no router on the link? Kernel default is yes. +# Kernel 2.4.0-test? or later (after ANK accepts my patch - baggins). +# net.ipv6.conf.all.autoconf_route = 0 + +### OTHER SETTINGS + +# Adjust number of inodes and file handles available in the system. +# If you have a havily loaded system and kernel complains about +# file/inode limit reached in VFS, increase this 2x. The default +# value is 4096 (file) and 8192 (inode). The inode number should be +# always 2-3 times the file number. For most systems this should not +# be changed +# fs.file-max = 8192 +# fs.inode-max = 16384 + +# Controls whether core dumps will append the PID to the core filename. +# Useful for debugging multi-threaded applications. +#kernel.core_uses_pid = 1 + +# Enable the magic-sysrq key +kernel.sysrq = 1 + +# After how many seconds reboot system after kernel panic? +# 0 - never reboot system (suggested 60) +#kernel.panic = 60 + +# +# GRSECURITY http://www.grsecurity.org +# +# WARNING! +# These values are SET ONCE! +# +#kernel.grsecurity.linking_restrictions = 1 +#kernel.grsecurity.fifo_restrictions = 1 +#kernel.grsecurity.destroy_unused_shm = 0 +#kernel.grsecurity.chroot_caps = 0 +#kernel.grsecurity.chroot_deny_chmod = 0 +#kernel.grsecurity.chroot_deny_chroot = 1 +#kernel.grsecurity.chroot_deny_fchdir = 0 +#kernel.grsecurity.chroot_deny_mknod = 1 +#kernel.grsecurity.chroot_deny_mount = 1 +#kernel.grsecurity.chroot_deny_pivot = 1 +#kernel.grsecurity.chroot_deny_shmat = 0 +#kernel.grsecurity.chroot_deny_sysctl = 1 +#kernel.grsecurity.chroot_deny_unix = 0 +#kernel.grsecurity.chroot_enforce_chdir = 0 +#kernel.grsecurity.chroot_execlog = 0 +#kernel.grsecurity.chroot_findtask = 1 +#kernel.grsecurity.chroot_restrict_nice = 0 + +#kernel.grsecurity.exec_logging = 0 +#kernel.grsecurity.signal_logging = 1 +#kernel.grsecurity.forkfail_logging = 0 +#kernel.grsecurity.timechange_logging = 1 +#kernel.grsecurity.audit_chdir = 0 +#kernel.grsecurity.audit_gid = 65505 +#kernel.grsecurity.audit_group = 0 +#kernel.grsecurity.audit_ipc = 0 +#kernel.grsecurity.audit_mount = 0 + +#kernel.grsecurity.execve_limiting = 1 +#kernel.grsecurity.dmesg = 1 +#kernel.grsecurity.tpe = 1 +#kernel.grsecurity.tpe_gid = 65500 +#kernel.grsecurity.tpe_glibc = 0 +#kernel.grsecurity.tpe_restrict_all = 0 + +#kernel.grsecurity.rand_pids = 1 +#kernel.grsecurity.socket_all = 1 +#kernel.grsecurity.socket_all_gid = 65501 +#kernel.grsecurity.socket_client = 1 +#kernel.grsecurity.socket_client_gid = 65502 +#kernel.grsecurity.socket_server = 1 +#kernel.grsecurity.socket_server_gid = 65503 + +#kernel.grsecurity.disable_modules = 0 +#kernel.grsecurity.grsec_lock = 0 + +# kernel.randomize_va_space = 2 +# 0 - Turn the process address space randomization off by default. +# 1 - Conservative address space randomization makes the addresses of +# mmap base and VDSO page randomized. This, among other things, +# implies that shared libraries will be loaded to random addresses. +# Also for PIE binaries, the location of code start is randomized. +# 2 - This includes all the features that Conservative randomization +# provides. In addition to that, also start of the brk area is randomized. +# There a few legacy applications out there (such as some ancient +# versions of libc.so.5 from 1996) that assume that brk area starts +# just after the end of the code+bss. These applications break when +# start of the brk area is randomized. There are however no known +# non-legacy applications that would be broken this way, so for most +# systems it is safe to choose Full randomization. + +# for mplayer +#dev.rtc.max-user-freq = 1024 +# diff --git a/t/backtick-test.sh b/t/backtick-test.sh new file mode 100755 index 0000000..67d2289 --- /dev/null +++ b/t/backtick-test.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +# from man sh: + +# NOTE: $(command) expressions are currently parsed by finding the matching paren- +# thesis, regardless of quoting. This will hopefully be fixed soon. + +# this script file will finally tell when 'soon' comes + +a=1 + +ret_old=` +case $a in + 0) echo "a=0";; + 1) echo "a=1";; + *) echo "a!=[01]";; +esac +` + +ret_new=$( +case $a in + 0) echo "a=0";; + 1) echo "a=1";; + *) echo "a!=[01]";; +esac +) + +echo "$ret_old vs $ret_new" \ No newline at end of file diff --git a/t/status-pidfile.sh b/t/status-pidfile.sh new file mode 100755 index 0000000..c5c33d9 --- /dev/null +++ b/t/status-pidfile.sh @@ -0,0 +1,39 @@ +#!/bin/sh + +# broken check with --pidfile specified: +# +# $ (. /etc/rc.d/init.d/functions; status --pidfile /var/run/naviagent/agent.pid naviagent) +# naviagent (pid 12788) is running... +# +# $ ls -l /proc/`cat /var/run/naviagent/agent.pid` +# ls: cannot access /proc/12788: No such file or directory + +lib=$(dirname "$0")/.. +tmp=$(mktemp -d) + +# TODO: rc_cache_init should be able to use tmp dir, not real root +. $lib/lib/functions + +# first unused pid +pid=9999999 # may not exist +procname=testd # irrelevant +pidfile=$tmp/agent.pid + +if [ -d /proc/$pid ]; then + echo >&2 "bad pid chosen for test, /proc/$pid exists" + exit 1 +fi + +echo $pid > $pidfile +status --pidfile $pidfile $procname +rc=$? +if [ $rc = 0 ]; then + echo "FAIL: should not say process is running" + rv=1 +else + echo "OK: process is not running" + rv=0 +fi + +rm -rf $tmp +exit $rv -- 2.46.0