Comprehensive Steps:
http://packaging.ubuntu.com/html/packaging-new-software.html
https://askubuntu.com/questions/164621/how-do-i-add-a-binary-file-to-my-existing-ppa-package
https://askubuntu.com/questions/146343/how-to-create-a-deb-package-that-installs-a-series-of-files
Optimized setup: - use this after performing a complete example somewhere else
Basic system update and upgrade:
ubuntu:~#sudo apt-get update ubuntu:~#sudo apt-get upgrade
For having pbuilder that creates a clean simple ubuntu environment for builds:
ubuntu:~#sudo apt-get install gnupg pbuilder ubuntu-dev-tools bzr-builddeb apt-file
This does the packaging but is not used regularly
ubuntu:~#sudo apt-get install packaging-dev
Generate the gpg key:
gpg --gen-key
Send the keys to launchpad:
gpg --send-keys --keyserver keyserver.ubuntu.com keythatgotgenerated
Copy paste the secure email from launchpad to read its content:
vim mail.gpg
Extract the message for the launchpad stuff:
gpg -d mail.gpg
Creating the clean pbuilder environment:
pbuilder-dist trusty create
Should match with the gpg key:
bzr whoami "YourName <youremailid>"
Launchpad key:
bzr launchpad-login yourlaunchpadid
These commands should be included in the bashrc file:
vim ~/.bashrc
and add:
export DEBFULLNAME="YourFullName" export DEBEMAIL="youremailid"
Source the script:
source ~/.bashrc
basic git config necessary:
git config --global user.email "youremailid" git config --global user.name "youreusername" git config --global core.editor "vim" git config --global push.default simple git --version
This allows us to access the actual file system - vagrant is useful this way that by placing //files/folders in this folder will allow them to be accessible to vagrant shell:
cd /vagrant mkdir code cd packages/ mkdir -p adxadapter2 cd adxadapter2/ sudo apt-get install openjdk-7-jdk --no-install-recommends
This will create the .ssh folder in the exact location:
ssh-keygen
Copy your private rsa key so that you can directly access github:
cp id_rsa ~/.ssh/ cd .ssh cd ..
Remove the created public file that is not required created by ssh-keygen file:
rm id_rsa.pub
Doing the Packaging
Navigate to the packaging folders
cd code/packages/
This will get all the folders from the pepfar files
git clone git@github.com:pepfar-datim/OHIE.git
Navigate to the packaging folder:
cd adxAdapter/
This is not yet executable and the following will make it executable to make it run:
chmod +x gradlew ./gradlew war cd build cd libs cp adxAdapter.war /vagrant/code/packages/adxadapter2/ cd .. cp adxAdapter.properties.sample /vagrant/code/packages/adxadapter2/ cd /vagrant/code/packages/adxadapter2/ tar czf adxadapter-1.0.0.tar.gz adxAdapter.* rm adxAdapter.* dh_make -p adxadapter_1.0.0 -f adxadapter-1.0.0.tar.gz
This needs to be in double folder names down because the build file/folder generated is kept //one level up and it was a mistake to not do it this way earlier:
mkdir adxadapter2 cp -r debian adxadapter2/
This will extract the data from a tar.gz file
tar zxf adxadapter-1.0.0.tar.gz -C adxadapter2/ cd adxadapter2/
-p allows to create all the folders that are not yet created in the below levels:
mkdir -p var/lib/tomcat7/webapps/ cp adxAdapter.war var/lib/tomcat7/webapps/ rm *.war
Rename the file:
mv adxAdapter.properties.sample adxAdapter.properties
Entering the packaging folders:
mkdir -p etc/adxadapter/ mv adxAdapter.properties etc/adxadapter/ cd debian/ rm *.ex rm *.EX vim control
Keep section as misc and homepage should be if the have any page, depends needs to be include any packages needed, architecture is changed to amd64
Source: adxadapter Section: misc Priority: optional Maintainer: yourname <youremailid> Build-Depends: debhelper (>= 8.0.0) Standards-Version: 3.9.4 Homepage: Package: adxadapter Architecture: amd64 Depends: npm, nodejs Description: ADX adapter sample package |
Clear out the Copyright or include one as per your needs:
vim copyright
Include only if required for a sample one - clear this out
rm README.Debian vim README.source
adxadapter for Debian --------------------- use gradlew without parameters script to set up gradle (only needed the first time) projects users 1.7 java compliance, so at least 1.7 should be present use gradlew eclipse to set up eclipse project. it also downloads dependencies on the first run. if adding new dependencies, update gradle.build and rerun gradlew eclipse to update eclipse classpath. Alternatively, gradlew eclipseClasspath can be used to only update eclipse classpath, and not affect other project files. to generate war file, use gradlew war command. it places war file in build/libs directory. -- yourname <youremailid> Fri, 15 Apr 2016 15:33:01 +0000 |
The last line is important for this as that matches with the GPG key in launchpad
vim source/format
3.0 (native) |
vim rules