From 0198eedff93ff17592e78ae606dc65e7ee4cb4f4 Mon Sep 17 00:00:00 2001 From: pgrondek Date: Fri, 12 Jul 2019 00:13:30 +0200 Subject: [PATCH] [transmission] Move config to separate folder --- dependencies.sh | 5 -- install-mime.sh | 12 ----- install.sh | 7 --- local/share/applications/mimeapps.list | 2 - transmission/Makefile | 47 +++++++++++++++++++ transmission/mimeapps.list | 2 + {bin => transmission}/transmission-add | 4 +- .../transmission.desktop | 0 8 files changed, 51 insertions(+), 28 deletions(-) delete mode 100755 dependencies.sh delete mode 100755 install-mime.sh delete mode 100755 local/share/applications/mimeapps.list create mode 100644 transmission/Makefile create mode 100755 transmission/mimeapps.list rename {bin => transmission}/transmission-add (66%) rename local/share/applications/torrent.desktop => transmission/transmission.desktop (100%) diff --git a/dependencies.sh b/dependencies.sh deleted file mode 100755 index de499db..0000000 --- a/dependencies.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -packages="transmission-cli" - -sudo aptitude install -y $packages diff --git a/install-mime.sh b/install-mime.sh deleted file mode 100755 index ab78519..0000000 --- a/install-mime.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - -set -x - -sed -i '/x-scheme-handler\/magnet/d' $HOME/.config/mimeapps.list -sed -i '/x-scheme-handler\/magnet/d' $HOME/.local/share/applications/mimeapps.list - -sed -i '/application\/x-bittorrent/d' $HOME/.config/mimeapps.list -sed -i '/application\/x-bittorrent/d' $HOME/.local/share/applications/mimeapps.list - -cat $(pwd)/local/share/applications/mimeapps.list >> $HOME/.local/share/applications/mimeapps.list - diff --git a/install.sh b/install.sh index 1d2a243..be37818 100755 --- a/install.sh +++ b/install.sh @@ -1,15 +1,8 @@ #!/bin/sh -rm -f $HOME/bin/transmission-add -rm -f $HOME/.local/share/applications/torrent.desktop rm -f $HOME/.ssh/authorized_keys -mkdir -p $HOME/bin/ mkdir -p $HOME/.ssh -mkdir -p $HOME/.local/share/applications ln -s $(pwd)/ssh/authorized_keys $HOME/.ssh/authorized_keys -ln -s $(pwd)/bin/transmission-add $HOME/bin/transmission-add -ln -s $(pwd)/local/share/applications/torrent.desktop $HOME/.local/share/applications/torrent.desktop - diff --git a/local/share/applications/mimeapps.list b/local/share/applications/mimeapps.list deleted file mode 100755 index ffed87b..0000000 --- a/local/share/applications/mimeapps.list +++ /dev/null @@ -1,2 +0,0 @@ -x-scheme-handler/magnet=torrent.desktop -application/x-bittorrent=torrent.desktop diff --git a/transmission/Makefile b/transmission/Makefile new file mode 100644 index 0000000..10d9c9d --- /dev/null +++ b/transmission/Makefile @@ -0,0 +1,47 @@ +REQUIRED_BINS=/usr/bin/transmission-cli +PACKAGES=transmission-cli + +CUSTOM_BINS=transmission-add +CUSTOM_BINS_DIR=$(HOME)/bin + +MIMEAPPS_LIST=$(HOME)/.config/mimeapps.list +APPLICATIONS_MIMEAPPS_LIST=$(HOME)/.local/share/applications/mimeapps.list + +TRANSMISSION_MIME=mimeapps.list +TRANSMISSION_DESKTOP_ENTRY=transmission.desktop +TRANSMISSION_DESKTOP_ENTRY_OUT=$(HOME)/.local/share/applications/transmission.desktop + +ROOT_APT=sudo aptitude + +OUT=$(I3_CONFIG_OUT) $(DUNST_CONFIG_OUT) + +.PHONY: clean_install + +clean_install: clean install +clean: clean_mime clean_bins +install: $(REQUIRED_BINS) install_mime install_bins + +$(REQUIRED_BINS): + $(ROOT_APT) install $(PACKAGES) + +# setup mime +install_mime: clean_mime + cat $(TRANSMISSION_MIME) > $(APPLICATIONS_MIMEAPPS_LIST) + cp $(TRANSMISSION_DESKTOP_ENTRY) $(TRANSMISSION_DESKTOP_ENTRY_OUT) + +clean_mime: + sed -i '/x-scheme-handler\/magnet/d' $(MIMEAPPS_LIST) + sed -i '/x-scheme-handler\/magnet/d' $(APPLICATIONS_MIMEAPPS_LIST) + sed -i '/application\/x-bittorrent/d' $(MIMEAPPS_LIST) + sed -i '/application\/x-bittorrent/d' $(APPLICATIONS_MIMEAPPS_LIST) + rm -f $(TRANSMISSION_DESKTOP_ENTRY_OUT) + +# bins +install_bins: $(CUSTOM_BINS_DIR) + cp $(CUSTOM_BINS) $(CUSTOM_BINS_DIR) + +clean_bins: + rm -f $(CUSTOM_BINS:%=$(CUSTOM_BINS_DIR)/%) + +$(CUSTOM_BINS_DIR): + mkdir -p $(CUSTOM_BINS) $(CUSTOM_BINS_DIR) \ No newline at end of file diff --git a/transmission/mimeapps.list b/transmission/mimeapps.list new file mode 100755 index 0000000..e6c1dea --- /dev/null +++ b/transmission/mimeapps.list @@ -0,0 +1,2 @@ +x-scheme-handler/magnet=transmission.desktop +application/x-bittorrent=transmission.desktop diff --git a/bin/transmission-add b/transmission/transmission-add similarity index 66% rename from bin/transmission-add rename to transmission/transmission-add index 6b434f6..a515ee9 100755 --- a/bin/transmission-add +++ b/transmission/transmission-add @@ -4,11 +4,11 @@ address=192.168.50.101 set -x -transmission-remote $address -a "$1" &> /dev/null +transmission-remote ${address} -a "$1" &> /dev/null status=$? -if [ $status -eq 0 ] ; then +if [[ ${status} -eq 0 ]] ; then notify-send Transmission "Added torrent" else notify-send Transmission "Error adding torrent" diff --git a/local/share/applications/torrent.desktop b/transmission/transmission.desktop similarity index 100% rename from local/share/applications/torrent.desktop rename to transmission/transmission.desktop