steamguard-cli/scripts/package-deb.sh

47 lines
1.3 KiB
Bash
Raw Permalink Normal View History

2016-08-24 18:45:48 +02:00
#!/bin/bash
2021-08-25 16:48:03 +02:00
set -e
2022-06-12 15:24:04 +02:00
DISTRO=$(lsb_release -i -s)
DISTRO_VERSION=$(lsb_release -r -s)
if ! which cross; then
echo "cross not found, installing..."
cargo install cross
fi
BIN_PATH="target/x86_64-unknown-linux-musl/release/steamguard-cli"
2021-08-25 16:48:03 +02:00
if [[ ! -f "$BIN_PATH" ]]; then
2021-08-20 18:17:59 +02:00
echo "ERROR: Could not find release binaries, building them..."
cross build --release --target=x86_64-unknown-linux-musl
2021-08-20 18:17:59 +02:00
fi
2022-06-12 15:24:04 +02:00
VERSION="$("$BIN_PATH" --version | cut -d " " -f 2)"
2016-08-24 18:45:48 +02:00
TEMP_PKG_PATH="/tmp/steamguard-cli_$VERSION"
2022-06-12 15:24:04 +02:00
echo "Building package on $DISTRO $DISTRO_VERSION for v$VERSION..."
2016-08-24 18:45:48 +02:00
2021-08-20 18:17:59 +02:00
mkdir -p "$TEMP_PKG_PATH/usr/local/bin"
mkdir -p "$TEMP_PKG_PATH/etc/bash_completion.d"
mkdir -p "$TEMP_PKG_PATH/DEBIAN"
2016-08-24 18:45:48 +02:00
2021-08-20 18:17:59 +02:00
cp "$BIN_PATH" "$TEMP_PKG_PATH/usr/local/bin/steamguard"
pushd "$TEMP_PKG_PATH/usr/local/bin/"
ln -s "./steamguard" "./steamguard-cli"
popd
2021-08-20 18:17:59 +02:00
"$BIN_PATH" completion --shell bash > "$TEMP_PKG_PATH/etc/bash_completion.d/steamguard"
2016-08-24 18:45:48 +02:00
cat <<EOT >> $TEMP_PKG_PATH/DEBIAN/control
Package: steamguard-cli
2021-08-20 18:17:59 +02:00
Depends:
2016-08-24 18:45:48 +02:00
Version: $VERSION
Section: base
Priority: optional
2022-06-12 16:20:46 +02:00
Architecture: x86_64
2021-08-20 18:17:59 +02:00
Maintainer: Carson McManus <carson.mcmanus1@gmail.com>
2016-08-24 18:45:48 +02:00
Description: steamguard-cli
2021-08-20 18:17:59 +02:00
A command line utility to generate Steam 2FA codes and respond to confirmations.
2016-08-24 18:45:48 +02:00
EOT
2022-06-12 15:24:04 +02:00
dpkg-deb --build "$TEMP_PKG_PATH" "steamguard-cli_$VERSION-0.deb"
2016-08-24 18:45:48 +02:00
2021-08-20 18:17:59 +02:00
rm -rf "$TEMP_PKG_PATH"