From 6de1efbeb5e6dcf630c4139544ec6eaaa9835c90 Mon Sep 17 00:00:00 2001 From: David Yang Date: Thu, 31 Jan 2019 22:57:05 +0800 Subject: [PATCH] i2pd: Update to 2.23.0, fix #7845 and #8088 Signed-off-by: David Yang --- net/i2pd/Makefile | 13 ++++++----- net/i2pd/files/i2pd.config | 15 ++++++++++++ net/i2pd/files/i2pd.init | 48 ++++++++++++++++++++++++++------------ 3 files changed, 55 insertions(+), 21 deletions(-) create mode 100644 net/i2pd/files/i2pd.config diff --git a/net/i2pd/Makefile b/net/i2pd/Makefile index b1b396839..c2e484cec 100644 --- a/net/i2pd/Makefile +++ b/net/i2pd/Makefile @@ -9,13 +9,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=i2pd -PKG_VERSION:=2.22.0 +PKG_VERSION:=2.23.0 PKG_RELEASE:=1 PKG_BUILD_PARALLEL:=1 PKG_SOURCE_URL:=https://codeload.github.com/PurpleI2P/i2pd/tar.gz/$(PKG_VERSION)? PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_HASH:=6547d7a560482c5eda9106ae19267bc8afbb6af48fed3bebf423ade28103e173 +PKG_HASH:=19e8573b44b94ce83bd5705569934049cb1dc39db11449abcb9e4b36afe5a279 PKG_LICENSE:=BSD-3-clause include $(INCLUDE_DIR)/package.mk @@ -38,8 +38,8 @@ define Package/i2pd/description endef define Package/i2pd/conffiles + /etc/config/i2pd /etc/i2pd/i2pd.conf - /etc/i2pd/subscriptions.txt /etc/i2pd/tunnels.conf endef @@ -51,14 +51,15 @@ define Package/i2pd/install $(INSTALL_BIN) $(PKG_BUILD_DIR)/i2pd $(1)/usr/sbin $(INSTALL_DIR) $(1)/usr/share/i2pd $(CP) $(PKG_BUILD_DIR)/contrib/certificates $(1)/usr/share/i2pd + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./files/i2pd.config $(1)/etc/config/i2pd $(INSTALL_DIR) $(1)/etc/i2pd - $(INSTALL_BIN) $(PKG_BUILD_DIR)/contrib/i2pd.conf $(1)/etc/i2pd + $(INSTALL_CONF) $(PKG_BUILD_DIR)/contrib/i2pd.conf $(1)/etc/i2pd $(SED) ' \ s/127.0.0.1/192.168.1.1/g; \ s/datadir = \/var\/lib/datadir = \/etc/ \ ' $(1)/etc/i2pd/i2pd.conf - $(INSTALL_BIN) $(PKG_BUILD_DIR)/contrib/subscriptions.txt $(1)/etc/i2pd - $(INSTALL_BIN) $(PKG_BUILD_DIR)/contrib/tunnels.conf $(1)/etc/i2pd + $(INSTALL_CONF) $(PKG_BUILD_DIR)/contrib/tunnels.conf $(1)/etc/i2pd $(INSTALL_DIR) $(1)/etc/init.d $(INSTALL_BIN) ./files/i2pd.init $(1)/etc/init.d/i2pd endef diff --git a/net/i2pd/files/i2pd.config b/net/i2pd/files/i2pd.config new file mode 100644 index 000000000..ca6f3c756 --- /dev/null +++ b/net/i2pd/files/i2pd.config @@ -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' diff --git a/net/i2pd/files/i2pd.init b/net/i2pd/files/i2pd.init index 81e97cdce..4af101363 100755 --- a/net/i2pd/files/i2pd.init +++ b/net/i2pd/files/i2pd.init @@ -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 }