aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files
Commit message (Collapse)AuthorAgeFilesLines
* OpenWrt v21.02.3: revert to branch defaultsHauke Mehrtens2022-04-171-2/+2
| | | | Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
* OpenWrt v21.02.3: adjust config defaultsv21.02.3Hauke Mehrtens2022-04-171-2/+2
| | | | Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
* base-files: call "sync" after initial setupRafał Miłecki2022-03-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | OpenWrt uses a lot of (b)ash scripts for initial setup. This isn't the best solution as they almost never consider syncing files / data. Still this is what we have and we need to try living with it. Without proper syncing OpenWrt can easily get into an inconsistent state on power cut. It's because: 1. Actual (flash) inode and data writes are not synchronized 2. Data writeback can take up to 30 seconds (dirty_expire_centisecs) 3. ubifs adds extra 5 seconds (dirty_writeback_centisecs) "delay" Some possible cases (examples) for new files: 1. Power cut during 5 seconds after write() can result in all data loss 2. Power cut happening between 5 and 35 seconds after write() can result in empty file (inode flushed after 5 seconds, data flush queued) Above affects e.g. uci-defaults. After executing some migration script it may get deleted (whited out) without generated data getting actually written. Power cut will result in missing data and deleted file. There are three ways of dealing with that: 1. Rewriting all user-space init to proper C with syncs 2. Trying bash hacks (like creating tmp files & moving them) 3. Adding sync and hoping for no power cut during critical section This change introduces the last solution that is the simplest. It reduces time during which things may go wrong from ~35 seconds to probably less than a second. Of course it applies only to IO operations performed before /etc/init.d/boot . It's probably the stage when the most new files get created. All later changes are usually done using smarter C apps (e.g. busybox or uci) that creates tmp files and uses rename() that is expected to be atomic. Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Acked-by: Hauke Mehrtens <hauke@hauke-m.de> Acked-by: Sergey Ryazanov <ryazanov.s.a@gmail.com> (cherry picked from commit 9851d4b6ce6e89d164a04803817625a9041b060a)
* OpenWrt v21.02.2: revert to branch defaultsHauke Mehrtens2022-02-171-2/+2
| | | | Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
* OpenWrt v21.02.2: adjust config defaultsv21.02.2Hauke Mehrtens2022-02-171-2/+2
| | | | Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
* base-files: fix service_running checkFlorian Eckert2021-12-291-3/+3
| | | | | | | | | | | | | | | | | | | The following command checks if a instance of a service is running. /etc/init.d/<service> running <instance> In the variable `$@`, which is passed to the function `service_running`, the first argument is always the `instance` which should be checked. Because all other variables where removed from `$@` with `shift`. Before this change the first argument of `$@` was set to the `$service` Variable. So the function does not work as expected. The `$service` variable was always the instance which should be checked. This is not what we want. Signed-off-by: Florian Eckert <fe@dev.tdt.de> Reviewed-by: Sungbo Eo <mans0n@gorani.run> (cherry picked from commit dd681838d370f1f6f6fa1bf1f22b0414322292f3)
* base-files: upgrade: fix efi partitions size calculationJavier Marcet2021-12-291-1/+1
| | | | | | | | | | We were missing (not using) the last sector of each partition, compared with the output of gparted. Signed-off-by: Javier Marcet <javier@marcet.info> [moved the dot] Signed-off-by: Christian Lamparter <chunkeey@gmail.com> (cherry picked from commit 018ada5403f02921be22ee0cf49b88b2700ee105)
* base-files: chmod 1777 /var/lockDeomid Ryabkov2021-11-051-2/+3
| | | | | | | | | | | | | | Per FHS 3.0, /var/lock is the location for lock files [1]. However its current permissions (755) are too restrictive for use by unprivileged processes. Debian and Ubuntu set them to 1777, and now so do we. [1] <https://refspecs.linuxfoundation.org/FHS_3.0/fhs-3.0.html#varlockLockFiles> Signed-off-by: Deomid Ryabkov <rojer@rojer.me> [fixed typo in commit message, had to remove "rojer" due to git hooks] Signed-off-by: Christian Lamparter <chunkeey@gmail.com> (cherry picked from commit 430f69194388ad6a7826a51e0e2b2dd478e27f0f)
* OpenWrt v21.02.1: revert to branch defaultsHauke Mehrtens2021-10-251-2/+2
| | | | Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
* OpenWrt v21.02.1: adjust config defaultsv21.02.1Hauke Mehrtens2021-10-251-2/+2
| | | | Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
* OpenWrt v21.02.0: revert to branch defaultsHauke Mehrtens2021-09-011-2/+2
| | | | Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
* OpenWrt v21.02.0: adjust config defaultsv21.02.0Hauke Mehrtens2021-09-011-2/+2
| | | | Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
* OpenWrt v21.02.0-rc4: revert to branch defaultsHauke Mehrtens2021-08-011-2/+2
| | | | Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
* OpenWrt v21.02.0-rc4: adjust config defaultsv21.02.0-rc4Hauke Mehrtens2021-08-011-2/+2
| | | | Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
* base-files: wifi: tidy up the reconf codeBob Cantor2021-06-301-1/+2
| | | | | | | | | | | | | commit 5edbd390d321532d9a697d6895a1a7c71c40bd5d rearranged the "wifi up" code. This commit tidies up the "wifi reconf" code so as to keep it aligned with the "wifi up" code. branches affected: trunk, 21.02 Signed-off-by: Bob Cantor <coxede6557@w3boats.com> (cherry-picked from commit e8b54296092118fbef75de796d57799cc6c7b927)
* base-files: wifi: swap the order of some ubus callsBob Cantor2021-06-301-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | "/sbin/wifi up" makes three ubus calls: 1. ubus call network reload 2. ubus call network.wireless down 3. ubus call network.wireless up The first and third ubus calls call drv_mac80211_setup, while the second ubus call triggers wireless_device_setup_cancel, so the call sequence becomes, 1. drv_mac80211_setup 2. wireless_device_setup_cancel 3. drv_mac80211_setup This commit swaps the order of the first two ubus calls, 1. ubus call network.wireless down 2. ubus call network reload 3. ubus call network.wireless up Consequently drv_mac80211_setup is only called once, and two related bugs (#FS3784 and #FS3902) are no longer triggered by /sbin/wifi. branches affected: trunk, 21.02 Signed-off-by: Bob Cantor <coxede6557@w3boats.com> (cherry-picked from commit b82cc8071366b8e96904a1b52af503442069b20d)
* base-files: fix /tmp/TZ when zoneinfo not installedPaul Spooren2021-06-251-7/+4
| | | | | | | | | | | | | The zoneinfo packages are not installed per default so neither /tmp/localtime nor /tmp/TZ is generated. This patch mostly reverts the previous fix and instead incooperates a solution suggested by Jo. Fixes "base-files: fix zoneinfo support " 8af62ed Signed-off-by: Paul Spooren <mail@aparcar.org> (cherry picked from commit 56bdb6bb9781f8a0bbec5fc3075b9d2b8d12f9a8)
* base-files: fix zoneinfo supportRosen Penev2021-06-231-7/+9
| | | | | | | | | | | | | | | | | The system init script currently sets /tmp/localinfo when zoneinfo is populated. However, zoneinfo has spaces in it whereas the actual files have _ instead of spaces. This made the if condition never return true. Example failure when removing the if condition: /tmp/localtime -> /usr/share/zoneinfo/America/Los Angeles This file does not exist. America/Los_Angeles does. Ran through shfmt -w -ci -bn -sr -s Signed-off-by: Rosen Penev <rosenp@gmail.com> (cherry picked from commit 8af62ede189aa504135db05474d34c9f8a1ed35d)
* base-files: failsafe: Remove the VLAN modifier from interface nameHauke Mehrtens2021-06-221-0/+2
| | | | | | | | Some interfaces have a VLAN modifier like :t in lan1:t, this modifier should be removed from the interface before calling preinit_ip_config(). Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> (cherry picked from commit 790561d5109ef81537fdb8ceb8eb183c0cab077c)
* base-files: failsafe: Fix IP configurationHauke Mehrtens2021-06-221-3/+9
| | | | | | | | | | | | | | Adapt the preinit_config_board() to the board.json network changes. It now looks for the device and the ports variables to configure the LAN network. This works with swconfig configurations. Fixes: FS#3866 Fixes: d42640e389a8 ("base-files: use "ports" array in board.json network for bridges") Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Reviewed-by: Rafał Miłecki <rafal@milecki.pl> (cherry picked from commit 467cd378db3359814866ec4121fdb4417783241e)
* base-files: fix typo in config_generate MAC checkRafał Miłecki2021-06-221-1/+1
| | | | | | Fixes: 125deb4d783e ("base-files: set MAC for bridge ports (devices) instead of bridge itself") Signed-off-by: Rafał Miłecki <rafal@milecki.pl> (cherry picked from commit 946019637ec9192450c685a61c589a9cbef7637b)
* base-files: set MAC for bridge ports (devices) instead of bridge itselfRafał Miłecki2021-06-221-1/+9
| | | | | | | | | | | | | | This restores the original config_generate behaviour. With MAC set for bridged devices the bridge automatically gets its MAC adjusted (it picks the lowest MAC of bridged devices). This fixes confusing interfaces setup (bridge ports not having custom MAC assigned). Reported-by: Koen Vandeputte <koen.vandeputte@citymesh.com> Fixes: c2139eef279e ("base-files: simplify setting device MAC") Signed-off-by: Rafał Miłecki <rafal@milecki.pl> (cherry picked from commit c8d8eb9d13fc6fc8b394a620c27995ee71d29c4d)
* OpenWrt v21.02.0-rc3: revert to branch defaultsHauke Mehrtens2021-06-141-2/+2
| | | | Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
* OpenWrt v21.02.0-rc3: adjust config defaultsv21.02.0-rc3Hauke Mehrtens2021-06-141-2/+2
| | | | Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
* OpenWrt v21.02.0-rc2: revert to branch defaultsHauke Mehrtens2021-05-291-2/+2
| | | | Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
* OpenWrt v21.02.0-rc2: adjust config defaultsv21.02.0-rc2Hauke Mehrtens2021-05-291-2/+2
| | | | Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
* base-files: simplify setting device MACRafał Miłecki2021-05-281-11/+8
| | | | | | | | | | | | | | | 1. Move code above interface generation It results in more logical order. Device gets its config section above interface section. 2. Drop the loop We have separated code handling bridges now so $device should be guaranteed to contain a single device name. 3. Drop section name It's not required by netifd or LuCI & it's not needed by this script as $device contains a single device name now. Signed-off-by: Rafał Miłecki <rafal@milecki.pl> (cherry picked from commit e002179a6d2eea8640e262160030336bea54ec26)
* base-files: generate network config with "device" optionsRafał Miłecki2021-05-272-18/+18
| | | | | | | | Replace "ifname" with "device" as netifd has been recently patches to used the later one. It's more clear and accurate. Signed-off-by: Rafał Miłecki <rafal@milecki.pl> (cherry picked from commit 4b9a67362d70c544b85078b8d5c661f43f7472d9)
* base-files: fix configuration generation of network if "bridge" existsINAGAKI Hiroshi2021-05-271-2/+3
| | | | | | | | | | | | | | | | | After the commit 43fc720657c6e3b30c6ed89d7227ee6e646c158b ("base-files: generate "device UCI type section for bridge"), the wrong network configuration is generated for the devices that already have the bridge device section for VLAN, such as the devices in realtek target. As a result, the bridge device by additional "device" section is specified to the "ports" option in the "bridge-vlan" section and netifd shuts down the switch and the ethernet when the network service started. Fixes: 43fc720657 ("base-files: generate "device" UCI type section for bridge") Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com> [rmilecki: use $ports for generate_bridge_vlan argument] Signed-off-by: Rafał Miłecki <rafal@milecki.pl> (cherry picked from commit 8cc4e87a2f81df02dbe481759ae6c36cf056c13b)
* base-files: support setting bridge MAC addressRafał Miłecki2021-05-271-0/+2
| | | | | | Fixes: 43fc720657c6 ("base-files: generate "device" UCI type section for bridge") Signed-off-by: Rafał Miłecki <rafal@milecki.pl> (cherry picked from commit 7a90ad3c431031191afe51b163bf97d3ec820d54)
* base-files: generate bridge device sections with br- name prefixRafał Miłecki2021-05-271-2/+2
| | | | | | | | | | | | Missing br- prefix could result in name conflict between DSA port interface and bridge interface. Some devices with just one LAN port use "lan" interface name for DSA port. Trying to create bridge with the same "lan" name was failing. Reported-by: David Bauer <mail@david-bauer.net> Fixes: 43fc720657c6 ("base-files: generate "device" UCI type section for bridge") Signed-off-by: Rafał Miłecki <rafal@milecki.pl> (cherry picked from commit 0e459668c5b3b158991803204f628b1b7dce9034)
* base-files: generate "device" UCI type section for bridgeRafał Miłecki2021-05-271-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This switches from the old way of defining bridges in an "interface" UCI section type (that should be used for layer 3 only). From now a defualt board switch will have its own "device" UCI section type. It's a new & preferred way of defining L2 devices. Before: config interface 'lan' option type 'bridge' option ifname 'lan1 lan2 lan3 lan4' option proto 'static' option ipaddr '192.168.1.1' option netmask '255.255.255.0' After: config device option name 'lan' option type 'bridge' list ports 'lan1' list ports 'lan2' list ports 'lan3' list ports 'lan4' config interface 'lan' option ifname 'lan' option proto 'static' option ipaddr '192.168.1.1' option netmask '255.255.255.0' Signed-off-by: Rafał Miłecki <rafal@milecki.pl> (cherry picked from commit 43fc720657c6e3b30c6ed89d7227ee6e646c158b)
* base-files: use "ports" array in board.json network for bridgesRafał Miłecki2021-05-242-7/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | Bridge aggregates multiple ports so use a more accurate name ("ports") and format (array) for storing them in board.json. Example: "network": { "lan": { "ports": [ "lan1", "lan2", "lan3", "lan4" ], "protocol": "static" }, "wan": { "ifname": "wan", "protocol": "dhcp" } } Signed-off-by: Rafał Miłecki <rafal@milecki.pl> (cherry picked from commit d42640e389a8b22a31fb0061c12cd9dfbddb87b8)
* base-files: shinit: properly handle dashes in service namesJo-Philipp Wich2021-05-121-1/+1
| | | | | | Fixes: FS#3801 Signed-off-by: Jo-Philipp Wich <jo@mein.io> (cherry picked from commit 75ea878d1ba05610121a732dc0abf7c914e83ca1)
* OpenWrt v21.02.0-rc1: revert to branch defaultsHauke Mehrtens2021-04-191-2/+2
| | | | Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
* OpenWrt v21.02.0-rc1: adjust config defaultsv21.02.0-rc1Hauke Mehrtens2021-04-191-2/+2
| | | | Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
* base-files: fix status display commandAlexander Egorenkov2021-04-181-1/+1
| | | | | | | | | | | | | | | | | | | | | If service() is called w/o parameter then the status display for services with multiple instances is incorrect. E.g. samba4 or wpad have 2 instances. root@OpenWrt:~# /etc/init.d/samba4 status running root@OpenWrt:~# /etc/init.d/wpad status running Before change: /etc/init.d/samba4 enabled stopped /etc/init.d/wpad enabled stopped After change: /etc/init.d/samba4 enabled running /etc/init.d/wpad enabled running Signed-off-by: Alexander Egorenkov <egorenar-dev@posteo.net> (cherry picked from commit 9318f61556c5443eb66eec7e26715b00f0df86fc)
* base-files: add logging for configuration importFlorian Eckert2021-03-221-0/+1
| | | | | | | Make sysupgrade backup import more verbose. Signed-off-by: Florian Eckert <fe@dev.tdt.de> (cherry picked from commit fdbdbe8eaaa6aa3acacdcb3ae1308b2a2055fc39)
* OpenWrt v21.02: set branch defaultsAlexander Couzens2021-02-161-1/+1
| | | | Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
* base-files: use hwclock --systzRosen Penev2021-02-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | The date -k patch is non standard and will be removed in the next commit. Tested behavior to be identical with a simple C program: #define _GNU_SOURCE #include <unistd.h> #include <stdio.h> #include <sys/time.h> #include <sys/syscall.h> int main() { struct timezone tt; struct timezone tz; int a = syscall(SYS_gettimeofday, NULL, &tt); int b = gettimeofday(NULL, &tz); printf("%d - %d, %d\n", a, tt.tz_minuteswest, tt.tz_dsttime); printf("%d - %d, %d\n", b, tz.tz_minuteswest, tz.tz_dsttime); } Signed-off-by: Rosen Penev <rosenp@gmail.com>
* base-files: mount pstore if presentBrian Norris2021-01-291-0/+1
| | | | | | | | Pstore (persistent store) can be used to stash debug information (kernel console, panics, ftrace) across reboots or crashes. If the filesystem is present, mount it. Signed-off-by: Brian Norris <computersforpeace@gmail.com>
* base-files: remove execute bit and shebang from functions.shAdrian Schmutzler2021-01-291-1/+0
| | | | | | | | | | | /lib/functions.sh was executable for no obvious reason and its execute property was even checked in package-ipkg.mk just to source it afterwards. Remove the execute bit and shebang as this is clearly a library. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> Reviewed-by: Philip Prindeville <philipp@redfish-solutions.com>
* treewide: drop shebang from non-executable lib filesAdrian Schmutzler2021-01-2916-20/+0
| | | | | | | | | | | | This drops the shebang from another bunch of files in various /lib folders, as these are sourced and the shebang is useless. Fix execute bit in one case, too. This should cover almost all trivial cases now, i.e. where /lib is actually used for library files. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* base-files: bump Copyright to 2021Paul Spooren2021-01-261-1/+1
| | | | | | | | | | This commit is only added to keep the PKG_RELEASE correct after fixing the $(COMMITCOUNT) logic in the previous commit. This way the PKG_RELEASE stays the same while the compiled packages content isn't changed. Signed-off-by: Paul Spooren <mail@aparcar.org>
* base-files: use $(COMMITCOUNT) in PKG_RELEASEPaul Spooren2021-01-221-1/+1
| | | | | | | | | The newly added `$(COMMITCOUNT)` varialbe allows automatic versioning based on the number of Git commits of a package. Replace *tedious to bump* and *merge conflict causing* `PKG_RELEASE` and replace it with `$(COMMITCOUNT)`. Signed-off-by: Paul Spooren <mail@aparcar.org>
* base-files: read all 3 bytes in get_magic_vfat() at onceAdrian Schmutzler2021-01-072-2/+2
| | | | | | | While the speed improvement might be negligible, there is still no reason to read individual bytes. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* base-files: wifi: add support for 802.11adDaniel Golle2021-01-052-1/+2
| | | | Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* x86/efi: add FAT32 esp mounting supportKagurazaka Kotori2021-01-031-1/+6
| | | | | | | | | Adds a new function get_magic_fat32() in base-files to read FAT32 magic. Now FAT32 EFI system partition can be handled in the same way as FAT12/FAT16. Signed-off-by: Kagurazaka Kotori <kagurazakakotori@gmail.com> [replace '-o' with '] || [' to satisfy shellsheck] Signed-off-by: Paul Spooren <mail@aparcar.org>
* base-files: allow reusing of boolean value extraction logicOldřich Jedlička2021-01-012-6/+13
| | | | | | | | | | | | | | | | | | | The `functions.sh` script has `config_get_bool()` function, which is usable when using UCI config direct access API, but there is no equivalent for the callback API. Introduce `get_bool()` function to allow reusing it from init scripts. Example: ```sh option_cb() { local option="$1" local value="$(get_bool "$2")" ... } ``` Signed-off-by: Oldřich Jedlička <oldium.pro@gmail.com>
* base-files: sysupgrade: add function for conffiles retrievalAdrian Schmutzler2020-12-302-8/+13
| | | | | | | | | | | | The find command to retrieve files from /etc/sysupgrade.conf and /lib/upgrade/keep.d/* is used twice in almost the same way. Move it into a function to consolidate, enhance readability and make future adjustments easier. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> Acked-by: Paul Spooren <mail@aparcar.org> Reviewed-by: Philip Prindeville <philipp@redfish-solutions.com>