summarylogtreecommitdiffstats
path: root/buildAndInstall.sh
blob: c992f651abcae3e5d2c2d3661beb25e03b116734 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash
set -e 
set -o pipefail
VERSION=$1
VERSION_REGEX="^[0-9]+\.[0-9]+\.[0-9]+$"
if [[ ! $VERSION =~ $VERSION_REGEX ]]; then
    echo "$VERSION is not valid version in format ${VERSION_REGEX}"
fi
echo "Downloading package to calculate checksum"
SHA512=$(wget -q -O - "https://mango-lychee.nyc3.cdn.digitaloceanspaces.com/LycheeSlicer-$VERSION.deb" | sha512sum | awk '{print $1}') \
    || (echo "Version not found" && exit 1)
echo "Preparing PKG file"
sed -i "s@sha512sums_x86_64=(.*)@sha512sums_x86_64=('$SHA512')@g" PKGBUILD
sed -i "s@pkgver=.*@pkgver=$VERSION@g" PKGBUILD
makepkg --printsrcinfo > .SRCINFO && makepkg
PKG_FILE=$(ls -t1 *.tar.zst | head -n 1)
printf "Done, install $PKG_FILE? [Y/n]"
read install
if [ "$install" = "y" ]; then
    sudo pacman -U *.tar.zst
fi