Added NM_CONFIG_DIR option to the Makefile (closes #68)
This should not be used in most cases, as it will break compatibility with existing mods which depend on adding a config to NM. This option is meant as a better option than find/replace for people who do private builds of NM for themselves and want to change the config dir. It will also affect the path used for installing the documentation and shown in the default menu item.
This commit is contained in:
12
Makefile
12
Makefile
@@ -5,7 +5,7 @@ override LIBRARY := src/libnm.so
|
|||||||
override SOURCES += src/action.c src/action_c.c src/action_cc.cc src/config.c src/generator.c src/generator_c.c src/kfmon.c src/nickelmenu.cc src/util.c
|
override SOURCES += src/action.c src/action_c.c src/action_cc.cc src/config.c src/generator.c src/generator_c.c src/kfmon.c src/nickelmenu.cc src/util.c
|
||||||
override CFLAGS += -Wall -Wextra -Werror -fvisibility=hidden
|
override CFLAGS += -Wall -Wextra -Werror -fvisibility=hidden
|
||||||
override CXXFLAGS += -Wall -Wextra -Werror -Wno-missing-field-initializers -isystemlib -fvisibility=hidden -fvisibility-inlines-hidden
|
override CXXFLAGS += -Wall -Wextra -Werror -Wno-missing-field-initializers -isystemlib -fvisibility=hidden -fvisibility-inlines-hidden
|
||||||
override KOBOROOT += res/doc:/mnt/onboard/.adds/nm/doc
|
override KOBOROOT += res/doc:$(NM_CONFIG_DIR)/doc
|
||||||
|
|
||||||
override SKIPCONFIGURE += strip
|
override SKIPCONFIGURE += strip
|
||||||
strip:
|
strip:
|
||||||
@@ -16,4 +16,14 @@ ifeq ($(NM_UNINSTALL_CONFIGDIR),1)
|
|||||||
override CPPFLAGS += -DNM_UNINSTALL_CONFIGDIR
|
override CPPFLAGS += -DNM_UNINSTALL_CONFIGDIR
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(NM_CONFIG_DIR),)
|
||||||
|
override NM_CONFIG_DIR := /mnt/onboard/.adds/nm
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq ($(NM_CONFIG_DIR),/mnt/onboard/.adds/nm)
|
||||||
|
$(info -- Warning: NM_CONFIG_DIR is set to a non-default value; this will cause issues with other mods using it!)
|
||||||
|
endif
|
||||||
|
|
||||||
|
override CPPFLAGS += -DNM_CONFIG_DIR='"$(NM_CONFIG_DIR)"' -DNM_CONFIG_DIR_DISP='"$(patsubst /mnt/onboard/%,KOBOeReader/%,$(NM_CONFIG_DIR))"'
|
||||||
|
|
||||||
include NickelHook/NickelHook.mk
|
include NickelHook/NickelHook.mk
|
||||||
|
|||||||
11
res/doc
11
res/doc
@@ -7,10 +7,9 @@
|
|||||||
# it has a lot of error checking, and a failsafe mechanism which automatically
|
# it has a lot of error checking, and a failsafe mechanism which automatically
|
||||||
# uninstalls it as a last resort.
|
# uninstalls it as a last resort.
|
||||||
#
|
#
|
||||||
# Place your configuration files in this folder (/mnt/onboard/.adds/nm). They
|
# Place your configuration files in this folder. They can be named anything, and
|
||||||
# can be named anything, and should consist of multiple lines either starting
|
# should consist of multiple lines either starting with # for a comment, or in
|
||||||
# with # for a comment, or in one of the the following formats (spaces around
|
# one of the the following formats (spaces around fields are ignored):
|
||||||
# fields are ignored):
|
|
||||||
#
|
#
|
||||||
# menu_item:<location>:<label>:<action>:<arg>
|
# menu_item:<location>:<label>:<action>:<arg>
|
||||||
# Adds a menu item.
|
# Adds a menu item.
|
||||||
@@ -131,7 +130,7 @@
|
|||||||
# gui - only enumerate non-hidden active KFMon watches (this is the default)
|
# gui - only enumerate non-hidden active KFMon watches (this is the default)
|
||||||
# all - enumerate all active KFMon watches
|
# all - enumerate all active KFMon watches
|
||||||
#
|
#
|
||||||
# For example, you might have a configuration file in KOBOeReader/.adds/nm/mystuff like:
|
# For example, you might have a configuration file named "mystuff" like:
|
||||||
#
|
#
|
||||||
# menu_item :main :Show an Error :dbg_error :This is an error message!
|
# menu_item :main :Show an Error :dbg_error :This is an error message!
|
||||||
# menu_item :main :Do Nothing :cmd_spawn :sleep 60
|
# menu_item :main :Do Nothing :cmd_spawn :sleep 60
|
||||||
@@ -164,7 +163,7 @@
|
|||||||
# which can be viewed over telnet or SSH (the username is root) with the command
|
# which can be viewed over telnet or SSH (the username is root) with the command
|
||||||
# logread.
|
# logread.
|
||||||
#
|
#
|
||||||
# To uninstall NickelMenu, create a file named KOBOeReader/.adds/nm/uninstall,
|
# To uninstall NickelMenu, create a file in this directory named "uninstall",
|
||||||
# or manually uninstall it by deleting libnm.so. You can also uninstall it by
|
# or manually uninstall it by deleting libnm.so. You can also uninstall it by
|
||||||
# triggering the failsafe mechanism by turning your Kobo off within 20 seconds
|
# triggering the failsafe mechanism by turning your Kobo off within 20 seconds
|
||||||
# of turning it on.
|
# of turning it on.
|
||||||
|
|||||||
@@ -300,7 +300,7 @@ nm_config_t *nm_config_parse(nm_config_file_t *files) {
|
|||||||
.act = NM_ACTION(dbg_toast),
|
.act = NM_ACTION(dbg_toast),
|
||||||
.on_failure = true,
|
.on_failure = true,
|
||||||
.on_success = true,
|
.on_success = true,
|
||||||
.arg = "See .adds/nm/doc for instructions on how to customize this menu.",
|
.arg = "See " NM_CONFIG_DIR_DISP "/doc for instructions on how to customize this menu.",
|
||||||
.next = NULL,
|
.next = NULL,
|
||||||
}))) RETERR("error appending default action to empty config: %s", nm_config_parse__strerror(ret));
|
}))) RETERR("error appending default action to empty config: %s", nm_config_parse__strerror(ret));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ typedef struct {
|
|||||||
nm_menu_action_t *action;
|
nm_menu_action_t *action;
|
||||||
} nm_menu_item_t;
|
} nm_menu_item_t;
|
||||||
|
|
||||||
#ifndef NM_CONFIG_DIR
|
#if !(defined(NM_CONFIG_DIR) && defined(NM_CONFIG_DIR_DISP))
|
||||||
#define NM_CONFIG_DIR "/mnt/onboard/.adds/nm"
|
#error "NM_CONFIG_DIR not set (it should be done by the Makefile)"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef NM_CONFIG_MAX_MENU_ITEMS_PER_MENU
|
#ifndef NM_CONFIG_MAX_MENU_ITEMS_PER_MENU
|
||||||
@@ -40,8 +40,8 @@ typedef struct nm_config_t nm_config_t;
|
|||||||
|
|
||||||
typedef struct nm_config_file_t nm_config_file_t;
|
typedef struct nm_config_file_t nm_config_file_t;
|
||||||
|
|
||||||
// nm_config_parse lists the configuration files in /mnt/onboard/.adds/nm. If
|
// nm_config_parse lists the configuration files in NM_CONFIG_DIR. If there are
|
||||||
// there are errors reading the dir, NULL is returned and nm_err is set.
|
// errors reading the dir, NULL is returned and nm_err is set.
|
||||||
nm_config_file_t *nm_config_files();
|
nm_config_file_t *nm_config_files();
|
||||||
|
|
||||||
// nm_config_files_update checks if the configuration files are up to date and
|
// nm_config_files_update checks if the configuration files are up to date and
|
||||||
|
|||||||
Reference in New Issue
Block a user