61 lines
1.6 KiB
Bash
Executable File
61 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
SCRIPT=$(readlink -f $0)
|
|
SCRIPTPATH=`dirname $SCRIPT`
|
|
PROJECT_DIR=`dirname $SCRIPTPATH`
|
|
PROJECT_DAT=`cat $PROJECT_DIR/project-gui.json`
|
|
PROJECT_NAM=`echo $PROJECT_DAT | jq .Package -r`
|
|
PROJECT_VER=`echo $PROJECT_DAT | jq .Version -r`
|
|
|
|
echo
|
|
echo "Packaging $PROJECT_NAM v$PROJECT_VER"
|
|
echo
|
|
|
|
LIBRARY_DIR="/usr/lib/melonvpn"
|
|
ICON_DIR="/usr/share/icons"
|
|
DESKTOP_DIR="/usr/share/applications"
|
|
|
|
LIBRARY_DIR=$(realpath -sm "$LIBRARY_DIR")
|
|
DESKTOP_DIR=$(realpath -sm "$DESKTOP_DIR")
|
|
PROJECT_DIR=$(realpath -sm "$PROJECT_DIR")
|
|
|
|
# paths in package
|
|
PACK="${PROJECT_DIR}/package/${PROJECT_NAM}_${PROJECT_VER}"
|
|
PACK_LIB=$(realpath -sm "$PACK/$LIBRARY_DIR")
|
|
PACK_ICO=$(realpath -sm "$PACK/$ICON_DIR")
|
|
PACK_DES=$(realpath -sm "$PACK/$DESKTOP_DIR")
|
|
PACK_DEB=$(realpath -sm "$PACK/DEBIAN")
|
|
mkdir -p "$PACK"
|
|
mkdir -p "$PACK_LIB"
|
|
mkdir -p "$PACK_ICO"
|
|
mkdir -p "$PACK_DES"
|
|
mkdir -p "$PACK_DEB"
|
|
|
|
# Copying files
|
|
echo "Copying icon files"
|
|
ICON_SCALE=$(realpath -sm "$PACK_ICO/hicolor/scalable/apps")
|
|
mkdir -p "$ICON_SCALE"
|
|
cp dist/melonvpn.svg "$ICON_SCALE"
|
|
cp dist/melonvpn.png "$PACK_LIB"
|
|
cp dist/statusmelonoff.png "$PACK_LIB"
|
|
cp dist/statusmelonon.png "$PACK_LIB"
|
|
|
|
echo "Copying setup files"
|
|
cp setup/melonvpn.desktop "$PACK_DES"
|
|
|
|
echo "Copying library files"
|
|
cp dist/libmelonvpngui.so "$PACK_LIB"
|
|
|
|
echo "Generating meta data"
|
|
PACK_CON=$(realpath -sm "$PACK_DEB/control")
|
|
echo "" > "$PACK_CON"
|
|
for row in $(echo "$PROJECT_DAT" | jq -r 'keys[]'); do
|
|
value=`echo "$PROJECT_DAT" | jq -r ".[\"$row\"]"`
|
|
echo "$row: $value" >> "$PACK_CON"
|
|
done
|
|
|
|
echo "Building package"
|
|
dpkg-deb --build "$PACK"
|
|
echo "Signing package"
|
|
dpkg-sig -k OnPointCoding --sign repo "$PACK.deb"
|
|
echo "Package complete"
|