|
| 1 | +#!/usr/bin/env bash |
| 2 | +# |
| 3 | +# ReactOS Build Environment for Unix-based Operating Systems - Packaging tool for DEB source packages |
| 4 | +# Copyright 2020 Colin Finck <colin@reactos.org> |
| 5 | +# |
| 6 | +# Released under GNU GPL v2 or any later version. |
| 7 | + |
| 8 | +cd `dirname $0` |
| 9 | + |
| 10 | +# |
| 11 | +# Prerequisites |
| 12 | +# |
| 13 | +# Check the parameters |
| 14 | +if [[ "$3" = "" ]]; then |
| 15 | + echo "makepackage-deb - Package a RosBE-Unix version as DEB source package (for Launchpad)" |
| 16 | + echo "Syntax: ./makepackage-deb.sh <package> <version> <distro>" |
| 17 | + echo |
| 18 | + echo " package - Package name (i.e. \"Base-i386\")" |
| 19 | + echo " version - Version number of the Build Environment to package (i.e. \"1.4\")" |
| 20 | + echo " distro - Debian/Ubuntu distribution name to create a package for (i.e. \"bionic\")" |
| 21 | + exit 1 |
| 22 | +fi |
| 23 | + |
| 24 | +package_name="$1" |
| 25 | +package_version="$2" |
| 26 | +distro_name="$3" |
| 27 | + |
| 28 | +# Set the full package name |
| 29 | +full_package_name="RosBE-Unix" |
| 30 | + |
| 31 | +case "$package_name" in |
| 32 | + "Base-i386") |
| 33 | + # Add no suffix |
| 34 | + ;; |
| 35 | + *) |
| 36 | + # Add the package name as the suffix |
| 37 | + full_package_name+="-$package_name" |
| 38 | + ;; |
| 39 | +esac |
| 40 | + |
| 41 | +debian_package_name=`echo $full_package_name | tr '[:upper:]' '[:lower:]'` |
| 42 | +debian_orig_file="${debian_package_name}_${package_version}.orig.tar.bz2" |
| 43 | + |
| 44 | +full_package_name+="-$package_version" |
| 45 | +full_package_file="$full_package_name.tar.bz2" |
| 46 | + |
| 47 | +# Let's hope we will never need more than one try for each distro :) |
| 48 | +debian_package_name+="_$package_version-1ppa1~$distro_name" |
| 49 | + |
| 50 | +if [[ ! -d "$full_package_name" || ! -f "$full_package_file" ]]; then |
| 51 | + echo "Directory \"$full_package_name\" or file \"$full_package_file\" does not exist!" |
| 52 | + echo "Make sure that you run ./makepackage.sh beforehand." |
| 53 | + exit 1 |
| 54 | +fi |
| 55 | + |
| 56 | +debian_directory="${package_name}_debian" |
| 57 | +if [[ ! -d "$debian_directory" ]]; then |
| 58 | + echo "Debian package directory \"$debian_directory\" does not exist!" |
| 59 | + exit 1 |
| 60 | +fi |
| 61 | + |
| 62 | +distro_directory="${debian_directory}_${distro_name}" |
| 63 | +if [[ ! -d "$distro_directory" ]]; then |
| 64 | + echo "Distro-specific Debian package directory \"$distro_directory\" does not exist!" |
| 65 | + exit 1 |
| 66 | +fi |
| 67 | + |
| 68 | +# Create the Debian package structure |
| 69 | +rm -rf $debian_package_name |
| 70 | +rm -f $debian_package_name* |
| 71 | + |
| 72 | +cp $full_package_file $debian_orig_file |
| 73 | +cp -R $full_package_name $debian_package_name |
| 74 | +cp -R $debian_directory $debian_package_name/debian |
| 75 | +cp $distro_directory/* $debian_package_name/debian |
| 76 | + |
| 77 | +# Create the DEB source package for Launchpad |
| 78 | +cd $debian_package_name |
| 79 | +debuild -S |
0 commit comments