[Pkg-ocaml-maint-commits] r3620 -
/trunk/packages/mldonkey/trunk/debian/mldonkey-server.postinst
smimram at users.alioth.debian.org
smimram at users.alioth.debian.org
Sun Mar 18 17:06:50 CET 2007
Author: smimram
Date: Sun Mar 18 16:06:50 2007
New Revision: 3620
URL: http://svn.debian.org/wsvn/pkg-ocaml-maint/?sc=1&rev=3620
Log:
Write debconf values even when we don't start automatically.
Modified:
trunk/packages/mldonkey/trunk/debian/mldonkey-server.postinst
Modified: trunk/packages/mldonkey/trunk/debian/mldonkey-server.postinst
URL: http://svn.debian.org/wsvn/pkg-ocaml-maint/trunk/packages/mldonkey/trunk/debian/mldonkey-server.postinst?rev=3620&op=diff
==============================================================================
--- trunk/packages/mldonkey/trunk/debian/mldonkey-server.postinst (original)
+++ trunk/packages/mldonkey/trunk/debian/mldonkey-server.postinst Sun Mar 18 16:06:50 2007
@@ -18,111 +18,109 @@
CONF=/etc/default/mldonkey-server
- if [ "$launch_at_startup" = "true" ]; then
-
- ###########################
- # Handling debconf values #
- ###########################
-
- mldonkey_umask=0022
- umask $mldonkey_umask
-
- db_get mldonkey-server/run_as_user
- run_as_user=$RET
-
- db_get mldonkey-server/mldonkey_group
- mldonkey_group=$RET
-
- db_get mldonkey-server/mldonkey_dir
- new_mldonkey_dir="$RET"
-
- db_get mldonkey-server/mldonkey_niceness
- mldonkey_niceness="$RET"
-
- client_name=`/bin/hostname`
-
- db_get mldonkey-server/max_hard_upload_rate
- max_hard_upload_rate="$RET"
-
- db_get mldonkey-server/max_hard_download_rate
- max_hard_download_rate="$RET"
-
- # db_get mldonkey-server/password
- # password="$RET"
- password=""
-
- ###################
- # User management #
- ###################
-
- # Creating MLDonkey group if it isn't already there
- if ! getent group $mldonkey_group > /dev/null ; then
- $DEBUG && echo -n "Creating mldonkey group: "
- addgroup --system --quiet $mldonkey_group
- $DEBUG && echo "done."
+ ###########################
+ # Handling debconf values #
+ ###########################
+
+ mldonkey_umask=0022
+ umask $mldonkey_umask
+
+ db_get mldonkey-server/run_as_user
+ run_as_user=$RET
+
+ db_get mldonkey-server/mldonkey_group
+ mldonkey_group=$RET
+
+ db_get mldonkey-server/mldonkey_dir
+ new_mldonkey_dir="$RET"
+
+ db_get mldonkey-server/mldonkey_niceness
+ mldonkey_niceness="$RET"
+
+ client_name=`/bin/hostname`
+
+ db_get mldonkey-server/max_hard_upload_rate
+ max_hard_upload_rate="$RET"
+
+ db_get mldonkey-server/max_hard_download_rate
+ max_hard_download_rate="$RET"
+
+ # db_get mldonkey-server/password
+ # password="$RET"
+ password=""
+
+ ###################
+ # User management #
+ ###################
+
+ # Creating MLDonkey group if it isn't already there
+ if ! getent group $mldonkey_group > /dev/null ; then
+ $DEBUG && echo -n "Creating mldonkey group: "
+ addgroup --system --quiet $mldonkey_group
+ $DEBUG && echo "done."
+ fi
+
+ # Creating MLDonkey user if it isn't already there
+ if ! getent passwd $run_as_user > /dev/null ; then
+ $DEBUG && echo -n "Creating mldonkey user: "
+ adduser --quiet --system --ingroup $mldonkey_group \
+ --home "$new_mldonkey_dir" --no-create-home $run_as_user
+ $DEBUG && echo "done."
+ fi
+
+ run_as_useruid=`/usr/bin/id -u $run_as_user`
+
+ if [ ! -d $new_mldonkey_dir ]; then
+ $DEBUG && echo -n "Creating mldonkey home directory: "
+ mkdir "$new_mldonkey_dir"
+ $DEBUG && echo "done."
+ fi
+
+ #########################
+ # Relocation management #
+ #########################
+
+ if [ -e "$CONF" ]; then
+ . "$CONF"
+ if [ -n "$MLDONKEY_DIR" ] && [ -f "$MLDONKEY_DIR/downloads.ini" ]; then
+ db_get mldonkey-server/reown_file
+ if [ "$RET" = "true" ] && ! dpkg-statoverride --list "$MLDONKEY_DIR" >/dev/null; then
+ $DEBUG && echo -n "Reowning file of $MLDONKEY_DIR: "
+ # BUG: should not use chown, should use dpkg-statoverride itself, but the owner is not always
+ # the same. If i use the method suggested in the Debian Policy 10.9.1, i need to dynamically
+ # create a user, but this user should never be changed. The DP method will inject a new rules
+ # in dpkg-statoverride which will made the above test always false for any further
+ # upgrade/configure. With my method, only the user can set dpkg-statoverride rules to stop the
+ # reowning of a file... However i am not sure this is the best method to do so.
+ /bin/chown -R $run_as_user:$mldonkey_group "$MLDONKEY_DIR"
+ $DEBUG && echo "done."
+ fi
+
+ db_get mldonkey-server/mldonkey_move
+ if [ "$RET" = "true" ] && [ "$new_mldonkey_dir" != "$MLDONKEY_DIR" ]; then
+ $DEBUG && echo -n "Moving file of $MLDONKEY_DIR to $new_mldonkey_dir: "
+ /bin/mv "--target-directory=$new_mldonkey_dir" "$MLDONKEY_DIR/*"
+ $DEBUG && echo "done."
+ fi
fi
-
- # Creating MLDonkey user if it isn't already there
- if ! getent passwd $run_as_user > /dev/null ; then
- $DEBUG && echo -n "Creating mldonkey user: "
- adduser --quiet --system --ingroup $mldonkey_group \
- --home "$new_mldonkey_dir" --no-create-home $run_as_user
- $DEBUG && echo "done."
- fi
-
- run_as_useruid=`/usr/bin/id -u $run_as_user`
-
- if [ ! -d $new_mldonkey_dir ]; then
- $DEBUG && echo -n "Creating mldonkey home directory: "
- mkdir "$new_mldonkey_dir"
- $DEBUG && echo "done."
- fi
-
- #########################
- # Relocation management #
- #########################
-
- if [ -e "$CONF" ]; then
- . "$CONF"
- if [ -n "$MLDONKEY_DIR" ] && [ -f "$MLDONKEY_DIR/downloads.ini" ]; then
- db_get mldonkey-server/reown_file
- if [ "$RET" = "true" ] && ! dpkg-statoverride --list "$MLDONKEY_DIR" >/dev/null; then
- $DEBUG && echo -n "Reowning file of $MLDONKEY_DIR: "
- # BUG: should not use chown, should use dpkg-statoverride itself, but the owner is not always
- # the same. If i use the method suggested in the Debian Policy 10.9.1, i need to dynamically
- # create a user, but this user should never be changed. The DP method will inject a new rules
- # in dpkg-statoverride which will made the above test always false for any further
- # upgrade/configure. With my method, only the user can set dpkg-statoverride rules to stop the
- # reowning of a file... However i am not sure this is the best method to do so.
- /bin/chown -R $run_as_user:$mldonkey_group "$MLDONKEY_DIR"
- $DEBUG && echo "done."
- fi
-
- db_get mldonkey-server/mldonkey_move
- if [ "$RET" = "true" ] && [ "$new_mldonkey_dir" != "$MLDONKEY_DIR" ]; then
- $DEBUG && echo -n "Moving file of $MLDONKEY_DIR to $new_mldonkey_dir: "
- /bin/mv "--target-directory=$new_mldonkey_dir" "$MLDONKEY_DIR/*"
- $DEBUG && echo "done."
- fi
- fi
- fi
-
- #################
- # Downloads.ini #
- #################
-
- if [ -e "$new_mldonkey_dir/downloads.ini" ]; then
- $DEBUG && echo -n "Creating backup of $new_mldonkey_dir/downloads.ini: "
- /bin/cp -p -f "$new_mldonkey_dir/downloads.ini" "$new_mldonkey_dir/downloads.ini.dpkg"
- $DEBUG && echo "done."
- else
- $DEBUG && echo -n "Creating empty $new_mldonkey_dir/downloads.ini: "
- /bin/touch "$new_mldonkey_dir/downloads.ini"
- $DEBUG && echo "done."
- fi
-
- $DEBUG && echo -n "Writing new values to $new_mldonkey_dir/downloads.ini: "
- /usr/bin/mldonkey_options -f "$new_mldonkey_dir/downloads.ini" <<EOF
+ fi
+
+ #################
+ # Downloads.ini #
+ #################
+
+ if [ -e "$new_mldonkey_dir/downloads.ini" ]; then
+ $DEBUG && echo -n "Creating backup of $new_mldonkey_dir/downloads.ini: "
+ /bin/cp -p -f "$new_mldonkey_dir/downloads.ini" "$new_mldonkey_dir/downloads.ini.dpkg"
+ $DEBUG && echo "done."
+ else
+ $DEBUG && echo -n "Creating empty $new_mldonkey_dir/downloads.ini: "
+ /bin/touch "$new_mldonkey_dir/downloads.ini"
+ $DEBUG && echo "done."
+ fi
+
+ $DEBUG && echo -n "Writing new values to $new_mldonkey_dir/downloads.ini: "
+ /usr/bin/mldonkey_options -f "$new_mldonkey_dir/downloads.ini" <<EOF
run_as_useruid=$run_as_useruid
run_as_user="$run_as_user"
client_name="$client_name"
@@ -136,83 +134,82 @@
max_hard_upload_rate=$max_hard_upload_rate
max_hard_download_rate=$max_hard_download_rate
EOF
- $DEBUG && echo "done."
-
- #############
- # Files.ini #
- #############
-
- # Handling fasttrack file split here, better than in the mldonkey-server.init
-
- if [ -e "$new_mldonkey_dir/files.ini" ] \
- && [ ! -e "$new_mldonkey_dir/files.ini.fasttrack" ] \
- && /usr/bin/mldonkey_files --test Fasttrack -q -f0 "$new_mldonkey_dir/files.ini"; then
- echo "Correction of the Fasttrack problem (see /usr/share/doc/mldonkey-server/README.Debian)"
- echo -n "Splitting $new_mldonkey_dir/files.ini (backup in $new_mldonkey_dir/files.ini.fasttrack): "
- /usr/bin/mldonkey_files --split Fasttrack -f0 "$new_mldonkey_dir/files.ini" \
- -f1 "$new_mldonkey_dir/files.ini.fasttrack" \
- -f2 "$new_mldonkey_dir/files.ini"
- echo "done."
+ $DEBUG && echo "done."
+
+ #############
+ # Files.ini #
+ #############
+
+ # Handling fasttrack file split here, better than in the mldonkey-server.init
+
+ if [ -e "$new_mldonkey_dir/files.ini" ] \
+ && [ ! -e "$new_mldonkey_dir/files.ini.fasttrack" ] \
+ && /usr/bin/mldonkey_files --test Fasttrack -q -f0 "$new_mldonkey_dir/files.ini"; then
+ echo "Correction of the Fasttrack problem (see /usr/share/doc/mldonkey-server/README.Debian)"
+ echo -n "Splitting $new_mldonkey_dir/files.ini (backup in $new_mldonkey_dir/files.ini.fasttrack): "
+ /usr/bin/mldonkey_files --split Fasttrack -f0 "$new_mldonkey_dir/files.ini" \
+ -f1 "$new_mldonkey_dir/files.ini.fasttrack" \
+ -f2 "$new_mldonkey_dir/files.ini"
+ echo "done."
+ fi
+
+ #############
+ # Users.ini #
+ #############
+
+ # if [ -n "$password" ]; then
+ # $DEBUG && echo -n "Registering admin password in $new_mldonkey_dir/users.ini: "
+ # /usr/bin/mlnet -useradd "admin $password"
+ # $DEBUG && echo "done."
+ # fi
+
+ ####################
+ # Files permission #
+ ####################
+
+ for file in \
+ "$new_mldonkey_dir" \
+ "/var/run/mldonkey" \
+ "/var/log/mldonkey" \
+ "$new_mldonkey_dir/downloads.ini" \
+ "$new_mldonkey_dir/downloads.ini.dpkg" \
+ "$new_mldonkey_dir/downloads.ini.old" \
+ "$new_mldonkey_dir/downloads.ini.tmp" \
+ "$new_mldonkey_dir/files.ini" \
+ "$new_mldonkey_dir/files.ini.fasttrack"; do
+ $DEBUG && echo -n "Changing owner and file permission of $file: "
+ if ! dpkg-statoverride --list "$file" >/dev/null; then
+ # BUG: cf dpkg-statoverride above
+ if [ -e "$file" ]; then
+ /bin/chown $run_as_user:$mldonkey_group $file
+ $DEBUG && echo "done."
+ else
+ $DEBUG && echo "$file doesn't exist."
+ fi
+ else
+ $DEBUG && echo "$file is listed in dpkg-statoverride."
fi
-
- #############
- # Users.ini #
- #############
-
-# if [ -n "$password" ]; then
-# $DEBUG && echo -n "Registering admin password in $new_mldonkey_dir/users.ini: "
-# /usr/bin/mlnet -useradd "admin $password"
-# $DEBUG && echo "done."
-# fi
-
- ####################
- # Files permission #
- ####################
-
- for file in \
- "$new_mldonkey_dir" \
- "/var/run/mldonkey" \
- "/var/log/mldonkey" \
- "$new_mldonkey_dir/downloads.ini" \
- "$new_mldonkey_dir/downloads.ini.dpkg" \
- "$new_mldonkey_dir/downloads.ini.old" \
- "$new_mldonkey_dir/downloads.ini.tmp" \
- "$new_mldonkey_dir/files.ini" \
- "$new_mldonkey_dir/files.ini.fasttrack"; do
- $DEBUG && echo -n "Changing owner and file permission of $file: "
- if ! dpkg-statoverride --list "$file" >/dev/null; then
- # BUG: cf dpkg-statoverride above
- if [ -e "$file" ]; then
- /bin/chown $run_as_user:$mldonkey_group $file
- $DEBUG && echo "done."
- else
- $DEBUG && echo "$file doesn't exist."
- fi
+ done
+
+ for file in \
+ "$new_mldonkey_dir/users.ini" \
+ "$new_mldonkey_dir/users.ini.dpkg" \
+ "$new_mldonkey_dir/users.ini.old" \
+ "$new_mldonkey_dir/users.ini.tmp"; do
+ $DEBUG && echo -n "Changing owner and file permission of $file: "
+ if ! dpkg-statoverride --list "$file" >/dev/null; then
+ # BUG: cf dpkg-statoverride above
+ if [ -e "$file" ]; then
+ /bin/chown $run_as_user:$mldonkey_group "$file"
+ /bin/chmod 0600 "$file"
+ $DEBUG && echo "done."
else
- $DEBUG && echo "$file is listed in dpkg-statoverride."
- fi
- done
-
- for file in \
- "$new_mldonkey_dir/users.ini" \
- "$new_mldonkey_dir/users.ini.dpkg" \
- "$new_mldonkey_dir/users.ini.old" \
- "$new_mldonkey_dir/users.ini.tmp"; do
- $DEBUG && echo -n "Changing owner and file permission of $file: "
- if ! dpkg-statoverride --list "$file" >/dev/null; then
- # BUG: cf dpkg-statoverride above
- if [ -e "$file" ]; then
- /bin/chown $run_as_user:$mldonkey_group "$file"
- /bin/chmod 0600 "$file"
- $DEBUG && echo "done."
- else
- $DEBUG && echo "$file doesn't exist."
- fi
- else
- $DEBUG && echo "$file is listed in dpkg-statoverride."
- fi
- done
- fi
+ $DEBUG && echo "$file doesn't exist."
+ fi
+ else
+ $DEBUG && echo "$file is listed in dpkg-statoverride."
+ fi
+ done
################################
# /etc/default/mldonkey-server #
More information about the Pkg-ocaml-maint-commits
mailing list