aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatias Linares <matiaslina@openmailbox.org>2015-12-08 01:10:08 -0300
committerMatias Linares <matiaslina@openmailbox.org>2015-12-08 01:10:08 -0300
commitad181f63bc252303d52dc413433890f14d21b915 (patch)
treefdb4e153b8fdfc010e0fe1ec3fcd91c0f8a2cb75
parentc754763c4370a9eb055e68db3d638fd38382c137 (diff)
downloaddotwm-ad181f63bc252303d52dc413433890f14d21b915.tar.gz
Add a simple installation script and xsession file
-rw-r--r--dotwm.desktop6
-rwxr-xr-xinstall.sh78
2 files changed, 84 insertions, 0 deletions
diff --git a/dotwm.desktop b/dotwm.desktop
new file mode 100644
index 0000000..4b3a832
--- /dev/null
+++ b/dotwm.desktop
@@ -0,0 +1,6 @@
+[Desktop Entry]
+Encoding=UTF-8
+Name=DotWM
+Comment=Stacking window manager
+Exec=/usr/local/bin/dotwm
+Type=XSession
diff --git a/install.sh b/install.sh
new file mode 100755
index 0000000..4c16960
--- /dev/null
+++ b/install.sh
@@ -0,0 +1,78 @@
+#!/bin/bash
+
+PREFIX=/usr/local
+BINDIR=${PREFIX}/bin
+DATADIR=${PREFIX}/share
+MANDIR=${DATADIR}/man
+MAN1DIR=${MANDIR}/man1
+DOCDIR=${DATADIR}/doc/dotwm
+EXAMPLEDIR=${DOCDIR}/examples
+SYSCONFDIR=/etc
+CONFIGDIR=${SYSCONFDIR}/xdg/dotwm
+XSESSIONDIR=${DATADIR}/share/xsessions
+
+fail_dependencies() {
+ cat <<EOF
+You need to install all the dependencies.
+Check www.rust-lang.org for installation instructions for rust compiler and cargo.
+EOF
+}
+
+_build() {
+ echo Building...
+ if ! which rustc 2> /dev/null > /dev/null
+ then
+ fail_dependencies
+ fi
+
+ if ! which cargo 2> /dev/null > /dev/null
+ then
+ fail_dependencies
+ fi
+
+ cargo build --release
+}
+
+_install() {
+ echo $@
+ if [[ x"$1" = "x--prefix" ]]
+ then
+ PREFIX=$2
+ fi
+ echo "Base dir for installation: ${PREFIX}"
+ install -m 755 target/release/dotwm $BINDIR
+ install -m 644 dotwm.1 ${MAN1DIR}
+ mkdir -p ${DOCDIR}
+ mkdir -p ${EXAMPLEDIR}
+ install -m 755 autostart ${EXAMPLEDIR}
+ install -m 644 LICENSE ${DOCDIR}
+ install -m 644 README.md ${DOCDIR}
+ install -m 644 dotwm.desktop ${XSESSIONDIR}
+}
+
+_uninstall() {
+ rm $BINDIR/dotwm
+ rm ${EXAMPLEDIR}/autostart
+ rm ${MAN1DIR}/dotwm.1
+ rm -r ${DOCDIR}
+ rm ${XSESSIONDIR}/dotwm.desktop
+}
+
+base=$1
+shift
+case $base in
+ build)
+ _build
+ ;;
+ install)
+ _install $@
+ ;;
+ uninstall)
+ _uninstall $@
+ ;;
+ *)
+ _build
+ _install $@
+ ;;
+esac
+