From 72c28b2518b7cdc46759e512938ca13573d9bfc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Flor=C3=A9al=20Toumikian?= Date: Thu, 27 Aug 2020 11:38:00 +0200 Subject: [PATCH] Enhancement: better packaging scripts - build.sh: will build for release - ./install.sh: - default $PREFIX set to /usr/local to avoid installing in / - use install over cp - ./uninstall.sh: - remove installed files (leave directory structure though) - default $PREFIX set to /usr/local --- Cargo.lock | 2 ++ build.sh | 3 +++ install.sh | 24 ++++++++++++++++++------ uninstall.sh | 13 +++++++++++++ 4 files changed, 36 insertions(+), 6 deletions(-) create mode 100755 build.sh create mode 100755 uninstall.sh diff --git a/Cargo.lock b/Cargo.lock index 7381d55..63be256 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,3 +1,5 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. [[package]] name = "MacTypes-sys" version = "2.1.0" diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..2b71ded --- /dev/null +++ b/build.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +cargo build --release diff --git a/install.sh b/install.sh index 055e276..f26da08 100755 --- a/install.sh +++ b/install.sh @@ -1,7 +1,19 @@ -cargo build --release -sudo cp target/release/mobydick $PREFIX/bin/xyz.gelez.mobydick -sudo cp *.appdata.xml $PREFIX/share/appdata/ -sudo cp *.desktop $PREFIX/share/applications/ +#!/usr/bin/env sh +if [ -z "$PREFIX" ]; then + PREFIX=/usr/local +fi + +if [ ! -f target/release/mobydick ]; then + ./build.sh +fi + +sudo install -v -d $PREFIX/bin/ +sudo install -v target/release/mobydick $PREFIX/bin/xyz.gelez.mobydick +sudo install -v -d $PREFIX/share/appdata +sudo install -v -t $PREFIX/share/appdata *.appdata.xml +sudo install -v -d $PREFIX/share/applications +sudo install -v -t $PREFIX/share/applications *.desktop for s in "16" "24" "32" "48" "64" "128"; do - sudo cp icons/$s.svg $PREFIX/share/icons/hicolor/${s}x${s}/mobydick.svg -done \ No newline at end of file + sudo install -v -d $PREFIX/share/icons/hicolor/${s}x${s}/ + sudo install -v icons/$s.svg $PREFIX/share/icons/hicolor/${s}x${s}/mobydick.svg +done diff --git a/uninstall.sh b/uninstall.sh new file mode 100755 index 0000000..146cae9 --- /dev/null +++ b/uninstall.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +if [ -z "$PREFIX" ]; then + PREFIX=/usr/local +fi + +sudo rm -v $PREFIX/bin/xyz.gelez.mobydick +sudo rm -v $PREFIX/share/appdata/$(ls *.appdata.xml) +sudo rm -v $PREFIX/share/applications/$(ls *.desktop) + +for s in "16" "24" "32" "48" "64" "128"; do + sudo rm -v $PREFIX/share/icons/hicolor/${s}x${s}/mobydick.svg +done