Browse Source

tossing sys files

Danja Vasiliev 10 years ago
parent
commit
97a91d2bf5

+ 17 - 15
debian/etc/lighttpd/lighttpd.conf

@@ -14,6 +14,7 @@ server.modules = (
 )
 
 server.document-root = "/www/htdocs"
+#server.document-root = "/home/danja/www/merz/"
 server.upload-dirs = ( "/tmp" )
 server.errorlog = "/tmp/lighttpd-error.log"
 accesslog.filename = "/tmp/lighttpd-access.log"
@@ -27,7 +28,7 @@ include_shell "/etc/lighttpd/vars.sh"
 
 setenv.add-response-header = ( "X-SuperGlue-Version" => var.superglueVersion )
 
-#debug.log-request-handling = "enable"
+debug.log-request-handling = "enable"
 #debug.log-request-header = "enable"
 #debug.log-file-not-found	= "enable"
 #debug.log-request-header-on-error = "enable"
@@ -44,14 +45,15 @@ compress.filetype = ( "application/x-javascript", "text/css", "text/html", "text
 
 index-file.names = ( "index.html", "default.html" )
 
-cgi.assign = ( ".sh" => "/bin/bash" )
+#cgi.assign = ( ".sh" => "/bin/bash" )
+cgi.assign = ( ".cgi" => "" )
 url.access-deny = ( "~", ".inc", ".htaccess", ".htpasswd", "htpasswd")
 
 $HTTP["request-method"] == "GET" {
   url.rewrite = ( "^/resources/(.*)$" => "resources/$1",
                   "^/devTools/(.*)$" => "devTools/$1",
                   "^/templates/(.*)$" => "templates/$1",
-                  "^/admin/(.*)$" => "admin/admin.sh" )
+                  "^/admin/(.*)$" => "admin/admin.cgi" )
 
   alias.url = ( "/resources" => "/www/lib/resources",
                 "/devTools" => "/www/lib/devTools",
@@ -60,24 +62,24 @@ $HTTP["request-method"] == "GET" {
 }
 
 $HTTP["request-method"] == "POST" {
-  url.rewrite = ( "^(/(?!admin).*)" => "post.sh",
-                  "^(/(admin).*)" => "admin.sh" 
+  url.rewrite = ( "^(/(?!admin).*)" => "post.cgi",
+                  "^(/(admin).*)" => "admin.cgi" 
   )
-  $HTTP["url"] =~ "^/post.sh" {
+  $HTTP["url"] =~ "^/post.cgi" {
     server.document-root = "/www/lib/cgi"
   }
-  $HTTP["url"] =~ "^/admin.sh" {
+  $HTTP["url"] =~ "^/admin.cgi" {
     server.document-root = "/www/lib/admin"
    }
 }
 
-auth.require = ( 
-  "/post.sh" => ( "method" => "digest", 
-                  "realm" => "superglue", 
-                  "require" => "valid-user" ),
-  "/admin" => ( "method" => "digest", 
-                  "realm" => "superglue", 
-                  "require" => "valid-user" )
-  )
+#auth.require = ( 
+#  "/post.sh" => ( "method" => "digest", 
+#                  "realm" => "superglue", 
+#                  "require" => "valid-user" ),
+#  "/admin" => ( "method" => "digest", 
+#                  "realm" => "superglue", 
+#                  "require" => "valid-user" )
+#  )
 
 include "/etc/lighttpd/mime.conf"

BIN
openwrt/.make_fw.sh.swo


BIN
openwrt/.make_fw.sh.swp


+ 19 - 0
openwrt/WRT160NL/etc/config/system

@@ -0,0 +1,19 @@
+
+config system
+	option hostname 'superglue'
+  ## Made in Berlin
+	option timezone 'CET-1CEST'
+
+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'
+
+config led 'led_wlan'
+	option name 'WLAN'
+	option sysfs 'wrt160nl:blue:wlan'
+	option trigger 'phy0tpt'
+

+ 1 - 1
openwrt/common/etc/config/dhcp

@@ -6,7 +6,7 @@ config dnsmasq
 	option localise_queries '1'
 	option rebind_protection '1'
 	option rebind_localhost '1'
-	option local '/home/'
+	option local '/local/'
 	option domain 'home'
 	option expandhosts '1'
 	option nonegcache '0'

+ 9 - 4
openwrt/common/etc/lighttpd/lighttpd.conf

@@ -15,8 +15,8 @@ server.modules = (
 
 server.document-root = "/www/htdocs"
 server.upload-dirs = ( "/www/htdocs/tmp" )
-server.errorlog = "/www/htdocs/log/error.log"
-accesslog.filename = "/www/htdocs/log/access.log"
+server.errorlog = "/www/htdocs/logs/error.log"
+accesslog.filename = "/www/htdocs/logs/access.log"
 server.pid-file = "/var/run/lighttpd.pid"
 server.username = "httpd"
 server.groupname = "nogroup"
@@ -63,10 +63,12 @@ $HTTP["request-method"] == "GET" {
 }
 
 $HTTP["request-method"] == "POST" {
-  url.rewrite = ( "^(/(?!admin).*)" => "post.cgi",
+#  url.rewrite = ( "^(/(?!admin).*)" => "post.cgi",
+  url.rewrite = ( "^(/(?!admin).*)" => "post.sh",
                   "^(/(admin).*)" => "admin.sh" 
   )
-  $HTTP["url"] =~ "^/post.cgi" {
+#  $HTTP["url"] =~ "^/post.cgi" {
+  $HTTP["url"] =~ "^/post.sh" {
     server.document-root = "/www/lib/cgi"
   }
   $HTTP["url"] =~ "^/admin.sh" {
@@ -75,6 +77,9 @@ $HTTP["request-method"] == "POST" {
 }
 
 auth.require = ( 
+#  "/post.cgi" => ( "method" => "digest", 
+#                  "realm" => "superglue", 
+#                  "require" => "valid-user" ),
   "/post.sh" => ( "method" => "digest", 
                   "realm" => "superglue", 
                   "require" => "valid-user" ),

+ 1 - 0
openwrt/common/etc/lighttpd/mime.conf

@@ -72,6 +72,7 @@ mimetype.assign             = (
   ".ogv"          =>      "video/ogg",
   ".ttf"          =>  	  "application/font-sfnt",
   ".otf"          =>  	  "application/font-sfnt",
+  ".svg"          =>      "image/svg+xml",
   ""              =>      "text/html"
  )
 

+ 7 - 10
openwrt/common/etc/rc.local

@@ -7,10 +7,9 @@ _SG=/www/htdocs
 #mountpoint -q $_SG || block mount $_SG
 #mountpoint -q $_SG || mount -L sg-user -o rw,noatime,nodiratime $_SG
 
-## this seems to be the only way to mount btrfs on boot, ups                                                                       
-(sleep 15; mount /dev/sda3 -o rw,noatime,nodiratime $_SG 
+## this seems to be the only way to mount btrfs on boot, ups                                ## (sleep 15; mount /dev/sda3 -o rw,noatime,nodiratime $_SG 
 
-## if /www is mounted
+## if /www/htdocs is mounted
 mountpoint -q $_SG && (
 
   ## if not writable chown with httpd
@@ -24,14 +23,14 @@ mountpoint -q $_SG && (
     )
 
   ## check for log directory
-  [ -e $_SG/log ] || ( mkdir $_SG/log
-    chown httpd $_SG/log
-    }
+  [ -e $_SG/logs ] || ( mkdir $_SG/logs
+    chown httpd $_SG/logs
+    )
 
   ## check for tmp directory
   [ -e $_SG/tmp ] || ( mkdir $_SG/tmp
     chown httpd $_SG/tmp
-    }
+    )
 
   ## check symlinking
 #  for i in devTools resources templates; do
@@ -43,10 +42,8 @@ mountpoint -q $_SG && (
 #    mkdir $_SG/tmp && chown httpd $_SG/tmp
 #    )
 
-  )
-
 ## needed to make lighty use mounted location for logs
-/etc/init.d/lighttpd restart
+  /etc/init.d/lighttpd restart
 )&
 
 exit 0

+ 0 - 11
openwrt/common/root/logrotate.sh

@@ -1,11 +0,0 @@
-#!/bin/bash
-
-_FILE=$1
-_DATE=$(date +%s)
-
-gzip -f $_FILE && 
-mv $_FILE.gz $_FILE.$_DATE.gz
-
-
-
-

+ 27 - 0
openwrt/common/sbin/logrotate

@@ -0,0 +1,27 @@
+#!/bin/bash
+
+## Simple logrotate script
+## http://superglue.it | Danja Vasiliev, 2014
+##
+## Takes filepath as argument
+
+## backlogs to keep
+_ROTATE=7
+_DATE=$(date +%d.%m.%y-%H:%M:%S)
+_FILE=$1
+
+function err {
+  printf %s": "%s"\n" "$(basename $0)" "$1"; exit 1
+}
+
+[[ -z $1 ]] && err 'missing input file'
+[[ ! -e $1 ]] && err 'input file not readable'
+
+## get number of backlogs and purge unwanted
+_N=( $(ls -1 -r $_FILE*.gz) ) 
+[[ ${#_N[@]} -gt $((_ROTATE-1)) ]] && rm -f ${_N[@]:$((_ROTATE-1)) }
+
+gzip -f $_FILE || err 'failed to gzip file'
+mv $_FILE.gz "$_FILE"_"$_DATE".gz || err 'failed to rename archive'
+
+exit 0

+ 0 - 0
openwrt/common/root/opkg-link → openwrt/common/sbin/opkg-link


+ 0 - 0
openwrt/common/root/opkg-link-clean → openwrt/common/sbin/opkg-link-clean


BIN
openwrt/common/www/lib/cgi/.post.sh.swp


+ 12 - 12
openwrt/make_fw.sh

@@ -1,24 +1,24 @@
 #!/bin/bash
 
-## Superglue firmware image builder script
+## Firmware image building script
 ## http://superglue.it | Danja Vasiliev, 2014
 ##
-##  Requirements: 
-##     OpenWRT ImageBuilder blob:
-##        http://downloads.openwrt.org/barrier_breaker/14.07-rc3/ar71xx/generic 
-##        or http://downloads.openwrt.org/snapshots/trunk/ar71xx
-##     Superglue serverfiles repo (which this script is part of):
-##        http://git.superglue.it/superglue/serverfiles/tree/master
+## Needs:
+## - OpenWRT ImageBuilder blob:
+##    http://downloads.openwrt.org/barrier_breaker/14.07-rc3/ar71xx/generic 
+##    or http://downloads.openwrt.org/snapshots/trunk/ar71xx
+## - Superglue serverfiles local repo (which this script is part of):
+##    http://git.superglue.it/superglue/serverfiles/tree/master
 
 _PWD=$(pwd)
 _IMAGEBUILDER="$_PWD/../../../openwrt/OpenWrt-ImageBuilder-ar71xx_generic-for-linux-x86_64"
 _BUILDS="$_PWD/../../../sg-builds"
 
-[[ -e $_IMAGEBUILDER ]] || echo 'ImageBuilder is missing'; exit 1
-[[ -e $_BUILDS ]] || echo 'Builds directory is missing'; exit 1
+[[ -e $_IMAGEBUILDER ]] || (echo 'ImageBuilder is missing'; exit 1;)
+[[ -e $_BUILDS ]] || (echo 'Builds directory is missing'; exit 1;)
 
 ## dirs with platform specific files
-_TARGETS='DIR505A1 TLWR710'
+_TARGETS='DIR505A1 TLWR710 WRT160NL'
 #_TARGETS='DIR505A1'
 
 ## dir with common files
@@ -84,7 +84,7 @@ done
 if [[ $_ERR -eq 0 ]]; then
   ## if build succeeded bump revision
   echo $_MINOR > sg_$_MAJOR.revision
-  echo -e "\nBuild SUCCESS\n"
+  echo -e "\nBuilding SUCCEEDED! :)\n"
 
   ## create symlinks to latest
   [[ -e $_BUILDS/latest ]] && touch $_BUILDS/latest || mkdir $_BUILDS/latest 
@@ -96,7 +96,7 @@ if [[ $_ERR -eq 0 ]]; then
   done
 
 else
-  echo -e "\nBuild FAIL\n"
+  echo -e "\nBuilding FAILED.. :/\n"
 fi
 
 exit $_ERR

+ 1 - 0
openwrt/openwrt.revision

@@ -0,0 +1 @@
+r42056

+ 1 - 0
openwrt/sg_0.1.revision

@@ -0,0 +1 @@
+4