# This should be a time slightly less than the DHT's KEY_EXPIRE value.
KEY_REFRESH = 57m
+# The user name to try and run as (leave blank to run as current user)
+USERNAME = apt-p2p
+
# Which DHT implementation to use.
# It must be possible to do "from <DHT>.DHT import DHT" to get a class that
# implements the IDHT interface. There should also be a similarly named
# bootstrap nodes to contact to join the DHT
BOOTSTRAP = www.camrdale.org:9977
+ www.camrdale.org:9976
steveholt.hopto.org:9976
# whether this node is a bootstrap node
log.msg("Loading config files: '%s'" % "', '".join(DEFAULT_CONFIG_FILES + [config_file]))
config_read = config.read(DEFAULT_CONFIG_FILES + [config_file])
log.msg("Successfully loaded config files: '%s'" % "', '".join(config_read))
-if config.has_option('DEFAULT', 'username') and config.get('DEFAULT', 'username'):
- uid,gid = pwd.getpwnam(config.get('DEFAULT', 'username'))[2:4]
-else:
+try:
+ uid,gid = pwd.getpwnam(config.get('DEFAULT', 'USERNAME'))[2:4]
+except:
uid,gid = None,None
log.msg('Starting application')
# This should be a time slightly less than the DHT's KEY_EXPIRE value.
'KEY_REFRESH': '57m',
+ # The user name to try and run as (leave blank to run as current user)
+ 'USERNAME': 'apt-p2p',
+
# Which DHT implementation to use.
# It must be possible to do "from <DHT>.DHT import DHT" to get a class that
# implements the IDHT interface.
(Default is 57 minutes.)</para>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><option>USERNAME = <replaceable>user</replaceable></option></term>
+ <listitem>
+ <para>The <replaceable>user</replaceable> name to try and run as.
+ Leaving this blank will try to run as current user.
+ (Default is 'apt-p2p'.)</para>
+ </listitem>
+ </varlistentry>
<varlistentry>
<term><option>DHT = <replaceable>string</replaceable></option></term>
<listitem>
logfile=/var/log/apt-p2p.log
application=/usr/sbin/apt-p2p
twistd=/usr/bin/twistd
-user=aptp2p
+user=apt-p2p
group=nogroup
[ -r /etc/default/apt-p2p ] && . /etc/default/apt-p2p
case "$1" in
configure)
- if ! getent passwd aptp2p >/dev/null; then
+ if ! getent passwd apt-p2p >/dev/null; then
adduser --quiet --system --no-create-home \
--home /var/cache/apt-p2p --disabled-password \
--disabled-login --shell /bin/false --ingroup nogroup \
- aptp2p
+ apt-p2p
fi
touch /var/log/apt-p2p.log
- chown aptp2p:adm /var/log/apt-p2p.log
+ chown apt-p2p:adm /var/log/apt-p2p.log
mkdir -p /var/cache/apt-p2p
- chown -R aptp2p:adm /var/cache/apt-p2p
+ chown -R apt-p2p:adm /var/cache/apt-p2p
;;
abort-upgrade|abort-remove|abort-deconfigure)
echo Purging apt-p2p cache directory
rm -rf /var/cache/apt-p2p
- if id aptp2p >/dev/null; then
- deluser aptp2p
+ if id apt-p2p >/dev/null; then
+ deluser apt-p2p
fi
fi
# This should be a time slightly less than the DHT's KEY_EXPIRE value.
KEY_REFRESH = 57m
+# The user name to try and run as (leave blank to run as current user)
+USERNAME =
+
# Which DHT implementation to use.
# It must be possile to do "from <DHT>.DHT import DHT" to get a class that
# implements the IDHT interface.