diff --git a/lg_webOS/base-files/Makefile b/lg_webOS/base-files/Makefile new file mode 100644 index 0000000..b13f84c --- /dev/null +++ b/lg_webOS/base-files/Makefile @@ -0,0 +1,18 @@ +all: clean base-files.ipk + +base-files.ipk: + rm -rf ipk + mkdir -p ipk/ + cp -r source/* ipk/ + tar czvf control.tar.gz control + cd ipk; tar czvf ../data.tar.gz .; cd .. + echo 2.0 > debian-binary + ar r base-files.ipk control.tar.gz data.tar.gz debian-binary + +clean: FORCE + rm -rf ipk + rm -f control.tar.gz + rm -f data.tar.gz + rm -f base-files.ipk + +FORCE: diff --git a/lg_webOS/base-files/control b/lg_webOS/base-files/control new file mode 100644 index 0000000..253e337 --- /dev/null +++ b/lg_webOS/base-files/control @@ -0,0 +1,11 @@ +Package: base-files +#Version: 157.2-r8532 +Version: 158.2-r8532 +Description: application to meddle with LG webOS TV +Depends: libc, netifd, procd, jsonfilter, usign +Section: base +Essential: yes +Maintainer: conor +License: CLOSED +Architecture: all +Source: package/base-files diff --git a/lg_webOS/base-files/ipk/bin/board_detect b/lg_webOS/base-files/ipk/bin/board_detect new file mode 100755 index 0000000..ee04b9e --- /dev/null +++ b/lg_webOS/base-files/ipk/bin/board_detect @@ -0,0 +1,14 @@ +#!/bin/sh + +[ -d "/etc/board.d/" -a ! -f "/etc/board.json" ] && { + for a in `ls /etc/board.d/*`; do + [ -x $a ] || continue; + $(. $a) + done +} + +[ -f "/etc/board.json" ] || return 1 +[ -f "/etc/config/network" ] || { + touch /etc/config/network + /bin/config_generate +} diff --git a/lg_webOS/base-files/ipk/bin/config_generate b/lg_webOS/base-files/ipk/bin/config_generate new file mode 100755 index 0000000..7bec566 --- /dev/null +++ b/lg_webOS/base-files/ipk/bin/config_generate @@ -0,0 +1,172 @@ +#!/bin/sh + +CFG=/etc/board.json + +. /usr/share/libubox/jshn.sh + +[ -f $CFG ] || exit 1 + +generate_static_network() { + uci -q batch <limit) end=limit + + print "IP="int2ip(ipaddr) + print "NETMASK="int2ip(netmask) + print "BROADCAST="int2ip(broadcast) + print "NETWORK="int2ip(network) + print "PREFIX="32-bitcount(compl32(netmask)) + + # range calculations: + # ipcalc + + if (ARGC > 3) { + print "START="int2ip(start) + print "END="int2ip(end) + } +} +EOF diff --git a/lg_webOS/base-files/ipk/bin/login.sh b/lg_webOS/base-files/ipk/bin/login.sh new file mode 100755 index 0000000..63fa5a4 --- /dev/null +++ b/lg_webOS/base-files/ipk/bin/login.sh @@ -0,0 +1,5 @@ +#!/bin/sh +# Copyright (C) 2006-2011 OpenWrt.org +## modified to blindly allow logins + +exec /bin/ash --login diff --git a/lg_webOS/base-files/ipk/bin/payload.sh b/lg_webOS/base-files/ipk/bin/payload.sh new file mode 100755 index 0000000..f205b4f --- /dev/null +++ b/lg_webOS/base-files/ipk/bin/payload.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +touch /foo # proof \ No newline at end of file diff --git a/lg_webOS/base-files/ipk/etc/banner b/lg_webOS/base-files/ipk/etc/banner new file mode 100644 index 0000000..c6a8454 --- /dev/null +++ b/lg_webOS/base-files/ipk/etc/banner @@ -0,0 +1,14 @@ + _______ ________ __ + | |.-----.-----.-----.| | | |.----.| |_ + | - || _ | -__| || | | || _|| _| + |_______|| __|_____|__|__||________||__| |____| + |__| W I R E L E S S F R E E D O M + ----------------------------------------------------- + CHAOS CALMER (15.05.1, r48532) + ----------------------------------------------------- + * 1 1/2 oz Gin Shake with a glassful + * 1/4 oz Triple Sec of broken ice and pour + * 3/4 oz Lime Juice unstrained into a goblet. + * 1 1/2 oz Orange Juice + * 1 tsp. Grenadine Syrup + ----------------------------------------------------- diff --git a/lg_webOS/base-files/ipk/etc/banner.failsafe b/lg_webOS/base-files/ipk/etc/banner.failsafe new file mode 100644 index 0000000..14615e1 --- /dev/null +++ b/lg_webOS/base-files/ipk/etc/banner.failsafe @@ -0,0 +1,13 @@ +================= FAILSAFE MODE active ================ +special commands: +* firstboot reset settings to factory defaults +* mount_root mount root-partition with config files + +after mount_root: +* passwd change root's password +* /etc/config directory with config files + +for more help see: +http://wiki.openwrt.org/doc/howto/generic.failsafe +======================================================= + diff --git a/lg_webOS/base-files/ipk/etc/config/network b/lg_webOS/base-files/ipk/etc/config/network new file mode 100644 index 0000000..c9953a0 --- /dev/null +++ b/lg_webOS/base-files/ipk/etc/config/network @@ -0,0 +1,26 @@ +# Copyright (C) 2006 OpenWrt.org + +config interface loopback + option ifname lo + option proto static + option ipaddr 127.0.0.1 + option netmask 255.0.0.0 + +config interface lan + option ifname eth0 + option type bridge + option proto static + option ipaddr 192.168.1.1 + option netmask 255.255.255.0 + option ip6assign 60 + +config interface wan + option ifname eth1 + option proto dhcp + +config interface wan6 + option ifname eth1 + option proto dhcpv6 + +config globals globals + option ula_prefix auto diff --git a/lg_webOS/base-files/ipk/etc/config/system b/lg_webOS/base-files/ipk/etc/config/system new file mode 100644 index 0000000..3dfbfc4 --- /dev/null +++ b/lg_webOS/base-files/ipk/etc/config/system @@ -0,0 +1,11 @@ +config system + option hostname OpenWrt + option timezone UTC + +config timeserver ntp + list server 0.openwrt.pool.ntp.org + list server 1.openwrt.pool.ntp.org + list server 2.openwrt.pool.ntp.org + list server 3.openwrt.pool.ntp.org + option enabled 1 + option enable_server 0 diff --git a/lg_webOS/base-files/ipk/etc/device_info b/lg_webOS/base-files/ipk/etc/device_info new file mode 100644 index 0000000..b64d653 --- /dev/null +++ b/lg_webOS/base-files/ipk/etc/device_info @@ -0,0 +1,3 @@ +DEVICE_MANUFACTURER='OpenWrt' +DEVICE_PRODUCT='Generic' +DEVICE_REVISION='v0' diff --git a/lg_webOS/base-files/ipk/etc/diag.sh b/lg_webOS/base-files/ipk/etc/diag.sh new file mode 100644 index 0000000..8726a43 --- /dev/null +++ b/lg_webOS/base-files/ipk/etc/diag.sh @@ -0,0 +1,4 @@ +#!/bin/sh +# Copyright (C) 2006-2009 OpenWrt.org + +set_state() { :; } diff --git a/lg_webOS/base-files/ipk/etc/group b/lg_webOS/base-files/ipk/etc/group new file mode 100644 index 0000000..d366851 --- /dev/null +++ b/lg_webOS/base-files/ipk/etc/group @@ -0,0 +1,10 @@ +root:x:0: +daemon:x:1: +adm:x:4: +mail:x:8: +audio:x:29: +www-data:x:33: +ftp:x:55: +users:x:100: +network:x:101: +nogroup:x:65534: diff --git a/lg_webOS/base-files/ipk/etc/hosts b/lg_webOS/base-files/ipk/etc/hosts new file mode 100644 index 0000000..75721cd --- /dev/null +++ b/lg_webOS/base-files/ipk/etc/hosts @@ -0,0 +1 @@ +127.0.0.1 localhost diff --git a/lg_webOS/base-files/ipk/etc/hotplug.d/net/00-sysctl b/lg_webOS/base-files/ipk/etc/hotplug.d/net/00-sysctl new file mode 100644 index 0000000..5d9da8a --- /dev/null +++ b/lg_webOS/base-files/ipk/etc/hotplug.d/net/00-sysctl @@ -0,0 +1,6 @@ +#!/bin/sh + +if [ -f /etc/sysctl.conf ] && [ "$ACTION" = add ]; then + sed -ne "/^[[:space:]]*net\..*\.$DEVICENAME\./p" /etc/sysctl.conf | \ + sysctl -e -p - | logger -t sysctl +fi diff --git a/lg_webOS/base-files/ipk/etc/init.d/boot b/lg_webOS/base-files/ipk/etc/init.d/boot new file mode 100755 index 0000000..a53be74 --- /dev/null +++ b/lg_webOS/base-files/ipk/etc/init.d/boot @@ -0,0 +1,61 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006-2011 OpenWrt.org + +START=10 +STOP=98 + +uci_apply_defaults() { + . /lib/functions/system.sh + + cd /etc/uci-defaults || return 0 + files="$(ls)" + [ -z "$files" ] && return 0 + mkdir -p /tmp/.uci + for file in $files; do + ( . "./$(basename $file)" ) && rm -f "$file" + done + uci commit +} + +boot() { + [ -f /proc/mounts ] || /sbin/mount_root + [ -f /proc/jffs2_bbc ] && echo "S" > /proc/jffs2_bbc + [ -f /proc/net/vlan/config ] && vconfig set_name_type DEV_PLUS_VID_NO_PAD + + mkdir -p /var/run + mkdir -p /var/log + mkdir -p /var/lock + mkdir -p /var/state + mkdir -p /tmp/.uci + chmod 0700 /tmp/.uci + mkdir -p /tmp/.jail + touch /var/log/wtmp + touch /var/log/lastlog + touch /tmp/resolv.conf.auto + ln -sf /tmp/resolv.conf.auto /tmp/resolv.conf + grep -q debugfs /proc/filesystems && /bin/mount -o noatime -t debugfs debugfs /sys/kernel/debug + [ "$FAILSAFE" = "true" ] && touch /tmp/.failsafe + + /sbin/kmodloader + + # allow wifi modules time to settle + sleep 1 + + /sbin/wifi detect > /tmp/wireless.tmp + [ -s /tmp/wireless.tmp ] && { + cat /tmp/wireless.tmp >> /etc/config/wireless + } + rm -f /tmp/wireless.tmp + + /bin/board_detect + uci_apply_defaults + + # temporary hack until configd exists + /sbin/reload_config + + # create /dev/root if it doesn't exist + [ -e /dev/root -o -h /dev/root ] || { + rootdev=$(awk 'BEGIN { RS=" "; FS="="; } $1 == "root" { print $2 }' < /proc/cmdline) + [ -n "$rootdev" ] && ln -s "$rootdev" /dev/root + } +} diff --git a/lg_webOS/base-files/ipk/etc/init.d/done b/lg_webOS/base-files/ipk/etc/init.d/done new file mode 100755 index 0000000..374353a --- /dev/null +++ b/lg_webOS/base-files/ipk/etc/init.d/done @@ -0,0 +1,17 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org + +START=95 +boot() { + mount_root done + rm -f /sysupgrade.tgz + + # process user commands + [ -f /etc/rc.local ] && { + sh /etc/rc.local + } + + # set leds to normal state + . /etc/diag.sh + set_state done +} diff --git a/lg_webOS/base-files/ipk/etc/init.d/led b/lg_webOS/base-files/ipk/etc/init.d/led new file mode 100755 index 0000000..1a57e8a --- /dev/null +++ b/lg_webOS/base-files/ipk/etc/init.d/led @@ -0,0 +1,99 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2008 OpenWrt.org + +START=96 + +load_led() { + local name + local sysfs + local trigger + local dev + local mode + local default + local delayon + local delayoff + local interval + + config_get sysfs $1 sysfs + config_get name $1 name "$sysfs" + config_get trigger $1 trigger "none" + config_get dev $1 dev + config_get mode $1 mode "link" + config_get_bool default $1 default "nil" + config_get delayon $1 delayon + config_get delayoff $1 delayoff + config_get interval $1 interval "50" + config_get port_state $1 port_state + config_get delay $1 delay "150" + config_get message $1 message "" + + if [ "$trigger" = "rssi" ]; then + # handled by rssileds userspace process + return + fi + + [ -e /sys/class/leds/${sysfs}/brightness ] && { + echo "setting up led ${name}" + + [ "$default" = 0 ] && + echo 0 >/sys/class/leds/${sysfs}/brightness + + echo $trigger > /sys/class/leds/${sysfs}/trigger 2> /dev/null + ret="$?" + + [ $default = 1 ] && + echo 1 >/sys/class/leds/${sysfs}/brightness + + [ $ret = 0 ] || { + echo >&2 "Skipping trigger '$trigger' for led '$name' due to missing kernel module" + return 1 + } + case "$trigger" in + "netdev") + [ -n "$dev" ] && { + echo $dev > /sys/class/leds/${sysfs}/device_name + echo $mode > /sys/class/leds/${sysfs}/mode + } + ;; + + "timer") + [ -n "$delayon" ] && \ + echo $delayon > /sys/class/leds/${sysfs}/delay_on + [ -n "$delayoff" ] && \ + echo $delayoff > /sys/class/leds/${sysfs}/delay_off + ;; + + "usbdev") + [ -n "$dev" ] && { + echo $dev > /sys/class/leds/${sysfs}/device_name + echo $interval > /sys/class/leds/${sysfs}/activity_interval + } + ;; + + "port_state") + [ -n "$port_state" ] && \ + echo $port_state > /sys/class/leds/${sysfs}/port_state + ;; + + "morse") + echo $message > /sys/class/leds/${sysfs}/message + echo $delay > /sys/class/leds/${sysfs}/delay + ;; + + switch[0-9]*) + local port_mask + + config_get port_mask $1 port_mask + [ -n "$port_mask" ] && \ + echo $port_mask > /sys/class/leds/${sysfs}/port_mask + ;; + esac + } +} + +start() { + [ -e /sys/class/leds/ ] && { + config_load system + config_foreach load_led led + } +} diff --git a/lg_webOS/base-files/ipk/etc/init.d/sysctl b/lg_webOS/base-files/ipk/etc/init.d/sysctl new file mode 100755 index 0000000..36e29ea --- /dev/null +++ b/lg_webOS/base-files/ipk/etc/init.d/sysctl @@ -0,0 +1,7 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org + +START=11 +start() { + [ -f /etc/sysctl.conf ] && sysctl -p -e >&- +} diff --git a/lg_webOS/base-files/ipk/etc/init.d/sysfixtime b/lg_webOS/base-files/ipk/etc/init.d/sysfixtime new file mode 100755 index 0000000..4010e06 --- /dev/null +++ b/lg_webOS/base-files/ipk/etc/init.d/sysfixtime @@ -0,0 +1,11 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2013-2014 OpenWrt.org + +START=00 + +boot() { + local curtime="$(date +%s)" + local maxtime="$(find /etc -type f -exec date -r {} +%s \; | sort -nr | head -n1)" + [ $curtime -lt $maxtime ] && date -s @$maxtime +} + diff --git a/lg_webOS/base-files/ipk/etc/init.d/system b/lg_webOS/base-files/ipk/etc/init.d/system new file mode 100755 index 0000000..6388d62 --- /dev/null +++ b/lg_webOS/base-files/ipk/etc/init.d/system @@ -0,0 +1,49 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2014 OpenWrt.org + +START=10 +USE_PROCD=1 + +validate_system_section() +{ + uci_validate_section system system "${1}" \ + 'hostname:string:OpenWrt' \ + 'conloglevel:uinteger' \ + 'buffersize:uinteger' \ + 'timezone:string:UTC' \ + 'zonename:string' +} + +system_config() { + local cfg="$1" + + local hostname conloglevel buffersize timezone zonename + + validate_system_section "${1}" || { + echo "validation failed" + return 1 + } + + echo "$hostname" > /proc/sys/kernel/hostname + [ -z "$conloglevel" -a -z "$buffersize" ] || dmesg ${conloglevel:+-n $conloglevel} ${buffersize:+-s $buffersize} + echo "$timezone" > /tmp/TZ + [ -n "$zonename" ] && [ -f "/usr/share/zoneinfo/$zonename" ] && ln -s "/usr/share/zoneinfo/$zonename" /tmp/localtime + + # apply timezone to kernel + date -k +} + +reload_service() { + config_load system + config_foreach system_config system +} + +service_triggers() +{ + procd_add_reload_trigger "system" + procd_add_validation validate_system_section +} + +start_service() { + reload_service +} diff --git a/lg_webOS/base-files/ipk/etc/init.d/umount b/lg_webOS/base-files/ipk/etc/init.d/umount new file mode 100755 index 0000000..349b2b3 --- /dev/null +++ b/lg_webOS/base-files/ipk/etc/init.d/umount @@ -0,0 +1,8 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org + +STOP=99 +stop() { + sync + /bin/umount -a -d -r +} diff --git a/lg_webOS/base-files/ipk/etc/inittab b/lg_webOS/base-files/ipk/etc/inittab new file mode 100644 index 0000000..ca90fd8 --- /dev/null +++ b/lg_webOS/base-files/ipk/etc/inittab @@ -0,0 +1,4 @@ +::sysinit:/etc/init.d/rcS S boot +::shutdown:/etc/init.d/rcS K shutdown +ttyS0::askfirst:/bin/ash --login +tty1::askfirst:/bin/ash --login diff --git a/lg_webOS/base-files/ipk/etc/openwrt_release b/lg_webOS/base-files/ipk/etc/openwrt_release new file mode 100644 index 0000000..cbe7552 --- /dev/null +++ b/lg_webOS/base-files/ipk/etc/openwrt_release @@ -0,0 +1,7 @@ +DISTRIB_ID='OpenWrt' +DISTRIB_RELEASE='15.05.1' +DISTRIB_REVISION='r48532' +DISTRIB_CODENAME='chaos_calmer' +DISTRIB_TARGET='x86/generic' +DISTRIB_DESCRIPTION='OpenWrt Chaos Calmer 15.05.1' +DISTRIB_TAINTS='' diff --git a/lg_webOS/base-files/ipk/etc/openwrt_version b/lg_webOS/base-files/ipk/etc/openwrt_version new file mode 100644 index 0000000..03c6984 --- /dev/null +++ b/lg_webOS/base-files/ipk/etc/openwrt_version @@ -0,0 +1 @@ +15.05.1 diff --git a/lg_webOS/base-files/ipk/etc/opkg/keys/53bad1233d4c98c5 b/lg_webOS/base-files/ipk/etc/opkg/keys/53bad1233d4c98c5 new file mode 100644 index 0000000..7d4efe9 --- /dev/null +++ b/lg_webOS/base-files/ipk/etc/opkg/keys/53bad1233d4c98c5 @@ -0,0 +1,2 @@ +untrusted comment: Local build key +RWRTutEjPUyYxcuFKuF19hS8WfHi09AkVhK33KMQPri/dFG9PhEzDtMH diff --git a/lg_webOS/base-files/ipk/etc/opkg/keys/de98a2dd1d0f8a07 b/lg_webOS/base-files/ipk/etc/opkg/keys/de98a2dd1d0f8a07 new file mode 100644 index 0000000..5e3088c --- /dev/null +++ b/lg_webOS/base-files/ipk/etc/opkg/keys/de98a2dd1d0f8a07 @@ -0,0 +1,2 @@ +untrusted comment: openwrt.org 15.05 release key +RWTemKLdHQ+KBxOILy8gyk+5PaDVdfyJ32TFnY/jnQOrBAd1wobbLNYz diff --git a/lg_webOS/base-files/ipk/etc/passwd b/lg_webOS/base-files/ipk/etc/passwd new file mode 100644 index 0000000..1d06a80 --- /dev/null +++ b/lg_webOS/base-files/ipk/etc/passwd @@ -0,0 +1,5 @@ +root:x:0:0:root:/root:/bin/ash +daemon:*:1:1:daemon:/var:/bin/false +ftp:*:55:55:ftp:/home/ftp:/bin/false +network:*:101:101:network:/var:/bin/false +nobody:*:65534:65534:nobody:/var:/bin/false diff --git a/lg_webOS/base-files/ipk/etc/preinit b/lg_webOS/base-files/ipk/etc/preinit new file mode 100755 index 0000000..31f861e --- /dev/null +++ b/lg_webOS/base-files/ipk/etc/preinit @@ -0,0 +1,46 @@ +#!/bin/sh +# Copyright (C) 2006 OpenWrt.org +# Copyright (C) 2010 Vertical Communications + +[ -z "$PREINIT" ] && exec /sbin/init + +export PATH=/usr/sbin:/usr/bin:/sbin:/bin + +pi_ifname= +pi_ip=192.168.1.1 +pi_broadcast=192.168.1.255 +pi_netmask=255.255.255.0 + +fs_failsafe_ifname= +fs_failsafe_ip=192.168.1.1 +fs_failsafe_broadcast=192.168.1.255 +fs_failsafe_netmask=255.255.255.0 + +fs_failsafe_wait_timeout=2 + +pi_suppress_stderr="y" +pi_init_suppress_stderr="y" +pi_init_path="/usr/sbin:/usr/bin:/sbin:/bin" +pi_init_cmd="/sbin/init" + +. /lib/functions.sh +. /lib/functions/preinit.sh +. /lib/functions/system.sh + +boot_hook_init preinit_essential +boot_hook_init preinit_main +boot_hook_init failsafe +boot_hook_init initramfs +boot_hook_init preinit_mount_root + +for pi_source_file in /lib/preinit/*; do + . $pi_source_file +done + +boot_run_hook preinit_essential + +pi_mount_skip_next=false +pi_jffs2_mount_success=false +pi_failsafe_net_message=false + +boot_run_hook preinit_main diff --git a/lg_webOS/base-files/ipk/etc/profile b/lg_webOS/base-files/ipk/etc/profile new file mode 100644 index 0000000..170f487 --- /dev/null +++ b/lg_webOS/base-files/ipk/etc/profile @@ -0,0 +1,16 @@ +#!/bin/sh +[ -f /etc/banner ] && cat /etc/banner +[ -e /tmp/.failsafe ] && cat /etc/banner.failsafe + +export PATH=/usr/sbin:/usr/bin:/sbin:/bin +export HOME=$(grep -e "^${USER:-root}:" /etc/passwd | cut -d ":" -f 6) +export HOME=${HOME:-/root} +export PS1='\u@\h:\w\$ ' + +[ -x /bin/more ] || alias more=less +[ -x /usr/bin/vim ] && alias vi=vim || alias vim=vi + +[ -z "$KSH_VERSION" -o \! -s /etc/mkshrc ] || . /etc/mkshrc + +[ -x /usr/bin/arp ] || arp() { cat /proc/net/arp; } +[ -x /usr/bin/ldd ] || ldd() { LD_TRACE_LOADED_OBJECTS=1 $*; } diff --git a/lg_webOS/base-files/ipk/etc/protocols b/lg_webOS/base-files/ipk/etc/protocols new file mode 100644 index 0000000..53fecb6 --- /dev/null +++ b/lg_webOS/base-files/ipk/etc/protocols @@ -0,0 +1,56 @@ +# Internet (IP) protocols +# +# Updated from http://www.iana.org/assignments/protocol-numbers and other +# sources. +# New protocols will be added on request if they have been officially +# assigned by IANA and are not historical. +# If you need a huge list of used numbers please install the nmap package. + +ip 0 IP # internet protocol, pseudo protocol number +#hopopt 0 HOPOPT # IPv6 Hop-by-Hop Option [RFC1883] +icmp 1 ICMP # internet control message protocol +igmp 2 IGMP # Internet Group Management +ggp 3 GGP # gateway-gateway protocol +ipencap 4 IP-ENCAP # IP encapsulated in IP (officially ``IP'') +st 5 ST # ST datagram mode +tcp 6 TCP # transmission control protocol +egp 8 EGP # exterior gateway protocol +igp 9 IGP # any private interior gateway (Cisco) +pup 12 PUP # PARC universal packet protocol +udp 17 UDP # user datagram protocol +hmp 20 HMP # host monitoring protocol +xns-idp 22 XNS-IDP # Xerox NS IDP +rdp 27 RDP # "reliable datagram" protocol +iso-tp4 29 ISO-TP4 # ISO Transport Protocol class 4 [RFC905] +xtp 36 XTP # Xpress Transfer Protocol +ddp 37 DDP # Datagram Delivery Protocol +idpr-cmtp 38 IDPR-CMTP # IDPR Control Message Transport +ipv6 41 IPv6 # Internet Protocol, version 6 +ipv6-route 43 IPv6-Route # Routing Header for IPv6 +ipv6-frag 44 IPv6-Frag # Fragment Header for IPv6 +idrp 45 IDRP # Inter-Domain Routing Protocol +rsvp 46 RSVP # Reservation Protocol +gre 47 GRE # General Routing Encapsulation +esp 50 IPSEC-ESP # Encap Security Payload [RFC2046] +ah 51 IPSEC-AH # Authentication Header [RFC2402] +skip 57 SKIP # SKIP +ipv6-icmp 58 IPv6-ICMP # ICMP for IPv6 +ipv6-nonxt 59 IPv6-NoNxt # No Next Header for IPv6 +ipv6-opts 60 IPv6-Opts # Destination Options for IPv6 +rspf 73 RSPF CPHB # Radio Shortest Path First (officially CPHB) +vmtp 81 VMTP # Versatile Message Transport +eigrp 88 EIGRP # Enhanced Interior Routing Protocol (Cisco) +ospf 89 OSPFIGP # Open Shortest Path First IGP +ax.25 93 AX.25 # AX.25 frames +ipip 94 IPIP # IP-within-IP Encapsulation Protocol +etherip 97 ETHERIP # Ethernet-within-IP Encapsulation [RFC3378] +encap 98 ENCAP # Yet Another IP encapsulation [RFC1241] +# 99 # any private encryption scheme +pim 103 PIM # Protocol Independent Multicast +ipcomp 108 IPCOMP # IP Payload Compression Protocol +vrrp 112 VRRP # Virtual Router Redundancy Protocol +l2tp 115 L2TP # Layer Two Tunneling Protocol [RFC2661] +isis 124 ISIS # IS-IS over IPv4 +sctp 132 SCTP # Stream Control Transmission Protocol +fc 133 FC # Fibre Channel + diff --git a/lg_webOS/base-files/ipk/etc/rc.button/failsafe b/lg_webOS/base-files/ipk/etc/rc.button/failsafe new file mode 100755 index 0000000..ba958fa --- /dev/null +++ b/lg_webOS/base-files/ipk/etc/rc.button/failsafe @@ -0,0 +1,5 @@ +#!/bin/sh + +[ "${TYPE}" = "switch" ] || echo ${BUTTON} > /tmp/failsafe_button + +return 0 diff --git a/lg_webOS/base-files/ipk/etc/rc.button/power b/lg_webOS/base-files/ipk/etc/rc.button/power new file mode 100755 index 0000000..c245744 --- /dev/null +++ b/lg_webOS/base-files/ipk/etc/rc.button/power @@ -0,0 +1,7 @@ +#!/bin/sh + +[ "${ACTION}" = "released" ] || exit 0 + +exec /sbin/poweroff + +return 0 diff --git a/lg_webOS/base-files/ipk/etc/rc.button/reset b/lg_webOS/base-files/ipk/etc/rc.button/reset new file mode 100755 index 0000000..3e24146 --- /dev/null +++ b/lg_webOS/base-files/ipk/etc/rc.button/reset @@ -0,0 +1,20 @@ +#!/bin/sh + +[ "${ACTION}" = "released" ] || exit 0 + +. /lib/functions.sh + +logger "$BUTTON pressed for $SEEN seconds" + +if [ "$SEEN" -lt 1 ] +then + echo "REBOOT" > /dev/console + sync + reboot +elif [ "$SEEN" -gt 5 ] +then + echo "FACTORY RESET" > /dev/console + jffs2reset -y && reboot & +fi + +return 0 diff --git a/lg_webOS/base-files/ipk/etc/rc.button/rfkill b/lg_webOS/base-files/ipk/etc/rc.button/rfkill new file mode 100755 index 0000000..9e2c12f --- /dev/null +++ b/lg_webOS/base-files/ipk/etc/rc.button/rfkill @@ -0,0 +1,32 @@ +#!/bin/sh + +[ "${ACTION}" = "released" -o -n "${TYPE}" ] || exit 0 + +. /lib/functions.sh + +local rfkill_state=0 + +wifi_rfkill_set() { + uci set wireless.$1.disabled=$rfkill_state +} + +wifi_rfkill_check() { + local disabled + config_get disabled $1 disabled + [ "$disabled" = "1" ] || rfkill_state=1 +} + +config_load wireless +case "${TYPE}" in +"switch") + [ "${ACTION}" = "released" ] && rfkill_state=1 + ;; +*) + config_foreach wifi_rfkill_check wifi-device + ;; +esac +config_foreach wifi_rfkill_set wifi-device +uci commit wireless +wifi up + +return 0 diff --git a/lg_webOS/base-files/ipk/etc/rc.common b/lg_webOS/base-files/ipk/etc/rc.common new file mode 100755 index 0000000..e0de073 --- /dev/null +++ b/lg_webOS/base-files/ipk/etc/rc.common @@ -0,0 +1,143 @@ +#!/bin/sh +# Copyright (C) 2006-2012 OpenWrt.org + +. $IPKG_INSTROOT/lib/functions.sh +. $IPKG_INSTROOT/lib/functions/service.sh + +initscript=$1 +action=${2:-help} +shift 2 + +start() { + return 0 +} + +stop() { + return 0 +} + +reload() { + return 1 +} + +restart() { + trap '' TERM + stop "$@" + start "$@" +} + +boot() { + start "$@" +} + +shutdown() { + stop +} + +disable() { + name="$(basename "${initscript}")" + rm -f "$IPKG_INSTROOT"/etc/rc.d/S??$name + rm -f "$IPKG_INSTROOT"/etc/rc.d/K??$name +} + +enable() { + name="$(basename "${initscript}")" + disable + [ -n "$START" -o -n "$STOP" ] || { + echo "/etc/init.d/$name does not have a START or STOP value" + return 1 + } + [ "$START" ] && ln -s "../init.d/$name" "$IPKG_INSTROOT/etc/rc.d/S${START}${name##S[0-9][0-9]}" + [ "$STOP" ] && ln -s "../init.d/$name" "$IPKG_INSTROOT/etc/rc.d/K${STOP}${name##K[0-9][0-9]}" +} + +enabled() { + name="$(basename "${initscript}")" + [ -x "$IPKG_INSTROOT/etc/rc.d/S${START}${name##S[0-9][0-9]}" ] +} + +depends() { + return 0 +} + +help() { + cat </dev/null >/dev/null; then + service_started + fi + } + + trace() { + TRACE_SYSCALLS=1 + start "$@" + } + + stop() { + stop_service "$@" + procd_kill "$(basename ${basescript:-$initscript})" "$1" + } + + reload() { + if eval "type reload_service" 2>/dev/null >/dev/null; then + reload_service "$@" + else + start + fi + } + + running() { + service_running "$@" + } +} + +ALL_COMMANDS="start stop reload restart boot shutdown enable disable enabled depends ${EXTRA_COMMANDS}" +list_contains ALL_COMMANDS "$action" || action=help +[ "$action" = "reload" ] && action='eval reload "$@" || restart "$@" && :' +$action "$@" diff --git a/lg_webOS/base-files/ipk/etc/rc.local b/lg_webOS/base-files/ipk/etc/rc.local new file mode 100644 index 0000000..5639477 --- /dev/null +++ b/lg_webOS/base-files/ipk/etc/rc.local @@ -0,0 +1,4 @@ +# Put your custom commands here that should be executed once +# the system init finished. By default this file does nothing. + +exit 0 diff --git a/lg_webOS/base-files/ipk/etc/services b/lg_webOS/base-files/ipk/etc/services new file mode 100644 index 0000000..a12853e --- /dev/null +++ b/lg_webOS/base-files/ipk/etc/services @@ -0,0 +1,171 @@ +echo 7/tcp +echo 7/udp +discard 9/tcp +discard 9/udp +daytime 13/tcp +daytime 13/udp +netstat 15/tcp +chargen 19/tcp +chargen 19/udp +ftp-data 20/tcp +ftp 21/tcp +ssh 22/tcp +ssh 22/udp +telnet 23/tcp +smtp 25/tcp +time 37/tcp +time 37/udp +whois 43/tcp +domain 53/tcp +domain 53/udp +bootps 67/tcp +bootps 67/udp +bootpc 68/tcp +bootpc 68/udp +tftp 69/udp +finger 79/tcp +www 80/tcp http +kerberos 88/tcp kerberos5 krb5 kerberos-sec +kerberos 88/udp kerberos5 krb5 kerberos-sec +pop3 110/tcp +pop3 110/udp +sunrpc 111/tcp +sunrpc 111/udp +auth 113/tcp ident +sftp 115/tcp +nntp 119/tcp +ntp 123/tcp +ntp 123/udp +netbios-ns 137/tcp +netbios-ns 137/udp +netbios-dgm 138/tcp +netbios-dgm 138/udp +netbios-ssn 139/tcp +netbios-ssn 139/udp +imap2 143/tcp imap +imap2 143/udp imap +snmp 161/tcp +snmp 161/udp +snmp-trap 162/tcp snmptrap +snmp-trap 162/udp snmptrap +xdmcp 177/tcp +xdmcp 177/udp +bgp 179/tcp +bgp 179/udp +imap3 220/tcp +imap3 220/udp +ldap 389/tcp +ldap 389/udp +https 443/tcp +https 443/udp +microsoft-ds 445/tcp +microsoft-ds 445/udp +isakmp 500/tcp +isakmp 500/udp +rtsp 554/tcp +rtsp 554/udp +ipp 631/tcp +ipp 631/udp +syslog 514/udp +printer 515/tcp spooler +dhcpv6-client 546/tcp +dhcpv6-client 546/udp +dhcpv6-server 547/tcp +dhcpv6-server 547/udp +afpovertcp 548/tcp +afpovertcp 548/udp +nntps 563/tcp snntp +nntps 563/udp snntp +ldaps 636/tcp +ldaps 636/udp +tinc 655/tcp +tinc 655/udp +rsync 873/tcp +rsync 873/udp +ftps-data 989/tcp +ftps 990/tcp +imaps 993/tcp +imaps 993/udp +ircs 994/tcp +ircs 994/udp +pop3s 995/tcp +pop3s 995/udp +socks 1080/tcp +socks 1080/udp +openvpn 1194/tcp +openvpn 1194/udp +l2f 1701/tcp l2tp +l2f 1701/udp l2tp +radius 1812/tcp +radius 1812/udp +radius-acct 1813/tcp radacct +radius-acct 1813/udp radacct +nfs 2049/tcp +nfs 2049/udp +dict 2628/tcp +dict 2628/udp +gpsd 2947/tcp +gpsd 2947/udp +icpv2 3130/tcp icp +icpv2 3130/udp icp +mysql 3306/tcp +mysql 3306/udp +nut 3493/tcp +nut 3493/udp +distcc 3632/tcp +distcc 3632/udp +daap 3689/tcp +daap 3689/udp +svn 3690/tcp subversion +svn 3690/udp subversion +epmd 4369/tcp +epmd 4369/udp +iax 4569/tcp +iax 4569/udp +mtn 4691/tcp +mtn 4691/udp +munin 4949/tcp +sip 5060/tcp +sip 5060/udp +sip-tls 5061/tcp +sip-tls 5061/udp +xmpp-client 5222/tcp jabber-client +xmpp-client 5222/udp jabber-client +xmpp-server 5269/tcp jabber-server +xmpp-server 5269/udp jabber-server +mdns 5353/tcp +mdns 5353/udp +postgresql 5432/tcp postgres +postgresql 5432/udp postgres +x11 6000/tcp +x11 6000/udp +mysql-proxy 6446/tcp +mysql-proxy 6446/udp +bacula-dir 9101/tcp +bacula-dir 9101/udp +bacula-fd 9102/tcp +bacula-fd 9102/udp +bacula-sd 9103/tcp +bacula-sd 9103/udp +nbd 10809/tcp +zabbix-agent 10050/tcp +zabbix-agent 10050/udp +zabbix-trapper 10051/tcp +zabbix-trapper 10051/udp +hkp 11371/tcp +hkp 11371/udp +ssmtp 465/tcp smtps +spamd 783/tcp +zebrasrv 2600/tcp +zebra 2601/tcp +ripd 2602/tcp +ripngd 2603/tcp +ospfd 2604/tcp +bgpd 2605/tcp +ospf6d 2606/tcp +ospfapi 2607/tcp +isisd 2608/tcp +sane-port 6566/tcp sane saned +ircd 6667/tcp +git 9418/tcp + diff --git a/lg_webOS/base-files/ipk/etc/shadow b/lg_webOS/base-files/ipk/etc/shadow new file mode 100644 index 0000000..4b4154f --- /dev/null +++ b/lg_webOS/base-files/ipk/etc/shadow @@ -0,0 +1,5 @@ +root::0:0:99999:7::: +daemon:*:0:0:99999:7::: +ftp:*:0:0:99999:7::: +network:*:0:0:99999:7::: +nobody:*:0:0:99999:7::: diff --git a/lg_webOS/base-files/ipk/etc/shells b/lg_webOS/base-files/ipk/etc/shells new file mode 100644 index 0000000..006aa38 --- /dev/null +++ b/lg_webOS/base-files/ipk/etc/shells @@ -0,0 +1 @@ +/bin/ash diff --git a/lg_webOS/base-files/ipk/etc/sysctl.conf b/lg_webOS/base-files/ipk/etc/sysctl.conf new file mode 100644 index 0000000..8f3de1a --- /dev/null +++ b/lg_webOS/base-files/ipk/etc/sysctl.conf @@ -0,0 +1,29 @@ +kernel.panic=3 +net.ipv4.conf.default.arp_ignore=1 +net.ipv4.conf.all.arp_ignore=1 +net.ipv4.ip_forward=1 +net.ipv4.icmp_echo_ignore_broadcasts=1 +net.ipv4.icmp_ignore_bogus_error_responses=1 +net.ipv4.igmp_max_memberships=100 +net.ipv4.tcp_ecn=0 +net.ipv4.tcp_fin_timeout=30 +net.ipv4.tcp_keepalive_time=120 +net.ipv4.tcp_syncookies=1 +net.ipv4.tcp_timestamps=1 +net.ipv4.tcp_sack=1 +net.ipv4.tcp_dsack=1 + +net.ipv6.conf.default.forwarding=1 +net.ipv6.conf.all.forwarding=1 + +net.netfilter.nf_conntrack_acct=1 +net.netfilter.nf_conntrack_checksum=0 +net.netfilter.nf_conntrack_max=16384 +net.netfilter.nf_conntrack_tcp_timeout_established=7440 +net.netfilter.nf_conntrack_udp_timeout=60 +net.netfilter.nf_conntrack_udp_timeout_stream=180 + +# disable bridge firewalling by default +net.bridge.bridge-nf-call-arptables=0 +net.bridge.bridge-nf-call-ip6tables=0 +net.bridge.bridge-nf-call-iptables=0 diff --git a/lg_webOS/base-files/ipk/etc/sysupgrade.conf b/lg_webOS/base-files/ipk/etc/sysupgrade.conf new file mode 100644 index 0000000..e06fd5e --- /dev/null +++ b/lg_webOS/base-files/ipk/etc/sysupgrade.conf @@ -0,0 +1,5 @@ +## This file contains files and directories that should +## be preserved during an upgrade. + +# /etc/example.conf +# /etc/openvpn/ diff --git a/lg_webOS/base-files/ipk/etc/uci-defaults/10_migrate-shadow b/lg_webOS/base-files/ipk/etc/uci-defaults/10_migrate-shadow new file mode 100644 index 0000000..b7ea571 --- /dev/null +++ b/lg_webOS/base-files/ipk/etc/uci-defaults/10_migrate-shadow @@ -0,0 +1,12 @@ +#!/bin/sh + +local ppwd="$(sed -ne '/^root:/s/^root:\([^:]*\):.*$/\1/p' /etc/passwd)" +local spwd="$(sed -ne '/^root:/s/^root:\([^:]*\):.*$/\1/p' /etc/shadow)" + +if [ -n "${ppwd#[\!x]}" ] && [ -z "${spwd#[\!x]}" ]; then + logger -t migrate-shadow "Moving root password hash into shadow database" + sed -i -e "s:^root\:[^\:]*\::root\:x\::" /etc/passwd + sed -i -e "s:^root\:[^\:]*\::root\:$ppwd\::" /etc/shadow +fi + +exit 0 diff --git a/lg_webOS/base-files/ipk/etc/uci-defaults/11_migrate-sysctl b/lg_webOS/base-files/ipk/etc/uci-defaults/11_migrate-sysctl new file mode 100644 index 0000000..464e275 --- /dev/null +++ b/lg_webOS/base-files/ipk/etc/uci-defaults/11_migrate-sysctl @@ -0,0 +1,16 @@ +#!/bin/sh + +if [ ! -f "/rom/etc/sysctl.conf" ] || cmp -s "/rom/etc/sysctl.conf" "/etc/sysctl.conf"; then + exit 0 +fi + +fingerprint="$(md5sum /etc/sysctl.conf)" +fingerprint="${fingerprint%% *}" + +if [ "$fingerprint" = "1b05ebb41f72cb84e5510573cd4aca26" ] || \ + [ "$fingerprint" = "62deb895be1a7f496040187b7c930e4e" ]; then + logger -t migrate-sysctl "Updating sysctl.conf to use current defaults" + cp "/rom/etc/sysctl.conf" "/etc/sysctl.conf" +fi + +exit 0 diff --git a/lg_webOS/base-files/ipk/etc/uci-defaults/12_network-generate-ula b/lg_webOS/base-files/ipk/etc/uci-defaults/12_network-generate-ula new file mode 100644 index 0000000..8871427 --- /dev/null +++ b/lg_webOS/base-files/ipk/etc/uci-defaults/12_network-generate-ula @@ -0,0 +1,15 @@ +#!/bin/sh + +[ "$(uci -q get network.globals.ula_prefix)" != "auto" ] && exit 0 + +r1=$(dd if=/dev/urandom bs=1 count=1 |hexdump -e '1/1 "%02x"') +r2=$(dd if=/dev/urandom bs=2 count=1 |hexdump -e '2/1 "%02x"') +r3=$(dd if=/dev/urandom bs=2 count=1 |hexdump -e '2/1 "%02x"') + +uci -q batch <<-EOF >/dev/null + set network.globals.ula_prefix=fd$r1:$r2:$r3::/48 + commit network +EOF + +exit 0 + diff --git a/lg_webOS/base-files/ipk/init b/lg_webOS/base-files/ipk/init new file mode 100755 index 0000000..514be57 --- /dev/null +++ b/lg_webOS/base-files/ipk/init @@ -0,0 +1,4 @@ +#!/bin/sh +# Copyright (C) 2006 OpenWrt.org +export INITRAMFS=1 +exec /sbin/init diff --git a/lg_webOS/base-files/ipk/lib/functions.sh b/lg_webOS/base-files/ipk/lib/functions.sh new file mode 100755 index 0000000..8d045fa --- /dev/null +++ b/lg_webOS/base-files/ipk/lib/functions.sh @@ -0,0 +1,322 @@ +#!/bin/sh +# Copyright (C) 2006-2014 OpenWrt.org +# Copyright (C) 2006 Fokus Fraunhofer +# Copyright (C) 2010 Vertical Communications + + +debug () { + ${DEBUG:-:} "$@" +} + +# newline +N=" +" + +_C=0 +NO_EXPORT=1 +LOAD_STATE=1 +LIST_SEP=" " + +append() { + local var="$1" + local value="$2" + local sep="${3:- }" + + eval "export ${NO_EXPORT:+-n} -- \"$var=\${$var:+\${$var}\${value:+\$sep}}\$value\"" +} + +list_contains() { + local var="$1" + local str="$2" + local val + + eval "val=\" \${$var} \"" + [ "${val%% $str *}" != "$val" ] +} + +config_load() { + [ -n "$IPKG_INSTROOT" ] && return 0 + uci_load "$@" +} + +reset_cb() { + config_cb() { return 0; } + option_cb() { return 0; } + list_cb() { return 0; } +} +reset_cb + +package() { + return 0 +} + +config () { + local cfgtype="$1" + local name="$2" + + export ${NO_EXPORT:+-n} CONFIG_NUM_SECTIONS=$(($CONFIG_NUM_SECTIONS + 1)) + name="${name:-cfg$CONFIG_NUM_SECTIONS}" + append CONFIG_SECTIONS "$name" + [ -n "$NO_CALLBACK" ] || config_cb "$cfgtype" "$name" + export ${NO_EXPORT:+-n} CONFIG_SECTION="$name" + export ${NO_EXPORT:+-n} "CONFIG_${CONFIG_SECTION}_TYPE=$cfgtype" +} + +option () { + local varname="$1"; shift + local value="$*" + + export ${NO_EXPORT:+-n} "CONFIG_${CONFIG_SECTION}_${varname}=$value" + [ -n "$NO_CALLBACK" ] || option_cb "$varname" "$*" +} + +list() { + local varname="$1"; shift + local value="$*" + local len + + config_get len "$CONFIG_SECTION" "${varname}_LENGTH" 0 + [ $len = 0 ] && append CONFIG_LIST_STATE "${CONFIG_SECTION}_${varname}" + len=$(($len + 1)) + config_set "$CONFIG_SECTION" "${varname}_ITEM$len" "$value" + config_set "$CONFIG_SECTION" "${varname}_LENGTH" "$len" + append "CONFIG_${CONFIG_SECTION}_${varname}" "$value" "$LIST_SEP" + list_cb "$varname" "$*" +} + +config_unset() { + config_set "$1" "$2" "" +} + +# config_get