Added packaging script and makefile for Linux install

This commit is contained in:
Antoine Gersant 2017-05-29 19:13:03 -07:00
parent 2b865d80c1
commit baadd410ca
2 changed files with 38 additions and 0 deletions

14
build_release_unix.sh Normal file
View file

@ -0,0 +1,14 @@
#!/bin/sh
echo "Creating output directory"
mkdir -p release/tmp
echo "Copying package files"
cp -r web src Cargo.toml Cargo.lock res/unix/Makefile release/tmp
cp res/default_config.toml release/tmp/polaris.toml
echo "Creating tarball"
POLARIS_VERSION=$(grep ^version Cargo.toml | awk '{print $3}' | tr -d '"\r\n')
tar -zc -C release/tmp -f release/polaris-$POLARIS_VERSION.tar.gz .
echo "Cleaning up"
rm -rf release/tmp

24
res/unix/Makefile Normal file
View file

@ -0,0 +1,24 @@
POLARIS_BIN_DIR := ~/.local/bin/polaris
POLARIS_CONFIG_DIR := ~/.config/polaris
POLARIS_DATA_DIR := ~/.local/share/polaris
all: build
build:
cargo build --release
install: build
install -d $(POLARIS_BIN_DIR)
install -d $(POLARIS_CONFIG_DIR)
install -d $(POLARIS_DATA_DIR)
install ./target/release/polaris $(POLARIS_BIN_DIR)
install ./polaris.toml $(POLARIS_CONFIG_DIR)
cp -r ./web $(POLARIS_DATA_DIR)
clean:
cargo clean
uninstall:
rm -r $(POLARIS_BIN_DIR)
rm -r $(POLARIS_CONFIG_DIR)
rm -r $(POLARIS_DATA_DIR)