Ticket #143 (closed Enhancement: fixed)

Opened 11 years ago

Last modified 8 years ago

DEB: Notes for deepamehta - 4.0.5-1ubuntu4

Reported by: silke Owned by: silke
Priority: Major Milestone:
Component: DeepaMehta Standard Distribution Version: 4.0.5
Keywords: Cc: JuergeN
Complexity: 3 Area: Ubuntu/Debian Package
Module:

Description

  • Remove the lines quoted below from postinst? Is there a policy how long to keep such changes in the package files? What about people who upgrade from deepamehta-4.0.5-1ubuntu2 to deepamehta-4.0.5-1ubuntu4, they should still get the changes...
    if [ -f /etc/deepamehta/logging.properties ]; then
      rm /etc/deepamehta/logging.properties
    fi
    if [ -f /etc/deepamehta/config.properties ]; then
      rm /etc/deepamehta/config.properties
    fi

Change History

comment:1 Changed 11 years ago by silke

  • Status changed from new to accepted

comment:2 Changed 11 years ago by silke

  • Milestone set to Build .deb Package

comment:3 Changed 11 years ago by JuergeN

  • don't delete logfiles, unless when purging
  • change text in /usr/share/doc/deepamehta/examples/deepamehta.filedir
    The default files directory is /var/lib/deepamehta/deepamehta-filedir. 
    To change this, edit /etc/deepamehta/deepamehta.conf.
    


comment:4 Changed 11 years ago by JuergeN

A simple way, to check if DB update is necessary, could be to put a file, e.g. .db-update.405 in /var/lib/deepamehta/deepamehta-db/ when installing the new version. Then, when you install the next update, you just check if the file is present, before moving the old database.

So in preinst you could add something like this

if [ -d /var/lib/deepamehta/deepamehta-db ] && [ ! -f /var/lib/deepamehta/deepamehta-db/.db-updated.405 ]; then
   mv /var/lib/deepamehta/deepamehta-db /var/lib/deepamehta/deepamehta-db-backup-$BACKUPDATE
   touch /var/lib/deepamehta/deepamehta-db/.db-updated.405
   echo "Your existing database has been moved to /var/lib/deepamehta/deepamehta-db-backup-$BACKUPDATE."
fi

or you rename your backup directory to deepamehta-db-backup-405-$BACKUPDATE and check for [ ! -d /var/lib/deepamehta/deepamehta-db-backup-405-* ], which would maybe be even a bit more elegant.

comment:5 Changed 11 years ago by JuergeN

I have changed /etc/init.d/deepamehta to utilize /etc/default/deepamehta. Please apply this patch:

--- deepamehta	2011-10-28 10:14:52.000000000 +0200
+++ deepamehta.new	2011-10-30 15:48:19.000000000 +0100
@@ -16,7 +16,7 @@
 
 # PATH should only include /usr/* if it runs after the mountnfs.sh script
 PATH=/sbin:/usr/sbin:/bin:/usr/bin
-DESC="DeepaMehta server"
+DESC="DeepaMehta daemon"
 NAME=deepamehta
 DAEMON=/usr/lib/deepamehta/deepamehta-daemon
 EXTRA_ARGS="-c $NAME --user $NAME --name $NAME --background --make-pidfile"
@@ -34,6 +34,7 @@
 if [ ! -d /var/run/$NAME ]; then
     mkdir /var/run/$NAME
     chown $NAME:$NAME /var/run/$NAME
+    sleep 2
 fi
 
 # Read configuration variable file if it is present
@@ -54,19 +55,18 @@
     #   0 if daemon is running
     #   1 if daemon is not running
     #   2 on pidfile mismatch
-
     PIDLNUM=$( ps -U $NAME -u $NAME o pid= | sed s'/^\ //' )
     if [ "$PIDLNUM" != "" ]; then
 	if [ -f $PIDFILE ]; then
 	    PIDFNUM=$( cat $PIDFILE )
 	    if [ "$PIDLNUM" != "$PIDFNUM" ]; then
-		echo -e "\n   Error in pidfile $PIDFILE! - Is there another $NAME process running?\n"
+		echo "\n   Error in pidfile $PIDFILE! - Is there another $NAME process running?\n"
 		return 2
 	    else
 		return 0
 	    fi
 	else
-	    echo -e "\n   WARNING! Found running $DESC with PID $PIDLNUM,\n   but no valid pidfile $PIDFILE was found.\n"
+	    echo "\n   WARNING! Found running $DESC with PID $PIDLNUM,\n   but no valid pidfile $PIDFILE was found.\n"
 	    return 2
 	fi
     else
@@ -79,6 +79,11 @@
 #
 do_start()
 {
+	# Check START_DEEPAMEHTA
+	if [ "$START_DEEPAMEHTA" != "yes" ]; then
+	    echo "\n   $DESC is disabled in /etc/default/$NAME.\n"
+	    exit 0
+	fi
 	# Return
 	#   0 if daemon has been started
 	#   1 if daemon was already running

to deepamehta.init and add a file for /etc/default/deepamehta with these lines:

# This file is utilized by init script /etc/init.d/deepamehta.
# Set START_DEEPAMEHTA to 'yes' to start DeepaMehta daemon.
#
START_DEEPAMEHTA=no

Then in your README you should write something like:

Adjust the settings in /etc/deepamehta/deepamehta.conf and make sure your computer is protected by a firewall. Then edit /etc/default/deepamehta and set "START_DEEPAMEHTA=yes" before invoking "/etc/init.d/deepamehta start" to start DeepaMehta.

comment:6 Changed 11 years ago by JuergeN

/etc/default/deepamehta must be chmod 644.

comment:7 Changed 11 years ago by silke

patch -i deepamehta.patch -o deepamehta.new

comment:8 Changed 11 years ago by silke

I've run a test and have a question concerning /etc/default/deepamehta:

When it's set to "no", I can't start the daemon manually:

root@lovelace:~# /etc/init.d/deepamehta start

   DeepaMehta daemon is disabled in /etc/default/deepamehta.

Is this correct? I thought /etc/default determines whether the daemon is started automatically after reboot, but not that it disables it completely.

comment:9 Changed 11 years ago by JuergeN

Yes, this is the correct behaviour. After an initial installation, the user needs to configure deepamehta (e.g. check HTTP port). Then the user edits /etc/default/deepamehta and sets START_DEEPAMEHTA=yes. Once it is set to yes, deepamehta can be re-started with every update, because you can be sure, that the user has decided to do so. This is exactly identical to many other debian programs. You can now add /etc/init.d/deepamehta start to postinst.

BTW, another very common way for applying patches is this:

patch filetopatch.file [output.file] < changes.patch

comment:10 Changed 11 years ago by silke

  • Status changed from accepted to closed
  • Resolution set to fixed

OK, deepamehta-4.0.5-1ubuntu4 is out. The to do list for deepamehta-4.0.5-1ubuntu5 is in #144.

comment:11 Changed 8 years ago by jri

  • Milestone Build .deb Package deleted

Milestone Build .deb Package deleted

Note: See TracTickets for help on using tickets.