diff --git a/.gitignore b/.gitignore index aeda464..fe88422 100644 --- a/.gitignore +++ b/.gitignore @@ -31,11 +31,7 @@ build_packages/* build_packages/NSIS/* !build_packages/NSIS/ProgressiaInstaller.nsi -# ... and except build_packages/DEB/progressia-*/DEBIAN/control +# ... and except build_packages/DEB/template !build_packages/DEB build_packages/DEB/* -!build_packages/DEB/progressia-* -build_packages/DEB/progressia-*/* -!build_packages/DEB/progressia-*/DEBIAN -build_packages/DEB/progressia-*/DEBIAN/* -!build_packages/DEB/progressia-*/DEBIAN/control +!build_packages/DEB/template diff --git a/buildPackages.sh b/buildPackages.sh index f01b54e..d1d4f5a 100755 --- a/buildPackages.sh +++ b/buildPackages.sh @@ -25,15 +25,20 @@ buildDebianPackage() { # Commands that must be available to execute this action requiredCommands='dpkg-deb fakeroot' - # Version that the package will receive - version='0.1_all' + # Package name. Sync with control file manually! + name='progressia-techdemo' + # Version that the package will receive. Sync with control file manually! + version='1.0_all' - directory="build_packages/DEB/progressia-$version" + # This directory will be copied into $tmpDir + templateDirectory="build_packages/DEB/template" - # .deb control file that must be present - configurationFile="$directory/DEBIAN/control" + # Files that must be present + requiredFiles="$templateDirectory/DEBIAN/control" - outputFile="build_packages/DEB/progressia-$version.deb" + nameAndVersion="$name-$version" + tmpDir="build_packages/DEB/$nameAndVersion" + outputFile="build_packages/DEB/$nameAndVersion.deb" echo "Checking environment to build Debian package" @@ -46,26 +51,29 @@ buildDebianPackage() { fi done - if ! [ -r "$configurationFile" ]; then - echoerr "$configurationFile is missing or not readable, cannot package" - exit 101 - else - echo "- $configurationFile is present and readable" - fi + for file in $requiredFiles; do + if ! [ -r "$file" ]; then + echoerr "$file is missing or not readable, cannot package" + exit 101 + else + echo "- $file is present and readable" + fi + done echo "Environment OK; packaging Debian package" exitCode=0 { - user=`whoami` - homeDir="$directory/home/$user/Progressia/" + shareDir="$tmpDir/usr/share/progressia" - mkdir -p "$homeDir" && - cp -r 'build/libs/lib' "$homeDir/lib" && - cp 'build/libs/Progressia.jar' "$homeDir/Progressia.jar" && - echo "------ DPKG-DEB ------" && - fakeroot dpkg-deb --build "$directory" && - echo "---- DPKG-DEB END ----" && + mkdir -p "$tmpDir" && + mkdir -p "$shareDir" && + cp -r "$templateDirectory"/* "$tmpDir" && + cp -r 'build/libs/lib' "$shareDir/lib" && + cp 'build/libs/Progressia.jar' "$shareDir/Progressia.jar" && + echo "------ DPKG-DEB ------" && + fakeroot dpkg-deb --build "$tmpDir" && + echo "---- DPKG-DEB END ----" && mv "$outputFile" build_packages } || { echoerr "Could not create Debian package" @@ -73,8 +81,8 @@ buildDebianPackage() { } { - if [ -d "$homeDir" ]; then - rm -r "$homeDir" + if [ -d "$tmpDir" ]; then + rm -r "$tmpDir" fi echo "Cleaned up" } || { diff --git a/build_packages/DEB/progressia-0.1_all/DEBIAN/control b/build_packages/DEB/progressia-0.1_all/DEBIAN/control deleted file mode 100644 index 406c8d1..0000000 --- a/build_packages/DEB/progressia-0.1_all/DEBIAN/control +++ /dev/null @@ -1,9 +0,0 @@ -Package: Progressia -Version: 0.1 -Section: custom -Priority: optional -Architecture: all -Essential: no -Maintainer: Test -Depends: default-jdk -Description: Test package diff --git a/build_packages/DEB/template/DEBIAN/control b/build_packages/DEB/template/DEBIAN/control new file mode 100644 index 0000000..0095cf7 --- /dev/null +++ b/build_packages/DEB/template/DEBIAN/control @@ -0,0 +1,8 @@ +Package: progressia-techdemo +Version: 1.0 +Section: custom +Priority: optional +Architecture: all +Maintainer: Javapony +Depends: java8-runtime +Description: Progressia Techdemo release