From 79dc5a1adb5614261f42f65046f5d0b52afa7691 Mon Sep 17 00:00:00 2001 From: Alexander Bocken Date: Sun, 3 Jan 2021 19:21:47 +0100 Subject: [PATCH] added installer helpfile --- README.md | 7 ++++++- installer | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100755 installer diff --git a/README.md b/README.md index 1eb8885..1a609bb 100644 --- a/README.md +++ b/README.md @@ -12,4 +12,9 @@ This part of the script is quite generic and could easily be adjusted for other See the documentation inside the `ripper` file for more information. -A Makefile will soon be added. +## Install +After `git clone`ing this repo, run the helper `installer` + +```sh +./installer install +``` diff --git a/installer b/installer new file mode 100755 index 0000000..0345ae3 --- /dev/null +++ b/installer @@ -0,0 +1,33 @@ +#!/bin/sh +DESTDIR="/usr/local/bin" +XDG_VIDEOS_DIR=$HOME/vids #TODO ADJUST FOR PERSONAL USE HERE! +DLARCHIVE="${XDG_VIDEOS_DIR:-$HOME/Videos}/.downloaded" +DLLOC="${XDG_VIDEOS_DIR:-$HOME/Videos}" +CHANNELSFILE="${XDG_VIDEOS_DIR:-$HOME/Videos}/.channels" +BLACKLIST="${XDG_VIDEOS_DIR:-$HOME/Videos}/.blacklist" + +install(){ + mkdir -p "$DLLOC" "$(dirname "$CHANNELSFILE")" "$(dirname "$DLARCHIVE")" "$(dirname "$BLACKLIST")" "$DESTDIR" + cp ripper "$DESTDIR/ripper" + [ ! -f "$CHANNELSFILE" ] && printf '#Add channels to add in this file\n#Format: https://www.youtube.com/channel/' > "$CHANNELSFILE" + [ ! -f "$BLACKLIST" ] && printf '#Add video URIs here (not just the IDs)' > "$BLACKLIST" + [ ! -f "$DLARCHIVE" ] && printf '#These videos will not be attempted to download again' > "$DLARCHIVE" +} + +uninstall(){ + rm "$DESTDIR/ripper" +} + +clean(){ + rm "$BLACKLIST" "$DLARCHIVE" "$CHANNELSFILE" +} + +case "$1" in + "install") install;; + "uninstall") uninstall;; + "clean") clean;; + *) echo "installer [install] [uninstall] [clean] + install: installs application and adds needed files if not present + uninstall: remove application + clean: remove channels, archive, and blacklist files (use with caution!)";; + esac