|
@ -17,7 +17,6 @@ CONFFILE=/etc/i2pd/i2pd.conf |
|
|
. /lib/functions.sh |
|
|
. /lib/functions.sh |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
i2pd_start() { |
|
|
i2pd_start() { |
|
|
local cfg="$1" |
|
|
local cfg="$1" |
|
|
local data_dir |
|
|
local data_dir |
|
@ -27,16 +26,19 @@ i2pd_start() { |
|
|
config_get addressbook_dir "$cfg" addressbook_dir |
|
|
config_get addressbook_dir "$cfg" addressbook_dir |
|
|
|
|
|
|
|
|
## Setting up data dir |
|
|
## Setting up data dir |
|
|
[ -d "$data_dir" ] || { |
|
|
|
|
|
|
|
|
if [ ! -d "$data_dir" ] ; then |
|
|
mkdir -p "$data_dir" |
|
|
mkdir -p "$data_dir" |
|
|
chown "$USER:$GROUP" "$data_dir" |
|
|
chown "$USER:$GROUP" "$data_dir" |
|
|
ln -s /usr/share/i2pd/certificates "$data_dir/certificates" |
|
|
ln -s /usr/share/i2pd/certificates "$data_dir/certificates" |
|
|
[ -n "$addressbook_dir" ] && { |
|
|
|
|
|
[ -d "$addressbook_dir" ] || mkdir -p "$addressbook_dir" |
|
|
|
|
|
chown "$USER:$GROUP" "$addressbook_dir" |
|
|
|
|
|
|
|
|
if [ -n "$addressbook_dir" ] ; then |
|
|
|
|
|
if [ ! -d "$addressbook_dir" ] ; then |
|
|
|
|
|
mkdir -p "$addressbook_dir" |
|
|
|
|
|
chown "$USER:$GROUP" "$addressbook_dir" |
|
|
|
|
|
fi |
|
|
ln -s "$addressbook_dir" "$data_dir/addressbook" |
|
|
ln -s "$addressbook_dir" "$data_dir/addressbook" |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
fi |
|
|
|
|
|
fi |
|
|
|
|
|
[ -d "$DATADIR" ] || ln -s "$data_dir" "$DATADIR" |
|
|
|
|
|
|
|
|
## We need permissions |
|
|
## We need permissions |
|
|
touch "$PIDFILE" |
|
|
touch "$PIDFILE" |
|
@ -44,7 +46,6 @@ i2pd_start() { |
|
|
|
|
|
|
|
|
procd_open_instance |
|
|
procd_open_instance |
|
|
procd_set_param command "$PROG" --service --conf="$CONFFILE" --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" |
|
|
## For debugging, provide about 512 MB on external storage for coredump and adjust /proc/sys/kernel/core_pattern |
|
|
## For debugging, provide about 512 MB on external storage for coredump and adjust /proc/sys/kernel/core_pattern |
|
|
# echo "/tmp/coredumps/core.%e.%p.%s.%t" > /proc/sys/kernel/core_pattern |
|
|
# echo "/tmp/coredumps/core.%e.%p.%s.%t" > /proc/sys/kernel/core_pattern |
|
@ -65,13 +66,13 @@ start_service() { |
|
|
config_cb() { |
|
|
config_cb() { |
|
|
local type="$1" |
|
|
local type="$1" |
|
|
local name="$2" |
|
|
local name="$2" |
|
|
[ "$type" = "i2pd" ] && [ -n "$instance" ] && [ "$instance" = "$name" ] && instance_found=1 |
|
|
|
|
|
|
|
|
[ "$type" = "i2pd" -a -n "$instance" -a "$instance" = "$name" ] && instance_found=1 |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
config_load i2pd |
|
|
config_load i2pd |
|
|
|
|
|
|
|
|
if [ -n "$instance" ]; then |
|
|
if [ -n "$instance" ]; then |
|
|
[ "$instance_found" -gt 0 ] || return |
|
|
|
|
|
|
|
|
[ "$instance_found" = 0 ] && return |
|
|
i2pd_start "$instance" |
|
|
i2pd_start "$instance" |
|
|
else |
|
|
else |
|
|
config_foreach i2pd_start i2pd |
|
|
config_foreach i2pd_start i2pd |
|
|