aboutsummaryrefslogtreecommitdiff
path: root/net/i2pd/files
diff options
context:
space:
mode:
authorR4SAS I2P <r4sas@i2pmail.org>2021-12-26 04:29:58 +0000
committerR4SAS I2P <r4sas@i2pmail.org>2022-01-14 12:46:37 +0000
commitac27fffff9159be7b0b6529797ca45d7dc4136c0 (patch)
treebd8268466aef445b81b51af7a561fc91b95947f9 /net/i2pd/files
parent87c393f0aebaf66ef6ba6bac47bbeb6a76f0e31c (diff)
i2pd: Update to 2.40.0 and update package sources
* Updating i2pd package to 2.40.0 * Rewrite Makefile * Remove usage of PKG_INSTALL (package's make install) * Rewrite init.rc configuration and script * Remove '--service' option from init, which only sets datadir to /var/lib/i2pd * Use '--datadir' option in init, otherwise datadir changing via uci is not works * Update patch for i2pd.conf Signed-off-by: R4SAS I2P <r4sas@i2pmail.org>
Diffstat (limited to 'net/i2pd/files')
-rw-r--r--net/i2pd/files/i2pd.config32
-rwxr-xr-xnet/i2pd/files/i2pd.init75
2 files changed, 52 insertions, 55 deletions
diff --git a/net/i2pd/files/i2pd.config b/net/i2pd/files/i2pd.config
index c75bad211..bc349a48b 100644
--- a/net/i2pd/files/i2pd.config
+++ b/net/i2pd/files/i2pd.config
@@ -1,20 +1,20 @@
config i2pd
- # Make sure your directories have the right owner! (i2pd: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.
- # If you store data permanently, you may want to enable
- # 'profiles = true' and 'addressbook = true' in i2pd.conf.
- #### IMPORTANT! ####
- # Data is consistently rewritten. DO NOT POINT IT TO INNER ROM. Flash
- # will die.
+ # 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 addressbooks. If not, i2pd will be forced to do HTTP
- # 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.
- # Enable 'addressbook = true' in i2pd.conf to make it take effect.
+ # If you don't store i2pd data permanently, you can still choose to store only
+ # netDb. If not, i2pd will be forced to do HTTP reseeding on every start.
+ # Storing netDb may be useful if HTTP reseeding is not possible or blocked
+ # (by censorship).
+ # Even netDb doesn't take up too much space, extroot is still strongly
+ # recommended to avoid flash wear-out.
+ #option netdb_dir '/etc/i2pd/netDb'
+
+ # Also you can store permanently addressbook, which is used for accessing
+ # to i2p addresses using human-understandable addresses in .i2p zone.
+ # If not, it will be fetched from subscription at start after 3 minutes.
#option addressbook_dir '/etc/i2pd/addressbook'
diff --git a/net/i2pd/files/i2pd.init b/net/i2pd/files/i2pd.init
index bfea047e7..abca8824e 100755
--- a/net/i2pd/files/i2pd.init
+++ b/net/i2pd/files/i2pd.init
@@ -1,5 +1,6 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2017 OpenWrt.org
+# Copyright (C) 2021-2022 PurpleI2P team
USE_PROCD=1
@@ -14,42 +15,54 @@ PIDFILE=/var/run/i2pd.pid
DATADIR=/var/lib/i2pd
CONFFILE=/etc/i2pd/i2pd.conf
-
-
-i2pd_start() {
- local cfg="$1"
- local data_dir
- local addressbook_dir
+start_instance() {
+ local data_dir netdb_dir addressbook_dir cfg="$1"
config_get data_dir "$cfg" data_dir "$DATADIR"
+ config_get netdb_dir "$cfg" netdb_dir
config_get addressbook_dir "$cfg" addressbook_dir
## Setting up data dir
- if [ ! -d "$data_dir" ] ; then
+ if [ ! -d "$data_dir" ]; then
mkdir -p "$data_dir"
- chown "$USER:$GROUP" "$data_dir"
ln -s /usr/share/i2pd/certificates "$data_dir/certificates"
- 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 /etc/i2pd/i2pd.conf "$data_dir/i2pd.conf"
+ ln -s /etc/i2pd/tunnels.conf "$data_dir/tunnels.conf"
+ ln -s /etc/i2pd/tunnels.d "$data_dir/tunnels.d"
+ fi
+
+ if [ -n "$netdb_dir" ]; then
+ if [ ! -d "$netdb_dir" ]; then
+ mkdir -p "$netdb_dir"
fi
+ ln -s "$netdb_dir" "$data_dir/netDb"
+ fi
+
+ if [ -n "$addressbook_dir" ]; then
+ if [ ! -d "$addressbook_dir" ]; then
+ mkdir -p "$addressbook_dir"
+ fi
+ ln -s "$addressbook_dir" "$data_dir/addressbook"
fi
- [ -d "$DATADIR" ] || ln -s "$data_dir" "$DATADIR"
## We need permissions
+ chown "$USER:$GROUP" "$data_dir"
+
+ if [ -n "$netdb_dir" ]; then
+ chown "$USER:$GROUP" "$netdb_dir"
+ fi
+
+ if [ -n "$addressbook_dir" ]; then
+ chown "$USER:$GROUP" "$addressbook_dir"
+ fi
+
touch "$PIDFILE"
chown "$USER:adm" "$PIDFILE"
- chown "$USER:adm" "$CONFFILE"
procd_open_instance
- procd_set_param command "$PROG" --service --conf="$CONFFILE" --pidfile "$PIDFILE"
- procd_set_param env "HOME=$DATADIR"
- ## 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
- # procd_set_param limits core="unlimited unlimited"
+ procd_set_param command "$PROG" --datadir="$data_dir" --conf="$CONFFILE" --pidfile "$PIDFILE"
+ ## Don't know about i2pd user's HOME
+ procd_set_param env "HOME=$data_dir"
procd_set_param limits nofile=4096
procd_set_param stdout 1
procd_set_param stderr 1
@@ -58,23 +71,7 @@ i2pd_start() {
procd_close_instance
}
-
start_service() {
- local instance="$1"
- local instance_found=0
-
- config_cb() {
- local type="$1"
- local name="$2"
- [ "$type" = "i2pd" -a -n "$instance" -a "$instance" = "$name" ] && instance_found=1
- }
-
- config_load i2pd
-
- if [ -n "$instance" ]; then
- [ "$instance_found" = 0 ] && return
- i2pd_start "$instance"
- else
- config_foreach i2pd_start i2pd
- fi
+ config_load "i2pd"
+ config_foreach start_instance "i2pd"
}