cannot find deb postinst when install deb of my own

asked 2016-11-08 03:20:26 -0500

anonymous user


updated 2016-11-08 11:23:04 -0500

rbowen gravatar image

I want to create my own deb package on Ubtunu 14.04 using dh_make,dh_install and so on. I put the postinst file in mongodbdebbuild-1.0/debian/postinst. And I have no problem to create the deb. But when I install it using "dpkg -i mongodbdebbuild_1.0-1_all.deb", there are some errors below:

Selecting previously unselected package mongodbdebbuild.
(Reading database ... 170486 files and directories currently installed.)
Preparing to unpack mongodbdebbuild_1.0-1_all.deb ...
Unpacking mongodbdebbuild (1.0-1) ...
Setting up mongodbdebbuild (1.0-1) ...
dpkg (subprocess): unable to execute installed post-installation script (/var/lib/dpkg/info/mongodbdebbuild.postinst): No such file or directory
dpkg: error processing package mongodbdebbuild (--install):
 subprocess installed post-installation script returned error exit status 2
Processing triggers for ureadahead (0.100.0-16) ...
Errors were encountered while processing:

The message shows /var/lib/dpkg/info/mongodbdebbuild.postinst doesnot exist. But it exists in fact.

root@root-VM:/etc# ls -al /var/lib/dpkg/info/mongodbdebbuild.postinst         
-rwxr-xr-x 1 root root 2704 Nov  8 02:18 /var/lib/dpkg/info/mongodbdebbuild.postinst

The comment of postinst:


set -x


while IFS='' read -r line || [[ -n "$line" ]];do 
  read -r key value <<< "$line"
  if [[ ! $line =~ ^# && $line ]]; then
      #echo "Key:$key -Value:$value"
      declare -A array
done < "/etc/install.conf"
for keyname in "${!array[@]}";do
        case $keyname in 
            "DBServiceName") dbservicename=${array[$keyname]} ;;
            "DBSystemUser") dbsystemuser=${array[$keyname]} ;;
            "DBSystemGroup") dbsystemgroup=${array[$keyname]} ;;
            "RootPath") rootpath=${array[$keyname]} ;;
            "DBPath") dbpath=${array[$keyname]} ;;
            "DataPath") datapath=${array[$keyname]} ;;
            "LogPath") logpath=${array[$keyname]} ;;
            "BindIp") bindip=${array[$keyname]} ;;
            "DBPort") dbport=${array[$keyname]} ;;
            "ReplicaSetName") replicasetname=${array[$keyname]} ;;
            "CPULimit") cpulimit=${array[$keyname]} ;;
            "MemoryLimit") memorylimit=${array[$keyname]} ;;
            "UninstallSaveData") uninstallsavedata=${array[$keyname]} ;;
            "RequireSSL") requiressl=${array[$keyname]} ;;  
            "CertPath") certpath=${array[$keyname]} ;;
            "KeyPath") keypath=${array[$keyname]} ;;
            "DBUser") dbuser=${array[$keyname]} ;;
            "DBPassword") dbpassword=${array[$keyname]} ;;
            "SingleNode") singlenode=${array[$keyname]} ;;  
            "ReplicaSetMembers") replicasetmembers=${array[$keyname]} ;;
            "ReplicaSetKeyFile") replicasetkeyfile=${array[$keyname]} ;;
        #echo "key  : $keyname"
        #echo "value: ${array[$keyname]}"
echo "DBServiceName value is :$dbservicename"
echo "DBSystemUser value is :$dbsystemuser"
echo "DBSystemGroup value is :$dbsystemgroup"
echo "RootPath value is :$rootpath"
echo "DBPath value is :$dbpath"
echo "DataPath value is :$datapath"
echo "LogPath value is :$logpath"
echo "BindIp value is :$bindip"
echo "DBPort value is :$dbport"
echo "ReplicaSetName value is :$replicasetname"
echo "CPULimit value is :$cpulimit"
echo "MemoryLimit value is :$memorylimit"
echo "UninstallSaveData value is :$uninstallsavedata"
echo "RequireSSL value is :$requiressl"
echo "CertPath value is :$certpath"
echo "KeyPath value is :$keypath"
echo "SingleNode value is :$singlenode"
echo "ReplicaSetMembers value is :$replicasetmembers"
echo "ReplicaSetKeyFile value is :$replicasetkeyfile"

chmod a+x $dbpath
mv -f $SOURCEFILE2 $dbservicename
chmod a+x $dbservicename
mv -f $SOURCEFILE4 mongod
mkdir -p $datapath
mkdir -p $logpath
touch $logpath/mongod.log

echo "Hello World!" 
echo "Hello World!" 
echo "Hello World!" 

exit 0

I have no idea. The errors are the same on Ubuntu 14.04 and Ubuntu 16.04.

edit retag flag offensive close merge delete