mirror of
https://git.FreeBSD.org/ports.git
synced 2025-01-19 08:13:21 +00:00
cebdb0c2fc
- Use fixed uid and gid - Rewrite the rc script to use the new rc.d style and split into two scripts: hts (for server) and htc (for client) - Bump PORTREVISION for this PR: ports/125714 (based on) Submitted by: G.V. Tjong A Hung <gvtjongahung at users.sourceforge.net> (based on)
78 lines
2.0 KiB
Bash
78 lines
2.0 KiB
Bash
#!/bin/sh
|
|
|
|
# PROVIDE: htc
|
|
# REQUIRE: LOGIN
|
|
#
|
|
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
|
|
# to enable this service:
|
|
#
|
|
# htc_enable (bool): Set to NO by default.
|
|
# Set it to YES to enable httptunnel client.
|
|
# htc_port (string): host:port where hts is running
|
|
# htc_forward (string): Talk to this socket.
|
|
# htc_device (string): *or* talk to this device.
|
|
#
|
|
# htc_proxy (string): host:port of proxy to talk to hts via
|
|
# htc_proxyauth (string): user:password to pass to proxy, or a file
|
|
# htc_proxybuffer (string): Buffer size for buffered proxies.
|
|
# Default set to "1K".
|
|
# htc_browser (string): Pretend to be this browser.
|
|
# Default set to "Mozilla/4.7 [en] (X11; I; Linux 2.2.12 i386)".
|
|
# htc_flags (string): additional arguments to htc. Default set to -S.
|
|
#
|
|
|
|
. %%RC_SUBR%%
|
|
|
|
name="htc"
|
|
rcvar=${name}_enable
|
|
|
|
command=%%PREFIX%%/bin/${name}
|
|
|
|
start_precmd="htc_prestart"
|
|
|
|
htc_prestart()
|
|
{
|
|
if checkyesno htc_enable; then
|
|
if [ -z "$htc_device" -a -z "$htc_forward" ]; then
|
|
err 1 "Specify either htc_device or htc_forward"
|
|
fi
|
|
fi
|
|
|
|
return 0
|
|
}
|
|
|
|
|
|
load_rc_config $name
|
|
|
|
: ${htc_enable="NO"}
|
|
: ${htc_user="httptunnel"}
|
|
|
|
: ${htc_port=""}
|
|
: ${htc_forward=""}
|
|
: ${htc_device=""}
|
|
|
|
: ${htc_proxy=""}
|
|
: ${htc_proxyauth=""}
|
|
: ${htc_proxybuffer="1K"}
|
|
: ${htc_browser="Mozilla/4.7 [en] (X11; I; Linux 2.2.12 i386)"}
|
|
: ${htc_flags="-S"}
|
|
|
|
[ -n "$htc_forward" ] && command_args="-F $htc_forward"
|
|
[ -n "$htc_device" ] && command_args="-d $htc_device"
|
|
[ -n "$htc_browser" ] && command_args="-U '\"'\"'$htc_browser'\"'\"' $command_args"
|
|
if [ -n "$htc_proxy" ]; then
|
|
[ -n "$htc_proxybuffer" ] && command_args="-B $htc_proxybuffer $command_args"
|
|
if [ -n "$htc_proxyauth" ]; then
|
|
if [ -f "$htc_proxyauth" ]; then
|
|
command_args="--proxy-authorization-file $htc_proxyauth $command_args"
|
|
else
|
|
command_args="-A $htc_proxyauth $command_args"
|
|
fi
|
|
fi
|
|
command_args="-P $htc_proxy $command_args"
|
|
fi
|
|
|
|
command_args="$command_args $htc_port"
|
|
|
|
run_rc_command "$1"
|