aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files/files/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* base-files: make ucidef_set_led_rssi offset and factor optionalMathias Kresin2017-06-171-2/+2
| | | | | | | | | | The offset and factor are only related for LEDs which can have different brightness values. But binary LEDs are more common and don't require any further configuation than setting the factor to 1. Use offset = 0 and factor = 1 in case nothing else is specified. Signed-off-by: Mathias Kresin <dev@kresin.me>
* base-files: board.json's switch reset means existence, not argumentJonas Gorski2017-06-111-1/+4
| | | | | | | Don't pass the value unconditionally to swconfig as a parameter but instead only call reset if it is 1. Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
* base-files: network.sh: fix a number of IPv6 logic flawsJo-Philipp Wich2017-06-081-17/+48
| | | | | | | | | | | | | | | | | | | | | | * Change network_get_subnet6() to sensibly guess a suitable prefix Attempt to return the first non-linklocal, non-ula range, then attempt to return the first non-linklocal range and finally fall back to the previous behaviour of simply returning the first found item. * Fix network_get_ipaddrs_all() Instead of replicating the flawed logic appending a fixed ":1" suffix to IPv6 addresses, rely on network_get_ipaddrs() and network_get_ipaddrs6() to build a single list of all interface addresses. * Fix network_get_subnets6() Instead of replicating the flawed logic appending a fixed ":1" suffix to IPv6 addresses, rely on the ipv6-prefix-assignment.local-address field to figure out the proper network address. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* base-files: network.sh: properly report local IPv6 addressesJo-Philipp Wich2017-06-081-17/+13
| | | | | | | | | | Rework the network_get_ipaddr6() and network_get_ipaddrs6() functions to fetch the effective local IPv6 address of delegated prefix from the "local-address" field instead of naively hardcoding ":1" as static suffix. Fixes FS#829. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* mvebu: fix sysupgradeMatthias Schiffer2017-06-011-1/+1
| | | | | | | | | | | | | | | | | mvebu was modifying RAMFS_COPY_BIN and RAMFS_COPY_DATA from a sysupgrade_pre_upgrade hook. As the ramfs is created from stage2, this did not have an effect anymore after the staged sysupgrade changes. As it doesn't really hurt to copy fw_printenv and fw_setenv unconditionally, simply add them in /lib/upgrade/platform.sh, so stage2 will see them. Config copying is moved to a function called by platform_copy_config, where it belongs. Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net> Fixes: FS#821 Fixes: 30f61a34b4cf "base-files: always use staged sysupgrade"
* base-files: nand: use CI_KERNPART whenever the kernel volume is neededChristian Lamparter2017-05-311-4/+4
| | | | | | | | | | | | | | | | | | The sender domain has a DMARC Reject/Quarantine policy which disallows sending mailing list messages using the original "From" header. To mitigate this problem, the original message has been wrapped automatically by the mailing list software. This patch is in continuation of: commit 93aa86040523 "procd: nand: make it possible to configure kernel and ubi partition" The $CI_KERNPART variable should be used in place of the fixed "kernel" partition name. This allows targets to specifiy alternate names for the kernel partition. Cc: Chris Blake <chrisrblake93@gmail.com> Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
* base-files: add support for staged sysupgrades from failsafe modeMatthias Schiffer2017-05-292-5/+12
| | | | Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
* base-files: sysupgrade cleanupMatthias Schiffer2017-05-292-103/+102
| | | | | | | | | | | | Some functions only used by stage2 are moved there from common.sh. One piece that could still use more cleanup is platform_pre_upgrade: many targets reference files from there are aren't available in the ramfs, so we need to evaluate it before the switch; conversely, flash writes happen in that function on some targets. Targets that do the latter should be fixed eventually to use platform_do_upgrade for that purpose. Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
* base-files: always use staged sysupgradeMatthias Schiffer2017-05-293-117/+116
| | | | | | | | | | | Support for the -d and -p options is dropped; it may be added again at some point by adding these flags to the ubus sysupgrade call. A downside of this is that we get a lot less information about the progress of the upgrade: as soon as the actual upgrade starts, all shell sessions are killed to allow unmounting the root filesystem. Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
* procd: remove procd-nand packageMatthias Schiffer2017-05-291-0/+376
| | | | | | | | | | | We always want to support staged upgrades now, so it's better to include upgraded into the main package. /lib/upgrade/nand.sh is moved to base-files. The procd-nand-firstboot package is removed for now, it may return later as a separate package. Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
* base-files: add led functions to uci-defaults.shAlberto Bursi2017-05-141-0/+8
| | | | | | | | | | | | | uci_set_leds_ataport() allows to set a led to show activity on a specific (s)ata port, which is needed for devices that have a Sata led for each sata port. The led trigger is from the 834-ledtrig-libata.patch LEDE kernel patch. uci_set_leds_usbhost() allows to set a led to show total usb activity. Signed-off-by: Alberto Bursi <alberto.bursi@outlook.it> [Jo-Philipp Wich: use a single underscore to denote private functions] Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* base-files: cleanup led functions in uci-defaults.shAlberto Bursi2017-05-141-145/+91
| | | | | | | | | | create a function with code common to all led functions, create another function with code common to functions setting a simple led trigger, restore alphabetical order in function names. Signed-off-by: Alberto Bursi <alberto.bursi@outlook.it> [Jo-Philipp Wich: use a single underscore to denote private functions] Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* base-files: implement ucidef_set_hostname(), ucidef_set_ntpserver()Jo-Philipp Wich2017-05-031-0/+20
| | | | | | | | | | | | | | Commit 2036ae4 (base-files: support hostname and ntp servers through board.d) was supposed to implement these procedures but lacked the required changes to uci-defaults.sh. Add the missing procedures now to fix config generation on targets relying on hostname or NTP server presetting. Fixes FS#754. Reported-by: Cristian Morales Vega <cristian@samknows.com> Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* base-files: add generic board_name function to functions.shFelix Fietkau2017-03-221-0/+4
| | | | | | | This will be used to replace all those nasty board specific scripts that do basically the same thing Signed-off-by: Felix Fietkau <nbd@nbd.name>
* base-files: always set proto passed to _ucidef_set_interface()Mathias Kresin2017-03-111-1/+1
| | | | | | | | | | | | | | | Overwrite an already set proto if a new one is passed to _ucidef_set_interface() similar to what is done for the interface. It is required when using ""ucidef_set_interface_wan 'ptm0' 'pppoe'" after some initial wan interface configuration is already done by ucidef_add_switch. The "json_is_a protocol string" guard is meant to not reset an earlier set interface proto in case something like "ucidef_set_interface_lan 'eth0'" is used afterwards. Signed-off-by: Mathias Kresin <dev@kresin.me>
* base-files: emit tagged switch configuration by defaultJo-Philipp Wich2017-02-021-1/+1
| | | | | | | | | | | | | | | | | | | Instead of only using tagged CPU port configurations when more than one VLAN is present on the switch, always emit tagged configurations unless a board explicitely opts out of this behaviour by using the previously introduced [0-9]u@netdev syntax. Emitting default tagged configurations has the following benefits: - Relation of switch vlans to netdevs is easier to understand, especially for multi-cpu-port switches - Adding additional VLANs (e.g. to break out a LAN port for other purposes) becomes easier as users are not forced to change the existing untagged VLAN to tagged and the existing ifname notation from ethX to ethX.Y anymore, drastly reducing the likelyhood of soft-bricks. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* base-files: don't overwrite model name set by targetMathias Kresin2017-01-301-1/+1
| | | | | | | | | | | The condition is always true due to the literal string followed the -n test parameter. A model name set by target scripts always gets overwritten this way. Change the condition to check for an already existing destination file as it was before 5e85ae9 ("base-files: fix error message during boot"). Signed-off-by: Mathias Kresin <dev@kresin.me>
* base-files: save /bin/mknod for sysupgradeFelix Fietkau2017-01-061-1/+2
| | | | | | It is used on NAND devices in case hotplug is too slow Signed-off-by: Felix Fietkau <nbd@nbd.name>
* base-files: export x86 platform upgrade functions to common.shYousong Zhou2017-01-051-0/+90
| | | | Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
* base-files: add support for overlaying rootfs contentRafał Miłecki2016-12-201-0/+5
| | | | | | | | | This adds support for install-overlay define. When used in package it allows installing files to a special directory that gets copied to the root when installing it. It allows overwriting files provided by other packages. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* base-files: add a hint in sysupgrade that shows what to do when the image ↵Felix Fietkau2016-12-041-0/+3
| | | | | | metadata check fails Signed-off-by: Felix Fietkau <nbd@nbd.name>
* base-files: ignore failure of stopping services on removalJonas Gorski2016-11-211-1/+1
| | | | | | | | | Packages that do a killall <cmd> with the same name as the init script will fail the prerm step when the service isn't running. Do make them removable without having to restart the service, ignore the return code. Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com> Acked-by: Jo-Philipp Wich <jo@mein.io>
* base-files: don't modify enabled state of service on upgradeJonas Gorski2016-11-211-10/+12
| | | | | | | | Properly stop/start services on upgrade, but don't change the enabled state. Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com> Acked-by: Jo-Philipp Wich <jo@mein.io>
* base-files: validate metadata of sysupgrade imagesFelix Fietkau2016-11-191-0/+40
| | | | | | | | | | | Use fwtool to extract it, only require metadata to be present if the platform sysupgrade script sets REQUIRE_IMAGE_METADATA=1 Image metadata is in JSON format and contains a list of supported devices, along with version information that could be displayed by a UI later before the actual upgrade happens. Signed-off-by: Felix Fietkau <nbd@nbd.name>
* base-files: uci-defaults: support requesting untagged switch port configurationJo-Philipp Wich2016-11-021-8/+14
| | | | | | | | | | | | | Introduce support for a new [0-9]u@netdev syntax to ucidev_add_switch() to let board.d network files request default network switch configurations which do not use tagged CPU ports. This commit itself has no effect on generated configurations at the moment since we still emit untagged configurations by default but it allows boards to opt-out from default tagged configs in case we start emitting tagged settings by default. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* package/basefiles: add mkfs.ext4 and losetup binaries to ramfs listAndré Valentin2016-10-261-0/+2
| | | | | | | mkfs.ext4 und losetup are needed for sysupgrade support on mmc devices with automatic rootfs split (loopback device usage). Signed-off-by: André Valentin <avalentin@marcant.net>
* base-files: add ucidef_set_led_usbport for full usbport supportRafał Miłecki2016-10-221-0/+24
| | | | | | | | | | | | | | | | | | | | This helper allows using usbport trigger directly. It requires usbport compatible syntax and supports specifying multiple USB ports, e.g.: ucidef_set_led_usbport "usb" "USB" "devicename:colour:function" "usb1-port1" "usb2-port1" This adds a proper object to the board.json, e.g. "usb": { "name": "USB", "type": "usbport", "sysfs": "devicename:colour:function", "ports": [ "usb1-port1", "usb2-port1" ] } and supports translating it into uci section. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* base-files: make default_prerm work offlineMatthias Schiffer2016-09-261-4/+12
| | | | | | | IPKG_INSTROOT must be respected for offline removal (used for per-device rootfs). Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
* base-files: set pi_ifname in board.d case to fix deconfigJonas Gorski2016-08-141-1/+3
| | | | | | | | Due to an empty pi_ifname in the generic failsafe setup, the deconfig never removed the failsafe networking interface, causing broken networking later on. Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
* base-files: configure switch in failsafeJonas Gorski2016-08-131-2/+46
| | | | | | | Also configure the switch based on the failsafe config, and create the failsafe interface as tagged if necessary. Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
* base-files: allow failsafe to configure vlansJonas Gorski2016-08-131-3/+29
| | | | | | | In preparation of properly setting up vlans and switches, add support for configuring failsafe on a vlan tagged interface. Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
* base-files: add preinit ifname detection based on board.jsonJonas Gorski2016-08-131-0/+29
| | | | | | Make use of the existing board.d to autodetect lan ifname in a generic way. Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
* base-files: split out preinit interface configJonas Gorski2016-08-131-4/+10
| | | | | | | Move preinit interface and ip config to its own function to allow calling it from more than one place. Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
* base-files: board_detect: allow specifying the generated fileJonas Gorski2016-08-131-2/+0
| | | | | | | Allow passing a filename to change the location of the generated board.json. Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
* kernel: remove unused morse led trigger driverFelix Fietkau2016-08-041-11/+0
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* sysupgrade: unmount filesystems before rebootMathias Kresin2016-08-041-0/+1
| | | | | | | | | | | | | | | sysupgrade immediately reboots after flashing an image and doesn't allow to unmount filesystems. At least in case the image used for sysupgrade is stored on a FAT formatted usb flash drive, the following warning is printed during the next mount of the flash drive: FAT-fs (sda1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck. Although a data corruption during read operations is unlikely, there is no need to scare the users. Signed-off-by: Mathias Kresin <dev@kresin.me>
* base-files: sysupgrade: fix pseudobridge upgradesConn O'Griofa2016-07-241-1/+1
| | | | | | Treat 'relayd' as an essential service to avoid connection interruptions during sysupgrade on devices configured as a pseudobridge. Signed-off-by: Conn O'Griofa <connogriofa@gmail.com>
* base-files: seed /dev/urandomEtienne CHAMPETIER2016-06-301-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit: 1) seed /dev/urandom with the saved seeds as early as possible (see /lib/preinit/81_urandom_seed) 2) save a seed at /etc/urandom.seed if it doesn't exists 3) save a new seed each boot at "system.@system[0].urandom_seed" (see /etc/init.d/urandom_seed) We use getrandom() so we are sure /dev/urandom pool is initialized Seed size is 512 bytes (ie /proc/sys/kernel/random/poolsize / 8) it's the same size as in ubuntu 14.04 and all systemd systems Seeding /dev/urandom doesn't change entropy estimation, so we still have "random: ubus urandom read with 4 bits of entropy available" messages in the logs, but we can now ignore them if after "urandom-seed: Seeding with ..." message Saving a new seed on each boot is disabled by default to avoid too much writes without user consent v2: log preinit messages to /dev/kmsg v3: use non generic function name for logging, as /lib/preinit/ files are all sourced together in /etc/preinit v4: after a lot of discussion on the ML, use a uci config param v5: config param is now the path of the seed Signed-off-by: Etienne CHAMPETIER <champetier.etienne@gmail.com> Acked-by: Jo-Philipp Wich <jo@mein.io>
* base-files: support port_state LED types in board.dJo-Philipp Wich2016-06-081-0/+19
| | | | | | Add support for handling port_state LEDs as used by ADM5120. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* base-files: rework postinstall uci-defaults handlingJo-Philipp Wich2016-05-271-5/+4
| | | | | | | | | | | | | | | Some package postinstall operations, e.g. those emitted by the LuCI build system, source and delete the uci-defaults themselves upon package insteall, causing the generic defaults apply code to trigger shell errors like: .../luci-app-ddns.postinst: .: line 130: can't open './40_luci-ddns' Rework the generic apply code to check the existence of the uci-defaults script before trying to source it, use sed to prefilter the list of entries from the control file and perform the directory change in a subshell, avoiding the need for cd $OLDPWD. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* x86: generalize partition discovery for sysupgradeJo-Philipp Wich2016-05-241-1/+1
| | | | | | | | | | | | | | | Generalize the partition discovery in sysupgrade in order to fix sysupgrade and config backup/recovery on MMC block devices which use a different naming scheme compared to mtdblock or sd* devices. The change also adds the find applet to the ramdisk utilities so that upgrade code can rely on it. The commit is based on the initial submission by Russell Senior at http://patchwork.ozlabs.org/patch/625440/ . Signed-off-by: Russell Senior <russell@personaltelco.net> Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* base-files: fix some failsafe issuesJohn Crispin2016-05-231-0/+1
| | | | | | * if the shell was closed booting continued Signed-off-by: John Crispin <john@phrozen.org>
* base-files: evaluate uci-defaults on run-time installationsDaniel Golle2016-05-041-0/+11
| | | | | | | | | | | | Packages may install scripts into /etc/uci-defaults to be executed once after installation, usually at the first boot of the target. This works fine if the package was installed to the rootfs during build or using the ImageBuilder. If the package is installed using opkg during run-time uci-defaults were applied only after a reboot of the device. Avoid the need to reboot by evaluting the package's uci-defaults in default-postinst. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* base-files: split user/group addition code into a functionJohn Crispin2016-04-291-4/+10
| | | | Signed-off-by: John Crispin <john@phrozen.org>
* base-files: Allow to disable failsafe modeJohn Crispin2016-04-193-1/+7
| | | | Signed-off-by: Daniel Dickinson <openwrt@daniel.thecshore.com>
* base-files: fix error message during bootJohn Crispin2016-04-111-1/+1
| | | | | | | | preinit spews out this message "cat: can't open '/proc/device-tree/model': No such file or directory" Signed-off-by: John Crispin <john@phrozen.org>
* branding: add LEDE brandingJohn Crispin2016-03-241-1/+1
| | | | Signed-off-by: John Crispin <blogic@openwrt.org>
* base-files: add function ucidef_set_interface_raw to enable default ↵John Crispin2016-03-101-0/+6
| | | | | | | | configuration on interfaces other than lan and wan. Signed-off-by: Micke Prag <micke.prag@telldus.se> SVN-Revision: 48976
* lantiq: do not set default firmware fileFelix Fietkau2016-03-071-4/+2
| | | | | | | | | We are now shipping a DSL firmware, do not set it by default to some file name. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> SVN-Revision: 48941
* base-files: support passing mode to ucidef_set_led_netdev()Jo-Philipp Wich2016-02-261-0/+2
| | | | | | Signed-off-by: Jo-Philipp Wich <jow@openwrt.org> SVN-Revision: 48806