Browse Source

gnunet: improve packaging and set fix permissions on firstrun

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Daniel Golle 9 years ago
parent
commit
d6ac08f843
2 changed files with 60 additions and 28 deletions
  1. 21
    19
      net/gnunet/Makefile
  2. 39
    9
      net/gnunet/files/gnunet.init

+ 21
- 19
net/gnunet/Makefile View File

@@ -8,9 +8,9 @@
8 8
 include $(TOPDIR)/rules.mk
9 9
 
10 10
 PKG_NAME:=gnunet
11
-PKG_SOURCE_VERSION:=35856
11
+PKG_SOURCE_VERSION:=35865
12 12
 PKG_VERSION:=0.10.1-svn$(PKG_SOURCE_VERSION)
13
-PKG_RELEASE:=3
13
+PKG_RELEASE:=1
14 14
 
15 15
 # ToDo:
16 16
 #  - break-out transports
@@ -85,6 +85,7 @@ define BuildComponent
85 85
     TITLE+= $(2)
86 86
     DEPENDS:=gnunet $(DEPENDS_$(1))
87 87
     $(if $(3),DEFAULT:=y if PACKAGE_gnunet)
88
+    $(if $(USERID_$(1)),USERID:=$(USERID_$(1)))
88 89
   endef
89 90
 
90 91
   define Package/gnunet-$(1)/install
@@ -131,14 +132,14 @@ define Package/gnunet/install
131 132
 	$(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib/gnunet/libexec
132 133
 	$(INSTALL_DIR) $(1)/usr/share/gnunet/config.d $(1)/usr/share/gnunet/hellos
133 134
 
134
-	( for bin in arm ats core ecc identity nat-server nse \
135
-	    peerinfo revocation scalarproduct statistics transport uri; do \
135
+	( for bin in arm ats core config ecc identity nat-server nse \
136
+	    peerinfo peerstore revocation scalarproduct statistics transport uri; do \
136 137
 		$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gnunet-$$$$bin $(1)/usr/bin/ ; \
137 138
 	done )
138 139
 
139 140
 	( for lib in arm ats block cadet core datacache dht \
140 141
 	    dns dnsparser dnsstub fragmentation friends hello identity nat nse \
141
-	    peerinfo regexblock regex revocation scalarproduct set \
142
+	    peerinfo peerstore regexblock regex revocation scalarproduct set \
142 143
 	    statistics transport util; do \
143 144
 		$(CP) $(PKG_INSTALL_DIR)/usr/lib/libgnunet$$$$lib.so* $(1)/usr/lib/ ; \
144 145
 	done )
@@ -153,14 +154,15 @@ define Package/gnunet/install
153 154
 	( for lex in daemon-hostlist daemon-topology helper-nat-client \
154 155
 	    helper-nat-server service-arm service-ats service-cadet \
155 156
 	    service-core service-dht service-identity service-nse \
156
-	    service-peerinfo service-regex service-revocation \
157
-	    service-scalarproduct-alice service-scalarproduct-bob \
158
-	    service-set service-statistics service-transport; do \
157
+	    service-peerinfo service-peerstore service-regex \
158
+	    service-revocation service-scalarproduct-alice \
159
+	    service-scalarproduct-bob service-set service-statistics \
160
+	    service-transport; do \
159 161
 		$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/gnunet/libexec/gnunet-$$$$lex $(1)/usr/lib/gnunet/libexec ; \
160 162
 	done )
161 163
 
162
-	( for conf in arm ats cadet core datacache dht hostlist \
163
-	    identity nat nse peerinfo regex revocation scalarproduct \
164
+	( for conf in arm ats cadet core datacache dht hostlist identity \
165
+	    nat nse peerinfo peerstore regex revocation scalarproduct \
164 166
 	    set statistics topology transport util; do \
165 167
 		$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/gnunet/config.d/$$$$conf.conf $(1)/usr/share/gnunet/config.d ; \
166 168
 	done )
@@ -170,7 +172,6 @@ define Package/gnunet/install
170 172
 	$(INSTALL_BIN) ./files/gnunet.init $(1)/etc/init.d/gnunet
171 173
 endef
172 174
 
173
-
174 175
 define Build/InstallDev
175 176
 	$(INSTALL_DIR) $(1)/usr/include/gnunet $(1)/usr/lib/pkgconfig
176 177
 	$(CP) $(PKG_INSTALL_DIR)/usr/lib/*.{la,so}* $(1)/usr/lib/
@@ -196,18 +197,19 @@ LIB_EXEC_fs:=helper-fs-publish service-fs
196 197
 CONF_fs:=fs
197 198
 
198 199
 DEPENDS_gns:=+gnunet-vpn
199
-BIN_gns:=gns namecache resolver
200
+USERID_gns:=gnunetdns=401:gnunetdns=401
201
+BIN_gns:=gns gns-import.sh namecache namestore resolver
200 202
 LIB_gns:=gns gnsrecord namecache namestore
201 203
 PLUGIN_gns:=block_dns block_gns gnsrecord_dns gnsrecord_gns
202
-LIBEXEC_gns:=dns2gns gns-proxy helper-dns service-dns service-gns service-namecache service-resolver
203
-CONF_gns:=dns gns namecache resolver
204
+LIBEXEC_gns:=dns2gns gns-proxy helper-dns namestore-fcfsd service-dns service-gns service-namecache service-namestore service-resolver
205
+CONF_gns:=dns gns namecache namestore resolver
204 206
 
205 207
 DEPENDS_storage:=+gnunet-gns +libsqlite3
206
-BIN_storage:=datastore peerstore
207
-LIB_storage:=datastore peerstore
208
+BIN_storage:=datastore
209
+LIB_storage:=datastore
208 210
 PLUGIN_storage:=datacache_sqlite datastore_heap datastore_sqlite namecache_sqlite namestore_sqlite
209
-LIBEXEC_storage:=daemon-latency-logger namestore-fcfsd service-datastore service-peerstore
210
-CONF_storage:=datastore peerstore
211
+LIBEXEC_storage:=daemon-latency-logger service-datastore
212
+CONF_storage:=datastore
211 213
 
212 214
 DEPENDS_transport-bluetooth:=+bluez-libs
213 215
 PLUGIN_transport-bluetooth:=transport_bluetooth
@@ -218,7 +220,7 @@ BIN_utils:=config gns-import.sh gns-proxy-setup-ca transport-certificate-creatio
218 220
 
219 221
 DEPENDS_vpn:=+kmod-tun
220 222
 LIB_vpn:=tun vpn
221
-LIBEXEC_vpn:=daemon-exit daemon-pt helper-exit  helper-vpn service-vpn
223
+LIBEXEC_vpn:=daemon-exit daemon-pt helper-exit helper-vpn service-vpn
222 224
 CONF_vpn:=exit pt vpn
223 225
 
224 226
 $(eval $(call BuildPackage,gnunet))

+ 39
- 9
net/gnunet/files/gnunet.init View File

@@ -6,17 +6,47 @@ STOP=10
6 6
 
7 7
 USE_PROCD=1
8 8
 PROG=/usr/lib/gnunet/libexec/gnunet-service-arm
9
-CONFIGFILE=/var/run/gnunet/gnunet.conf
10 9
 
11
-start_service() {
12
-	if [ ! -e /var/run/gnunet ]; then
13
-		mkdir -p /var/run/gnunet
14
-		chmod 0750 /var/run/gnunet
15
-		chown gnunet:gnunet /var/run/gnunet
16
-		touch $CONFIGFILE
17
-		chown gnunet:gnunet $CONFIGFILE
18
-		chmod 0600 $CONFIGFILE
10
+GNUNET_HOME=/var/run/gnunet
11
+CONFIGFILE=$GNUNET_HOME/gnunet.conf
12
+SUID_ROOT_HELPERS="exit nat-server nat-client transport-bluetooth transport-wlan vpn"
13
+
14
+chmodown_execbin() {
15
+	execname=/usr/lib/gnunet/libexec/gnunet-$1
16
+	if [ -x $execname ]; then
17
+		chmod $2 $execname
18
+		[ "$3" ] && chown $3 $execname
19 19
 	fi
20
+}
21
+
22
+fix_libexec_permissions() {
23
+	[ -e /usr/share/gnunet/.permfix ] && return
24
+	for helper in $SUID_ROOT_HELPERS; do
25
+		chmodown_execbin helper-$helper u+s
26
+	done
27
+	chmodown_execbin helper-dns 4750 root:gnunetdns
28
+	chmodown_execbin service-dns 2750 root:gnunetdns
29
+
30
+	touch /usr/share/gnunet/.permfix
31
+}
32
+
33
+prepare_config() {
34
+	mkdir -p $GNUNET_HOME
35
+	chown gnunet:gnunet $GNUNET_HOME
36
+	chmod 0750 $GNUNET_HOME
37
+	touch $CONFIGFILE
38
+	chown root:gnunet $CONFIGFILE
39
+	chmod 0640 $CONFIGFILE
40
+	gnunet-config -c /tmp/run/gnunet/gnunet.conf -s PATHS -o GNUNET_HOME -V $GNUNET_HOME
41
+	defaultservices=$( gnunet-config -c /tmp/run/gnunet/gnunet.conf -s arm -o DEFAULTSERVICES )
42
+	defaultservices="$defaultservices gns2dns"
43
+	gnunet-config -c /tmp/run/gnunet/gnunet.conf -s arm -o DEFAULTSERVICES -V "$defaultservices"
44
+}
45
+
46
+start_service() {
47
+	fix_libexec_permissions
48
+	[ ! -e $GNUNET_HOME ] && prepare_config
49
+
20 50
 	procd_open_instance
21 51
 	procd_set_param user gnunet
22 52
 	procd_set_param command $PROG -c $CONFIGFILE