From 0d78a6bdfe2bd38647d0c5cec78660426590c1e3 Mon Sep 17 00:00:00 2001 From: Dylan Date: Mon, 8 Feb 2016 22:02:49 +1100 Subject: [PATCH] Makefile: Use for the install of ascii art and default config --- Makefile | 16 ++++++++-------- fetch | 9 +++++++-- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 8b50f8f4..0307c40a 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -PREFIX ?= usr +PREFIX ?= /usr RM ?= rm -f INSTALL_DIR ?= install -m755 -d INSTALL_PROG ?= install -m755 -D @@ -8,14 +8,14 @@ all: @echo Run \'make install\' to install Fetch install: - $(INSTALL_DIR) $(DESTDIR)/$(PREFIX)/bin - $(INSTALL_DIR) $(DESTDIR)/usr/share/fetch/ascii/distro - $(INSTALL_PROG) fetch $(DESTDIR)/$(PREFIX)/bin/fetch - $(INSTALL_PROG) config/config $(DESTDIR)/usr/share/fetch/config - $(INSTALL_PROG) ascii/distro/* $(DESTDIR)/usr/share/fetch/ascii/distro + $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/bin + $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/fetch/ascii/distro + $(INSTALL_PROG) fetch $(DESTDIR)$(PREFIX)/bin/fetch + $(INSTALL_PROG) config/config $(DESTDIR)$(PREFIX)/share/fetch/config + $(INSTALL_PROG) ascii/distro/* $(DESTDIR)$(PREFIX)/share/fetch/ascii/distro uninstall: - $(RM) $(DESTDIR)/$(PREFIX)/bin/fetch - $(RM) -r $(DESTDIR)/usr/share/fetch + $(RM) $(DESTDIR)$(PREFIX)/bin/fetch + $(RM) -r $(DESTDIR)$(PREFIX)/share/fetch diff --git a/fetch b/fetch index 4318d70c..2404f19f 100755 --- a/fetch +++ b/fetch @@ -1980,20 +1980,25 @@ getconfig () { return fi + # Make the directory if it doesn't exist + mkdir -p "$HOME/.config/fetch/" + # Check $HOME/.config/fetch and create the # dir/files if they don't exist. if [ -f "$HOME/.config/fetch/config" ]; then source "$HOME/.config/fetch/config" elif [ -f "/usr/share/fetch/config" ]; then - mkdir -p "$HOME/.config/fetch/" cp "/usr/share/fetch/config" "$HOME/.config/fetch" source "$HOME/.config/fetch/config" + elif [ -f "/usr/local/share/fetch/config" ]; then + cp "/usr/local/share/fetch/config" "$HOME/.config/fetch" + source "$HOME/.config/fetch/config" + else getscriptdir - mkdir -p "$HOME/.config/fetch/" cp "$script_dir/config/config" "$HOME/.config/fetch" source "$HOME/.config/fetch/config" fi