Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • ffnw-firmware/packages
  • pic/packages
  • PowerPan/packages
  • floh1111/packages
4 results
Show changes
Commits on Source (856)
Showing
with 143 additions and 568 deletions
# swap
[._]*.s[a-v][a-z]
[._]*.sw[a-p]
[._]s[a-v][a-z]
[._]sw[a-p]
# session
Session.vim
# temporary
.netrwhist
*~
# auto-generated tag files
tags
return tonumber(fs.readfile('/tmp/luftdruck'))
return tonumber(fs.readfile('/tmp/temperatur'))
#
# Copyright (C) 2012 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=ath9k-watchdog
PKG_VERSION:=1
PKG_RELEASE:=1
include $(INCLUDE_DIR)/package.mk
define Package/ath9k-watchdog
SECTION:=utils
CATEGORY:=Utilities
TITLE:=Watchdog for ath9k-outages
endef
define Package/ath9k-watchdog/description
If pattern "ResetWLAN" is seen in the logs, wifi reset is executed
endef
define Package/ath9k-watchdog/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) files/ath9k-watchdog $(1)/usr/sbin/
$(INSTALL_BIN) files/ath9k-watchdog-pm $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_DIR) $(1)/etc/init.d/
$(INSTALL_BIN) files/ath9k-watchdog.init $(1)/etc/init.d/ath9k-watchdog
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef
define Build/Configure
endef
define Build/Compile
endef
$(eval $(call BuildPackage,ath9k-watchdog))
#!/bin/sh
mkdir -p /usr/lib/ath9k-watchdog
logread -f | while read line
do
case "$line" in
*"Could not stop RX"*)
hostname=$(cat /proc/sys/kernel/hostname)
if [ "$hostname" == "OpenWrt" ]; then
hostname=""
fi
if [ "$hostname" == "" ]; then
hostname=$(awk '{ if (mac) next; mac=toupper($1); gsub(":", "", mac); print mac }' /sys/class/net/br-mesh/address /sys/class/net/eth0/address /sys/class/net/ath0/address 2>/dev/null)
fi
# Perform post-mortem dump
tstmp=$(/bin/date +%s)
echo -n "data[hostname]=${hostname}&data[tstmp]=${tstmp}" > /tmp/$tstmp
# Move into upload directory
mv /tmp/$tstmp /usr/lib/ath9k-watchdog
#Bye
/sbin/reboot
;;
*)
;;
esac
done
#!/bin/sh
# Save log
mkdir -p /usr/lib/ath9k-watchdog
WGETC=$(which wget)
# CD to avoid annoying prefixes
cd /usr/lib/ath9k-watchdog
#Poll directory every 60 secs
while [ 1 = 1 ]
do
if [ "$(ls .)" != "" ]
then
UPLOAD_URL="http://[$(uci get configurator.@api[0].ipv6_address)%$(uci get configurator.@api[0].ipv6_interface)]/api/rest/event/"
for f in $(ls .); do
$WGETC -q $UPLOAD_URL"?api_key=$(uci get configurator.@api[0].api_key)&object=router&object_id="$(uci get configurator.@crawl[0].router_id)"&action=watchdog_ath9k_bug&"$(cat $f) -O - && rm $f
done
# If there are more than 15 files, assume that files cannot be uploaded
# Delete oldest files in order to avoid jffs-overflow
ls -t | sed -e '1,15d' | xargs rm 2> /dev/null
fi
sleep 60
done
#!/bin/sh /etc/rc.common
START=95
APP=ath9k-watchdog
POSTM=ath9k-watchdog-pm
PID_FILE=/var/run/$APP.pid
POSTM_PID_FILE=/var/run/$POSTM.pid
start() {
if [ -f $PID_FILE ]; then
echo "Ath9k-watchdog: Already Running"
else
start-stop-daemon -S -x $APP -p $PID_FILE -m -b
fi
if [ -f $POSTM_PID_FILE ]; then
echo "ath9k-watchdog-pm: Already Running"
else
start-stop-daemon -S -x $POSTM -p $POSTM_PID_FILE -m -b
fi
}
stop() {
start-stop-daemon -K -n $APP -p $PID_FILE -s TERM
start-stop-daemon -K -n $POSTM -p $POSTM_PID_FILE -s TERM
rm -rf $PID_FILE
rm -rf $POSTM_PID_FILE
}
\ No newline at end of file
include $(TOPDIR)/rules.mk
PKG_NAME:=ffnw-autoupdater-mod
PKG_VERSION:=1
PKG_RELEASE:=1
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk
define Package/ffnw-autoupdater-mod
SECTION:=Daemon
CATEGORY:=Freifunk Nordwest
TITLE:=custom autoupdater special for batman upgrade
endef
define Package/ffnw-autoupdater-mod/description
custom autoupdater special for batman upgrade
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef
define Build/Configure
endef
define Build/Compile
endef
define Package/ffnw-autoupdater-mod/install
$(INSTALL_DIR) $(1)/lib/gluon/cron/
$(INSTALL_DATA) files/lib/gluon/cron/autoupdater-mod $(1)/lib/gluon/cron/
$(INSTALL_DIR) $(1)/lib/ffnw/autoupdater-mod/
$(INSTALL_BIN) files/lib/ffnw/autoupdater-mod/* $(1)/lib/ffnw/autoupdater-mod/
endef
$(eval $(call BuildPackage,ffnw-autoupdater-mod))
#!/usr/bin/lua
local fs = require('luci.fs')
local nixio = require('nixio')
local platform_info = require('platform_info')
local uci = require('luci.model.uci').cursor()
local util = require('luci.util')
local autoupdater_util = require('autoupdater.util')
local autoupdater_version = require('autoupdater.version')
local pidPath="/var/run/autoupdater.pid"
local direct_vpn= false
local mesh_lan = false
if io.open(pidPath, "r") ~=nil then
io.stderr:write("The autoupdater is still running.\n")
os.exit(1)
else
local pidf = io.open(pidPath, "w")
io.close(pidf)
end
function pid_clean()
if io.open(pidPath, "r") ~=nil then
os.remove(pidPath)
end
return 0
end
function wait(seconds)
local start = os.time()
repeat until os.time() > start + seconds
end
local foreach_count=1
for originator in io.popen(string.format("cat /sys/kernel/debug/batman_adv/bat0/originators"), 'r'):lines() do
if foreach_count > 2 then
if string.find(originator,"vpn") ~= nil then
direct_vpn=true
end
if string.find(originator,"eth") ~= nil then
mesh_lan = true
end
end
foreach_count = foreach_count + 1
end
if not platform_info.get_image_name() then
io.stderr:write("The autoupdater doesn't support this hardware model.\n")
pid_clean()
os.exit(1)
end
autoupdater_util.randomseed()
local settings = uci:get_all('autoupdater', 'settings')
local branch = uci:get_all('autoupdater', settings.branch)
local old_version = util.trim(fs.readfile(settings.version_file) or '')
-- If force is true the updater will perform an upgrade regardless of
-- the priority and even when it is disabled in uci
local force = false
if settings.enabled ~= '1' and not force then
io.stderr:write('autoupdater is disabled.\n')
pid_clean()
os.exit(0)
end
-- Verifies a file given as a list of lines with a list of signatures using ecdsaverify
local function verify_lines(lines, sigs)
local command = string.format('ecdsaverify -n %i', branch.good_signatures)
-- Build command line from sigs and branch.pubkey
for _, sig in ipairs(sigs) do
if sig:match('^' .. string.rep('%x', 128) .. '$') then
command = command .. ' -s ' .. sig
end
end
for _, key in ipairs(branch.pubkey) do
if key:match('^' .. string.rep('%x', 64) .. '$') then
command = command .. ' -p ' .. key
end
end
-- Call ecdsautils
local pid, f = autoupdater_util.popen(command)
for _, line in ipairs(lines) do
f:write(line)
f:write('\n')
end
f:close()
local wpid, status, code = nixio.waitpid(pid)
return wpid and status == 'exited' and code == 0
end
-- Downloads, parses and verifies the update manifest from a mirror
-- Returns a table with the fields version, checksum and filename if everything is ok, nil otherwise
local function read_manifest(mirror)
local sep = false
local lines = {}
local sigs = {}
local branch_ok = false
local ret = {}
-- Read all lines from the manifest
-- The upper part is saves to lines, the lower part to sigs
for line in io.popen(string.format("wget -O- '%s/%s.manifest'", mirror, branch.name), 'r'):lines() do
if not sep then
if line == '---' then
sep = true
else
table.insert(lines, line)
if line == ('BRANCH=' .. branch.name) then
branch_ok = true
end
local date = line:match('^DATE=(.+)$')
local priority = line:match('^PRIORITY=([%d%.]+)$')
local model, version, checksum, filename = line:match('^([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+)$')
if date then
ret.date = autoupdater_util.parse_date(date)
elseif priority then
ret.priority = tonumber(priority)
elseif model == platform_info.get_image_name() then
ret.version = version
ret.checksum = checksum
ret.filename = filename
end
end
else
table.insert(sigs, line)
end
end
-- Do some very basic checks before checking the signatures
-- (as the signature verification is computationally expensive)
if not sep then
io.stderr:write('There seems to have gone something wrong downloading the manifest from ' .. mirror .. '\n')
return nil
end
if not ret.date or not ret.priority then
io.stderr:write('The manifest downloaded from ' .. mirror .. ' is invalid (DATE or PRIORITY missing)\n')
return nil
end
if not branch_ok then
io.stderr:write('Wrong branch. We are on ', branch.name, '.\n')
return nil
end
if not ret.version then
io.stderr:write('No matching firmware found (model ' .. platform_info.get_image_name() .. ')\n')
return nil
end
if not verify_lines(lines, sigs) then
io.stderr:write('Not enough valid signatures!\n')
return nil
end
return ret
end
-- Downloads the firmware image from a mirror to a given output file
local function fetch_firmware(mirror, filename, output)
if os.execute(string.format("wget -O '%s' '%s/%s'", output, mirror, filename)) ~= 0 then
io.stderr:write('Error downloading the image from ' .. mirror .. '\n')
return false
end
return true
end
-- Tries to perform an update from a given mirror
local function autoupdate(mirror)
local manifest = read_manifest(mirror)
if not manifest then
return false
end
if not autoupdater_version.newer_than(manifest.version, old_version) then
io.stderr:write('No new firmware available.\n')
return true
end
io.stderr:write('New version available.\n')
os.execute('sync; sysctl -w vm.drop_caches=3')
collectgarbage()
local image = os.tmpname()
if not fetch_firmware(mirror, manifest.filename, image) then
return false
end
local checksum = util.exec(string.format("sha512sum '%s'", image)):match('^%x+')
if checksum ~= manifest.checksum then
io.stderr:write('Invalid image checksum!\n')
os.remove(image)
return false
end
if direct_vpn == true then
wait(28800) -- Wait for 8h
elseif mesh_lan == true then
wait(21600) -- Wait for 6h
else
wait(14400) -- Wait for 4h
end
io.stderr:write('Upgrading firmware...\n')
local null = nixio.open('/dev/null', 'w+')
if null then
nixio.dup(null, nixio.stdin)
nixio.dup(null, nixio.stderr)
if null:fileno() > 2 then
null:close()
end
end
nixio.exec('/sbin/sysupgrade', image)
-- This should never be reached as nixio.exec replaces the autoupdater process unless /sbin/sysupgrade can't be executed
-- We output the error message through stdout as stderr isn't available anymore
io.write('Failed to call sysupgrade?\n')
os.remove(image)
pid_clean()
os.exit(1)
end
local mirrors = branch.mirror
while #mirrors > 0 do
local mirror = table.remove(mirrors, math.random(#mirrors))
if autoupdate(mirror) then
pid_clean()
os.exit(0)
end
end
io.stderr:write('No usable mirror found.\n')
pid_clean()
os.exit(1)
*/30 * * * * /usr/sbin/autoupdater
#!/bin/sh
cleanup () {
rm -rf /lib/gluon/cron/autoupdater-mod
rm -rf /lib/ffnw/autoupdater-mod
}
find /usr/sbin/ -name "autoupdater"
if [ $? -eq 0 ]; then
mv /lib/ffnw/autoupdater-mod/autoupdater /usr/sbin/autoupdater
mv /lib/ffnw/autoupdater-mod/autoupdater-cron /lib/gluon/cron/autoupdater
cleanup
else
cleanup
fi
*/5 * * * * sh /lib/ffnw/autoupdater-mod/autoupdater-mod.sh
include $(TOPDIR)/rules.mk
PKG_NAME:=ffnw-banner
PKG_VERSION:=1
PKG_RELEASE:=1
PKG_VERSION:=2
PKG_RELEASE:=$(GLUON_VERSION)
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk
include $(TOPDIR)/../package/gluon.mk
define Package/ffnw-banner
SECTION:=config
SECTION:= network
CATEGORY:=Freifunk Nordwest
TITLE:=Nordwest freifunk shell banner
MAINTAINER:=Freifunk Nordwest <tarek@ring0.de>
URL:=https://git.nordwest.freifunk.net/ffnw/packages
SOURCE:=git@git.nordwest.freifunk.net:ffnw/packages.git
endef
define Package/ffnw-banner/description
......@@ -29,43 +26,12 @@ define Build/Configure
endef
define Build/Compile
endef
define Package/ffnw-banner/preinst
#!/bin/sh
cd "$${IPKG_INSTROOT}/etc/"
if [ -h "./banner" ] ; then
/bin/rm "./banner"
elif [ -f "./banner" ] ; then
/bin/mv "./banner" "/tmp/banner.openwrt"
fi
/bin/ln -s "/tmp/banner.openwrt" "/etc/banner"
exit 0
endef
define Package/ffnw-banner/postinst
#!/bin/sh
cd "$${IPKG_INSTROOT}/etc/"
[ -h "./banner" ] && /bin/rm -f "./banner"
/bin/mv "./banner.ffnw" "./banner"
exit $$?
endef
define Package/ffnw-banner/prerm
#!/bin/sh
cd "$${IPKG_INSTROOT}/etc/"
if [ -h "./banner" ] ; then
[[ "$$(readlink -n ./banner)" == "./banner.ffnw" ]] && \
/bin/rm -f "./banner" && \
[ -f "/tmp/banner.openwrt" ] && \
/bin/ln -s "./banner.openwrt" "./banner"
fi
exit 0
$(call GluonSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/)
endef
define Package/ffnw-banner/install
$(INSTALL_DIR) $(1)/etc/
$(INSTALL_DATA) files/etc/banner.ffnw $(1)/etc/
$(CP) ./files/* $(1)/
$(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/
endef
$(eval $(call BuildPackage,ffnw-banner))
_______ __ ___ __
| ___|.----.-----.|__|.' _|.--.--.-----.| |--.
| ___|| _| -__|| || _|| | | || <
|___| |__| |_____||__||__| |_____|__|__||__|__|
_______ __ Freie Netze Fuer alle! __
| | |.-----.----.--| |.--.--.--.-----.-----.| |_
| || _ | _| _ || | | | -__|__ --|| _|
|__|____||_____|__| |_____||________|_____|_____||____|
#######################################################
_______ ________ __
| |.-----.-----.-----.| | | |.----.| |_
| - || _ | -__| || | | || _|| _|
|_______|| __|_____|__|__||________||__| |____|
|__| W I R E L E S S F R E E D O M
-----------------------------------------------------
BARRIER BREAKER (Barrier Breaker, r43483)
-----------------------------------------------------
_______ __ ___ __
| ___|.----.-----.|__|.' _|.--.--.-----.| |--.
| ___|| _| -__|| || _|| | | || <
|___| |__| |_____||__||__| |_____|__|__||__|__|
_______ __ Freie Netze fuer alle! __
| | |.-----.----.--| |.--.--.--.-----.-----.| |_
| || _ | _| _ || | | | -__|__ --|| _|
|__|____||_____|__| |_____||________|_____|_____||____|
##############################################################################
_______ ________ __
| |.-----.-----.-----.| | | |.----.| |_
| - || _ | -__| || | | || _|| _|
|_______|| __|_____|__|__||________||__| |____|
|__| W I R E L E S S F R E E D O M
------------------------------------------------------------------------------
%A
%B
%C
%D
------------------------------------------------------------------------------
#!/bin/sh
rm /etc/banner
touch /tmp/ffnw-banner
ln -s /tmp/ffnw-banner /etc/banner
lua /usr/sbin/ffnw-banner
\ No newline at end of file
*/5 * * * * lua /usr/sbin/ffnw-banner
#!/usr/bin/lua
local unistd = require 'posix.unistd'
local has_fastd = unistd.access('/lib/gluon/mesh-vpn/provider/fastd')
local has_tunneldigger = unistd.access('/lib/gluon/mesh-vpn/provider/tunneldigger')
local srcFile = "/lib/ffnw/banner/banner"
local desFile = "/tmp/ffnw-banner"
local uci = require('simple-uci').cursor()
local json = require 'jsonc'
os.execute('cp '..srcFile..' '..desFile)
-- Read the full domainfile. Return nil for wrong format or no such file
local function readdomainfile(file)
local jdomain = io.open(file, 'r')
if not jdomain then return nil end
local obj, _, err = json.parse (jdomain:read('*a'), 1, nil)
if err then
return nil
else
return obj
end
end
local openwrtRelease = io.open("/etc/openwrt_release", "r")
local gluonVersion = io.open("/lib/gluon/gluon-version", "r")
local gluonRelease = io.open("/lib/gluon/release", "r")
local infoHeader = {}
infoHeader["openwrtRelease"] = ""
infoHeader["revision"] = ""
infoHeader["gluonVersion"] = ""
infoHeader["gluonRelease"] = ""
infoHeader["domain"] = ""
infoHeader["HWmodel"] = require("platform_info").get_model()
infoHeader["vpn"] = ""
local domaincode = uci:get('gluon', 'core', 'domain')
if domaincode ~= nil then
local domain = readdomainfile("/lib/gluon/domains/" .. domaincode .. ".json")
if domain ~= nil then
infoHeader["domain"] = domain["domain_names"][domaincode]
end
end
if openwrtRelease~=nil then
for line in openwrtRelease:lines() do
-- Get openwrtRelease
if line:match("DISTRIB_DESCRIPTION") then
for v in string.gmatch(line, "([^=]+)") do
if not v:match("DISTRIB_DESCRIPTION") then
infoHeader["openwrtRelease"] = string.gsub(v,"'","")
end
end
end
-- Get openwrt revision
if line:match("DISTRIB_REVISION") then
for v in string.gmatch(line, "([^=]+)") do
if not v:match("DISTRIB_REVISION") then
infoHeader["revision"] = string.gsub(v,"'","")
end
end
end
end
end
if gluonVersion~=nil then
for line in gluonVersion:lines() do
if line ~= nil then
infoHeader["gluonVersion"] = line
end
end
end
if gluonRelease~=nil then
for line in gluonRelease:lines() do
if line ~= nil then
infoHeader["gluonRelease"] = line
end
end
end
if has_tunneldigger then
infoHeader["vpn"] = "l2tp"
elseif has_fastd then
infoHeader["vpn"] = "fastd"
else infoHeader["vpn"] = "unknown"
end
local firstLine =infoHeader["openwrtRelease"]
local secondLine ="Gluon Version: " .. infoHeader["gluonVersion"] .. " Gluon Release: " .. infoHeader["gluonRelease"]
local thirdLine = "Hardware model: " .. infoHeader["HWmodel"] .. " vpn: " .. infoHeader["vpn"]
local forthLine = "Domain: " .. infoHeader["domain"]
os.execute('sed -i \'/%A/c\\' .. firstLine .. '\' ' .. desFile)
os.execute('sed -i \'/%B/c\\' .. secondLine .. '\' ' .. desFile)
os.execute('sed -i \'/%C/c\\' .. thirdLine .. '\' ' .. desFile)
os.execute('sed -i \'/%D/c\\' .. forthLine .. '\' ' .. desFile)
include $(TOPDIR)/rules.mk
PKG_NAME:=ffnw-configurator
PKG_VERSION:=1
PKG_RELEASE:=1
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk
define Package/ffnw-configurator
SECTION:=daemon
CATEGORY:=Freifunk Nordwest
TITLE:=Registers node on netmon
endef
define Package/ffnw-configurator/description
Registers node on netmon
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef
define Build/Configure
endef
define Build/Compile
endef
define Package/ffnw-configurator/install
$(INSTALL_DIR) $(1)/lib/gluon/cron/
$(INSTALL_DATA) files/lib/gluon/cron/configurator $(1)/lib/gluon/cron/configurator
$(INSTALL_DIR) $(1)/lib/ffnw/configurator/
$(INSTALL_BIN) files/lib/ffnw/configurator/configurator.sh $(1)/lib/ffnw/configurator/
$(INSTALL_DIR) $(1)/etc/config/
$(INSTALL_CONF) files/configurator.config $(1)/etc/config/configurator
endef
$(eval $(call BuildPackage,ffnw-configurator))
config 'script'
option 'error_level' '0'
option 'logfile' '/var/log/configurator.log'
option 'version' '1'
option 'sync_hostname' '1'
config 'api'
option 'ipv4_address' '1'
option 'ipv6_interface' 'br-client'
option 'ipv6_address' 'netmon.ffnw'
option 'timeout' '5'
option 'retry' '5'
option 'api_key' '1'
config 'crawl'
option 'method' 'hash'
option 'nickname' '1'
option 'password' '1'
option 'login_string' '1'
option 'router_id' '1'
option 'update_hash' '1'
config 'netmon'
option 'autoadd_ipv6_address' '1'