Makefile: Use for the install of ascii art and default config

This commit is contained in:
Dylan 2016-02-08 22:02:49 +11:00
parent 9d35c8e6d1
commit 0d78a6bdfe
2 changed files with 15 additions and 10 deletions

View File

@ -1,4 +1,4 @@
PREFIX ?= usr PREFIX ?= /usr
RM ?= rm -f RM ?= rm -f
INSTALL_DIR ?= install -m755 -d INSTALL_DIR ?= install -m755 -d
INSTALL_PROG ?= install -m755 -D INSTALL_PROG ?= install -m755 -D
@ -8,14 +8,14 @@ all:
@echo Run \'make install\' to install Fetch @echo Run \'make install\' to install Fetch
install: install:
$(INSTALL_DIR) $(DESTDIR)/$(PREFIX)/bin $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/bin
$(INSTALL_DIR) $(DESTDIR)/usr/share/fetch/ascii/distro $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/fetch/ascii/distro
$(INSTALL_PROG) fetch $(DESTDIR)/$(PREFIX)/bin/fetch $(INSTALL_PROG) fetch $(DESTDIR)$(PREFIX)/bin/fetch
$(INSTALL_PROG) config/config $(DESTDIR)/usr/share/fetch/config $(INSTALL_PROG) config/config $(DESTDIR)$(PREFIX)/share/fetch/config
$(INSTALL_PROG) ascii/distro/* $(DESTDIR)/usr/share/fetch/ascii/distro $(INSTALL_PROG) ascii/distro/* $(DESTDIR)$(PREFIX)/share/fetch/ascii/distro
uninstall: uninstall:
$(RM) $(DESTDIR)/$(PREFIX)/bin/fetch $(RM) $(DESTDIR)$(PREFIX)/bin/fetch
$(RM) -r $(DESTDIR)/usr/share/fetch $(RM) -r $(DESTDIR)$(PREFIX)/share/fetch

9
fetch
View File

@ -1980,20 +1980,25 @@ getconfig () {
return return
fi fi
# Make the directory if it doesn't exist
mkdir -p "$HOME/.config/fetch/"
# Check $HOME/.config/fetch and create the # Check $HOME/.config/fetch and create the
# dir/files if they don't exist. # dir/files if they don't exist.
if [ -f "$HOME/.config/fetch/config" ]; then if [ -f "$HOME/.config/fetch/config" ]; then
source "$HOME/.config/fetch/config" source "$HOME/.config/fetch/config"
elif [ -f "/usr/share/fetch/config" ]; then elif [ -f "/usr/share/fetch/config" ]; then
mkdir -p "$HOME/.config/fetch/"
cp "/usr/share/fetch/config" "$HOME/.config/fetch" cp "/usr/share/fetch/config" "$HOME/.config/fetch"
source "$HOME/.config/fetch/config" 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 else
getscriptdir getscriptdir
mkdir -p "$HOME/.config/fetch/"
cp "$script_dir/config/config" "$HOME/.config/fetch" cp "$script_dir/config/config" "$HOME/.config/fetch"
source "$HOME/.config/fetch/config" source "$HOME/.config/fetch/config"
fi fi