diff --git a/package/klish-plugin-sysrepo/klish-plugin-sysrepo.hash b/package/klish-plugin-sysrepo/klish-plugin-sysrepo.hash index db9bc54e..8a096595 100644 --- a/package/klish-plugin-sysrepo/klish-plugin-sysrepo.hash +++ b/package/klish-plugin-sysrepo/klish-plugin-sysrepo.hash @@ -1,3 +1,3 @@ # Locally calculated sha256 9d9d33b873917ca5d0bdcc47a36d2fd385971ab0c045d1472fcadf95ee5bcf5b LICENCE -sha256 6ec2a048c50cf35c0a8d72e541afb78351d4b7229670ac55be544e38f6cc9e54 klish-plugin-sysrepo-7e8f75536d20ff38763d00508347acb142511301-br1.tar.gz +sha256 787981aafae509a889cfab71dcc8e68d8e511419cf9f3934239c5f2296d2ad5c klish-plugin-sysrepo-7572111a0f81009506392d309ec3fa4d328d5cce-br1.tar.gz diff --git a/package/klish-plugin-sysrepo/klish-plugin-sysrepo.mk b/package/klish-plugin-sysrepo/klish-plugin-sysrepo.mk index f10bd5ff..c346797c 100644 --- a/package/klish-plugin-sysrepo/klish-plugin-sysrepo.mk +++ b/package/klish-plugin-sysrepo/klish-plugin-sysrepo.mk @@ -4,7 +4,7 @@ # ################################################################################ -KLISH_PLUGIN_SYSREPO_VERSION = 7e8f75536d20ff38763d00508347acb142511301 +KLISH_PLUGIN_SYSREPO_VERSION = 7572111a0f81009506392d309ec3fa4d328d5cce KLISH_PLUGIN_SYSREPO_SITE = https://github.com/kernelkit/klish-plugin-sysrepo.git #KLISH_PLUGIN_SYSREPO_VERSION = cdd3eb51a7f7ee0ed5bd925fa636061d3b1b85fb #KLISH_PLUGIN_SYSREPO_SITE = https://src.libcode.org/pkun/klish-plugin-sysrepo.git diff --git a/patches/klish/0008-Add-w-qualifier-to-klish_prompt-to-expand-to-CWD.patch b/patches/klish/0008-Add-w-qualifier-to-klish_prompt-to-expand-to-CWD.patch new file mode 100644 index 00000000..9cb39d02 --- /dev/null +++ b/patches/klish/0008-Add-w-qualifier-to-klish_prompt-to-expand-to-CWD.patch @@ -0,0 +1,91 @@ +From 9f91b3969d2ba9ee6e6d1a174953dbd141ae1698 Mon Sep 17 00:00:00 2001 +From: Joachim Wiberg +Date: Sat, 15 Jul 2023 19:56:00 +0200 +Subject: [PATCH] Add '%w' qualifier to klish_prompt() to expand to CWD +Organization: Addiva Elektronik + +Signed-off-by: Joachim Wiberg +--- + klish/ksession/ksession_parse.c | 2 ++ + plugins/klish/misc.c | 40 ++++++++++++++++++++++++--------- + 2 files changed, 32 insertions(+), 10 deletions(-) + +diff --git a/klish/ksession/ksession_parse.c b/klish/ksession/ksession_parse.c +index 9f1fece..eb015fb 100644 +--- a/klish/ksession/ksession_parse.c ++++ b/klish/ksession/ksession_parse.c +@@ -620,6 +620,8 @@ kexec_t *ksession_parse_for_local_exec(ksession_t *session, + kcontext_set_parent_pargv(context, parent_pargv); + // Service ACTIONs like PTYPE, CONDitions etc. doesn't need session + // data within context. Else it will be able to change path. ++ /* KernelKit override for %w patch to klish_prompt() */ ++ kcontext_set_session(context, session); + kexec_add_contexts(exec, context); + + faux_argv_free(argv); +diff --git a/plugins/klish/misc.c b/plugins/klish/misc.c +index 659c0df..8237002 100644 +--- a/plugins/klish/misc.c ++++ b/plugins/klish/misc.c +@@ -75,21 +75,37 @@ int klish_print(kcontext_t *context) + return 0; + } + +- +-// Symbol to show current path +-int klish_pwd(kcontext_t *context) ++static char *cwd(kcontext_t *context) + { +- kpath_t *path = NULL; +- kpath_levels_node_t *iter = NULL; +- klevel_t *level = NULL; ++ kpath_levels_node_t *iter; ++ static char buf[256]; ++ ksession_t *session; ++ klevel_t *level; ++ size_t len; + +- path = ksession_path(kcontext_session(context)); +- iter = kpath_iter(path); ++ len = sizeof(buf); ++ memset(buf, 0, len); ++ ++ session = kcontext_session(context); ++ if (!session) ++ return NULL; ++ ++ iter = kpath_iter(ksession_path(session)); + while ((level = kpath_each(&iter))) { +- printf("/%s", kentry_name(klevel_entry(level))); ++ const char *nm = kentry_name(klevel_entry(level)); ++ ++ strncat(buf, "/", len--); ++ strncat(buf, nm, len); ++ len -= strlen(nm); + } +- printf("\n"); + ++ return buf; ++} ++ ++// Symbol to show current path ++int klish_pwd(kcontext_t *context) ++{ ++ printf("%s\n", cwd(context)); + return 0; + } + +@@ -138,6 +154,10 @@ int klish_prompt(kcontext_t *context) + faux_str_free(user); + break; + } ++ // Workdir (pwd) ++ case 'w': ++ faux_str_cat(&prompt, cwd(context)); ++ break; + } + is_macro = BOOL_FALSE; + start = pos + 1; +-- +2.34.1 + diff --git a/src/klinfix/xml/infix.xml b/src/klinfix/xml/infix.xml index 58c2163b..17b734c3 100644 --- a/src/klinfix/xml/infix.xml +++ b/src/klinfix/xml/infix.xml @@ -98,7 +98,7 @@ - %u@%h:exec> + %u@%h:/> @@ -135,7 +135,7 @@ - replace configure + replace config @@ -285,11 +285,11 @@ - + - - %u@%h:configure> + %u@%h:%w + %w/> @@ -304,6 +304,7 @@ + replace main