mirror of
https://github.com/novatiq/packages.git
synced 2026-04-29 23:18:42 +01:00
Signed-off-by: David Yang <mmyangfl@gmail.com>
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
config i2pd
|
||||
# Set where i2pd should store its data (netDB, certificates, addresses, etc)
|
||||
# By default we store it in RAM so no data is written to ROM.
|
||||
# IMPORTANT!
|
||||
# Data is consistently rewritten. DO NOT POINT IT TO INNER ROM. Flash will
|
||||
# die.
|
||||
option data_dir '/var/lib/i2pd'
|
||||
|
||||
# If you don't store i2pd data permanently, you can still choose to store only
|
||||
# addressbook. If not, i2pd will be forced to do HTTP reseeding reseeding on
|
||||
# every start. Storing addressbook may be useful if HTTP reseeding is not
|
||||
# possible or blocked (by censorship).
|
||||
# Even addressbook doesn't take up too much space, extroot is still strongly
|
||||
# recommended to avoid flash wear-out.
|
||||
#option addressbook_dir '/etc/i2pd/addressbook'
|
||||
+33
-15
@@ -6,36 +6,54 @@ USE_PROCD=1
|
||||
START=90
|
||||
STOP=10
|
||||
|
||||
# default params
|
||||
PROG=/usr/sbin/i2pd
|
||||
USER="i2pd"
|
||||
GROUP="i2pd"
|
||||
PIDFILE=/var/run/i2pd.pid
|
||||
DATADIR=/var/lib/i2pd
|
||||
#DATADIR=/var/lib/i2pd
|
||||
CONFFILE=/etc/i2pd/i2pd.conf
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
|
||||
|
||||
start_service() {
|
||||
## RAM
|
||||
if [ ! -d $DATADIR ]; then
|
||||
mkdir -p $DATADIR
|
||||
ln -s /usr/share/i2pd/certificates $DATADIR/certificates
|
||||
ln -s /etc/i2pd/tunnels.conf $DATADIR/tunnels.conf
|
||||
# for peoples who not possible to use http reseeding
|
||||
ln -s /etc/i2pd/addressbook $DATADIR/addressbook
|
||||
local data_dir
|
||||
local addressbook_dir
|
||||
|
||||
config_load i2pd
|
||||
|
||||
config_get data_dir i2pd data_dir
|
||||
config_get addressbook_dir i2pd addressbook_dir
|
||||
|
||||
## Setting up data dir
|
||||
if [ ! -d "$data_dir" ]; then
|
||||
mkdir -p "$data_dir"
|
||||
ln -s /usr/share/i2pd/certificates "$data_dir/certificates"
|
||||
ln -s /etc/i2pd/tunnels.conf "$data_dir/tunnels.conf"
|
||||
if [ -n "$addressbook_dir" ]; then
|
||||
if [ ! -d "$addressbook_dir" ]; then
|
||||
mkdir -p "$addressbook_dir"
|
||||
fi
|
||||
ln -s "$addressbook_dir" "$data_dir/addressbook"
|
||||
fi
|
||||
fi
|
||||
|
||||
## We need permissions
|
||||
chown $USER:$GROUP $DATADIR
|
||||
touch $PIDFILE
|
||||
chown $USER:adm $PIDFILE
|
||||
chown "$USER:$GROUP" "$data_dir"
|
||||
chown "$USER:$GROUP" "$addressbook_dir"
|
||||
touch "$PIDFILE"
|
||||
chown "$USER:adm" "$PIDFILE"
|
||||
|
||||
procd_open_instance
|
||||
procd_set_param command $PROG --service --conf=/etc/i2pd/i2pd.conf --pidfile $PIDFILE
|
||||
procd_set_param command "$PROG" --service --conf="$CONFFILE" --pidfile "$PIDFILE"
|
||||
## Don't know about i2pd user's HOME
|
||||
procd_set_param env HOME=$DATADIR
|
||||
procd_set_param env "HOME=$DATADIR"
|
||||
procd_set_param limits nofile=4096
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
procd_set_param user $USER
|
||||
procd_set_param pidfile $PIDFILE
|
||||
procd_set_param user "$USER"
|
||||
procd_set_param pidfile "$PIDFILE"
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user