Compare commits
90 Commits
Testing-js
...
developmen
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6574a724b4 | ||
|
|
bc0abbb985 | ||
|
|
f4d95e2441 | ||
|
|
efcba4cfb0 | ||
|
|
69e145aac6 | ||
|
|
a6e44e6c56 | ||
|
|
a6fa60a40a | ||
|
|
3c792cf286 | ||
|
|
babd6d88dc | ||
|
|
21290682b6 | ||
|
|
bd45b88477 | ||
|
|
6f5c01fccc | ||
|
|
6af5d94b8a | ||
|
|
2cd3ff1e78 | ||
|
|
2afc8c8708 | ||
|
|
e8a6021e3f | ||
|
|
da641cad7f | ||
|
|
75f3a6d1c0 | ||
|
|
06f1f9c10c | ||
|
|
ef0fb8b990 | ||
|
|
d81884eebd | ||
|
|
6dc3db1648 | ||
|
|
fbca31d88a | ||
|
|
852e05d2c2 | ||
|
|
ef90f0e4dc | ||
|
|
5dfbe6f951 | ||
|
|
54618be769 | ||
|
|
721c6ac0a7 | ||
|
|
7e3a4855d8 | ||
|
|
41ae988562 | ||
|
|
8f38cf62ac | ||
|
|
26890a8bbf | ||
|
|
879cb28b9e | ||
|
|
6c37a7b1a9 | ||
|
|
919dd41321 | ||
|
|
017721f659 | ||
|
|
ee0d1184ed | ||
|
|
b4352eb844 | ||
|
|
dddd6e8632 | ||
|
|
548ae2be2c | ||
|
|
209f557a9b | ||
|
|
307972b9ec | ||
|
|
9bd22c5fff | ||
|
|
3f2e729d85 | ||
|
|
c48da832e0 | ||
|
|
659fb74071 | ||
|
|
0035b2e6f3 | ||
|
|
0f58892d85 | ||
|
|
cf8af255c6 | ||
|
|
5391985618 | ||
|
|
a23ecd095c | ||
|
|
ca819b84e7 | ||
|
|
4691b30bf3 | ||
|
|
b37849ddef | ||
|
|
58c79ecbd4 | ||
|
|
888296e3e1 | ||
|
|
863b998eae | ||
|
|
c78ed7323a | ||
|
|
9e69651f0c | ||
|
|
2211f7ca95 | ||
|
|
dc12b92d5b | ||
|
|
559b1f2a7c | ||
|
|
7abc0ec624 | ||
|
|
91ef012688 | ||
|
|
0f5bd9fef4 | ||
|
|
45594aeac0 | ||
|
|
c8b3ab2413 | ||
|
|
52464ec5a8 | ||
|
|
37db23a0e8 | ||
|
|
c4fe5fbf37 | ||
|
|
8072fe9c36 | ||
|
|
2e263f1b14 | ||
|
|
fe07f41425 | ||
|
|
4b7f96a378 | ||
|
|
02ebfd7ce2 | ||
|
|
2e53784002 | ||
|
|
4c35d0f179 | ||
|
|
fc112d997b | ||
|
|
2e4c7e2683 | ||
|
|
fa6675cb04 | ||
|
|
212ea9ec65 | ||
|
|
c92fd63160 | ||
|
|
f8b7306dd0 | ||
|
|
b6f2379a38 | ||
|
|
fc7a1bf167 | ||
|
|
3c55e96341 | ||
|
|
44a636010e | ||
|
|
36d77591f4 | ||
|
|
c4fba54407 | ||
|
|
512f877039 |
BIN
..gitignore.swp
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
site/
|
||||
14
LICENSE.txt
Normal file
@@ -0,0 +1,14 @@
|
||||
Copyright (c) 2018, 2019, Kristjan Komloši, Jakob Kosec, Juš Dolžan,
|
||||
TeraHz development team
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
13
README.md
@@ -1,4 +1,8 @@
|
||||
# TeraHz
|
||||
|
||||
|
||||
[](https://terahz.readthedocs.io/en/latest/?badge=latest)
|
||||
|
||||
TeraHz is a low-cost spectrometer based on a Raspberry Pi 3 or 3 B+ and three sensors:
|
||||
+ [__AS7265x__](https://www.tindie.com/products/onehorse/compact-as7265x-spectrometer/)
|
||||
is a 18 channel spectrometer chipset that provides the device with spectral data
|
||||
@@ -12,6 +16,9 @@ Because people and institutions could use an affordable and accurate light-analy
|
||||
## Development team
|
||||
Copyright 2018, 2019
|
||||
|
||||
- Kristjan "d3m1g0d" Komloši (electronics, middleware)
|
||||
- Juš "ANormalPerson" Dolžan (backend)
|
||||
- Jakob "D3m1j4ck" Kosec (frontend, website)
|
||||
- Kristjan "cls-02" Komloši (electronics, sensor drivers, backend)
|
||||
- Jakob "D3m1j4ck" Kosec (frontend)
|
||||
|
||||
|
||||
I would also like to thank Juš "ANormalPerson" Dolžan, who decided to leave the
|
||||
team, but helped me a lot with backend development.
|
||||
|
||||
BIN
backend/__pycache__/main.cpython-35.pyc
Normal file
BIN
backend/__pycache__/main.cpython-37.pyc
Normal file
BIN
backend/__pycache__/sensors.cpython-35.pyc
Normal file
16
backend/app.py
Normal file
@@ -0,0 +1,16 @@
|
||||
# app.py - main backend program
|
||||
# All code in this file is licensed under the ISC license, provided in LICENSE.txt
|
||||
from flask import Flask, redirect, url_for, request
|
||||
import flask
|
||||
import sensors
|
||||
import json
|
||||
app = Flask(__name__)
|
||||
s=sensors.Spectrometer(path='/dev/serial0', baudrate=115200, tout=1)
|
||||
u=sensors.UVSensor()
|
||||
l=sensors.LxMeter()
|
||||
|
||||
@app.route('/data')
|
||||
def sendData():
|
||||
response = flask.jsonify([s.getData(), l.getData(), u.getABI()])
|
||||
response.headers.add('Access-Control-Allow-Origin', '*')
|
||||
return response
|
||||
@@ -1,16 +0,0 @@
|
||||
from flask import Flask, redirect, url_for, request
|
||||
app = Flask(__Name__)
|
||||
|
||||
@app.route('/list')
|
||||
def list():
|
||||
#Return list json
|
||||
|
||||
@app.route('/load'):
|
||||
def load():
|
||||
#Request args, load json
|
||||
|
||||
@app.route('/deposit'):
|
||||
def deposit():
|
||||
#Request .json, store json
|
||||
if request.isJson():
|
||||
request.json.
|
||||
BIN
backend/main.pyc
Normal file
@@ -1,7 +1,6 @@
|
||||
# sensors.py - a module for interfacing to the sensors
|
||||
# Copyright 2019 Kristjan Komloši
|
||||
# The code in this file is licensed under the 3-clause BSD License
|
||||
|
||||
# All code in this file is licensed under the ISC license, provided in LICENSE.txt
|
||||
import serial as ser
|
||||
import pandas as pd
|
||||
import smbus2
|
||||
@@ -65,7 +64,7 @@ class Spectrometer:
|
||||
responseorder = [i for i in 'RSTUVWGHIJKLABCDEF']
|
||||
realorder = [i for i in 'ABCDEFGHRISJTUVWKL']
|
||||
response = pd.Series([float(i)/35.0 for i in rawresp[:-3].split(',')], index=responseorder)
|
||||
return pd.DataFrame(response, index=realorder, columns = ['uW/cm^2'])
|
||||
return pd.DataFrame(response, index=realorder, columns = ['uW/cm^2']).to_dict()['uW/cm^2']
|
||||
|
||||
|
||||
def __init__(self, path='/dev/ttyUSB0', baudrate=115200, tout=1):
|
||||
@@ -162,6 +161,7 @@ class LxMeter:
|
||||
|
||||
class UVSensor:
|
||||
def __init__(self, bus=1, addr=0x10):
|
||||
self.addr=addr
|
||||
try:
|
||||
self.bus = smbus2.SMBus(bus)
|
||||
except:
|
||||
@@ -169,7 +169,7 @@ class UVSensor:
|
||||
|
||||
try:
|
||||
# enable the sensor and set the integration time
|
||||
self.bus.write_byte_data(addr, 0x00, 0b00010000)
|
||||
self.bus.write_byte_data(self.addr, 0x00, 0b00010000)
|
||||
except:
|
||||
raise Exception('An exception occured when initalizing the UV Sensor')
|
||||
|
||||
@@ -179,10 +179,10 @@ class UVSensor:
|
||||
|
||||
try:
|
||||
# read the raw UVA, UVB and compensation values from the sensor
|
||||
aRaw = self.bus.read_word_data(addr, 0x07)
|
||||
bRaw = self.bus.read_word_data(addr, 0x09)
|
||||
c1 = self.bus.read_word_data(addr, 0x0a)
|
||||
c2 = self.bus.read_word_data(addr, 0x0b)
|
||||
aRaw = self.bus.read_word_data(self.addr, 0x07)
|
||||
bRaw = self.bus.read_word_data(self.addr, 0x09)
|
||||
c1 = self.bus.read_word_data(self.addr, 0x0a)
|
||||
c2 = self.bus.read_word_data(self.addr, 0x0b)
|
||||
except:
|
||||
raise Exception('An exception occured when fetching raw UV data')
|
||||
# scary computations ahead! refer to Vishay app note 84339 and Sparkfun
|
||||
@@ -197,7 +197,7 @@ class UVSensor:
|
||||
b = bCorr * 0.00125
|
||||
|
||||
# last, calculate the UV index
|
||||
i = (uva + uvb) / 2
|
||||
i = (a + b) / 2
|
||||
|
||||
return [a,b,i]
|
||||
|
||||
@@ -215,7 +215,7 @@ class UVSensor:
|
||||
try:
|
||||
# write the default value for power on
|
||||
# no configurable params = no bitmask
|
||||
self.bus.write_byte_data(addr, 0x00, 0x10)
|
||||
self.bus.write_byte_data(self.addr, 0x00, 0x10)
|
||||
except:
|
||||
raise Exception('An exception occured when turning the UV sensor on')
|
||||
|
||||
@@ -224,6 +224,6 @@ class UVSensor:
|
||||
try:
|
||||
# write the default value + the shutdown bit
|
||||
# no configurable params = no bitmask
|
||||
self.bus.write_byte_data(addr, 0x00, 0x11)
|
||||
self.bus.write_byte_data(self.addr, 0x00, 0x11)
|
||||
except:
|
||||
raise Exception('An exception occured when shutting the UV sensor down')
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# storage.py - storage backend for TeraHz
|
||||
# Copyright Kristjan Komloši 2019
|
||||
# This code is licensed under the 3-clause BSD license
|
||||
# All code in this file is licensed under the ISC license, provided in LICENSE.txt
|
||||
|
||||
|
||||
import sqlite3
|
||||
|
||||
165
docs/build.md
Normal file
@@ -0,0 +1,165 @@
|
||||
## Warning
|
||||
The recommended way of getting TeraHz is the official Raspberry Pi SD card image
|
||||
provided under the releases tab in the GitHub repository. Installing TeraHz from
|
||||
source is a time consuming and painful process, even more so if you don't know
|
||||
what you're doing, and whatever you end up building __will not be officially
|
||||
supported__ (unless you're a core developer).
|
||||
|
||||
With this warning out of the way, let's begin.
|
||||
|
||||
## Getting the latest sources
|
||||
The most reliable way to get working source code is by cloning the official
|
||||
GitHub repository and checking out the `development-stable` tag. This tag marks
|
||||
the latest confirmed working commit. Building from the master branch is somewhat
|
||||
risky, and building from development branches is straight up stupid if you're
|
||||
not a developer.
|
||||
|
||||
Make sure that the repository is cloned into `/home/pi/TeraHz`, as Lighttpd
|
||||
expects to find frontend files inside this directory.
|
||||
|
||||
After cloning and checking out, check the documentation for module dependencies
|
||||
and the required version of python in the `docs/dependencies.md` file.
|
||||
|
||||
## Installing Python
|
||||
This step depends a lot on the platform you're using. TeraHz was developed with
|
||||
Raspberry Pi and Raspbian in mind. If you're familiar with Raspbian enough,
|
||||
you'll know that the latest version of Python available is `3.5`, which is too
|
||||
obsolete to run TeraHz and the required modules consistently. This leaves us
|
||||
with compiling Python from source. __This step is guaranteed to be slow,
|
||||
overnight compiling with something like tmux is recommended.__
|
||||
|
||||
### Pre-requirements
|
||||
Installing python without most C libraries will lead to a rather minimalistic
|
||||
Python install, missing a lot of important modules. To prevent this, update
|
||||
the system packages. After that, reboot.
|
||||
|
||||
```
|
||||
sudo apt update
|
||||
sudo apt full-upgrade
|
||||
sudo reboot
|
||||
```
|
||||
|
||||
Install the required build tools, libraries and their headers.
|
||||
|
||||
```
|
||||
sudo apt-get install build-essential tk-dev libncurses5-dev libncursesw5-dev \
|
||||
libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev \
|
||||
libexpat1-dev liblzma-dev zlib1g-dev
|
||||
```
|
||||
|
||||
### Compiling
|
||||
Compiling Python from source is, in fact pretty easy, just time-consuming. To combat
|
||||
that, using tmux to detach and later reattach the session is advised.
|
||||
|
||||
Python is packaged in many forms, but you'll be using the most basic
|
||||
of them all: a gzipped tarball. Download and decompress it, then cd into its
|
||||
directory.
|
||||
|
||||
```
|
||||
wget https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tgz
|
||||
tar -xzf Python-3.6.8.tgz
|
||||
cd Python-3.6.8
|
||||
```
|
||||
|
||||
Python's build process is pretty classic, a `.configure` script and a Makefile.
|
||||
Using the `-j` option with Make can reduce the compile time significantly. Go
|
||||
with as many threads as you have cores: `-j 4` works great on the Pi 3 B/B+.
|
||||
|
||||
```
|
||||
./configure
|
||||
make -j4
|
||||
```
|
||||
|
||||
When the compilation ends, install your freshly built version of python.
|
||||
|
||||
```
|
||||
sudo make altinstall
|
||||
```
|
||||
|
||||
"Altinstall" means that the new version of Python will be installed beside the
|
||||
existing version, and all related commands will use the full naming scheme:
|
||||
think `python3.6` or `pip3.6` instead of the shorter `python3` or `pip3`.
|
||||
|
||||
### Modules
|
||||
Another painfully slow part is the installation of all the required modules
|
||||
needed by TeraHz. Luckily, `pip3.6` takes care of the entire installation
|
||||
process. As before, using tmux is advised.
|
||||
|
||||
```
|
||||
pip3.6 install smbus pyserial flask pandas
|
||||
```
|
||||
|
||||
## Raspi-config
|
||||
For some law-obeying reason, Raspbian locks down the Wi-Fi interface card until
|
||||
the Wi-Fi country is set. This means that we will need to set it manually through
|
||||
the `raspi-config` program. It requires superuser privileges.
|
||||
|
||||
```
|
||||
sudo raspi-config
|
||||
```
|
||||

|
||||
|
||||
Configure the network hostname to something specific. If setting up multiple
|
||||
TeraHz machines, make their hostnames unique so you can tell them apart.
|
||||
|
||||

|
||||

|
||||
|
||||
Enable SSH and I2C interfaces.
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
Expand the root filesystem along the entire SD card.
|
||||
|
||||

|
||||

|
||||

|
||||
|
||||
Set the Wi-Fi country to the country you'll be using TeraHz in.
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
Save and reboot to enable Wi-Fi
|
||||
|
||||
## Installing packages
|
||||
In addition to what's already installed, TeraHz requires the following daemons
|
||||
to run:
|
||||
- Lighttpd - Frontend HTTP server
|
||||
- Dnsmasq - DNS and DHCP server, used to redirect the `terahz.site` domain
|
||||
- Hostapd - Wi-Fi access point
|
||||
|
||||
They are available from the Raspbian repository. Install it via `apt`.
|
||||
|
||||
```
|
||||
apt install hostapd dnsmasq hostapd
|
||||
```
|
||||
|
||||
## Configuring daemons
|
||||
By default, the daemons we installed are disabled and start only manually. To
|
||||
change that, enable them through systemctl. Hostapd conflicts with
|
||||
wpa_supplicant, the solution is to disable wpa_supplicant (this will break your
|
||||
wireless connections, so use wired ethernet).
|
||||
|
||||
```
|
||||
sudo systemctl unmask hostapd
|
||||
sudo systemctl stop wpa_supplicant
|
||||
sudo systemctl disable wpa_supplicant
|
||||
sudo systemctl enable dnsmasq hostapd lighttpd
|
||||
```
|
||||
|
||||
## Copying configuration files
|
||||
To simplify the process of configuring Raspbian to run TeraHz, sample
|
||||
configuration file are provided in the `etcs` subdirectory of the Git
|
||||
repository.
|
||||
|
||||
These files have been verified to work, but it's not a brilliant idea to just
|
||||
copy them into your `/etc` directory. Use them carefully and more as a template
|
||||
for your own configuration rather than as a _de facto_ way of configuring
|
||||
TeraHz.
|
||||
25
docs/dependencies.md
Normal file
@@ -0,0 +1,25 @@
|
||||
The current development version of TeraHz has been verified to work with:
|
||||
|
||||
- Raspbian Stretch (9)
|
||||
- Python 3.6.8 (built from source code and altinstall'd)
|
||||
- Module versions (direct `pip3.6 list` output):
|
||||
|
||||
```
|
||||
Package Version
|
||||
--------------- ---------
|
||||
Click 7.0
|
||||
Flask 1.0.3
|
||||
itsdangerous 1.1.0
|
||||
Jinja2 2.10.1
|
||||
MarkupSafe 1.1.1
|
||||
numpy 1.16.4
|
||||
pandas 0.24.2
|
||||
pip 18.1
|
||||
pyserial 3.4
|
||||
python-dateutil 2.8.0
|
||||
pytz 2019.1
|
||||
setuptools 40.6.2
|
||||
six 1.12.0
|
||||
smbus 1.1.post2
|
||||
Werkzeug 0.15.4
|
||||
```
|
||||
BIN
docs/imgs/raspi-config/1.png
Normal file
|
After Width: | Height: | Size: 54 KiB |
BIN
docs/imgs/raspi-config/10.png
Normal file
|
After Width: | Height: | Size: 54 KiB |
BIN
docs/imgs/raspi-config/11.png
Normal file
|
After Width: | Height: | Size: 35 KiB |
BIN
docs/imgs/raspi-config/12.png
Normal file
|
After Width: | Height: | Size: 33 KiB |
BIN
docs/imgs/raspi-config/14.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
docs/imgs/raspi-config/15.png
Normal file
|
After Width: | Height: | Size: 59 KiB |
BIN
docs/imgs/raspi-config/16.png
Normal file
|
After Width: | Height: | Size: 59 KiB |
BIN
docs/imgs/raspi-config/17.png
Normal file
|
After Width: | Height: | Size: 59 KiB |
BIN
docs/imgs/raspi-config/18.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
docs/imgs/raspi-config/19.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
docs/imgs/raspi-config/2.png
Normal file
|
After Width: | Height: | Size: 54 KiB |
BIN
docs/imgs/raspi-config/3.png
Normal file
|
After Width: | Height: | Size: 54 KiB |
BIN
docs/imgs/raspi-config/4.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
docs/imgs/raspi-config/5.png
Normal file
|
After Width: | Height: | Size: 54 KiB |
BIN
docs/imgs/raspi-config/6.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
docs/imgs/raspi-config/7.png
Normal file
|
After Width: | Height: | Size: 54 KiB |
BIN
docs/imgs/raspi-config/8.png
Normal file
|
After Width: | Height: | Size: 50 KiB |
BIN
docs/imgs/raspi-config/9.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
1
docs/index.md
Normal file
@@ -0,0 +1 @@
|
||||
This is the start page for the TeraHz documentation.
|
||||
4
etcs/default/avahi-daemon
Normal file
@@ -0,0 +1,4 @@
|
||||
# 1 = Try to detect unicast dns servers that serve .local and disable avahi in
|
||||
# that case, 0 = Don't try to detect .local unicast dns servers, can cause
|
||||
# troubles on misconfigured networks
|
||||
AVAHI_DAEMON_DETECT_LOCAL=1
|
||||
20
etcs/default/bluetooth
Normal file
@@ -0,0 +1,20 @@
|
||||
# Defaults for bluez
|
||||
|
||||
# start bluetooth on boot?
|
||||
# compatibility note: if this variable is _not_ found bluetooth will start
|
||||
BLUETOOTH_ENABLED=1
|
||||
|
||||
# This setting used to switch HID devices (e.g mouse/keyboad) to HCI mode, that
|
||||
# is you will have bluetooth functionality from your dongle instead of only
|
||||
# HID. This is accomplished for supported devices by udev in
|
||||
# /lib/udev/rules.d/62-bluez-hid2hci.rules by invoking hid2hci with correct
|
||||
# parameters.
|
||||
# See /usr/share/doc/bluez/NEWS.Debian.gz for further information.
|
||||
|
||||
# Older daemons like pand dund and hidd can be found in bluez-compat package as
|
||||
# they are deprecated and provided for backward compatibility only.
|
||||
|
||||
# Note that not every bluetooth dongle is capable of switching back to HID mode,
|
||||
# see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=355497
|
||||
HID2HCI_ENABLED=0
|
||||
HID2HCI_UNDO=0
|
||||
4
etcs/default/bsdmainutils
Normal file
@@ -0,0 +1,4 @@
|
||||
# Uncomment the following line if you'd like all of your users'
|
||||
# ~/calendar files to be checked daily. Calendar will send them mail
|
||||
# to remind them of upcoming events. See calendar(1) for more details.
|
||||
#RUN_DAILY=true
|
||||
16
etcs/default/console-setup
Normal file
@@ -0,0 +1,16 @@
|
||||
# CONFIGURATION FILE FOR SETUPCON
|
||||
|
||||
# Consult the console-setup(5) manual page.
|
||||
|
||||
ACTIVE_CONSOLES="/dev/tty[1-6]"
|
||||
|
||||
CHARMAP="UTF-8"
|
||||
|
||||
CODESET="guess"
|
||||
FONTFACE=""
|
||||
FONTSIZE=""
|
||||
|
||||
VIDEOMODE=
|
||||
|
||||
# The following is an example how to use a braille font
|
||||
# FONT='lat9w-08.psf.gz brl-8x8.psf'
|
||||
11
etcs/default/crda
Normal file
@@ -0,0 +1,11 @@
|
||||
# Set REGDOMAIN to a ISO/IEC 3166-1 alpha2 country code so that iw(8) may set
|
||||
# the initial regulatory domain setting for IEEE 802.11 devices which operate
|
||||
# on this system.
|
||||
#
|
||||
# Governments assert the right to regulate usage of radio spectrum within
|
||||
# their respective territories so make sure you select a ISO/IEC 3166-1 alpha2
|
||||
# country code suitable for your location or you may infringe on local
|
||||
# legislature. See `/usr/share/zoneinfo/zone.tab' for a table of timezone
|
||||
# descriptions containing ISO/IEC 3166-1 alpha2 country codes.
|
||||
|
||||
REGDOMAIN=
|
||||
28
etcs/default/cron
Normal file
@@ -0,0 +1,28 @@
|
||||
# Cron configuration options
|
||||
|
||||
# Whether to read the system's default environment files (if present)
|
||||
# If set to "yes", cron will set a proper mail charset from the
|
||||
# locale information. If set to something other than 'yes', the default
|
||||
# charset 'C' (canonical name: ANSI_X3.4-1968) will be used.
|
||||
#
|
||||
# This has no effect on tasks running under cron; their environment can
|
||||
# only be changed via PAM or from within the crontab; see crontab(5).
|
||||
READ_ENV="yes"
|
||||
|
||||
# Extra options for cron, see cron(8)
|
||||
#
|
||||
# For example, to enable LSB name support in /etc/cron.d/, use
|
||||
# EXTRA_OPTS='-l'
|
||||
#
|
||||
# Or, to log standard messages, plus jobs with exit status != 0:
|
||||
# EXTRA_OPTS='-L 5'
|
||||
#
|
||||
# For quick reference, the currently available log levels are:
|
||||
# 0 no logging (errors are logged regardless)
|
||||
# 1 log start of jobs
|
||||
# 2 log end of jobs
|
||||
# 4 log jobs with exit status != 0
|
||||
# 8 log the process identifier of child process (in all logs)
|
||||
#
|
||||
#EXTRA_OPTS=""
|
||||
|
||||
7
etcs/default/dbus
Normal file
@@ -0,0 +1,7 @@
|
||||
# This is a configuration file for /etc/init.d/dbus; it allows you to
|
||||
# perform common modifications to the behavior of the dbus daemon
|
||||
# startup without editing the init script (and thus getting prompted
|
||||
# by dpkg on upgrades). We all love dpkg prompts.
|
||||
|
||||
# Parameters to pass to dbus.
|
||||
PARAMS=""
|
||||
33
etcs/default/dnsmasq
Normal file
@@ -0,0 +1,33 @@
|
||||
# This file has five functions:
|
||||
# 1) to completely disable starting dnsmasq,
|
||||
# 2) to set DOMAIN_SUFFIX by running `dnsdomainname`
|
||||
# 3) to select an alternative config file
|
||||
# by setting DNSMASQ_OPTS to --conf-file=<file>
|
||||
# 4) to tell dnsmasq to read the files in /etc/dnsmasq.d for
|
||||
# more configuration variables.
|
||||
# 5) to stop the resolvconf package from controlling dnsmasq's
|
||||
# idea of which upstream nameservers to use.
|
||||
# For upgraders from very old versions, all the shell variables set
|
||||
# here in previous versions are still honored by the init script
|
||||
# so if you just keep your old version of this file nothing will break.
|
||||
|
||||
#DOMAIN_SUFFIX=`dnsdomainname`
|
||||
#DNSMASQ_OPTS="--conf-file=/etc/dnsmasq.alt"
|
||||
|
||||
# Whether or not to run the dnsmasq daemon; set to 0 to disable.
|
||||
ENABLED=1
|
||||
|
||||
# By default search this drop directory for configuration options.
|
||||
# Libvirt leaves a file here to make the system dnsmasq play nice.
|
||||
# Comment out this line if you don't want this. The dpkg-* are file
|
||||
# endings which cause dnsmasq to skip that file. This avoids pulling
|
||||
# in backups made by dpkg.
|
||||
CONFIG_DIR=/etc/dnsmasq.d,.dpkg-dist,.dpkg-old,.dpkg-new
|
||||
|
||||
# If the resolvconf package is installed, dnsmasq will use its output
|
||||
# rather than the contents of /etc/resolv.conf to find upstream
|
||||
# nameservers. Uncommenting this line inhibits this behaviour.
|
||||
# Note that including a "resolv-file=<filename>" line in
|
||||
# /etc/dnsmasq.conf is not enough to override resolvconf if it is
|
||||
# installed: the line below must be uncommented.
|
||||
IGNORE_RESOLVCONF=yes
|
||||
2
etcs/default/fake-hwclock
Normal file
@@ -0,0 +1,2 @@
|
||||
# Uncomment to set clock even if saved value appears to be in the past
|
||||
#FORCE=force
|
||||
20
etcs/default/hostapd
Normal file
@@ -0,0 +1,20 @@
|
||||
# Defaults for hostapd initscript
|
||||
#
|
||||
# See /usr/share/doc/hostapd/README.Debian for information about alternative
|
||||
# methods of managing hostapd.
|
||||
#
|
||||
# Uncomment and set DAEMON_CONF to the absolute path of a hostapd configuration
|
||||
# file and hostapd will be started during system boot. An example configuration
|
||||
# file can be found at /usr/share/doc/hostapd/examples/hostapd.conf.gz
|
||||
#
|
||||
DAEMON_CONF="/etc/hostapd/hostapd.conf"
|
||||
|
||||
# Additional daemon options to be appended to hostapd command:-
|
||||
# -d show more debug messages (-dd for even more)
|
||||
# -K include key data in debug messages
|
||||
# -t include timestamps in some debug messages
|
||||
#
|
||||
# Note that -B (daemon mode) and -P (pidfile) options are automatically
|
||||
# configured by the init.d script and must not be added to DAEMON_OPTS.
|
||||
#
|
||||
#DAEMON_OPTS=""
|
||||
19
etcs/default/hwclock
Normal file
@@ -0,0 +1,19 @@
|
||||
# Defaults for the hwclock init script. See hwclock(5) and hwclock(8).
|
||||
|
||||
# This is used to specify that the hardware clock incapable of storing
|
||||
# years outside the range of 1994-1999. Set to yes if the hardware is
|
||||
# broken or no if working correctly.
|
||||
#BADYEAR=no
|
||||
|
||||
# Set this to yes if it is possible to access the hardware clock,
|
||||
# or no if it is not.
|
||||
#HWCLOCKACCESS=yes
|
||||
|
||||
# Set this to any options you might need to give to hwclock, such
|
||||
# as machine hardware clock type for Alphas.
|
||||
#HWCLOCKPARS=
|
||||
|
||||
# Set this to the hardware clock device you want to use, it should
|
||||
# probably match the CONFIG_RTC_HCTOSYS_DEVICE kernel config option.
|
||||
#HCTOSYS_DEVICE=rtc0
|
||||
|
||||
10
etcs/default/keyboard
Normal file
@@ -0,0 +1,10 @@
|
||||
# KEYBOARD CONFIGURATION FILE
|
||||
|
||||
# Consult the keyboard(5) manual page.
|
||||
|
||||
XKBMODEL="pc105"
|
||||
XKBLAYOUT="gb"
|
||||
XKBVARIANT=""
|
||||
XKBOPTIONS=""
|
||||
|
||||
BACKSPACE="guess"
|
||||
2
etcs/default/locale
Normal file
@@ -0,0 +1,2 @@
|
||||
# File generated by update-locale
|
||||
LANG=en_GB.UTF-8
|
||||
11
etcs/default/networking
Normal file
@@ -0,0 +1,11 @@
|
||||
# Configuration for networking init script being run during
|
||||
# the boot sequence
|
||||
|
||||
# Set to 'no' to skip interfaces configuration on boot
|
||||
#CONFIGURE_INTERFACES=yes
|
||||
|
||||
# Don't configure these interfaces. Shell wildcards supported/
|
||||
#EXCLUDE_INTERFACES=
|
||||
|
||||
# Set to 'yes' to enable additional verbosity
|
||||
#VERBOSE=no
|
||||
19
etcs/default/nfs-common
Normal file
@@ -0,0 +1,19 @@
|
||||
# If you do not set values for the NEED_ options, they will be attempted
|
||||
# autodetected; this should be sufficient for most people. Valid alternatives
|
||||
# for the NEED_ options are "yes" and "no".
|
||||
|
||||
# Do you want to start the statd daemon? It is not needed for NFSv4.
|
||||
NEED_STATD=
|
||||
|
||||
# Options for rpc.statd.
|
||||
# Should rpc.statd listen on a specific port? This is especially useful
|
||||
# when you have a port-based firewall. To use a fixed port, set this
|
||||
# this variable to a statd argument like: "--port 4000 --outgoing-port 4001".
|
||||
# For more information, see rpc.statd(8) or http://wiki.debian.org/SecuringNFS
|
||||
STATDOPTS=
|
||||
|
||||
# Do you want to start the idmapd daemon? It is only needed for NFSv4.
|
||||
NEED_IDMAPD=
|
||||
|
||||
# Do you want to start the gssd daemon? It is required for Kerberos mounts.
|
||||
NEED_GSSD=
|
||||
37
etcs/default/nss
Normal file
@@ -0,0 +1,37 @@
|
||||
# /etc/default/nss
|
||||
# This file can theoretically contain a bunch of customization variables
|
||||
# for Name Service Switch in the GNU C library. For now there are only
|
||||
# four variables:
|
||||
#
|
||||
# NETID_AUTHORITATIVE
|
||||
# If set to TRUE, the initgroups() function will accept the information
|
||||
# from the netid.byname NIS map as authoritative. This can speed up the
|
||||
# function significantly if the group.byname map is large. The content
|
||||
# of the netid.byname map is used AS IS. The system administrator has
|
||||
# to make sure it is correctly generated.
|
||||
#NETID_AUTHORITATIVE=TRUE
|
||||
#
|
||||
# SERVICES_AUTHORITATIVE
|
||||
# If set to TRUE, the getservbyname{,_r}() function will assume
|
||||
# services.byservicename NIS map exists and is authoritative, particularly
|
||||
# that it contains both keys with /proto and without /proto for both
|
||||
# primary service names and service aliases. The system administrator
|
||||
# has to make sure it is correctly generated.
|
||||
#SERVICES_AUTHORITATIVE=TRUE
|
||||
#
|
||||
# SETENT_BATCH_READ
|
||||
# If set to TRUE, various setXXent() functions will read the entire
|
||||
# database at once and then hand out the requests one by one from
|
||||
# memory with every getXXent() call. Otherwise each getXXent() call
|
||||
# might result into a network communication with the server to get
|
||||
# the next entry.
|
||||
#SETENT_BATCH_READ=TRUE
|
||||
#
|
||||
# ADJUNCT_AS_SHADOW
|
||||
# If set to TRUE, the passwd routines in the NIS NSS module will not
|
||||
# use the passwd.adjunct.byname tables to fill in the password data
|
||||
# in the passwd structure. This is a security problem if the NIS
|
||||
# server cannot be trusted to send the passwd.adjuct table only to
|
||||
# privileged clients. Instead the passwd.adjunct.byname table is
|
||||
# used to synthesize the shadow.byname table if it does not exist.
|
||||
ADJUNCT_AS_SHADOW=TRUE
|
||||
11
etcs/default/raspberrypi-kernel
Normal file
@@ -0,0 +1,11 @@
|
||||
# Defaults for raspberrypi-kernel
|
||||
|
||||
# Uncomment the following line to enable generation of
|
||||
# /boot/initrd.img-KVER files (requires initramfs-tools)
|
||||
|
||||
#INITRD=Yes
|
||||
|
||||
# Uncomment the following line to enable generation of
|
||||
# /boot/initrd(7).img files (requires rpi-initramfs-tools)
|
||||
|
||||
#RPI_INITRD=Yes
|
||||
47
etcs/default/rsync
Normal file
@@ -0,0 +1,47 @@
|
||||
# defaults file for rsync daemon mode
|
||||
#
|
||||
# This file is only used for init.d based systems!
|
||||
# If this system uses systemd, you can specify options etc. for rsync
|
||||
# in daemon mode by copying /lib/systemd/system/rsync.service to
|
||||
# /etc/systemd/system/rsync.service and modifying the copy; add required
|
||||
# options to the ExecStart line.
|
||||
|
||||
# start rsync in daemon mode from init.d script?
|
||||
# only allowed values are "true", "false", and "inetd"
|
||||
# Use "inetd" if you want to start the rsyncd from inetd,
|
||||
# all this does is prevent the init.d script from printing a message
|
||||
# about not starting rsyncd (you still need to modify inetd's config yourself).
|
||||
RSYNC_ENABLE=false
|
||||
|
||||
# which file should be used as the configuration file for rsync.
|
||||
# This file is used instead of the default /etc/rsyncd.conf
|
||||
# Warning: This option has no effect if the daemon is accessed
|
||||
# using a remote shell. When using a different file for
|
||||
# rsync you might want to symlink /etc/rsyncd.conf to
|
||||
# that file.
|
||||
# RSYNC_CONFIG_FILE=
|
||||
|
||||
# what extra options to give rsync --daemon?
|
||||
# that excludes the --daemon; that's always done in the init.d script
|
||||
# Possibilities are:
|
||||
# --address=123.45.67.89 (bind to a specific IP address)
|
||||
# --port=8730 (bind to specified port; default 873)
|
||||
RSYNC_OPTS=''
|
||||
|
||||
# run rsyncd at a nice level?
|
||||
# the rsync daemon can impact performance due to much I/O and CPU usage,
|
||||
# so you may want to run it at a nicer priority than the default priority.
|
||||
# Allowed values are 0 - 19 inclusive; 10 is a reasonable value.
|
||||
RSYNC_NICE=''
|
||||
|
||||
# run rsyncd with ionice?
|
||||
# "ionice" does for IO load what "nice" does for CPU load.
|
||||
# As rsync is often used for backups which aren't all that time-critical,
|
||||
# reducing the rsync IO priority will benefit the rest of the system.
|
||||
# See the manpage for ionice for allowed options.
|
||||
# -c3 is recommended, this will run rsync IO at "idle" priority. Uncomment
|
||||
# the next line to activate this.
|
||||
# RSYNC_IONICE='-c3'
|
||||
|
||||
# Don't forget to create an appropriate config file,
|
||||
# else the daemon will not start.
|
||||
4
etcs/default/rsyslog
Normal file
@@ -0,0 +1,4 @@
|
||||
# Options for rsyslogd
|
||||
# -x disables DNS lookups for remote messages
|
||||
# See rsyslogd(8) for more details
|
||||
RSYSLOGD_OPTIONS=""
|
||||
5
etcs/default/ssh
Normal file
@@ -0,0 +1,5 @@
|
||||
# Default settings for openssh-server. This file is sourced by /bin/sh from
|
||||
# /etc/init.d/ssh.
|
||||
|
||||
# Options to pass to sshd
|
||||
SSHD_OPTS=
|
||||
22
etcs/default/timidity
Normal file
@@ -0,0 +1,22 @@
|
||||
# Defaults for TiMidity++ scripts
|
||||
# sourced by /etc/init.d/timidity
|
||||
# installed at /etc/default/timidity by the maintainer scripts
|
||||
# $Id: timidity.default,v 1.3 2004/08/07 14:33:26 hmh Exp $
|
||||
|
||||
#
|
||||
# This is a POSIX shell fragment
|
||||
#
|
||||
|
||||
SERVER_HOME=/etc/timidity
|
||||
SERVER_USER=timidity
|
||||
SERVER_NAME="TiMidity++ MIDI sequencer service"
|
||||
SERVER_GROUP=timidity
|
||||
ADDGROUP=audio
|
||||
|
||||
# Enable MIDI sequencer (ALSA), if timidity-deamon is installed
|
||||
|
||||
# uncomment to override enabling triggered by availability of timidity-deamon
|
||||
# TIM_ALSASEQ=false
|
||||
|
||||
# Setting overrides (of /etc/timidity.conf) for the ALSA sequencer daemon
|
||||
TIM_ALSASEQPARAMS="-Os"
|
||||
17
etcs/default/triggerhappy
Normal file
@@ -0,0 +1,17 @@
|
||||
# Defaults for triggerhappy initscript
|
||||
# sourced by /etc/init.d/triggerhappy
|
||||
# installed at /etc/default/triggerhappy by the maintainer scripts
|
||||
|
||||
#
|
||||
# This is a POSIX shell fragment
|
||||
#
|
||||
|
||||
# Additional options that are passed to the Daemon.
|
||||
DAEMON_OPTS=""
|
||||
|
||||
# The Triggerhappy daemon (thd) drops its root privileges after
|
||||
# startup and becomes "nobody". If you want it to retain its root
|
||||
# status (e.g. to run commands only accessible to the system user),
|
||||
# uncomment the following line or specifiy the user option yourself:
|
||||
#
|
||||
# DAEMON_OPTS="--user root"
|
||||
37
etcs/default/useradd
Normal file
@@ -0,0 +1,37 @@
|
||||
# Default values for useradd(8)
|
||||
#
|
||||
# The SHELL variable specifies the default login shell on your
|
||||
# system.
|
||||
# Similar to DHSELL in adduser. However, we use "sh" here because
|
||||
# useradd is a low level utility and should be as general
|
||||
# as possible
|
||||
SHELL=/bin/bash
|
||||
#
|
||||
# The default group for users
|
||||
# 100=users on Debian systems
|
||||
# Same as USERS_GID in adduser
|
||||
# This argument is used when the -n flag is specified.
|
||||
# The default behavior (when -n and -g are not specified) is to create a
|
||||
# primary user group with the same name as the user being added to the
|
||||
# system.
|
||||
# GROUP=100
|
||||
#
|
||||
# The default home directory. Same as DHOME for adduser
|
||||
# HOME=/home
|
||||
#
|
||||
# The number of days after a password expires until the account
|
||||
# is permanently disabled
|
||||
# INACTIVE=-1
|
||||
#
|
||||
# The default expire date
|
||||
# EXPIRE=
|
||||
#
|
||||
# The SKEL variable specifies the directory containing "skeletal" user
|
||||
# files; in other words, files such as a sample .profile that will be
|
||||
# copied to the new user's home directory when it is created.
|
||||
SKEL=/etc/skel
|
||||
#
|
||||
# Defines whether the mail spool should be created while
|
||||
# creating the account
|
||||
# CREATE_MAIL_SPOOL=yes
|
||||
|
||||
59
etcs/dhcpcd.conf
Normal file
@@ -0,0 +1,59 @@
|
||||
# A sample configuration for dhcpcd.
|
||||
# See dhcpcd.conf(5) for details.
|
||||
|
||||
# Allow users of this group to interact with dhcpcd via the control socket.
|
||||
#controlgroup wheel
|
||||
|
||||
# Inform the DHCP server of our hostname for DDNS.
|
||||
hostname
|
||||
|
||||
# Use the hardware address of the interface for the Client ID.
|
||||
clientid
|
||||
# or
|
||||
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
|
||||
# Some non-RFC compliant DHCP servers do not reply with this set.
|
||||
# In this case, comment out duid and enable clientid above.
|
||||
#duid
|
||||
|
||||
# Persist interface configuration when dhcpcd exits.
|
||||
persistent
|
||||
|
||||
# Rapid commit support.
|
||||
# Safe to enable by default because it requires the equivalent option set
|
||||
# on the server to actually work.
|
||||
option rapid_commit
|
||||
|
||||
# A list of options to request from the DHCP server.
|
||||
option domain_name_servers, domain_name, domain_search, host_name
|
||||
option classless_static_routes
|
||||
# Most distributions have NTP support.
|
||||
option ntp_servers
|
||||
# Respect the network MTU. This is applied to DHCP routes.
|
||||
option interface_mtu
|
||||
|
||||
# A ServerID is required by RFC2131.
|
||||
require dhcp_server_identifier
|
||||
|
||||
# Generate Stable Private IPv6 Addresses instead of hardware based ones
|
||||
slaac private
|
||||
|
||||
# Example static IP configuration:
|
||||
#interface eth0
|
||||
#static ip_address=192.168.0.10/24
|
||||
#static ip6_address=fd51:42f8:caae:d92e::ff/64
|
||||
#static routers=192.168.0.1
|
||||
#static domain_name_servers=192.168.0.1 8.8.8.8 fd51:42f8:caae:d92e::1
|
||||
|
||||
# It is possible to fall back to a static IP if DHCP fails:
|
||||
# define static profile
|
||||
#profile static_eth0
|
||||
#static ip_address=192.168.1.23/24
|
||||
#static routers=192.168.1.1
|
||||
#static domain_name_servers=192.168.1.1
|
||||
|
||||
# fallback to static profile on eth0
|
||||
#interface eth0
|
||||
#fallback static_eth0
|
||||
|
||||
interface wlan0
|
||||
static ip_address=192.168.1.1/24
|
||||
3
etcs/dnsmasq.conf
Normal file
@@ -0,0 +1,3 @@
|
||||
interface=wlan0
|
||||
dhcp-range=192.168.1.10,192.168.1.100,255.255.255.0,24h
|
||||
address=/terahz.site/192.168.1.1
|
||||
9
etcs/hostapd/hostapd.conf
Normal file
@@ -0,0 +1,9 @@
|
||||
interface=wlan0
|
||||
hw_mode=g
|
||||
channel=8
|
||||
wpa=2
|
||||
wpa_key_mgmt=WPA-PSK
|
||||
wpa_pairwise=TKIP
|
||||
rsn_pairwise=CCMP
|
||||
ssid=TeraHz
|
||||
wpa_passphrase=terahertz
|
||||
146
etcs/hostapd/ifupdown.sh
Normal file
@@ -0,0 +1,146 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (C) 2006-2009 Debian hostapd maintainers
|
||||
# Faidon Liambotis <paravoid@debian.org>
|
||||
# Kel Modderman <kel@otaku42.de>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# On Debian GNU/Linux systems, the text of the GPL license,
|
||||
# version 2, can be found in /usr/share/common-licenses/GPL-2.
|
||||
|
||||
# quit if we're called for lo
|
||||
if [ "$IFACE" = lo ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -n "$IF_HOSTAPD" ]; then
|
||||
HOSTAPD_CONF="$IF_HOSTAPD"
|
||||
else
|
||||
exit 0
|
||||
fi
|
||||
|
||||
HOSTAPD_BIN="/usr/sbin/hostapd"
|
||||
HOSTAPD_PNAME="hostapd"
|
||||
HOSTAPD_PIDFILE="/run/hostapd.$IFACE.pid"
|
||||
HOSTAPD_OMIT_PIDFILE="/run/sendsigs.omit.d/hostapd.$IFACE.pid"
|
||||
|
||||
if [ ! -x "$HOSTAPD_BIN" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$VERBOSITY" = "1" ]; then
|
||||
TO_NULL="/dev/stdout"
|
||||
else
|
||||
TO_NULL="/dev/null"
|
||||
fi
|
||||
|
||||
hostapd_msg () {
|
||||
case "$1" in
|
||||
verbose)
|
||||
shift
|
||||
echo "$HOSTAPD_PNAME: $@" > "$TO_NULL"
|
||||
;;
|
||||
stderr)
|
||||
shift
|
||||
echo "$HOSTAPD_PNAME: $@" > /dev/stderr
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
test_hostapd_pidfile () {
|
||||
if [ -n "$1" ] && [ -f "$2" ]; then
|
||||
if start-stop-daemon --stop --quiet --signal 0 \
|
||||
--exec "$1" --pidfile "$2"; then
|
||||
return 0
|
||||
else
|
||||
rm -f "$2"
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
init_hostapd () {
|
||||
HOSTAPD_OPTIONS="-B -P $HOSTAPD_PIDFILE $HOSTAPD_CONF"
|
||||
HOSTAPD_MESSAGE="$HOSTAPD_BIN $HOSTAPD_OPTIONS"
|
||||
|
||||
test_hostapd_pidfile "$HOSTAPD_BIN" "$HOSTAPD_PIDFILE" && return 0
|
||||
|
||||
hostapd_msg verbose "$HOSTAPD_MESSAGE"
|
||||
start-stop-daemon --start --oknodo --quiet --exec "$HOSTAPD_BIN" \
|
||||
--pidfile "$HOSTAPD_PIDFILE" -- $HOSTAPD_OPTIONS > "$TO_NULL"
|
||||
|
||||
if [ "$?" -ne 0 ]; then
|
||||
return "$?"
|
||||
fi
|
||||
|
||||
HOSTAPD_PIDFILE_WAIT=0
|
||||
until [ -s "$HOSTAPD_PIDFILE" ]; do
|
||||
if [ "$HOSTAPD_PIDFILE_WAIT" -ge 5 ]; then
|
||||
hostapd_msg stderr \
|
||||
"timeout waiting for pid file creation"
|
||||
return 1
|
||||
fi
|
||||
|
||||
HOSTAPD_PIDFILE_WAIT=$(($HOSTAPD_PIDFILE_WAIT + 1))
|
||||
sleep 1
|
||||
done
|
||||
cat "$HOSTAPD_PIDFILE" > "$HOSTAPD_OMIT_PIDFILE"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
kill_hostapd () {
|
||||
HOSTAPD_MESSAGE="stopping $HOSTAPD_PNAME via pidfile: $HOSTAPD_PIDFILE"
|
||||
|
||||
test_hostapd_pidfile "$HOSTAPD_BIN" "$HOSTAPD_PIDFILE" || return 0
|
||||
|
||||
hostapd_msg verbose "$HOSTAPD_MESSAGE"
|
||||
start-stop-daemon --stop --oknodo --quiet --exec "$HOSTAPD_BIN" \
|
||||
--pidfile "$HOSTAPD_PIDFILE" > "$TO_NULL"
|
||||
|
||||
[ "$HOSTAPD_OMIT_PIDFILE" ] && rm -f "$HOSTAPD_OMIT_PIDFILE"
|
||||
}
|
||||
|
||||
case "$MODE" in
|
||||
start)
|
||||
case "$PHASE" in
|
||||
pre-up)
|
||||
init_hostapd || exit 1
|
||||
;;
|
||||
*)
|
||||
hostapd_msg stderr "unknown phase: \"$PHASE\""
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
stop)
|
||||
case "$PHASE" in
|
||||
post-down)
|
||||
kill_hostapd
|
||||
;;
|
||||
*)
|
||||
hostapd_msg stderr "unknown phase: \"$PHASE\""
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
hostapd_msg stderr "unknown mode: \"$MODE\""
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
146
etcs/ifupdown.sh
Normal file
@@ -0,0 +1,146 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (C) 2006-2009 Debian hostapd maintainers
|
||||
# Faidon Liambotis <paravoid@debian.org>
|
||||
# Kel Modderman <kel@otaku42.de>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# On Debian GNU/Linux systems, the text of the GPL license,
|
||||
# version 2, can be found in /usr/share/common-licenses/GPL-2.
|
||||
|
||||
# quit if we're called for lo
|
||||
if [ "$IFACE" = lo ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -n "$IF_HOSTAPD" ]; then
|
||||
HOSTAPD_CONF="$IF_HOSTAPD"
|
||||
else
|
||||
exit 0
|
||||
fi
|
||||
|
||||
HOSTAPD_BIN="/usr/sbin/hostapd"
|
||||
HOSTAPD_PNAME="hostapd"
|
||||
HOSTAPD_PIDFILE="/run/hostapd.$IFACE.pid"
|
||||
HOSTAPD_OMIT_PIDFILE="/run/sendsigs.omit.d/hostapd.$IFACE.pid"
|
||||
|
||||
if [ ! -x "$HOSTAPD_BIN" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$VERBOSITY" = "1" ]; then
|
||||
TO_NULL="/dev/stdout"
|
||||
else
|
||||
TO_NULL="/dev/null"
|
||||
fi
|
||||
|
||||
hostapd_msg () {
|
||||
case "$1" in
|
||||
verbose)
|
||||
shift
|
||||
echo "$HOSTAPD_PNAME: $@" > "$TO_NULL"
|
||||
;;
|
||||
stderr)
|
||||
shift
|
||||
echo "$HOSTAPD_PNAME: $@" > /dev/stderr
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
test_hostapd_pidfile () {
|
||||
if [ -n "$1" ] && [ -f "$2" ]; then
|
||||
if start-stop-daemon --stop --quiet --signal 0 \
|
||||
--exec "$1" --pidfile "$2"; then
|
||||
return 0
|
||||
else
|
||||
rm -f "$2"
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
init_hostapd () {
|
||||
HOSTAPD_OPTIONS="-B -P $HOSTAPD_PIDFILE $HOSTAPD_CONF"
|
||||
HOSTAPD_MESSAGE="$HOSTAPD_BIN $HOSTAPD_OPTIONS"
|
||||
|
||||
test_hostapd_pidfile "$HOSTAPD_BIN" "$HOSTAPD_PIDFILE" && return 0
|
||||
|
||||
hostapd_msg verbose "$HOSTAPD_MESSAGE"
|
||||
start-stop-daemon --start --oknodo --quiet --exec "$HOSTAPD_BIN" \
|
||||
--pidfile "$HOSTAPD_PIDFILE" -- $HOSTAPD_OPTIONS > "$TO_NULL"
|
||||
|
||||
if [ "$?" -ne 0 ]; then
|
||||
return "$?"
|
||||
fi
|
||||
|
||||
HOSTAPD_PIDFILE_WAIT=0
|
||||
until [ -s "$HOSTAPD_PIDFILE" ]; do
|
||||
if [ "$HOSTAPD_PIDFILE_WAIT" -ge 5 ]; then
|
||||
hostapd_msg stderr \
|
||||
"timeout waiting for pid file creation"
|
||||
return 1
|
||||
fi
|
||||
|
||||
HOSTAPD_PIDFILE_WAIT=$(($HOSTAPD_PIDFILE_WAIT + 1))
|
||||
sleep 1
|
||||
done
|
||||
cat "$HOSTAPD_PIDFILE" > "$HOSTAPD_OMIT_PIDFILE"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
kill_hostapd () {
|
||||
HOSTAPD_MESSAGE="stopping $HOSTAPD_PNAME via pidfile: $HOSTAPD_PIDFILE"
|
||||
|
||||
test_hostapd_pidfile "$HOSTAPD_BIN" "$HOSTAPD_PIDFILE" || return 0
|
||||
|
||||
hostapd_msg verbose "$HOSTAPD_MESSAGE"
|
||||
start-stop-daemon --stop --oknodo --quiet --exec "$HOSTAPD_BIN" \
|
||||
--pidfile "$HOSTAPD_PIDFILE" > "$TO_NULL"
|
||||
|
||||
[ "$HOSTAPD_OMIT_PIDFILE" ] && rm -f "$HOSTAPD_OMIT_PIDFILE"
|
||||
}
|
||||
|
||||
case "$MODE" in
|
||||
start)
|
||||
case "$PHASE" in
|
||||
pre-up)
|
||||
init_hostapd || exit 1
|
||||
;;
|
||||
*)
|
||||
hostapd_msg stderr "unknown phase: \"$PHASE\""
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
stop)
|
||||
case "$PHASE" in
|
||||
post-down)
|
||||
kill_hostapd
|
||||
;;
|
||||
*)
|
||||
hostapd_msg stderr "unknown phase: \"$PHASE\""
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
hostapd_msg stderr "unknown mode: \"$MODE\""
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
25
etcs/lighttpd/conf-available/05-auth.conf
Normal file
@@ -0,0 +1,25 @@
|
||||
# /usr/share/doc/lighttpd/authentication.txt.gz
|
||||
|
||||
server.modules += ( "mod_auth" )
|
||||
|
||||
# auth.backend = "plain"
|
||||
# auth.backend.plain.userfile = "lighttpd.user"
|
||||
# auth.backend.plain.groupfile = "lighttpd.group"
|
||||
|
||||
# auth.backend.ldap.hostname = "localhost"
|
||||
# auth.backend.ldap.base-dn = "dc=my-domain,dc=com"
|
||||
# auth.backend.ldap.filter = "(uid=$)"
|
||||
|
||||
# auth.require = ( "/server-status" =>
|
||||
# (
|
||||
# "method" => "digest",
|
||||
# "realm" => "download archiv",
|
||||
# "require" => "group=www|user=jan|host=192.168.2.10"
|
||||
# ),
|
||||
# "/server-info" =>
|
||||
# (
|
||||
# "method" => "digest",
|
||||
# "realm" => "download archiv",
|
||||
# "require" => "group=www|user=jan|host=192.168.2.10"
|
||||
# )
|
||||
# )
|
||||
3
etcs/lighttpd/conf-available/10-accesslog.conf
Normal file
@@ -0,0 +1,3 @@
|
||||
server.modules += ( "mod_accesslog" )
|
||||
|
||||
accesslog.filename = "/var/log/lighttpd/access.log"
|
||||
15
etcs/lighttpd/conf-available/10-cgi.conf
Normal file
@@ -0,0 +1,15 @@
|
||||
# /usr/share/doc/lighttpd/cgi.txt
|
||||
|
||||
server.modules += ( "mod_cgi" )
|
||||
|
||||
$HTTP["url"] =~ "^/cgi-bin/" {
|
||||
cgi.assign = ( "" => "" )
|
||||
}
|
||||
|
||||
## Warning this represents a security risk, as it allow to execute any file
|
||||
## with a .pl/.py even outside of /usr/lib/cgi-bin.
|
||||
#
|
||||
#cgi.assign = (
|
||||
# ".pl" => "/usr/bin/perl",
|
||||
# ".py" => "/usr/bin/python",
|
||||
#)
|
||||
2
etcs/lighttpd/conf-available/10-dir-listing.conf
Normal file
@@ -0,0 +1,2 @@
|
||||
dir-listing.encoding = "utf-8"
|
||||
server.dir-listing = "enable"
|
||||
1
etcs/lighttpd/conf-available/10-evasive.conf
Normal file
@@ -0,0 +1 @@
|
||||
server.modules += ( "mod_evasive" )
|
||||
5
etcs/lighttpd/conf-available/10-evhost.conf
Normal file
@@ -0,0 +1,5 @@
|
||||
# http://redmine.lighttpd.net/wiki/1/Docs:ModEVhost
|
||||
|
||||
server.modules += ( "mod_evhost" )
|
||||
|
||||
evhost.path-pattern = "/srv/%_/htdocs"
|
||||
3
etcs/lighttpd/conf-available/10-expire.conf
Normal file
@@ -0,0 +1,3 @@
|
||||
# http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ModExpire
|
||||
|
||||
server.modules += ( "mod_expire" )
|
||||
4
etcs/lighttpd/conf-available/10-fastcgi.conf
Normal file
@@ -0,0 +1,4 @@
|
||||
# /usr/share/doc/lighttpd/fastcgi.txt.gz
|
||||
# http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ConfigurationOptions#mod_fastcgi-fastcgi
|
||||
|
||||
server.modules += ( "mod_fastcgi" )
|
||||
1
etcs/lighttpd/conf-available/10-flv-streaming.conf
Normal file
@@ -0,0 +1 @@
|
||||
server.modules += ( "mod_flv_streaming" )
|
||||
3
etcs/lighttpd/conf-available/10-no-www.conf
Normal file
@@ -0,0 +1,3 @@
|
||||
$HTTP["host"] =~ "^www\.(.*)" {
|
||||
url.redirect = ( "^/(.*)" => "http://%1/$1" )
|
||||
}
|
||||
25
etcs/lighttpd/conf-available/10-proxy.conf
Normal file
@@ -0,0 +1,25 @@
|
||||
# /usr/share/doc/lighttpd/proxy.txt
|
||||
|
||||
server.modules += ( "mod_proxy" )
|
||||
|
||||
## Balance algorithm, possible values are: "hash", "round-robin" or "fair" (default)
|
||||
# proxy.balance = "hash"
|
||||
|
||||
|
||||
## Redirect all queries to files ending with ".php" to 192.168.0.101:80
|
||||
#proxy.server = ( ".php" =>
|
||||
# (
|
||||
# ( "host" => "192.168.0.101",
|
||||
# "port" => 80
|
||||
# )
|
||||
# )
|
||||
# )
|
||||
|
||||
## Redirect all connections on www.example.com to 10.0.0.1{0,1,2,3}
|
||||
#$HTTP["host"] == "www.example.com" {
|
||||
# proxy.balance = "hash"
|
||||
# proxy.server = ( "" => ( ( "host" => "10.0.0.10" ),
|
||||
# ( "host" => "10.0.0.11" ),
|
||||
# ( "host" => "10.0.0.12" ),
|
||||
# ( "host" => "10.0.0.13" ) ) )
|
||||
#}
|
||||
4
etcs/lighttpd/conf-available/10-rewrite.conf
Normal file
@@ -0,0 +1,4 @@
|
||||
# /usr/share/doc/lighttpd/rewrite.txt
|
||||
# http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_ConfigurationOptions#mod_rewrite-rewriting
|
||||
|
||||
server.modules += ( "mod_rewrite" )
|
||||
10
etcs/lighttpd/conf-available/10-rrdtool.conf
Normal file
@@ -0,0 +1,10 @@
|
||||
# /usr/share/doc/lighttpd/rrdtool.txt
|
||||
|
||||
server.modules += ( "mod_rrdtool" )
|
||||
|
||||
## path to the rrdtool binary
|
||||
rrdtool.binary = "/usr/bin/rrdtool"
|
||||
|
||||
## file to store the rrd database, will be created by lighttpd
|
||||
rrdtool.db-name = "/var/www/lighttpd.rrd"
|
||||
|
||||
11
etcs/lighttpd/conf-available/10-simple-vhost.conf
Normal file
@@ -0,0 +1,11 @@
|
||||
# /usr/share/doc/lighttpd/simple-vhost.txt
|
||||
|
||||
server.modules += ( "mod_simple_vhost" )
|
||||
|
||||
## The document root of a virtual host is document-root =
|
||||
## simple-vhost.server-root + $HTTP["host"] + simple-vhost.document-root
|
||||
simple-vhost.server-root = "/srv"
|
||||
simple-vhost.document-root = "htdocs"
|
||||
|
||||
## the default host if no host is sent
|
||||
simple-vhost.default-host = "www.example.com"
|
||||
5
etcs/lighttpd/conf-available/10-ssi.conf
Normal file
@@ -0,0 +1,5 @@
|
||||
# /usr/share/doc/lighttpd/ssi.txt
|
||||
|
||||
server.modules += ( "mod_ssi" )
|
||||
|
||||
ssi.extension = ( ".shtml" )
|
||||
9
etcs/lighttpd/conf-available/10-ssl.conf
Normal file
@@ -0,0 +1,9 @@
|
||||
# /usr/share/doc/lighttpd/ssl.txt
|
||||
|
||||
$SERVER["socket"] == "0.0.0.0:443" {
|
||||
ssl.engine = "enable"
|
||||
ssl.pemfile = "/etc/lighttpd/server.pem"
|
||||
|
||||
ssl.cipher-list = "ECDHE-RSA-AES256-SHA384:AES256-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH:!AESGCM"
|
||||
ssl.honor-cipher-order = "enable"
|
||||
}
|
||||
15
etcs/lighttpd/conf-available/10-status.conf
Normal file
@@ -0,0 +1,15 @@
|
||||
# /usr/share/doc/lighttpd/status.txt
|
||||
# http://trac.lighttpd.net/trac/wiki/Docs%3AModStatus
|
||||
|
||||
server.modules += ( "mod_status" )
|
||||
|
||||
# status.status-url = "/server-status"
|
||||
|
||||
# status.config-url = "/server-config"
|
||||
|
||||
## relative URL for a plain-text page containing the internal statistics
|
||||
# status.statistics-url = "/server-statistics"
|
||||
|
||||
## add JavaScript which allows client-side sorting for the connection overview
|
||||
## default: enable
|
||||
# status.enable-sort = "disable"
|
||||
13
etcs/lighttpd/conf-available/10-userdir.conf
Normal file
@@ -0,0 +1,13 @@
|
||||
## The userdir module provides a simple way to link user-based directories into
|
||||
## the global namespace of the webserver.
|
||||
##
|
||||
# /usr/share/doc/lighttpd/userdir.txt
|
||||
|
||||
server.modules += ( "mod_userdir" )
|
||||
|
||||
## the subdirectory of a user's home dir which should be accessible
|
||||
## under http://$host/~$user
|
||||
userdir.path = "public_html"
|
||||
|
||||
## The users whose home directories should not be accessible
|
||||
userdir.exclude-user = ( "root", "postmaster" )
|
||||
1
etcs/lighttpd/conf-available/10-usertrack.conf
Normal file
@@ -0,0 +1 @@
|
||||
server.modules += ( "mod_usertrack" )
|
||||
6
etcs/lighttpd/conf-available/11-extforward.conf
Normal file
@@ -0,0 +1,6 @@
|
||||
# -*- depends: accesslog -*-
|
||||
|
||||
server.modules += ( "mod_extforward" )
|
||||
|
||||
# extforward.headers = ("X-Cluster-Client-Ip")
|
||||
# extforward.forwarder = ("10.0.0.232" => "trust")
|
||||
20
etcs/lighttpd/conf-available/15-fastcgi-php.conf
Normal file
@@ -0,0 +1,20 @@
|
||||
# -*- depends: fastcgi -*-
|
||||
# /usr/share/doc/lighttpd/fastcgi.txt.gz
|
||||
# http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ConfigurationOptions#mod_fastcgi-fastcgi
|
||||
|
||||
## Start an FastCGI server for php (needs the php5-cgi package)
|
||||
fastcgi.server += ( ".php" =>
|
||||
((
|
||||
"bin-path" => "/usr/bin/php-cgi",
|
||||
"socket" => "/var/run/lighttpd/php.socket",
|
||||
"max-procs" => 1,
|
||||
"bin-environment" => (
|
||||
"PHP_FCGI_CHILDREN" => "4",
|
||||
"PHP_FCGI_MAX_REQUESTS" => "10000"
|
||||
),
|
||||
"bin-copy-environment" => (
|
||||
"PATH", "SHELL", "USER"
|
||||
),
|
||||
"broken-scriptfilename" => "enable"
|
||||
))
|
||||
)
|
||||
15
etcs/lighttpd/conf-available/90-debian-doc.conf
Normal file
@@ -0,0 +1,15 @@
|
||||
#### handle Debian Policy Manual, Section 11.5. urls
|
||||
## by default allow them only from localhost
|
||||
$HTTP["remoteip"] =~ "^127\.0\.0\.1$|^::1$" {
|
||||
alias.url += (
|
||||
"/cgi-bin/" => "/usr/lib/cgi-bin/",
|
||||
"/doc/" => "/usr/share/doc/",
|
||||
"/images/" => "/usr/share/images/"
|
||||
)
|
||||
$HTTP["url"] =~ "^/doc/|^/images/" {
|
||||
dir-listing.activate = "enable"
|
||||
}
|
||||
$HTTP["url"] =~ "^/cgi-bin/" {
|
||||
cgi.assign = ( "" => "" )
|
||||
}
|
||||
}
|
||||
1
etcs/lighttpd/conf-available/90-javascript-alias.conf
Normal file
@@ -0,0 +1 @@
|
||||
alias.url += ("/javascript" => "/usr/share/javascript")
|
||||
22
etcs/lighttpd/conf-available/README
Normal file
@@ -0,0 +1,22 @@
|
||||
ligghttpd Configuration under Debian GNU/Linux
|
||||
==============================================
|
||||
|
||||
Files and Directories in /etc/lighttpd:
|
||||
---------------------------------------
|
||||
|
||||
lighttpd.conf:
|
||||
main configuration file
|
||||
|
||||
conf-available/
|
||||
This directory contains a series of .conf files. These files contain
|
||||
configuration directives necessary to load and run webserver modules.
|
||||
If you want to create your own files they names should be
|
||||
build as nn-name.conf where "nn" is two digit number (number
|
||||
is used to find order for loading files)
|
||||
|
||||
conf-enabled/
|
||||
To actually enable a module for lighttpd, it is necessary to create a
|
||||
symlink in this directory to the .conf file in conf-available/.
|
||||
|
||||
Enabling and disabling modules could be done by provided
|
||||
/usr/sbin/lighty-enable-mod and /usr/sbin/lighty-disable-mod scripts.
|
||||
1
etcs/lighttpd/conf-enabled/90-javascript-alias.conf
Symbolic link
@@ -0,0 +1 @@
|
||||
../conf-available/90-javascript-alias.conf
|
||||
27
etcs/lighttpd/lighttpd.conf
Normal file
@@ -0,0 +1,27 @@
|
||||
server.modules = (
|
||||
"mod_access",
|
||||
"mod_alias",
|
||||
"mod_compress",
|
||||
"mod_redirect",
|
||||
)
|
||||
|
||||
server.document-root = "/home/terahz/TeraHz/frontend"
|
||||
server.upload-dirs = ( "/var/cache/lighttpd/uploads" )
|
||||
server.errorlog = "/var/log/lighttpd/error.log"
|
||||
server.pid-file = "/var/run/lighttpd.pid"
|
||||
server.username = "www-data"
|
||||
server.groupname = "www-data"
|
||||
server.port = 80
|
||||
|
||||
|
||||
index-file.names = ( "index.php", "index.html", "index.lighttpd.html" )
|
||||
url.access-deny = ( "~", ".inc" )
|
||||
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
|
||||
|
||||
compress.cache-dir = "/var/cache/lighttpd/compress/"
|
||||
compress.filetype = ( "application/javascript", "text/css", "text/html", "text/plain" )
|
||||
|
||||
# default listening port for IPv6 falls back to the IPv4 port
|
||||
include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
|
||||
include_shell "/usr/share/lighttpd/create-mime.assign.pl"
|
||||
include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
|
||||
19
etcs/rc.local
Normal file
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh -e
|
||||
#
|
||||
# rc.local
|
||||
#
|
||||
# This script is executed at the end of each multiuser runlevel.
|
||||
# Make sure that the script will "exit 0" on success or any other
|
||||
# value on error.
|
||||
#
|
||||
# In order to enable or disable this script just change the execution
|
||||
# bits.
|
||||
#
|
||||
# By default this script does nothing.
|
||||
|
||||
# Print the IP address
|
||||
|
||||
cd /home/pi/TeraHz/backend
|
||||
service lighttpd start
|
||||
flask run -h 0.0.0.0 &
|
||||
exit 0
|
||||
14
etcs/resolvconf.conf
Normal file
@@ -0,0 +1,14 @@
|
||||
# Configuration for resolvconf(8)
|
||||
# See resolvconf.conf(5) for details
|
||||
|
||||
resolv_conf=/etc/resolv.conf
|
||||
# If you run a local name server, you should uncomment the below line and
|
||||
# configure your subscribers configuration files below.
|
||||
name_servers=1.1.1.1
|
||||
|
||||
# Mirror the Debian package defaults for the below resolvers
|
||||
# so that resolvconf integrates seemlessly.
|
||||
#dnsmasq_resolv=/var/run/dnsmasq/resolv.conf
|
||||
#pdnsd_conf=/etc/pdnsd.conf
|
||||
#unbound_conf=/var/cache/unbound/resolvconf_resolvers.conf
|
||||
resolvconf=NO
|
||||
56
frontend/frontend.js
Normal file
@@ -0,0 +1,56 @@
|
||||
// All code in this file is licensed under the ISC license, provided in LICENSE.txt
|
||||
var globalObject;
|
||||
$('#update').click(function () {
|
||||
updateData();
|
||||
});
|
||||
// jQuery event binder
|
||||
|
||||
function updateData () {
|
||||
// download data from backend into obj
|
||||
const url = 'http://' + window.location.hostname + ':5000/data';
|
||||
// I understand how bad this line looks. Please don't judge me...
|
||||
$.get(url, function (data, status) { // standard jQuery AJAX
|
||||
globalObject = data;
|
||||
})
|
||||
.done(function () {
|
||||
fillTable(globalObject, $('#specter'));
|
||||
graphSpectralData(globalObject, $('#spectrogram'));
|
||||
fillLuxUv(globalObject, $('#luxuv'));
|
||||
});
|
||||
}
|
||||
|
||||
function fillTable (obj, dom) {
|
||||
// applies data in obj[0] to HTML tags with the obj's key as ID.
|
||||
// useful mostly for slapping spectrometer JSON into HTML tables.
|
||||
for (var i in obj[0]) {
|
||||
$(dom).find('#' + i).text(obj[0][i]);
|
||||
}
|
||||
}
|
||||
|
||||
function graphSpectralData (obj, dom) {
|
||||
// graphs the data from obj[0] into canvas at dom
|
||||
var arr = [];
|
||||
['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'R', 'I', 'S', 'J', 'T', 'U', 'V', 'W', 'K', 'L'].forEach(function (i) {
|
||||
arr.push(obj[0][i]);
|
||||
});
|
||||
var chart = new Chart(dom, {
|
||||
type: 'line',
|
||||
data: {
|
||||
labels: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'R', 'I', 'S', 'J', 'T', 'U', 'V', 'W', 'K', 'L'],
|
||||
datasets: [{
|
||||
label: 'Spectrometer data',
|
||||
data: arr
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
responsive: false
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function fillLuxUv (obj, dom) {
|
||||
$(dom).find('#lx').text(obj[1]);
|
||||
$(dom).find('#uva').text(obj[2][0]);
|
||||
$(dom).find('#uvb').text(obj[2][1]);
|
||||
$(dom).find('#uvi').text(obj[2][2]);
|
||||
}
|
||||
154
frontend/index.html
Normal file
@@ -0,0 +1,154 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf8">
|
||||
<link rel="stylesheet" href="lib/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="stylesheet.css">
|
||||
<title>TeraHz</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container text-center">
|
||||
<h1>TeraHz</h1>
|
||||
</div>
|
||||
<div class="container">
|
||||
<button id="update" class="btn btn-primary m-1 float-right">Get data</button>
|
||||
<p id="debug">
|
||||
</p>
|
||||
<h3>Spectrogram</h3>
|
||||
<canvas id="spectrogram" width="640px" height="480"></canvas>
|
||||
<h3>Spectral readings</h3>
|
||||
<table class="table table-sm" id="specter">
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
<th>Band</th>
|
||||
<th>Wavelength [nm]</th>
|
||||
<th>Irradiance [μW/cm²]</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr>
|
||||
<td>A</td>
|
||||
<td>410 nm</td>
|
||||
<td id="A">---</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>B</td>
|
||||
<td>435 nm</td>
|
||||
<td id="B">---</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>C</td>
|
||||
<td>460 nm</td>
|
||||
<td id="C">---</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>D</td>
|
||||
<td>485 nm</td>
|
||||
<td id="D">---</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>E</td>
|
||||
<td>510 nm</td>
|
||||
<td id="E">---</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>F</td>
|
||||
<td>535 nm</td>
|
||||
<td id="F">---</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>G</td>
|
||||
<td>560 nm</td>
|
||||
<td id="G">---</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>H</td>
|
||||
<td>585 nm</td>
|
||||
<td id="H">---</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>R</td>
|
||||
<td>610 nm</td>
|
||||
<td id="R">---</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>I</td>
|
||||
<td>645 nm</td>
|
||||
<td id="I">---</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>S</td>
|
||||
<td>680 nm</td>
|
||||
<td id="S">---</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>J</td>
|
||||
<td>705 nm</td>
|
||||
<td id="J">---</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>T</td>
|
||||
<td>730 nm</td>
|
||||
<td id="T">---</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>U</td>
|
||||
<td>760 nm</td>
|
||||
<td id="U">---</td>
|
||||
</tr>
|
||||
<tr class="table-secondary">
|
||||
<td>V</td>
|
||||
<td>810 nm</td>
|
||||
<td id="V">---</td>
|
||||
</tr>
|
||||
<tr class="table-secondary">
|
||||
<td>W</td>
|
||||
<td>860 nm</td>
|
||||
<td id="W">---</td>
|
||||
</tr>
|
||||
<tr class="table-secondary">
|
||||
<td>K</td>
|
||||
<td>900 nm</td>
|
||||
<td id="K">---</td>
|
||||
</tr>
|
||||
<tr class="table-secondary">
|
||||
<td>L</td>
|
||||
<td>940 nm</td>
|
||||
<td id="L">---</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<h3>Lux and UV readings</h3>
|
||||
<table class="table" id="luxuv">
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
<th>Parameter</th>
|
||||
<th>Value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr>
|
||||
<td>Illuminance [lx]</td>
|
||||
<td id="lx">---</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>UVA irradiance [μW/cm²]</td>
|
||||
<td id="uva">---</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>UVB irradiance [μW/cm²]</td>
|
||||
<td id="uvb">---</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>UVA/UVB average [μW/cm²]</td>
|
||||
<td id="uvi">---</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<script src="lib/bootstrap.bundle.min.js"></script>
|
||||
<script src="lib/jquery-3.4.1.min.js"></script>
|
||||
<script src="lib/chart.bundle.js"></script>
|
||||
<script src="frontend.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
7
frontend/lib/bootstrap.bundle.min.js
vendored
Normal file
1
frontend/lib/bootstrap.bundle.min.js.map
Normal file
7
frontend/lib/bootstrap.min.css
vendored
Normal file
1
frontend/lib/bootstrap.min.css.map
Normal file
19288
frontend/lib/chart.bundle.js
Normal file
2
frontend/lib/jquery-3.4.1.min.js
vendored
Normal file
56
frontend/stylesheet.css
Normal file
@@ -0,0 +1,56 @@
|
||||
#A {
|
||||
background-color: #7e00db;
|
||||
color: white;
|
||||
}
|
||||
|
||||
#B {
|
||||
background-color: #2300ff;
|
||||
color: white;
|
||||
}
|
||||
|
||||
#C {
|
||||
background-color: #007bff;
|
||||
color: white;
|
||||
}
|
||||
|
||||
#D {
|
||||
background-color: #00eaff;
|
||||
}
|
||||
|
||||
#E {
|
||||
background-color: #00ff00;
|
||||
}
|
||||
|
||||
#F {
|
||||
background-color: #70ff00;
|
||||
}
|
||||
|
||||
#G {
|
||||
background-color: #c3ff00;
|
||||
}
|
||||
|
||||
#H {
|
||||
background-color: #ffef00;
|
||||
}
|
||||
|
||||
#R {
|
||||
background-color: #ff9b00;
|
||||
}
|
||||
|
||||
#I, #S {
|
||||
background-color: #ff0000;
|
||||
}
|
||||
|
||||
#J {
|
||||
background-color: #f60000;
|
||||
}
|
||||
|
||||
#T {
|
||||
background-color: #c80000;
|
||||
color: white;
|
||||
}
|
||||
|
||||
#U {
|
||||
background-color: #8d0000;
|
||||
color: white;
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<!-- Required meta tags -->
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
|
||||
<!-- Bootstrap CSS -->
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
<title>Spektrometer
|
||||
</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1><div class="p-3 mb-2 bg-primary text-white">Spektrometer</div></h1>
|
||||
|
||||
<div>
|
||||
<button type="button" class="btn btn-dark btn-lg btn-block">Pridobi rezultate
|
||||
</div>
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||