Added default system-wide config file

This commit is contained in:
TheDarkBug 2022-03-08 21:24:52 +01:00
parent bff91711cd
commit acd9662a30
5 changed files with 24 additions and 2 deletions

View file

@ -9,6 +9,7 @@ PLATFORM = $(shell uname)
ifeq ($(PLATFORM), Linux)
PREFIX = bin
LIBDIR = lib
ETC_DIR = /etc
MANDIR = share/man/man1
ifeq ($(shell uname -o), Android)
DESTDIR = /data/data/com.termux/files/usr
@ -16,12 +17,14 @@ ifeq ($(PLATFORM), Linux)
else ifeq ($(PLATFORM), Darwin)
PREFIX = local/bin
LIBDIR = local/lib
ETC_DIR = /etc
MANDIR = local/share/man/man1
else ifeq ($(PLATFORM), FreeBSD)
CFLAGS += -D__FREEBSD__
CFLAGS_DEBUG += -D__FREEBSD__
PREFIX = bin
LIBDIR = lib
ETC_DIR = /etc
MANDIR = share/man/man1
else ifeq ($(PLATFORM), windows32)
CC = gcc
@ -38,9 +41,10 @@ debug:
./$(NAME)
install: build
mkdir -p $(DESTDIR)/$(PREFIX) $(DESTDIR)/$(LIBDIR)/uwufetch $(DESTDIR)/$(MANDIR)
mkdir -p $(DESTDIR)/$(PREFIX) $(DESTDIR)/$(LIBDIR)/uwufetch $(DESTDIR)/$(MANDIR) $(ETC_DIR)/uwufetch
cp $(NAME) $(DESTDIR)/$(PREFIX)/$(NAME)
cp -r res/* $(DESTDIR)/$(LIBDIR)/uwufetch
cp default.config $(ETC_DIR)/uwufetch
cp ./$(NAME).1.gz $(DESTDIR)/$(MANDIR)/
uninstall:

15
default.config Normal file
View file

@ -0,0 +1,15 @@
#distro=arch
#image=~/Pictures/picture.png
ascii=true
user=true
os=true
host=true
kernel=true
cpu=true
gpu=true
ram=true
resolution=true
shell=true
pkgs=true
uptime=true
colors=true

View file

@ -32,7 +32,8 @@ prints image instead of ascii logo uses a custom image if one is provided (disab
.B -l --list
prints a list of all supported distributions
.SH CONFIGURATION
The config file is located in $HOME/.config/uwufetch/config (you need to create it), but you can change the path by using the \fB--config\fR option.
The system-wide config file is /etc/uwufetch/config, and you can use it to configure uwufetch globally or as a template for your own config.
The user config file is located in $HOME/.config/uwufetch/config (you need to create it), but you can change the path by using the \fB--config\fR option.
.TP
.SH EXAMPLE
.EX

Binary file not shown.

View file

@ -162,6 +162,8 @@ struct configuration parse_config(struct info* user_info) {
char homedir[512];
sprintf(homedir, "%s/.config/uwufetch/config", getenv("HOME"));
config = fopen(homedir, "r");
if (!config)
config = fopen("/etc/uwufetch/config", "r");
}
} else
config = fopen(user_info->config_directory, "r");