Fixed an issue with /etc/bb instead of /etc/xdg/bb and moved the startup

command into bb.h with the other bb shell script stuff.
This commit is contained in:
Bruce Hill 2019-09-30 17:22:17 -07:00
parent 3fd603c607
commit f0e37a95f1
3 changed files with 16 additions and 14 deletions

View File

@ -68,10 +68,11 @@ install: $(NAME)
fi; \
[ ! "$$prefix" ] && prefix="/usr/local"; \
[ ! "$$sysconfdir" ] && sysconfdir=/etc; \
mkdir -m 700 -pv "$$prefix/bin" "$$prefix/share/man/man1" "$$sysconfdir/bb" \
mkdir -m 644 -pv "$$prefix/share/man/man1" \
mkdir -m 755 -pv "$$prefix/bin" "$$sysconfdir/xdg/bb" \
&& cp -v $(NAME) "$$prefix/bin/" \
&& cp -v $(NAME).1 "$$prefix/share/man/man1/" \
&& cp -v bbstartup.sh bindings.bb "$$sysconfdir/bb/"
&& cp -v bbstartup.sh bindings.bb "$$sysconfdir/xdg/bb/"
uninstall:
@prefix="$(PREFIX)"; \
@ -83,6 +84,6 @@ uninstall:
[ ! "$$sysconfdir" ] && sysconfdir=/etc; \
[ ! "$$XDG_CONFIG_HOME" ] && XDG_CONFIG_HOME=~/.config; \
echo "Deleting..."; \
rm -rvf "$$prefix/bin/$(NAME)" "$$prefix/share/man/man1/$(NAME).1" "$$sysconfdir/bb"; \
printf '\033[1mIf you created any config files in $$XDG_CONFIG_HOME/bb, you may want to delete them manually.\033[0m'
rm -rvf "$$prefix/bin/$(NAME)" "$$prefix/share/man/man1/$(NAME).1" "$$sysconfdir/xdg/bb"; \
printf "\033[1mIf you created any config files in ~/.config/bb, you may want to delete them manually.\033[0m"

10
bb.c
View File

@ -29,16 +29,6 @@ void bb_browse(bb_t *bb, const char *path)
bb->scroll = 0;
bb->cursor = 0;
const char *runstartup =
"[ ! \"$XDG_CONFIG_HOME\" ] && XDG_CONFIG_HOME=~/.config;\n"
"[ ! \"$sysconfdir\" ] && sysconfdir=/etc;\n"
"if [ -e \"$XDG_CONFIG_HOME/bb/bbstartup.sh\" ]; then\n"
" . \"$XDG_CONFIG_HOME/bb/bbstartup.sh\";\n"
"elif [ -e \"$sysconfdir/xdg/bb/bbstartup.sh\" ]; then\n"
" . \"$sysconfdir/xdg/bb/bbstartup.sh\";\n"
"elif [ -e \"./bbstartup.sh\" ]; then\n"
" . \"./bbstartup.sh\";\n"
"fi\n";
run_script(bb, runstartup);
init_term();
goto force_check_cmds;

11
bb.h
View File

@ -298,4 +298,15 @@ SPIN ";\n"
#endif
;
const char *runstartup =
"[ ! \"$XDG_CONFIG_HOME\" ] && XDG_CONFIG_HOME=~/.config;\n"
"[ ! \"$sysconfdir\" ] && sysconfdir=/etc;\n"
"if [ -e \"$XDG_CONFIG_HOME/bb/bbstartup.sh\" ]; then\n"
" . \"$XDG_CONFIG_HOME/bb/bbstartup.sh\";\n"
"elif [ -e \"$sysconfdir/xdg/bb/bbstartup.sh\" ]; then\n"
" . \"$sysconfdir/xdg/bb/bbstartup.sh\";\n"
"elif [ -e \"./bbstartup.sh\" ]; then\n"
" . \"./bbstartup.sh\";\n"
"fi\n";
// vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1