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)
|
|
|
|
|
2021-08-25 16:48:03 +02:00
|
|
|
BIN_PATH="target/release/steamguard-cli"
|
|
|
|
if [[ ! -f "$BIN_PATH" ]]; then
|
2021-08-20 18:17:59 +02:00
|
|
|
echo "ERROR: Could not find release binaries, building them..."
|
|
|
|
cargo build --release
|
|
|
|
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"
|
|
|
|
"$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
|
|
|
|
Architecture: all
|
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"
|