diff options
Diffstat (limited to 'src/cmd')
-rw-r--r-- | src/cmd/copy-suite.sh | 53 | ||||
-rw-r--r-- | src/cmd/help.sh | 46 | ||||
-rw-r--r-- | src/cmd/include.sh | 39 | ||||
-rw-r--r-- | src/cmd/local.mk | 8 | ||||
-rw-r--r-- | src/cmd/process-incoming.sh | 51 | ||||
-rw-r--r-- | src/cmd/remove-suite.sh | 45 | ||||
-rw-r--r-- | src/cmd/remove.sh | 46 | ||||
-rw-r--r-- | src/cmd/version.sh | 32 |
8 files changed, 320 insertions, 0 deletions
diff --git a/src/cmd/copy-suite.sh b/src/cmd/copy-suite.sh new file mode 100644 index 0000000..51fd969 --- /dev/null +++ b/src/cmd/copy-suite.sh @@ -0,0 +1,53 @@ +# pro-archman +# lib/cmd/copy-suite.sh +# "copy-suite" command +# +# Copyright (C) 2013 Patrick "P. J." McDermott +# +# This program 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. +# +# This program 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 this program. If not, see <http://www.gnu.org/licenses/>. + +cmd_copy_suite_main() +{ + local src_suite="${1}" + local dst_suite="${2}" + local src_chan= + local src_dist= + local dst_chan= + local dst_dist= + + init + + src_chan="${src_suite%/*}" + src_dist="${src_suite##*/}" + if [ "x${src_chan}" = "x${src_suite}" ]; then + src_chan="${conf_incoming_channel}" + fi + dst_chan="${dst_suite%/*}" + dst_dist="${dst_suite##*/}" + if [ "x${dst_chan}" = "x${dst_suite}" ]; then + dst_chan="${conf_incoming_channel}" + fi + + copy_suite "${src_chan}" "${src_dist}" "${dst_chan}" "${dst_dist}" + + fini + + return 0 +} + +cmd_copy_suite_register() +{ + register_cmd 'copy-suite' +} +__init cmd_copy_suite_register diff --git a/src/cmd/help.sh b/src/cmd/help.sh new file mode 100644 index 0000000..628b0dc --- /dev/null +++ b/src/cmd/help.sh @@ -0,0 +1,46 @@ +# pro-archman +# lib/cmd/help.sh +# "help" command +# +# Copyright (C) 2013 Patrick "P. J." McDermott +# +# This program 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. +# +# This program 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 this program. If not, see <http://www.gnu.org/licenses/>. + +cmd_help_main() +{ + local cmd= + + if [ ${#} -eq 1 ]; then + cmd="${1}" + if is_cmd "${cmd}"; then + print_cmd_usage "${cmd}" + return 0 + fi + fi + + printf "$(get_msg 'cmd_help_head')\n\n" "${0}" + + printf "$(get_msg 'cmd_help_opts_head')\n" + print_opt_summaries + printf '\n' + + printf "$(get_msg 'cmd_help_summary_head')\n" + print_cmd_summaries +} + +cmd_help_register() +{ + register_cmd 'help' +} +__init cmd_help_register diff --git a/src/cmd/include.sh b/src/cmd/include.sh new file mode 100644 index 0000000..7f8fbac --- /dev/null +++ b/src/cmd/include.sh @@ -0,0 +1,39 @@ +# pro-archman +# lib/cmd/include.sh +# "include" command +# +# Copyright (C) 2013 Patrick "P. J." McDermott +# +# This program 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. +# +# This program 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 this program. If not, see <http://www.gnu.org/licenses/>. + +cmd_include_main() +{ + local changes= + + init + + for changes in "${@}"; do + include_changes "${changes}" >/dev/null + done + + fini + + return 0 +} + +cmd_include_register() +{ + register_cmd 'include' +} +__init cmd_include_register diff --git a/src/cmd/local.mk b/src/cmd/local.mk new file mode 100644 index 0000000..9dd7023 --- /dev/null +++ b/src/cmd/local.mk @@ -0,0 +1,8 @@ +pro_archman_SOURCES += \ + %reldir%/help.sh \ + %reldir%/version.sh \ + %reldir%/include.sh \ + %reldir%/process-incoming.sh \ + %reldir%/remove.sh \ + %reldir%/copy-suite.sh \ + %reldir%/remove-suite.sh diff --git a/src/cmd/process-incoming.sh b/src/cmd/process-incoming.sh new file mode 100644 index 0000000..0634f34 --- /dev/null +++ b/src/cmd/process-incoming.sh @@ -0,0 +1,51 @@ +# pro-archman +# lib/cmd/generate-index.sh +# "generate-index" command +# +# Copyright (C) 2013 Patrick "P. J." McDermott +# +# This program 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. +# +# This program 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 this program. If not, see <http://www.gnu.org/licenses/>. + +cmd_process_incoming_main() +{ + local changes= + local file= + + init + + info "$(get_msg 'cmd_process_incoming_processing')" + + for changes in "${conf_incoming_dir}/"*.changes; do + if [ ! -f "${changes}" ]; then + continue + fi + for file in $(include_changes "${changes}"); do + if [ ! -f "${file}" ]; then + continue + fi + rm -f "${file}" + done + rm -f "${changes}" + done + + fini + + return 0 +} + +cmd_process_incoming_register() +{ + register_cmd 'process-incoming' +} +__init cmd_process_incoming_register diff --git a/src/cmd/remove-suite.sh b/src/cmd/remove-suite.sh new file mode 100644 index 0000000..6703d24 --- /dev/null +++ b/src/cmd/remove-suite.sh @@ -0,0 +1,45 @@ +# pro-archman +# lib/cmd/remove-suite.sh +# "remove-suite" command +# +# Copyright (C) 2013 Patrick "P. J." McDermott +# +# This program 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. +# +# This program 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 this program. If not, see <http://www.gnu.org/licenses/>. + +cmd_remove_suite_main() +{ + local suite="${1}" + local chan= + local dist= + + init + + chan="${suite%/*}" + dist="${suite##*/}" + if [ "x${chan}" = "x${suite}" ]; then + chan="${conf_incoming_channel}" + fi + + remove_suite "${chan}" "${dist}" + + fini + + return 0 +} + +cmd_remove_suite_register() +{ + register_cmd 'remove-suite' +} +__init cmd_remove_suite_register diff --git a/src/cmd/remove.sh b/src/cmd/remove.sh new file mode 100644 index 0000000..388a4d3 --- /dev/null +++ b/src/cmd/remove.sh @@ -0,0 +1,46 @@ +# pro-archman +# lib/cmd/remove.sh +# "remove" command +# +# Copyright (C) 2013 Patrick "P. J." McDermott +# +# This program 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. +# +# This program 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 this program. If not, see <http://www.gnu.org/licenses/>. + +cmd_remove_main() +{ + local suite="${1}" + local source="${2}" + local chan= + local dist= + + init + + chan="${suite%/*}" + dist="${suite##*/}" + if [ "x${chan}" = "x${suite}" ]; then + chan="${conf_incoming_channel}" + fi + + remove_source_from_suite "${chan}" "${dist}" "${source}" + + fini + + return 0 +} + +cmd_remove_register() +{ + register_cmd 'remove' +} +__init cmd_remove_register diff --git a/src/cmd/version.sh b/src/cmd/version.sh new file mode 100644 index 0000000..b22205f --- /dev/null +++ b/src/cmd/version.sh @@ -0,0 +1,32 @@ +# pro-archman +# lib/cmd/version.sh +# "version" command +# +# Copyright (C) 2013 Patrick "P. J." McDermott +# +# This program 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. +# +# This program 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 this program. If not, see <http://www.gnu.org/licenses/>. + +cmd_version_main() +{ + printf '%s %s\n' "${PACKAGE}" "${PACKAGE_VERSION}" + + printf "$(get_msg 'cmd_version_copyright')\n" \ + '2013' 'Patrick "P. J." McDermott' +} + +cmd_version_register() +{ + register_cmd 'version' +} +__init cmd_version_register |