NBash

Форк
0
138 строк · 4.9 Кб
1
#!/bin/sh
2
#
3
# Copyright (C) 2021  Etersoft
4
# Copyright (C) 2021  Vitaly Lipatov <lav@etersoft.ru>
5
#
6
# This program is free software: you can redistribute it and/or modify
7
# it under the terms of the GNU Affero General Public License as published by
8
# the Free Software Foundation, either version 3 of the License, or
9
# (at your option) any later version.
10
#
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU Affero General Public License for more details.
15
#
16
# You should have received a copy of the GNU Affero General Public License
17
# along with this program. If not, see <http://www.gnu.org/licenses/>.
18
#
19

20
load_helper epm-sh-altlinux
21

22
epm_repo_help()
23
{
24
    get_help HELPCMD $SHAREDIR/epm-repo
25
    cat <<EOF
26

27
Examples:
28
  epm repo set p9
29
  epm repo switch p10
30
  epm repo add autoimports
31
  epm repo list
32
  epm repo change yandex
33
EOF
34
}
35

36

37
epm_repo()
38
{
39
    local CMD="$1"
40
    [ -n "$CMD" ] && shift
41
    case $CMD in
42
    "-h"|"--help"|help)               # HELPCMD: help
43
        epm_repo_help
44
        ;;
45
    ""|list)                          # HELPCMD: list enabled repositories (-a|--all for list disabled repositorires too)
46
        load_helper epm-repolist
47
        epm_repolist "$@"
48
        ;;
49
    change)                           # HELPCMD: <mirror>: switch sources to the mirror (supports etersoft/yandex/basealt/altlinux.org/eterfund.org): rewrite URLs to the specified server
50
        load_helper epm-repofix
51
        epm_repofix "$@"
52
        ;;
53
    set)                              # HELPCMD: <mirror>: remove all existing sources and add mirror for the branch
54
        epm repo rm all
55
        epm addrepo "$@"
56
        ;;
57
    switch)                           # HELPCMD: switch repo to <repo>: rewrite URLs to the repo (but use epm release-upgrade [Sisyphus|p10] for upgrade to a next branch)
58
        load_helper epm-repofix
59
        epm_reposwitch "$@"
60
        ;;
61
    enable)                           # HELPCMD: enable <repo>
62
        load_helper epm-repoenable
63
        epm_repoenable "$@"
64
        ;;
65
    disable)                          # HELPCMD: disable <repo>
66
        load_helper epm-repodisable
67
        epm_repodisable "$@"
68
        ;;
69
    addkey)                           # HELPCMD: add repository gpg key (by URL or file) (run with --help to detail)
70
        load_helper epm-repo-addkey
71
        epm_addkey "$@"
72
        ;;
73
    clean)                            # HELPCMD: remove temp. repos (tasks and CD-ROMs)
74
        [ "$BASEDISTRNAME" = "alt" ] || fatal "TODO: only ALT now is supported"
75
        # TODO: check for ALT
76
        sudocmd apt-repo $dryrun clean
77
        ;;
78
    save)                             # HELPCMD: save sources lists to a temp place
79
        load_helper epm-reposave
80
        epm_reposave "$@"
81
        ;;
82
    restore)                          # HELPCMD: restore sources lists from a temp place
83
        load_helper epm-reposave
84
        epm_reporestore "$@"
85
        ;;
86
    reset)                            # HELPCMD: reset repo lists to the distro default
87
        load_helper epm-reposave
88
        epm_reporeset "$@"
89
        ;;
90
    status)                           # HELPCMD: print repo status
91
        load_helper epm-reposave
92
        epm_repostatus "$@"
93
        ;;
94
    add)                              # HELPCMD: add package repo (etersoft, autoimports, archive 2017/01/31); run with param to get list
95
        load_helper epm-addrepo
96
        epm_addrepo "$@"
97
        ;;
98
    Add)                              # HELPCMD: like add, but do update after add
99
        load_helper epm-addrepo
100
        epm_addrepo "$@"
101
        epm update
102
        ;;
103
    rm|del|remove)                     # HELPCMD: remove repository from the sources lists (epm repo remove all for all)
104
        load_helper epm-removerepo
105
        epm_removerepo "$@"
106
        ;;
107
    fix)                              # HELPCMD: fix paths in sources lists (ALT Linux only)
108
        load_helper epm-repofix
109
        epm_repofix "$@"
110
        ;;
111

112
# HELPCMD: PART: Local repo commands:
113
    create)                            # HELPCMD: create (initialize) repo: [path] [name]
114
        load_helper epm-repoindex
115
        epm_repocreate "$@"
116
        ;;
117
    index)                            # HELPCMD: index repo (update indexes): [--init] [path] [name]
118
        load_helper epm-repoindex
119
        epm_repoindex "$@"
120
        ;;
121
    pkgadd)                           # HELPCMD: add to <dir> applied <package-filename1> [<package-filename2>...]
122
        load_helper epm-repopkg
123
        epm_repo_pkgadd "$@"
124
        ;;
125
    pkgupdate)                        # HELPCMD: replace in <dir> with new <package-filename1> [<package-filename2>...]
126
        load_helper epm-repopkg
127
        epm_repo_pkgupdate "$@"
128
        ;;
129
    pkgdel)                           # HELPCMD: del from <dir> <package1> [<package2>...]
130
        load_helper epm-repopkg
131
        epm_repo_pkgdel "$@"
132
        ;;
133
    *)
134
        fatal "Unknown command $ epm repo '$CMD'"
135
        ;;
136
esac
137

138
}
139

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.