diff options
author | Steven Barth <steven@midlink.org> | 2008-05-08 15:37:41 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2008-05-08 15:37:41 +0000 |
commit | aa9ccf77c6648515ba58c37b9345cdbd561028db (patch) | |
tree | b0270202d47b6c5e179f8475302bb3ef0d1c9402 /contrib/package/luci-addons/dist | |
parent | a3a51464fd8cffa6d18fa3f18be9c699901abd0d (diff) |
* Mördercommit ;-)
* Major Repository Reorganisation
* API 0.4 Softfreeze to come
Diffstat (limited to 'contrib/package/luci-addons/dist')
4 files changed, 133 insertions, 0 deletions
diff --git a/contrib/package/luci-addons/dist/etc/crontabs/root b/contrib/package/luci-addons/dist/etc/crontabs/root new file mode 100644 index 0000000000..6e2e417dcb --- /dev/null +++ b/contrib/package/luci-addons/dist/etc/crontabs/root @@ -0,0 +1,3 @@ +0-59/1 * * * * /usr/bin/run-parts /etc/cron.minutely +0 * * * * /usr/bin/run-parts /etc/cron.hourly +0 0 * * * /usr/bin/run-parts /etc/cron.daily diff --git a/contrib/package/luci-addons/dist/etc/hotplug.d/iface/20-aliases b/contrib/package/luci-addons/dist/etc/hotplug.d/iface/20-aliases new file mode 100644 index 0000000000..b9986e3aaa --- /dev/null +++ b/contrib/package/luci-addons/dist/etc/hotplug.d/iface/20-aliases @@ -0,0 +1,24 @@ +add_aliases() { + local config="$1" + + config_get base "$INTERFACE" ifname + config_get iface "$config" ifname + config_get ipaddr "$config" ipaddr + config_get auto "$config" auto + + [ "${iface%%:*}" == "$base" -a "$iface" != "$base" ] && { + case "$auto" in + 1|on|enabled) setup_interface "$iface" "$config";; + *) return 1;; + esac + } +} + + +case "$ACTION" in + ifup) + include /lib/network + scan_interfaces + config_foreach "add_aliases" interface + ;; +esac diff --git a/contrib/package/luci-addons/dist/sbin/ffluci-flash b/contrib/package/luci-addons/dist/sbin/ffluci-flash new file mode 100644 index 0000000000..3ff478f0f5 --- /dev/null +++ b/contrib/package/luci-addons/dist/sbin/ffluci-flash @@ -0,0 +1,88 @@ +#!/bin/sh +. /etc/functions.sh + +# initialize defaults +RAMFS_COPY_BIN="" # extra programs for temporary ramfs root +RAMFS_COPY_DATA="" # extra data files +export KEEP_PATTERN="" +export VERBOSE=1 + +# parse options +while [ -n "$1" ]; do + case "$1" in + -k) + shift + export KEEP_PATTERN="$1" + ;; + -*) + echo "Invalid option: $1" + exit 1 + ;; + *) break;; + esac + shift; +done + +export CONFFILES=/tmp/sysupgrade.conffiles +export CONF_TAR=/tmp/sysupgrade.tgz + +[ -f $CONFFILES ] && rm $CONFFILES +[ -f $CONF_TAR ] && rm $CONF_TAR + +export ARGV="$*" +export ARGC="$#" + +[ -z "$ARGV" ] && { + cat <<EOF +Usage: $0 [options] <image file or URL> + +Options: + -k <"file 1, file 2, ..."> Files to be kept +EOF + exit 1 +} + +add_pattern_conffiles() { + local file="$1" + find $KEEP_PATTERN >> "$file" 2>/dev/null + return 0 +} + +# hooks +sysupgrade_image_check="platform_check_image" +sysupgrade_init_conffiles="" + +[ -n "$KEEP_PATTERN" ] && append sysupgrade_init_conffiles "add_pattern_conffiles" + +include /lib/upgrade + +do_save_conffiles() { + [ -z "$(rootfs_type)" ] && { + echo "Cannot save config while running from ramdisk." + exit 3 + return 0 + } + run_hooks "$CONFFILES" $sysupgrade_init_conffiles + + v "Saving config files..." + [ "$VERBOSE" -gt 1 ] && TAR_V="v" || TAR_V="" + tar c${TAR_V}zf "$CONF_TAR" -T "$CONFFILES" 2>/dev/null +} + +type platform_check_image >/dev/null 2>/dev/null || { + echo "Firmware upgrade is not implemented for this platform." + exit 1 +} + +for check in $sysupgrade_image_check; do + ( eval "$check \"\$ARGV\"" ) || { + echo "Image check '$check' failed." + exit 2 + } +done + +[ -n "$sysupgrade_init_conffiles" ] && do_save_conffiles +run_hooks "" $sysupgrade_pre_upgrade + +v "Switching to ramdisk..." +run_ramfs '. /etc/functions.sh; include /lib/upgrade; do_upgrade'
\ No newline at end of file diff --git a/contrib/package/luci-addons/dist/usr/bin/run-parts b/contrib/package/luci-addons/dist/usr/bin/run-parts new file mode 100644 index 0000000000..0f0cbbdf5f --- /dev/null +++ b/contrib/package/luci-addons/dist/usr/bin/run-parts @@ -0,0 +1,18 @@ +#!/bin/sh +set +e + +if [ $# -lt 1 ]; then + echo "Usage: run-parts <dir>" + exit 1 +fi + +if [ ! -d $1 ]; then + echo "Not a directory: $1" + exit 1 +fi + +for i in $1/*; do + [ -x $i ] && $i +done + +exit 0
\ No newline at end of file |