1
0
mirror of https://github.com/pgrondek/config.git synced 2024-11-29 15:03:05 +00:00

[transmission] Move config to separate folder

This commit is contained in:
pgrondek 2019-07-12 00:13:30 +02:00
parent 1ef8df42e6
commit 0198eedff9
8 changed files with 51 additions and 28 deletions

View File

@ -1,5 +0,0 @@
#!/usr/bin/env bash
packages="transmission-cli"
sudo aptitude install -y $packages

View File

@ -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

View File

@ -1,15 +1,8 @@
#!/bin/sh #!/bin/sh
rm -f $HOME/bin/transmission-add
rm -f $HOME/.local/share/applications/torrent.desktop
rm -f $HOME/.ssh/authorized_keys rm -f $HOME/.ssh/authorized_keys
mkdir -p $HOME/bin/
mkdir -p $HOME/.ssh mkdir -p $HOME/.ssh
mkdir -p $HOME/.local/share/applications
ln -s $(pwd)/ssh/authorized_keys $HOME/.ssh/authorized_keys 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

View File

@ -1,2 +0,0 @@
x-scheme-handler/magnet=torrent.desktop
application/x-bittorrent=torrent.desktop

47
transmission/Makefile Normal file
View File

@ -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)

2
transmission/mimeapps.list Executable file
View File

@ -0,0 +1,2 @@
x-scheme-handler/magnet=transmission.desktop
application/x-bittorrent=transmission.desktop

View File

@ -4,11 +4,11 @@ address=192.168.50.101
set -x set -x
transmission-remote $address -a "$1" &> /dev/null transmission-remote ${address} -a "$1" &> /dev/null
status=$? status=$?
if [ $status -eq 0 ] ; then if [[ ${status} -eq 0 ]] ; then
notify-send Transmission "Added torrent" notify-send Transmission "Added torrent"
else else
notify-send Transmission "Error adding torrent" notify-send Transmission "Error adding torrent"