From f2100823e44032addbb027fea915318bea8dc69d Mon Sep 17 00:00:00 2001 From: ksyasuda Date: Fri, 26 Nov 2021 17:54:52 -0800 Subject: [PATCH] update setup script to be queit by default also make change so setup script does not run the if aniwrapper config directory already exists --- setup.sh | 86 +++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 54 insertions(+), 32 deletions(-) diff --git a/setup.sh b/setup.sh index b68e2a2..d0322b6 100755 --- a/setup.sh +++ b/setup.sh @@ -2,11 +2,10 @@ # Setup script to move the rofi theme files to the correct location # As well as set up the history database -# DO NOT RUN AS ROOT - -log() { - printf "%s\n" "$1" -} +###################### +# DO NOT RUN AS ROOT # +###################### +VERBOSE=0 DB="history.sqlite3" @@ -18,33 +17,56 @@ fi DIR="$XDG_CONFIG_HOME/aniwrapper" MPV_DIR="$XDG_CONFIG_HOME/mpv" -printf "%s\n" "INSTALL DIR: $DIR" +log() { + if [[ "$VERBOSE" -eq 1 ]]; then + printf "%s\n" "$*" + fi +} + +# executes aniwrapper setup +# 1. create the aniwrapper directory in $XDG_CONFIG_HOME +# 2. create history databases in $DIR +# 3. move theme files to $DIR +# 4. move skip-intro.lua into mpv/scripts folder +run_setup() { + log "INSTALL DIR: $DIR" + + if [[ ! -d "$DIR" ]]; then + log "Creating directory $DIR" + mkdir -p "$DIR" + log "Directory created" + fi + + if [[ ! -f "$DIR"/"$DB" ]]; then + # Create the DB if not exists + log "Creating history database..." + sqlite3 "$DIR"/"$DB"