mirror of
https://github.com/casjaysdevdocker/tor
synced 2026-06-24 02:01:02 -04:00
fd24da283f
Replace all boilerplate in the 7 service init scripts with the new
template structure from 00-template.sh while preserving all
service-specific content (function bodies, variables, heredoc configs).
Key boilerplate changes applied to all scripts:
- WTFPL license header, 2026 copyright, 49-char separators
- shellcheck disable list updated (SC2317, SC2329 added)
- set -e placed before trap lines
- New __trap_err_handler() with smart critical vs non-critical detection
- SIGPWR trap added as separate line with 2>/dev/null || true
- ${VAR##*/} replacing $(basename -- ...) for SCRIPT_NAME/EXEC_CMD_NAME
- if-block style throughout (replacing one-liner && / || guards)
- _resolved pattern for binary path resolution
- New __run_start_script with printf/hash-cache/bash "$START_SCRIPT"
- __run_secure_function with [ -n "$SERVICE_USER" ] && guard
- SERVICE_USES_PID='' variable added after EXEC_PRE_SCRIPT
- ${PIPESTATUS[0]} replacing $? after pipelines
- sleep 2 (not sleep 5) in __pre_execute
- fire-and-forget pattern in __post_execute (retVal=0)
- No __banner call at end; no SERVICE_PID_NUMBER= at bottom
- Remove duplicate "create needed dirs" block
- Remove IP4_ADDRESS/IP6_ADDRESS lines
- path: rootfs/usr/local/etc/docker/init.d/01-tor-server.sh: refactor to new template boilerplate; preserve tor-server service logic
- path: rootfs/usr/local/etc/docker/init.d/02-tor-bridge.sh: refactor to new template boilerplate; preserve tor-bridge service logic
- path: rootfs/usr/local/etc/docker/init.d/03-tor-relay.sh: refactor to new template boilerplate; preserve tor-relay service logic
- path: rootfs/usr/local/etc/docker/init.d/04-tor-exit.sh: refactor to new template boilerplate; preserve tor-exit service logic
- path: rootfs/usr/local/etc/docker/init.d/09-unbound.sh: refactor to new template boilerplate; preserve unbound service logic
- path: rootfs/usr/local/etc/docker/init.d/98-privoxy.sh: refactor to new template boilerplate; preserve privoxy service logic
- path: rootfs/usr/local/etc/docker/init.d/zz-nginx.sh: refactor to new template boilerplate; preserve nginx/onion service logic
README.md
rootfs/usr/local/etc/docker/init.d/01-tor-server.sh
rootfs/usr/local/etc/docker/init.d/02-tor-bridge.sh
rootfs/usr/local/etc/docker/init.d/03-tor-relay.sh
rootfs/usr/local/etc/docker/init.d/04-tor-exit.sh
rootfs/usr/local/etc/docker/init.d/09-unbound.sh
rootfs/usr/local/etc/docker/init.d/98-privoxy.sh
rootfs/usr/local/etc/docker/init.d/zz-nginx.sh
80 lines
1.8 KiB
Markdown
80 lines
1.8 KiB
Markdown
## 👋 Welcome to tor 🚀
|
|
|
|
tor README
|
|
|
|
|
|
## Install my system scripts
|
|
|
|
```shell
|
|
sudo bash -c "$(curl -q -LSsf "https://github.com/systemmgr/installer/raw/main/install.sh")"
|
|
sudo systemmgr --config && sudo systemmgr install scripts
|
|
```
|
|
|
|
## Automatic install/update
|
|
|
|
```shell
|
|
dockermgr update tor
|
|
```
|
|
|
|
## Install and run container
|
|
|
|
```shell
|
|
dockerHome="/var/lib/srv/$USER/docker/casjaysdevdocker/tor/latest/volumes"
|
|
mkdir -p "$dockerHome"
|
|
git clone "https://github.com/dockermgr/tor" "$HOME/.local/share/CasjaysDev/dockermgr/tor"
|
|
cp -Rfva "$HOME/.local/share/CasjaysDev/dockermgr/tor/volumes/." "$dockerHome/"
|
|
docker run -d \
|
|
--restart always \
|
|
--privileged \
|
|
--name casjaysdevdocker-tor-latest \
|
|
--hostname tor \
|
|
-e TZ=${TIMEZONE:-America/New_York} \
|
|
-v "$dockerHome/data:/data:z" \
|
|
-v "$dockerHome/config:/config:z" \
|
|
-p 80:80 \
|
|
casjaysdevdocker/tor:latest
|
|
```
|
|
|
|
## via docker-compose
|
|
|
|
```yaml
|
|
services:
|
|
ProjectName:
|
|
image: casjaysdevdocker/tor
|
|
container_name: casjaysdevdocker-tor
|
|
environment:
|
|
- TZ=America/New_York
|
|
- HOSTNAME=tor
|
|
volumes:
|
|
- "/var/lib/srv/$USER/docker/casjaysdevdocker/tor/latest/volumes/data:/data:z"
|
|
- "/var/lib/srv/$USER/docker/casjaysdevdocker/tor/latest/volumes/config:/config:z"
|
|
ports:
|
|
- 80:80
|
|
restart: always
|
|
```
|
|
|
|
## Get source files
|
|
|
|
```shell
|
|
dockermgr download src casjaysdevdocker/tor
|
|
```
|
|
|
|
OR
|
|
|
|
```shell
|
|
git clone "https://github.com/casjaysdevdocker/tor" "$HOME/Projects/github/casjaysdevdocker/tor"
|
|
```
|
|
|
|
## Build container
|
|
|
|
```shell
|
|
cd "$HOME/Projects/github/casjaysdevdocker/tor"
|
|
buildx
|
|
```
|
|
|
|
## Authors
|
|
|
|
🤖 casjay: [Github](https://github.com/casjay) 🤖
|
|
⛵ casjaysdevdocker: [Github](https://github.com/casjaysdevdocker) [Docker](https://hub.docker.com/u/casjaysdevdocker) ⛵
|
|
|