aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesús <heckyel@hyperbola.info>2021-01-10 15:31:22 -0500
committerJesús <heckyel@hyperbola.info>2021-01-10 15:31:22 -0500
commit3868295b057c06d02783bb730260e37b937c1625 (patch)
tree2ecd026dbd9a04454ad7e7988c00d324b8d3fd36
parent78abaf7aba2c09769ab85c1ea8469abe99d2b53d (diff)
downloadyt-local-3868295b057c06d02783bb730260e37b937c1625.tar.lz
yt-local-3868295b057c06d02783bb730260e37b937c1625.tar.xz
yt-local-3868295b057c06d02783bb730260e37b937c1625.zip
Organize docs
-rw-r--r--README.md2
-rw-r--r--docs/HACKING.md (renamed from HACKING.md)4
-rw-r--r--docs/basic-script-openrc/README.md76
3 files changed, 81 insertions, 1 deletions
diff --git a/README.md b/README.md
index 4f314e9..e36f12e 100644
--- a/README.md
+++ b/README.md
@@ -114,7 +114,7 @@ In general, Tor video routing will be slower (for instance, moving around in the
Pull requests and issues are welcome
-For coding guidelines and an overview of the software architecture, see the HACKING.md file.
+For coding guidelines and an overview of the software architecture, see the [HACKING.md](docs/HACKING.md) file.
## License
diff --git a/HACKING.md b/docs/HACKING.md
index 092938f..82128e5 100644
--- a/HACKING.md
+++ b/docs/HACKING.md
@@ -60,3 +60,7 @@
* You'll want to have a utility or IDE that can perform full text search on a repository, since this is crucial for navigating unfamiliar codebases to figure out where certain strings appear or where things get defined.
* If you're confused what the purpose of a particular line/section of code is, you can use the "git blame" feature on github (click the line number and then the three dots) to view the commit where the line of code was created and check the commit message. This will give you an idea of how it was put together.
+
+## OpenRC init
+
+You see [configuration with OpenRC](basic-script-openrc/README.md)
diff --git a/docs/basic-script-openrc/README.md b/docs/basic-script-openrc/README.md
new file mode 100644
index 0000000..7bef31e
--- /dev/null
+++ b/docs/basic-script-openrc/README.md
@@ -0,0 +1,76 @@
+## Basic init yt-local for openrc
+
+1. Write `/etc/init.d/ytlocal` file.
+
+```
+#!/sbin/openrc-run
+# Distributed under the terms of the GNU General Public License v3 or later
+name="yt-local"
+pidfile="/var/run/ytlocal.pid"
+command="/usr/sbin/ytlocal"
+
+depend() {
+ use net
+}
+
+start_pre() {
+ if [ ! -f /usr/sbin/ytlocal ] ; then
+ eerror "Please create script file of ytlocal in '/usr/sbin/ytlocal'"
+ return 1
+ else
+ return 0
+ fi
+}
+
+start() {
+ ebegin "Starting yt-local"
+ start-stop-daemon --start --exec "${command}" --pidfile "${pidfile}"
+ eend $?
+}
+
+reload() {
+ ebegin "Reloading ${name}"
+ start-stop-daemon --signal HUP --pidfile "${pidfile}"
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping ${name}"
+ start-stop-daemon --quiet --stop --exec "${command}" --pidfile "${pidfile}"
+ eend $?
+}
+```
+
+after, modified execute permissions:
+
+ $ doas chmod a+x /etc/init.d/ytlocal
+
+
+2. Write `/usr/sbin/ytlocal` and configure path.
+
+```
+#!/usr/bin/env bash
+
+cd /home/your-path/ytlocal/ # change me
+source venv/bin/activate
+python server.py > /dev/null 2>&1 &
+echo $! > /var/run/ytlocal.pid
+```
+
+after, modified execute permissions:
+
+ $ doas chmod a+x /usr/sbin/ytlocal
+
+
+3. OpenRC check
+
+- status: `doas rc-service ytlocal status`
+- start: `doas rc-service ytlocal start`
+- restart: `doas rc-service ytlocal restart`
+- stop: `doas rc-service ytlocal stop`
+
+- enable: `doas rc-update add ytlocal default`
+- disable: `doas rc-update del ytlocal`
+
+When yt-local is run with administrator privileges,
+the configuration file is stored in /root/.youtube-local