Build a Ubuntu debian package [duplicate]

Solution 1:

The tutorial you have linked uses a low level approach for building a package. Such an approach is not usually recommended and may lead to all sorts of issues when not done carefully.

Creating a .deb for a script is very simple once you understand packaging basics. In a nutshell:

# Configure your paths and filenames
SOURCEBINPATH=~
SOURCEBIN=myscript.sh
DEBFOLDER=~/somescripts
DEBVERSION=0.1

DEBFOLDERNAME=$DEBFOLDER-$DEBVERSION

# Create your scripts source dir
mkdir $DEBFOLDERNAME

# Copy your script to the source dir
cp $SOURCEBINPATH/$SOURCEBIN $DEBFOLDERNAME 
cd $DEBFOLDERNAME

# Create the packaging skeleton (debian/*)
dh_make -s --indep --createorig 

# Remove make calls
grep -v makefile debian/rules > debian/rules.new 
mv debian/rules.new debian/rules 

# debian/install must contain the list of scripts to install 
# as well as the target directory
echo $SOURCEBIN usr/bin > debian/install 

# Remove the example files
rm debian/*.ex

# Build the package.
# You  will get a lot of warnings and ../somescripts_0.1-1_i386.deb
debuild

Adding more scripts requires them to be copied to the directory and added to the debian/install file -- then just re-run debuild. You should also check and update the debian/* files as required .

You should read the man pages for: dh_make, dh_install, and debuild