mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <ahmad@a3f.at>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <ahmad@a3f.at>
Subject: Re: Getting more of Barebox
Date: Fri,  1 Apr 2022 18:45:58 +0200	[thread overview]
Message-ID: <20220401164558.603727-1-ahmad@a3f.at> (raw)
In-Reply-To: <20220401145902.GF4351@tellis.lin.mbt.kalray.eu>

Finally, a no-frills way to join the currently relevant $supportgroup. Thx!

Please squash below for v2, so I don't need to carry patch for

  global.boot.default="$global.boot.default helpme"

around. Appreciated!

-------- 8< --------

 arch/arm/configs/ircbox_defconfig        |  1 +
 defaultenv/defaultenv-2-base/boot/helpme | 21 +++++++++++++++++++++
 net/irc.c                                | 13 +++++++++++--
 3 files changed, 33 insertions(+), 2 deletions(-)
 create mode 100755 defaultenv/defaultenv-2-base/boot/helpme

diff --git a/arch/arm/configs/ircbox_defconfig b/arch/arm/configs/ircbox_defconfig
index 854a80775d79..0232156e624e 100644
--- a/arch/arm/configs/ircbox_defconfig
+++ b/arch/arm/configs/ircbox_defconfig
@@ -13,6 +13,7 @@ CONFIG_CONSOLE_ACTIVATE_NONE=y
 CONFIG_CONSOLE_ALLOW_COLOR=y
 CONFIG_PARTITION_DISK_EFI=y
 CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
+CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW_IKCONFIG=y
 CONFIG_STATE=y
 CONFIG_BOOTCHOOSER=y
 CONFIG_RESET_SOURCE=y
diff --git a/defaultenv/defaultenv-2-base/boot/helpme b/defaultenv/defaultenv-2-base/boot/helpme
new file mode 100755
index 000000000000..750445f297d7
--- /dev/null
+++ b/defaultenv/defaultenv-2-base/boot/helpme
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+. /env/data/config
+
+if [ -n "$CONFIG_ARM" ]; then
+  supportgroup="armlinux"
+elif [ -n "$CONFIG_RISCV" ]; then
+  supportgroup="riscv"
+elif [ -n "$CONFIG_OPENRISC" ]; then
+  supportgroup="openrisc"
+fi
+
+if [ -n "$supportgroup" ]; then
+  readline "Want to ask for support on $supportgroup? [Y/n]  " linuxsupport
+fi
+
+if [ "$linuxsupport" != "Y" ]; then
+  supportgroup=barebox
+fi
+
+irc -n $global.user -c "/j $supportgroup" irc.libera.chat
diff --git a/net/irc.c b/net/irc.c
index 5ce2dbb4c8be..b42d4afc2c30 100644
--- a/net/irc.c
+++ b/net/irc.c
@@ -469,11 +469,15 @@ static int do_irc(int argc, char *argv[])
 {
 	int ret;
 	char *host, *p;
+	const char *command = NULL;
 	uint16_t port = 6667;
 	int opt;
 
-	while ((opt = getopt(argc, argv, "n:")) > 0) {
+	while ((opt = getopt(argc, argv, "c:n:")) > 0) {
 		switch (opt) {
+		case 'c':
+			command = optarg;
+			break;
 		case 'n':
 			strlcpy(nick, optarg, sizeof(nick));
 			break;
@@ -516,6 +520,10 @@ static int do_irc(int argc, char *argv[])
 	if (nick[0] == '\0')
 		strlcpy(nick, "barebox", sizeof(nick));
 	irc_login(host, "barebox");
+
+	if (command)
+		irc_input(command);
+
 	while (con->state == TCP_ESTABLISHED) {
 		int len;
 		len = irc_readline(input_line, sizeof(input_line) - 1);
@@ -541,11 +549,12 @@ out:
 BAREBOX_CMD_HELP_START(irc)
 BAREBOX_CMD_HELP_TEXT("Options:")
 BAREBOX_CMD_HELP_OPT ("-n NICK\t", "nick to use")
+BAREBOX_CMD_HELP_OPT ("-c COMMAND\t", "command to run after login")
 BAREBOX_CMD_HELP_END
 
 BAREBOX_CMD_START(irc)
 	.cmd		= do_irc,
 	BAREBOX_CMD_DESC("IRC client")
-	BAREBOX_CMD_OPTS("[-n] DESTINATION[[/]PORT]")
+	BAREBOX_CMD_OPTS("[-nc] DESTINATION[[/]PORT]")
 	BAREBOX_CMD_GROUP(CMD_GRP_NET)
 BAREBOX_CMD_END
-- 
2.34.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


  reply	other threads:[~2022-04-01 16:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-01 14:59 [ANNOUNCEMENT] " Jules Maselbas
2022-04-01 16:45 ` Ahmad Fatoum [this message]
2022-04-01 17:43   ` Jules Maselbas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220401164558.603727-1-ahmad@a3f.at \
    --to=ahmad@a3f.at \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox