Misc: Removed Makefile and added install script

This commit is contained in:
Muhammad Herdiansyah 2017-06-20 15:14:45 +07:00
parent e383e6dfa4
commit 96103a757f
3 changed files with 39 additions and 50 deletions

View file

@ -1,20 +0,0 @@
PREFIX = /usr
all:
@echo Run \'make install\' to install Neofetch
install:
mkdir -p $(DESTDIR)$(PREFIX)/bin
mkdir -p $(DESTDIR)$(PREFIX)/share/man/man1
mkdir -p $(DESTDIR)/etc/neofetch
mkdir -p $(DESTDIR)$(PREFIX)/share/neofetch/ascii/distro
cp -p neofetch $(DESTDIR)$(PREFIX)/bin/neofetch
cp -p neofetch.1 $(DESTDIR)$(PREFIX)/share/man/man1/neofetch.1
cp -p config/config $(DESTDIR)/etc/neofetch/config
cp -p ascii/distro/* $(DESTDIR)$(PREFIX)/share/neofetch/ascii/distro
uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/neofetch
rm -f $(DESTDIR)$(PREFIX)/share/man/man1/neofetch.1
rm -f -r $(DESTDIR)$(PREFIX)/share/neofetch
rm -f -r $(DESTDIR)/etc/neofetch

31
install.sh Executable file
View file

@ -0,0 +1,31 @@
#!/usr/bin/env bash
while [[ "$1" ]]; do
case "$1" in
"--destdir") DESTDIR="$2" ;;
"--bindir") BINDIR="$2" ;;
"--confdir") CONFDIR="$2" ;;
"--prefix") PREFIX="$2" ;;
"--asciidir") ASCIIDIR="$2" ;;
"--mandir") MANDIR="$2" ;;
esac
shift
done
[[ -z "$BINDIR" ]] && BINDIR="/usr/bin"
[[ -z "$CONFDIR" ]] && CONFDIR="/etc/neofetch"
[[ -z "$ASCIIDIR" ]] && ASCIIDIR="/usr/share/neofetch/ascii/distro"
[[ -z "$MANDIR" ]] && MANDIR="/usr/share/man/man1"
mkdir -p "${DESTDIR}""${PREFIX}""${BINDIR}"
mkdir -p "${DESTDIR}""${PREFIX}""${CONFDIR}"
mkdir -p "${DESTDIR}""${PREFIX}""${ASCIIDIR}"
mkdir -p "${DESTDIR}""${PREFIX}""${MANDIR}"
sed -i -e "s|CONFDIR|/${PREFIX}${CONFDIR}|g" neofetch
sed -i -e "s|ASCIIDIR|/${PREFIX}${ASCIIDIR}|g" neofetch
cp -p neofetch "${DESTDIR}""${PREFIX}""${BINDIR}"
cp -p config/config "${DESTDIR}""${PREFIX}""${CONFDIR}"
cp -p ascii/distro/* "${DESTDIR}""${PREFIX}""${ASCIIDIR}"
cp -p neofetch.1 "${DESTDIR}""${PREFIX}""${MANDIR}"

View file

@ -2171,18 +2171,9 @@ get_ascii() {
[[ "$image_source" =~ \.(png|jpg|jpe|jpeg|gif)$ ]] && \ [[ "$image_source" =~ \.(png|jpg|jpe|jpeg|gif)$ ]] && \
err "Image: Source is image file but ascii backend was selected. Using distro ascii." err "Image: Source is image file but ascii backend was selected. Using distro ascii."
if [[ -d "/usr/share/neofetch/ascii/distro" ]]; then # Note: ASCIIDIR here is a placeholder -- it will be replaced with your ASCII directory.
ascii_dir="/usr/share/neofetch/ascii/distro" if [[ -d "ASCIIDIR" ]]; then
ascii_dir="ASCIIDIR"
elif [[ -d "/usr/local/share/neofetch/ascii/distro" ]]; then
ascii_dir="/usr/local/share/neofetch/ascii/distro"
elif [[ -d "/data/data/com.termux/files/usr/share/neofetch/ascii/distro" ]]; then
ascii_dir="/data/data/com.termux/files/usr/share/neofetch/ascii/distro"
elif [[ -d "/boot/home/config/non-packaged/share/neofetch/ascii/distro" ]]; then
ascii_dir="/boot/home/config/non-packaged/share/neofetch/ascii/distro"
else else
[[ -z "$script_dir" ]] && script_dir="$(get_full_path "$0")" [[ -z "$script_dir" ]] && script_dir="$(get_full_path "$0")"
ascii_dir="${script_dir%/*}/ascii/distro" ascii_dir="${script_dir%/*}/ascii/distro"
@ -3565,18 +3556,9 @@ get_full_path() {
} }
get_default_config() { get_default_config() {
if [[ -f "/etc/neofetch/config" ]]; then # Note: CONFDIR here is a placeholder -- it will be replaced with your configuration directory.
default_config="/etc/neofetch/config" if [[ -f "CONFDIR/config" ]]; then
default_config="CONFDIR/config"
elif [[ -f "/usr/local/etc/neofetch/config" ]]; then
default_config="/usr/local/etc/neofetch/config"
elif [[ -f "/data/data/com.termux/files/usr/etc/neofetch/config" ]]; then
default_config="/data/data/com.termux/files/usr/etc/neofetch/config"
elif [[ -f "/boot/home/config/non-packaged/etc/neofetch/config" ]]; then
default_config="/boot/home/config/non-packaged/etc/neofetch/config"
else else
[[ -z "$script_dir" ]] && script_dir="$(get_full_path "$0")" [[ -z "$script_dir" ]] && script_dir="$(get_full_path "$0")"
default_config="${script_dir%/*}/config/config" default_config="${script_dir%/*}/config/config"
@ -3604,12 +3586,8 @@ get_user_config() {
if [[ -f "${XDG_CONFIG_HOME}/neofetch/config" ]]; then if [[ -f "${XDG_CONFIG_HOME}/neofetch/config" ]]; then
config_file="${XDG_CONFIG_HOME}/neofetch/config" config_file="${XDG_CONFIG_HOME}/neofetch/config"
elif [[ -f "/etc/neofetch/config" ]]; then elif [[ -f "CONFDIR/config" ]]; then
cp "/etc/neofetch/config" "${XDG_CONFIG_HOME}/neofetch" cp "CONFDIR/config" "${XDG_CONFIG_HOME}/neofetch"
config_file="${XDG_CONFIG_HOME}/neofetch/config"
elif [[ -f "/usr/local/etc/neofetch/config" ]]; then
cp "/usr/local/share/neofetch/config" "${XDG_CONFIG_HOME}/neofetch"
config_file="${XDG_CONFIG_HOME}/neofetch/config" config_file="${XDG_CONFIG_HOME}/neofetch/config"
else else