Skip to content

Commit cbe399c

Browse files
grayawaMingcongBai
authored andcommitted
plugins/ciel-switchmirror: fix switchmirror command
1 parent de8ec8f commit cbe399c

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

plugins/ciel-switchmirror

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
11
#!/bin/bash
2-
# Usage: ciel-switchmirror <mirror name in apt-gen-list>
2+
# Usage: ciel-switchmirror <mirror name in oma mirror>
33

44
export CIEL_INST="ciel--switchmirror--"
55

66
ciel add "$CIEL_INST"
7-
echo -e "\e[1m\e[96m[switch-mirror]:\e[0m\e[1m Mirror set to '$1'\e[0m"
8-
ciel shell "apt-gen-list set-mirror $1"
7+
if [ "$1" != "" ]; then
8+
ciel shell oma mirror add "$1"
9+
if [ "$?" != "0" ]; then
10+
echo -e "\e[1m\e[91m[switch-mirror]:\e[0m\e[1m Failed to set mirror '$1'.\e[0m"
11+
echo -e "\e[1m\e[91m[switch-mirror]:\e[0m\e[1m More information please refer to the error oma had reported.\e[0m"
12+
exit 1
13+
else
14+
echo -e "\e[1m\e[96m[switch-mirror]:\e[0m\e[1m Mirror set to '$1' successfully.\e[0m"
15+
fi
16+
17+
else
18+
ciel shell "oma mirror"
19+
fi
920
ciel factory-reset
1021
ciel commit
1122
ciel del "$CIEL_INST"

0 commit comments

Comments
 (0)