summaryrefslogtreecommitdiffstats
path: root/src/cmd
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2020-06-23 20:42:29 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2020-06-23 20:42:29 (EDT)
commit6b03824781b7fe4d44e1243897386aa35a77aea2 (patch)
treec9bc03640223ab711077063473846c2d0efc968e /src/cmd
parent3c3d97f52ec08a4f1f2d3f8529796573123e7b87 (diff)
cmd/add-feed: New command
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/add-feed.sh65
-rw-r--r--src/cmd/local.mk3
2 files changed, 67 insertions, 1 deletions
diff --git a/src/cmd/add-feed.sh b/src/cmd/add-feed.sh
new file mode 100644
index 0000000..bb9c80f
--- /dev/null
+++ b/src/cmd/add-feed.sh
@@ -0,0 +1,65 @@
+# pro-archman
+# src/cmd/add-feed.sh
+# "add-feed" command
+#
+# Copyright (C) 2020 Patrick McDermott
+#
+# This file is part of the ProteanOS Archive Manager.
+#
+# The ProteanOS Archive Manager is free software: you can redistribute
+# it and/or modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# The ProteanOS Archive Manager is distributed in the hope that it
+# will be useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with the ProteanOS Archive Manager. If not, see
+# <http://www.gnu.org/licenses/>.
+
+cmd_add_feed_main()
+{
+ local feed=
+ local chan=
+ local dist=
+ local arch=
+ local plat=
+ local sect=
+
+ init
+
+ for feed in "${@}"; do
+ case "${feed}" in
+ */*/*/*/*/*)
+ error 2 "$(get_msg 'cmd_add_feed_invalid')" \
+ "${feed}"
+ ;;
+ */*/*/*/*)
+ ;;
+ *)
+ error 2 "$(get_msg 'cmd_add_feed_invalid')" \
+ "${feed}"
+ ;;
+ esac
+ done
+
+ for feed in "${@}"; do
+ IFS='/' read chan dist arch plat sect <<-EOF
+ ${feed}
+ EOF
+ feed_create "${chan}" "${dist}" "${arch}" "${plat}" "${sect}"
+ done
+
+ fini
+
+ return 0
+}
+
+cmd_add_feed_register()
+{
+ register_cmd 'add-feed'
+}
+__init cmd_add_feed_register
diff --git a/src/cmd/local.mk b/src/cmd/local.mk
index 860c117..d7263f5 100644
--- a/src/cmd/local.mk
+++ b/src/cmd/local.mk
@@ -6,4 +6,5 @@ pro_archman_SOURCES += \
%reldir%/remove.sh \
%reldir%/copy-suite.sh \
%reldir%/remove-suite.sh \
- %reldir%/sign.sh
+ %reldir%/sign.sh \
+ %reldir%/add-feed.sh