mkdeb.sh 1.46 KB
Newer Older
1
#!/usr/bin/env bash
2

3 4 5 6 7 8 9
ARCH=$(dpkg --print-architecture)
NAME=scriptbasic
VERSION=2.1
OS=$(uname)
MKTMP=$(mktemp -d)
OUTPUT="$NAME-$VERSION-${OS,,}-$ARCH"
DEST="$MKTMP/$OUTPUT/usr/local"
10

11 12 13 14 15 16 17
case $ARCH in
	"armfh")
		DEPENDS="libcurl3-gnutls, libiodbc2, libmariadbclient18, libncurses5, libsqlite3-0, libssl1.1";;
	"amd64")
		DEPENDS="libcurl3-gnutls, libiodbc2, libmysqlclient20, libncurses5, libsqlite3-0, libssl1.0.0";;
esac

18 19 20
CONTROL="Package: $OUTPUT
Version: 2.1-1
Architecture: $ARCH
21
Depends: $DEPENDS
22 23 24
Maintainer: support@scriptbasic.org
Description: Basic Scripting Language
"
25

26 27 28 29 30 31 32 33
CONFIG="dll \".so\"
module \"/usr/local/lib/scriba/\"
include \"/usr/local/include/scriba/\"
maxstep 0
maxlocalstep 0
maxlevel 29666
maxmem 0
"
34

35 36 37 38 39 40
mkdir -p "$MKTMP/$OUTPUT/DEBIAN"
echo "$CONTROL" > "$MKTMP/$OUTPUT/DEBIAN/control"
echo "ldconfig" > "$MKTMP/$OUTPUT/DEBIAN/postinst"
echo "ldconfig" > "$MKTMP/$OUTPUT/DEBIAN/postrm"
echo "$CONFIG" > "$MKTMP/sb.conf"
chmod a+x "$MKTMP/$OUTPUT/DEBIAN/postinst" "$MKTMP/$OUTPUT/DEBIAN/postrm"
41

42 43 44 45 46
mkdir -p "$DEST"/{bin,include/scriba,lib/scriba}
cp bin/exe/* "$DEST/bin"
cp bin/lib/* "$DEST/lib"
cp bin/mod/dll/* "$DEST/lib/scriba"
find extensions -name "*.bas" -exec cp {} "$DEST/include/scriba" \;
47

48 49 50 51 52 53 54 55 56
mkdir -p "$MKTMP/$OUTPUT/etc/scriba"
./bin/exe/scriba -f "$MKTMP/$OUTPUT/etc/scriba/basic.conf" -k "$MKTMP/sb.conf" 2>/dev/null

mkdir -p PACKAGES

dpkg --build "$MKTMP/$OUTPUT" 1>/dev/null
mv  "$MKTMP/$OUTPUT.deb" "PACKAGES/$OUTPUT.deb"

[[ -d $MKTMP ]] && rm -r "$MKTMP"