Build Wildfly deb package



sudo apt-get install -y devscripts

# Download the "source" (the binary "Java EE7 Full & Web Distribution")
# wget

# download archive
mkdir /tmp/wildfly
wget${VERSION}/wildfly-${VERSION}.tar.gz -q -O /tmp/wildfly/wildfly-${VERSION}.tar.gz

# create a link to archive
cd /tmp/wildfly
ln -s wildfly-${VERSION}.tar.gz wildfly_${VERSION}.orig.tar.gz

# unpack and enter directory
tar -xzf wildfly-${VERSION}.tar.gz
cd wildfly-${VERSION}

# Lets start with packaging (create debian/ dir and changelog)
mkdir debian
dch --create --package wildfly --newversion=${VERSION}-${REVISION} "Build WildFly ${VERSION} package at $(date -I)"

# 2. debian/compat
echo "9" > debian/compat

# 3. debian/rules
echo -ne '#!/usr/bin/make -f\n%:\n\tdh $@\n' > debian/rules

# 4. debian/control
cat < debian/control
Source: wildfly
Maintainer: Foo
Standards-Version: 3.9.5
Build-Depends: debhelper

Package: wildfly
Architecture: all
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: WildFly application server

# 5. debian/source/format
mkdir -p debian/source
echo "3.0 (quilt)" > debian/source/format

# 6. Add all dir to install
for i in $(ls | grep -v debian); do
echo $i opt/wildfly/
done > debian/wildfly.install

# Build with dpkg-buildpackage
sudo dpkg-buildpackage -us -uc