summaryrefslogtreecommitdiff
path: root/scripts/functions
AgeCommit message (Collapse)Author
2010-08-25configure_networking(): Look for presence of /tmp/net-*.conf filesVagrant Cascadian
when $DEVICE is not set (which is now default), otherwise ipconfig may receive a valid DHCP response, but fails to break out of the loop and is called repeatedly. thanks to Petter Reinholdtsen, i think i've figured out the initramfs-tools portion of this problem (there may still be outstanding issues with ipconfig). tested the attached patch, which seems to address the issue for me at least. Closes: #584583 Signed-off-by: maximilian attems <max@stro.at>
2010-08-07initramfs-tools: only allow hook scripts to errexit on mkinitramfsmaximilian attems
version is "the" essential exported variable by mkinitramfs. Use it's string length to determine that we are on mkinitramfs stage and not trying to boot a not precached initramfs image. hook scripts on boot can exit due to random failures and shouldn't interrupt boot there. Signed-off-by: maximilian attems <maks@debian.org>
2010-07-06initramfs-tools: output name of script that errexits.maximilian attems
this should make bug reports concerning bogus hook scripts easier to handle, like the *loooong* iscan story. Closes: 586554 Signed-off-by: maximilian attems <maks@debian.org>
2010-06-22mkinitramfs: set nounset and errexitmaximilian attems
Better catch both early than stupid mistakes cropping in. Signed-off-by: maximilian attems <maks@debian.org>
2010-06-18fix typos in manpage, scripts/functions and conf/initramfs.conf - thanks lintianMichael Prokop
* paramater -> parameter * adress -> address * adress -> address * overriden -> overridden * correponds -> corresponds * correponds -> corresponds * Overriden -> Overridden * usualy -> usually Signed-off-by: Michael Prokop <mika@debian.org>
2010-06-17scripts/functions: fix another sh -n usage and fix typoMichael Prokop
Signed-off-by: Michael Prokop <mika@debian.org>
2010-06-17scripts/functions: fix usage of test for script executionMichael Prokop
Signed-off-by: Michael Prokop <mika@debian.org>
2010-06-17scripts/functions: beautify a bit reduce_satisfied()maximilian attems
shorten code, no code change. function easier to read. Signed-off-by: maximilian attems <maks@debian.org>
2010-06-17mkinitramfs: check syntax of boot and hook scriptsmaximilian attems
only run them when sytax is good. Idea from LP: #570243. important now that we have errexit on for them. Signed-off-by: maximilian attems <maks@debian.org>
2010-06-17scripts/functions: On panic change to tty1 if chvt aroundmaximilian attems
To make sure the user can read any error messages displayed. (LP: #243226) usplash and other may cause the user to land somewhere, where nothing is displayed. merge from Ubuntu with adding conditional chvt invocation, as it may not be around. Thanks: Luke Yelavich <themuso@ubuntu.com> Thanks: Colin Watson <cjwatson@ubuntu.com> Signed-off-by: maximilian attems <maks@debian.org>
2010-06-16get_fstype: reference blkid in commentmaximilian attems
the removal of vol_id compat code as requested in #585419 is to early as we need it for Lenny upgrades. Nevertheless have the comment point to the newer tool. :) Thanks: Christoph Anton Mitterer <calestyo@scientia.net> Signed-off-by: maximilian attems <maks@debian.org>
2010-06-16scripts/functions: allow hooks to abort buildMichael Prokop
Execute call_scripts() under "set -e" so hook scripts can exit initrd build iff necessary. Closes: #396388 Signed-off-by: Michael Prokop <mika@debian.org>
2010-06-14code cleanup: drop trailing whitespaces.Michael Prokop
Signed-off-by: Michael Prokop <mika@debian.org>
2010-06-08Support dashes inside scripts names.Michael Prokop
[Closes: #566056] Signed-off-by: Michael Prokop <mika@debian.org>
2010-04-10configure_networking(): work with empty DEVICE stringmaximilian attems
initramfs-tools currently requires a device to be hard-coded, but this is not much use if the network device is not known ahead of time. If the device specified in either /etc/initramfs-tools/initramfs.conf or on the ip=xxx kernel command line. usefull for multiple net devices. Based on patch by Tim Small <tim@seoss.co.uk> Closes: #566295, #575766 Reviewed-by: Vagrant Cascadian <vagrant@freegeek.org> Signed-off-by: maximilian attems <maks@debian.org>
2010-04-10configure_networking: pxelinux BOOTIF fixesVagrant Cascadian
looks like i missed a few things on implementing BOOTIF support properly. somehow i managed to get the order of the mac address backwards. i know i tested it many times.. Signed-off-by: maximilian attems <maks@debian.org>
2010-04-07mkinitramfs: Fix several unbound variablesmaximilian attems
might not be all, but a first go in stricter mkinitramfs. as bonus remove old amusing unused varialbe from day 2.. Signed-off-by: maximilian attems <maks@debian.org>
2010-04-05mkinitramfs: generate pre-cached boot order fileScott James Remnant
if tsort is available, use it instead of custom sorting code if a pre-cached order file is available, use that instead [ move cache_run_scripts from scripts/functions to hook-scripts as only used on mkinitramfs build and not on boot ] Signed-off-by: maximilian attems <maks@debian.org>
2010-04-04scripts/functions: add get_fstype() from scripts/localmaximilian attems
allows wider usage. (closes: #487409) Reported-by: Christoph Anton Mitterer <calestyo@scientia.net> Signed-off-by: maximilian attems <maks@debian.org>
2010-03-26panic: quote variablemaximilian attems
Reported-by: Loïc Grenié <loic.grenie@gmail.com> Signed-off-by: maximilian attems <maks@debian.org>
2010-03-25configure_networking: Try repeatedly ipconfig with increasing timeoutAnna Jonna Armannsdottir
Here is a bug description and a patch. Please consider it. The patch solves a an LTSP client problem that arises when the clients are connected to Cisco switches that have spanning-tree calculations enabled. Also related to: http://git.debian.org/?p=kernel/initramfs-tools.git;a=commitdiff;h=9c3ec61b1a5e2feaa8d9c6de737eaa00eb446a9c And http://git.debian.org/?p=kernel/initramfs-tools.git;a=commitdiff;h=115134f07a0dd042355a2a6fb5a5ca987b000f5d Here in an extensive explaination: https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/181258 Also in the following: I can report the same problem. A number of diskless clients go flawlessly through a PXE boot, then the net interface is brought down when the Linux kernel boots and suddenly, dhcp does not work anymore. Background research on the network: The clients are connected to Cisco switches. The configuration of the switches makes them run spanning-tree calculations. This usually takes some seconds but for large networks it can take up to 30 40 seconds. The network port on the switch is turned on, when this calculation has been finished. This is primarily a security measure. See also: http://networkers-online.com/blog/2008/08/what-is-bpdu-filter/ If this security measure is turned off, the client boots without problems. :) To debug the problem, the following boot line was used: kernel amd64/vmlinuz append ro initrd=amd64/initrd.img nbdport=2000 debug=100 break=1 ip=dhcp In my case, this causes a timeout as can be seen on the attached screenshots. The kernel loads the NIC module e1000e and reports the type of NIC et.c. The kernel time reported is 5.927 . The debug shows the following: configure_networking [ -n eth0 ] [-e /tmp/net-eth0.conf ] ipconfig -t 60 eth0 At about 6.4 in kernel time, the NIC module reports further about it's IRQ configuration. Two seconds (2 sec) later at about 8.56 the NIC module reports that the Link is up at 100 Mbps full duplex. Some milliseconds later it signals ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready . At this point in time, ipconfig is just waiting for an answer to the DHCP-discover that really was choked by the switch. Now this is an obvious flaw in the script. It would be much more reasonable to try repeatedly with increasing timouts. This would also be much more efficent. may I suggest the following timeouts: 4 8 16 30 60 The sum of this timeout is about 120 seconds. I did some testing with exponential timeout with 1 2 4 8 16 30 ... and it solved the problem, but it seems that ipconfig runs once additionally after it has actually done the job. I am running tests now with an exponent of n/1.5 instead of n. That would give a sequence of (ca) 2 3 4 6 9 16 25 36 64 100 Attached are a jpeg screenshot of the boot sequence and of course the patch. The patch is relative to the present git snapshot. -- Kindest Regards, Anna Jonna Ármannsdóttir, %& A: Because people read from top to bottom. Unix System Aministration, Computing Services, %& Q: Why is top posting bad? University of Iceland. Signed-off-by: maximilian attems <maks@debian.org>
2010-02-24configure_networking: support BOOTIF variable set by pxelinuxVagrant Cascadian
updated patch against current master, using only shell, and with a cleaner method to convert BOOTF to a typical mac address. (closes: #567540) Signed-off-by: maximilian attems <maks@debian.org>
2010-02-22initramfs-tools: make the panic argument available in the rescue shellFerenc Wagner
Sometimes one misses the error message printed by the panic helper function, for example when attaching a serial console after the fact, or if kernel messages resulting from udev activity obscure or scroll it away. Please consider adding some facility like the attached patch. Thanks, Feri. (closes: #569033) Signed-off-by: maximilian attems <maks@debian.org>
2009-04-03cleanup LABEL handling codemaximilian attems
make it more concise: * use POSIX ${parameter:+word} * replace *[/]*) by just */*) * test exit code of command -v rather then running test -x on it while we are at it fix another command -v usage in scripts/functions. Reviewed-by: Colin Watson <cjwatson@ubuntu.com> Signed-off-by: maximilian attems <maks@debian.org>
2009-04-02mkinitramfs: Allow dots in boot and script filenames.maximilian attems
the regex was overly severe not allowing dots althoug they are useful as word ending. based on a patch in launchpad, that didn't get all occurences right, but was a good start. (LP: #305837)
2009-02-23init: export ip root param for configure_networking()maximilian attems
while at it cleanup the variable name that came due to legacy naming nfsopts in a very early initramfs-tools release. "The local-top/iscsi initramfs integration script uses the configure_networking function, which depends on the IPOPTS environmental variable set by the init script. However, this variable is not available, because it's not exported from init, and local-top/iscsi is not sourced but executed. Thus static IP configuration on the kernel command line is not communicated to the script." (closes: #516746) Reported-by: Ferenc Wagner <wferi@niif.hu>
2009-01-07configure_networking: Raise ipconfig timeout to 180 seconds.maximilian attems
in 0.92m, the timeout for ipconfig in scripts/functions was set to 60 seconds. This broke our iscsi-rootfs setups. It took me a while to debug this, but it seems that 60 seconds is not enough for switches which have spanning-tree enabled, they need some more time before they take up a port, in our case between 62 and 65 seconds. (closes: #511085)
2008-12-15fix redboot partition supportAndres Salomon
Fix buglet in parse_numeric where *:* would match mtd:root. We only want to match numbers. This fixes redboot partition support. Signed-off-by: Andres Salomon <dilinger@debian.org>
2008-12-15scripts/functions: comment fix path to moved linux-2.6 Documentation.maximilian attems
2008-12-14scripts/functions: fix not set break variablemaximilian attems
thanks martin f krafft <madduck@debian.org> closes: #502058
2008-12-14scripts/functions: Wrong check for udevadm in functionsJulien Danjou
2008-12-14scripts/functions: Call ipconfig with a one-minute timeoutColin Watson
rather than waiting forever (LP: #182940).
2008-09-02Fix parse_numeric() to ignore non hex root string prefixesAndres Salomon
On OLPC machines, root is a nand device that is mounted as mtd0 (it is neither a block device nor a char device). The arguments passed to the kernel are "ro root=mtd0 rootfstype=jffs2". Unfortunately, attempting to use an initrd based upon initramfs-tools on such a machine results in a kernel panic and a syntax error. Begin: Mounting root file system ... /init: line 172: syntax error: 0xmtd0 The probably appears to be in parse_numeric(); the init scripts assume that normal devices are always prefixed with /, and root= strings that aren't are raw device numbers (prefixing them with 0x). I'm not sure if there are other devices similar to mtd that don't begin with a /. How about something like the following patch? It's not foolproof, but it at least ignores things that can't possibly be hex strings. fixes partially #497133
2008-08-15wait_for_udev: s/udevsettle/udevadm/ for upgrades after Lennymaximilian attems
after lenny the symlink of udev is meant to be gone, support partial upgrades from lenny.
2008-08-12make log_begin_msg not emit trailing newlineChris Lamb
Please make log_begin_msg not emit a trailing newline - this makes the non- "quiet" output cleaner and results in half as many lines being emitted. For example: Begin: Finding root filesytem ... Done. Becomes: Begin: Finding root filesytem ... done. Patch attached - it also adds a space and alters the case of "done" for symmetry. This would be especially useful in Debian Live where we show a large number of these messages by default. (closes: #494257)
2008-07-05usplash pulsates: drop code to increment a progress bar after each message.maximilian attems
ubuntu sync
2008-07-05wait_for_udev(): simplify, no need for logging.maximilian attems
add small comment on top, what for we need it. Signed-off-by: maximilian attems <maks@debian.org>
2008-07-03Wait for udevsettle after $BOOT-top scripts ranmartin f. krafft
udev may be busy creating links for the root device by the time mountroot is called. udevsettle makes sure these are processed. I thus call udevsettle with a timeout of 10 seconds after the $BOOT-top scripts have run and before the ROOTDELAY hack kicks in. I thought about doing this with a local-top script instead, but there is no way to ensure that it'll run last; cryptsetup uses a hack to make sure it runs last, if we also use the same hack, there'll be a dependency loop. Signed-off-by: martin f. krafft <madduck@debian.org> Signed-off-by: maximilian attems <maks@debian.org>
2008-04-02configure_networking(): guard against unset "${DEVICE}"maximilian attems
found on testing that configure_networking() shouldn't make assumption that ${DEVICE} is really already set. this still allows to bail out if device is passed and set.
2008-03-31scripts/functions: fix configure_networking() for multiple interfaces.maximilian attems
IPOPTS can be assumed to get passed :::::: and thus configure any possible interface. we have thus also to source the relevant ipconfig output :) based on a patch by Michal Sojka <sojkam1@fel.cvut.cz>: "If I want several computers to boot from the same ramdisk (with NFS root) and some computers have multiple network interfaces, the DEVICE variable can't be set to a specific value (e.g. eth0). Ipconfig from klibc supports a mode, where DHCP request is sent to all interfaces and the one receiving the first DHCP offer is used. This perfectly suits my needs, but it can't be used with initramfs scripts because the interface name in not known in advance and the DEVICE variable is set to something like ::::::."
2008-03-30scripts/function: Use mknod directly.maximilian attems
No need to call chmod later on, now that klibc mknod can set permissions.
2008-02-15configure_network(): do nothing if device already configureddebian@x.ray.net
This patch is part of three patches (initramfs-tools, cryptsetup, dropbear) which enable mkinitramfs to create initramfs that provide the ability to log in and unlock a cryptroot during the boot process from remote via ssh. Calling configure_networking from /scripts/functions might appear more than once, so just try if it hasn't been done/wasn't successful yet. Check that by testing for existence of /tmp/net-$DEVICE.conf which is created by ipconfig.
2007-09-04initramfs-tools: split networking code into separate functionVagrant Cascadian
ltsp in ubuntu started using NBD+unionfs+squashfs instead of NFS, and debian-live uses has a network boot methods using cifs in addition to a different way of using NFS (i think it also uses unionfs and maybe squashfs, not just a plain NFS/cifs mount)... so splitting out the networking related code into a separate function would move towards not having forked code for all of these different network boot methods. at least, that's my hope.
2007-08-15scripts/functions: simplify panic()maximilian attems
sleep can take arg 0
2007-08-08scripts/funtions: run_scripts() on verbose mode add error messagesmaximilian attems
* add the error messages * fix double call to set_initlist * skip empty dirs at start
2007-08-07scripts/functions: style fix for maybe_break()maximilian attems
recover func from previous bogus change..
2007-08-07scripts/functions: Implement non-zero panic boot argmaximilian attems
sleep the passed time and then call reboot. works as arg can only be numeric.
2007-04-16fix regexes to always use posix char classes and release 0.87maximilian attems
needs the -regextype posix-extended switch for find, also it seems 0.86 disgarded uselessly uppercase scripts (they might be distasteful ;)
2007-04-11scripts/functions: fix cicular dep panic due to non-working prereqsmaximilian attems
check prereqs with the same set of checks for valid boot scripts
2007-04-06merge 0.85g security upload:maximilian attems
fixes permissions of created device /dev/root for lilo boots: brw------- 1 root root 8, 1 2007-04-06 09:28 /dev/root note: this is on trunk aka master, need to create etch branch too.