├── .gitignore
├── 1panel.service
├── 1pctl
├── LICENSE
├── README.md
├── etc
└── init.d
│ └── 1paneld
├── install.sh
├── lang
├── en.sh
├── fa.sh
├── pt-BR.sh
├── ru.sh
└── zh.sh
└── quick_start.sh
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea/
2 | *.iml
3 | target/
4 | .DS_Store
5 | .vscode/
--------------------------------------------------------------------------------
/1panel.service:
--------------------------------------------------------------------------------
1 | [Unit]
2 | Description=1Panel, a modern open source linux panel
3 | After=syslog.target network-online.target
4 | Wants=network-online.target
5 |
6 | [Service]
7 | ExecStart=/usr/bin/1panel
8 | ExecReload=/bin/kill -s HUP $MAINPID
9 | Restart=always
10 | RestartSec=5
11 | LimitNOFILE=1048576
12 | LimitNPROC=1048576
13 | LimitCORE=1048576
14 | Delegate=yes
15 | KillMode=process
16 |
17 | [Install]
18 | WantedBy=multi-user.target
19 |
--------------------------------------------------------------------------------
/1pctl:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | action=$1
4 | target=$2
5 | args=$@
6 |
7 | BASE_DIR=directory
8 | ORIGINAL_PORT=port
9 | ORIGINAL_VERSION=version
10 | ORIGINAL_ENTRANCE=entrance
11 | ORIGINAL_USERNAME=username
12 | ORIGINAL_PASSWORD=password
13 | LANGUAGE=en
14 |
15 | if [ -f "/usr/local/bin/lang/$LANGUAGE.sh" ]; then
16 | source "/usr/local/bin/lang/$LANGUAGE.sh"
17 | else
18 | LANGUAGE=en
19 | fi
20 |
21 | # 检查是否是root用户,避免多次要求输入密码
22 | check_root() {
23 | if [[ $EUID -ne 0 ]]; then
24 | echo "$TXT_RUN_AS_ROOT"
25 | exit 1
26 | fi
27 | }
28 |
29 | function usage() {
30 | echo "$PANEL_CONTROL_SCRIPT"
31 | echo
32 | echo "Usage: "
33 | echo " ./1pctl [COMMAND] [ARGS...]"
34 | echo " ./1pctl --help"
35 | echo
36 | echo "Commands: "
37 | echo " status $TXT_PANEL_SERVICE_STATUS"
38 | echo " start $TXT_PANEL_SERVICE_START"
39 | echo " stop $TXT_PANEL_SERVICE_STOP"
40 | echo " restart $TXT_PANEL_SERVICE_RESTART"
41 | echo " uninstall $TXT_PANEL_SERVICE_UNINSTALL"
42 | echo " user-info $TXT_PANEL_SERVICE_USER_INFO"
43 | echo " listen-ip $TXT_PANEL_SERVICE_LISTEN_IP"
44 | echo " version $TXT_PANEL_SERVICE_VERSION"
45 | echo " update $TXT_PANEL_SERVICE_UPDATE"
46 | echo " reset $TXT_PANEL_SERVICE_RESET"
47 | echo " restore $TXT_PANEL_SERVICE_RESTORE"
48 | }
49 |
50 | _service_manager() {
51 | local service_name="1panel"
52 | if command -v systemctl &>/dev/null; then
53 | service_manager="systemctl"
54 | service_target="${service_name}.service"
55 | elif command -v rc-service &>/dev/null; then
56 | service_manager="openrc"
57 | service_target="${service_name}d"
58 | else
59 | service_manager="sysvinit"
60 | service_target="${service_name}d"
61 | fi
62 | }
63 |
64 | _service_cmd() {
65 | local cmd=$1 success_msg=$2 error_msg=$3
66 | _service_manager
67 | case $service_manager in
68 | systemctl)
69 | if ! systemctl "$cmd" "$service_target" 2>/dev/null; then
70 | echo "$error_msg" >&2
71 | exit 1
72 | fi
73 | ;;
74 | openrc)
75 | if ! rc-service "$service_target" "$cmd" 2>/dev/null; then
76 | echo "$error_msg" >&2
77 | exit 1
78 | fi
79 | ;;
80 | *)
81 | if ! service "$service_target" "$cmd" 2>/dev/null; then
82 | echo "$error_msg" >&2
83 | exit 1
84 | fi
85 | ;;
86 | esac
87 | [[ -n "$success_msg" ]] && echo "$success_msg"
88 | }
89 | _safe_remove() {
90 | local path=$1
91 | if [[ -e "$path" ]]; then
92 | rm -rf -- "$path" || {
93 | echo "Failed to remove: $path" >&2
94 | exit 1
95 | }
96 | fi
97 | }
98 |
99 | function status() {
100 | _service_cmd "status" "" ""
101 | }
102 |
103 | function start() {
104 | _service_cmd "start" "$TXT_PANEL_SERVICE_START_SUCCESS" "$TXT_PANEL_SERVICE_START_ERROR"
105 | }
106 |
107 | function stop() {
108 | _service_cmd "stop" "$TXT_PANEL_SERVICE_STOP $TXT_SUCCESS_MESSAGE" "$TXT_PANEL_SERVICE_STOP $TXT_FAILED_MESSAGE"
109 | }
110 |
111 | function restart() {
112 | _service_cmd "restart" "$TXT_PANEL_SERVICE_RESTART $TXT_SUCCESS_MESSAGE" "$TXT_PANEL_SERVICE_RESTART $TXT_FAILED_MESSAGE"
113 | }
114 |
115 | function uninstall() {
116 | check_root
117 | local yn
118 | read -p "$TXT_PANEL_SERVICE_UNINSTALL_NOTICE : " yn
119 | case "${yn,,}" in
120 | y)
121 | echo "$TXT_PANEL_SERVICE_UNINSTALL_START"
122 | _service_manager
123 | echo -e "1) $TXT_PANEL_SERVICE_UNINSTALL_STOP"
124 | case $service_manager in
125 | systemctl)
126 | systemctl stop 1panel.service
127 | systemctl disable 1panel.service >/dev/null 2>&1
128 | ;;
129 | openrc)
130 | rc-service 1paneld stop
131 | rc-update del 1paneld >/dev/null 2>&1
132 | ;;
133 | *)
134 | service 1paneld stop
135 | ;;
136 | esac
137 | echo -e "2) $TXT_PANEL_SERVICE_UNINSTALL_REMOVE"
138 | _safe_remove "${BASE_DIR}/1panel"
139 | _safe_remove "/usr/local/bin/1pctl"
140 | _safe_remove "/usr/local/bin/1panel"
141 | _safe_remove "/usr/local/bin/lang"
142 | _safe_remove "/usr/bin/1panel"
143 | _safe_remove "/usr/bin/1pctl"
144 | echo -e "3) $TXT_PANEL_SERVICE_UNINSTALL_REMOVE_CONFIG"
145 | case $service_manager in
146 | systemctl)
147 | _safe_remove "/etc/systemd/system/1panel.service"
148 | systemctl daemon-reload
149 | systemctl reset-failed
150 | ;;
151 | openrc)
152 | _safe_remove "/etc/init.d/1paneld"
153 | ;;
154 | *)
155 | _safe_remove "/etc/init.d/1paneld"
156 | ;;
157 | esac
158 | echo -e "4) $TXT_PANEL_SERVICE_UNINSTALL_REMOVE_SUCCESS"
159 | ;;
160 | *)
161 | exit 0
162 | ;;
163 | esac
164 | }
165 | function user-info() {
166 | 1panel user-info
167 | }
168 |
169 | function listen-ip() {
170 | case "${target}" in
171 | ipv4)
172 | 1panel listen-ip ipv4
173 | restart
174 | ;;
175 | ipv6)
176 | 1panel listen-ip ipv6
177 | restart
178 | ;;
179 | *)
180 | 1panel listen-ip
181 | ;;
182 | esac
183 | }
184 |
185 | function restore() {
186 | read -p "$TXT_PANEL_SERVICE_RESTORE_NOTICE : " yn
187 | if [ "$yn" == "Y" ] || [ "$yn" == "y" ]; then
188 | echo -e ""
189 | 1panel restore
190 | if ! service 1paneld reload; then
191 | systemctl daemon-reload
192 | fi
193 | restart
194 | 1panel version
195 | else
196 | exit 0
197 | fi
198 | }
199 |
200 | function version() {
201 | 1panel version
202 | }
203 |
204 | function reset() {
205 | case "${target}" in
206 | domain)
207 | 1panel reset domain
208 | ;;
209 | entrance)
210 | 1panel reset entrance
211 | ;;
212 | https)
213 | 1panel reset https
214 | restart
215 | ;;
216 | ips)
217 | 1panel reset ips
218 | ;;
219 | mfa)
220 | 1panel reset mfa
221 | ;;
222 | *)
223 | 1panel reset
224 | ;;
225 | esac
226 | }
227 |
228 | function update() {
229 | case "${target}" in
230 | username)
231 | 1panel update username
232 | ;;
233 | password)
234 | 1panel update password
235 | ;;
236 | port)
237 | 1panel update port
238 | ;;
239 | *)
240 | 1panel update
241 | ;;
242 | esac
243 | }
244 |
245 | function main() {
246 | case "${action}" in
247 | status)
248 | status
249 | ;;
250 | start)
251 | start
252 | ;;
253 | stop)
254 | stop
255 | ;;
256 | restart)
257 | restart
258 | ;;
259 | restore)
260 | restore
261 | ;;
262 | uninstall)
263 | uninstall
264 | ;;
265 | user-info)
266 | user-info
267 | ;;
268 | listen-ip)
269 | listen-ip
270 | ;;
271 | version)
272 | version
273 | ;;
274 | reset)
275 | reset
276 | ;;
277 | update)
278 | update
279 | ;;
280 | help)
281 | usage
282 | ;;
283 | --help)
284 | usage
285 | ;;
286 | "")
287 | usage
288 | ;;
289 | *)
290 | echo "$TXT_PANEL_SERVICE_UNSUPPORTED_PARAMETER"
291 | ;;
292 | esac
293 | }
294 |
295 | main
296 |
297 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # openwrt 中 1Panel 安装包
2 |
3 | [1Panel](https://github.com/1Panel-dev/1Panel) is a modern, open-source Linux server management panel.
4 |
5 | 该项目为 1Panel 在openwrt环境下安装包相关内容,包含了 1Panel 的安装脚本及默认配置文件等。
6 |
7 | 本仓库修改1panel安装脚本,以匹配openwrt的运行,安装脚本默认下载1panel 官方安装包后,替换1pctl、install.sh文件,并在openwrt /etc/init.d/目录下生成1panel 自启动文件。
8 |
9 | 另外基于1panel-V1.10.1-lts源码,以修改tar命令适配busybox运行环境,打包生成在openwrt中运行的1panel二进制文件,可到仓库[wrt1panel](https://github.com/gcsong023/wrt1panel)选择、查看;
10 |
11 |
12 | ## 使用前须知
13 |
14 | WRT固件版本繁多,官方原版[openwrt](https://openwrt.org)及[Imortalwrt](https://downloads.immortalwrt.org/)版本或其他支持在线升级安装软件包的固件,请先安装docker,docker-compose;不具备docker且不支持在线安装docker的固件,在未更换固件的情况夏,可直接放弃安装尝试;
15 | ### 2024-6-5 安装版本选择说明
16 |
17 | 1.wrt1panel仓库最新版:为基于1panel 1.10.1-lts源码修改版本;
18 | 2.1panel最新版:为官方1panel 发布的最新版本;
19 |
20 | ## 执行如下命令一键安装 1Panel:
21 | ```sh
22 | curl -sSL https://raw.githubusercontent.com/gcsong023/wrt_installer/wrt_1panel/quick_start.sh -o quick_start.sh && bash quick_start.sh
23 | ```
24 | ### x86_amd64平台openwrt可尝试使用以下命令安装基于官方V1.10.1-lts源码的修改版本(一键安装脚本已支持自动安装选定):
25 |
26 | ~~wget https://github.com/gcsong023/wrt1panel/releases/download/v1.10.9-lts/1panel-v1.10.9-lts-linux-amd64.tar.gz && tar zxvf 1panel-v1.10.9-lts-linux-amd64.tar.gz && cd 1panel-v1.10.9-lts-linux-amd64 && bash install.sh~~
27 |
28 | ### 或尝试替换1panel二进制文件方式
29 | ```sh
30 | cp $pwd/1panel /usr/local/bin/1panel # 手动替换1panel二进制文件方式 $pwd 为压缩文件解压后目录。
31 | ```
32 | ## 2024-6-5 更新说明
33 |
34 | 1、更新quick_start.sh、install.sh,**支持根据环境设定默认选择安装包版本**;
35 |
36 | ## 2024-5-25 更新说明
37 |
38 | 1、更新quick_start.sh、install.sh及1pctl脚本,**适配通用linux系统及busybox环境的安装及使用**;
39 | 2、修改install.sh脚本,**支持ImmortalWrt固件在线安装docker与docker-compose**,其他固件未测试;
40 |
41 | ### 可能存在的问题:
42 | *1、-ash: curl: not found bash: not found 出现这类问题的原因是,所使用的openwrt版本,未安装curl bash 命令 ;*
43 |
44 | #### 解决办法:
45 | 运行opkg update ,更新包列表,然后 运行opkg install {package};
46 | ```sh
47 | opkg update
48 | opkg install curl
49 | opkg install bash
50 | ```
51 | 如果使用的固件为openwrt官方原版、immortalWrt版本,请尝试以下命令安装docker;
52 | ```sh
53 | opkg update
54 | ```
55 | *以下命令会自动安装相关依赖包*
56 | ```sh
57 | opkg install luci-i18n-dockerman-zh-cn
58 | ```
59 | ```sh
60 | opkg update
61 | opkg install docker-compose
62 | ```
63 | *需要安装的包比较大(约100M),如不能安装成功,在非磁盘空间不足的情况下,多运行几次安装命令试试,排除掉网络原因*
64 | *安装成功后,运行以下命令,查看版本号*
65 | ```sh
66 | docker --version # 查看docker 的安装版本;
67 | ```
68 | ```sh
69 | docker-compose --version # 查看docker-compose版本;
70 | ```
71 | *2、/etc/localtime 不存在,导致应用商店安装的应用报错无法启动的问题*
72 | #### 解决办法
73 | ```sh
74 | opkg update
75 | opkg install zoneinfo-asia #安装zoneinfo
76 | service system restart # 重启system 等同于 /etc/init.d/system restart
77 | ```
78 | *3、安装OpenResty 提示 80,443端口被占用的问题*
79 |
80 | openwrt 管理界面,默认会使用80,443端口,要么更改OpenResty 使用的端口号,要么更改openwrt web管理界面所使用的端口号。
81 |
82 |
83 | #### 不能使用的1panel功能
84 |
85 | *1、快照功能、备份功能: 在openwrt 中执行tar命令和systemctl 命令相关的功能,均不能正常执行,会报错;20240418补充: 以修改源代码的方式已修复快照功能和备份功能。详见:[releases](https://github.com/gcsong023/wrt1panel/releases)*
86 |
87 | *2、supervisor fail2ban firewall ssh管理 相关功能暂不能正常使用;*
88 |
89 | *3、可能还有其他暂不能正常使用的功能;*
90 |
91 | ### 问题反馈
92 |
93 | 如果您在使用过程中遇到什么问题,或有进一步的需求需要反馈,请提交 GitHub Issue 到 [1Panel 项目的主仓库](https://github.com/1Panel-dev/1Panel/issues),欢迎到[wrt1panel仓库](https://github.com/gcsong023/wrt1panel/issues)交流反馈在openwrt中使用1panel的相关问题。
94 |
--------------------------------------------------------------------------------
/etc/init.d/1paneld:
--------------------------------------------------------------------------------
1 | #!/bin/sh /etc/rc.common
2 |
3 | USE_PROCD=1
4 |
5 | START=95
6 | STOP=15
7 |
8 | start_service() {
9 | procd_open_instance
10 | procd_set_param command 1panel
11 | procd_set_param stdout 0 # 默认设置不输出系统日志,如为1,在系统日志可看到1panel前端响应信息
12 | procd_set_param stderr 1
13 | procd_close_instance
14 | }
15 |
--------------------------------------------------------------------------------
/install.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | RED='\033[0;31m'
4 | GREEN='\033[0;32m'
5 | YELLOW='\033[0;33m'
6 | BLUE='\033[0;34m'
7 | NC='\033[0m'
8 |
9 | CURRENT_DIR=$(
10 | cd "$(dirname "$0")" || exit
11 | pwd
12 | )
13 |
14 | LANG_FILE=".selected_language"
15 | LANG_DIR="$CURRENT_DIR/lang"
16 | AVAILABLE_LANGS=("en" "zh" "fa" "pt-BR" "ru")
17 |
18 | declare -A LANG_NAMES
19 | LANG_NAMES=( ["en"]="English" ["zh"]="Chinese 中文(简体)" ["fa"]="Persian" ["pt-BR"]="Português (Brasil)" ["ru"]="Русский" )
20 |
21 | if [ -f "$CURRENT_DIR/$LANG_FILE" ]; then
22 | selected_lang=$(cat "$CURRENT_DIR/$LANG_FILE")
23 | else
24 | echo "en" > "$CURRENT_DIR/$LANG_FILE"
25 | source "$LANG_DIR/en.sh"
26 |
27 | echo "$TXT_LANG_PROMPT_MSG"
28 | for i in "${!AVAILABLE_LANGS[@]}"; do
29 | lang_code="${AVAILABLE_LANGS[i]}"
30 | echo "$((i + 1)). ${LANG_NAMES[$lang_code]}"
31 | done
32 |
33 | read -p "$TXT_LANG_CHOICE_MSG" lang_choice
34 |
35 | if [[ $lang_choice -ge 1 && $lang_choice -le ${#AVAILABLE_LANGS[@]} ]]; then
36 | selected_lang=${AVAILABLE_LANGS[$((lang_choice - 1))]}
37 | echo "$TXT_LANG_SELECTED_CONFIRM_MSG ${LANG_NAMES[$selected_lang]}"
38 | echo "$selected_lang" > "$CURRENT_DIR/$LANG_FILE"
39 | else
40 | echo "$TXT_LANG_INVALID_MSG"
41 | selected_lang="en"
42 | echo "$selected_lang" > "$CURRENT_DIR/$LANG_FILE"
43 | fi
44 | fi
45 |
46 | LANGFILE="$LANG_DIR/$selected_lang.sh"
47 | if [ -f "$LANGFILE" ]; then
48 | source "$LANGFILE"
49 | else
50 | echo -e "${RED} $TXT_LANG_NOT_FOUND_MSG $LANGFILE${NC}"
51 | exit 1
52 | fi
53 | clear
54 |
55 | LOG_FILE=${CURRENT_DIR}/install.log
56 | PASSWORD_MASK="**********"
57 |
58 | function log() {
59 | timestamp=$(date +"%Y-%m-%d %H:%M:%S")
60 | message="[1Panel ${timestamp} install Log]: $1 "
61 | case "$1" in
62 | *"$TXT_RUN_AS_ROOT"*)
63 | echo -e "${RED}${message}${NC}" 2>&1 | tee -a ${LOG_FILE}
64 | ;;
65 | *"$TXT_SUCCESS_MESSAGE"* )
66 | echo -e "${GREEN}${message}${NC}" 2>&1 | tee -a ${LOG_FILE}
67 | ;;
68 | *"$TXT_IGNORE_MESSAGE"*|*"$TXT_SKIP_MESSAGE"* )
69 | echo -e "${YELLOW}${message}${NC}" 2>&1 | tee -a ${LOG_FILE}
70 | ;;
71 | * )
72 | echo -e "${BLUE}${message}${NC}" 2>&1 | tee -a ${LOG_FILE}
73 | ;;
74 | esac
75 | }
76 | cat << EOF
77 | ██╗ ██████╗ █████╗ ███╗ ██╗███████╗██╗
78 | ███║ ██╔══██╗██╔══██╗████╗ ██║██╔════╝██║
79 | ╚██║ ██████╔╝███████║██╔██╗ ██║█████╗ ██║
80 | ██║ ██╔═══╝ ██╔══██║██║╚██╗██║██╔══╝ ██║
81 | ██║ ██║ ██║ ██║██║ ╚████║███████╗███████╗
82 | ╚═╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═══╝╚══════╝╚══════╝
83 | EOF
84 |
85 | log "$TXT_START_INSTALLATION"
86 |
87 | function Check_Root() {
88 | if [[ $EUID -ne 0 ]]; then
89 | log "$TXT_RUN_AS_ROOT"
90 | exit 1
91 | fi
92 | }
93 |
94 | function Prepare_System(){
95 | if which 1panel >/dev/null 2>&1; then
96 | log "$TXT_PANEL_ALREADY_INSTALLED"
97 | exit 1
98 | fi
99 | }
100 |
101 | function Set_Dir(){
102 | if read -t 120 -p "$TXT_SET_INSTALL_DIR" PANEL_BASE_DIR;then
103 | if [[ "$PANEL_BASE_DIR" != "" ]];then
104 | if [[ "$PANEL_BASE_DIR" != /* ]];then
105 | log "$TXT_PROVIDE_FULL_PATH"
106 | Set_Dir
107 | fi
108 |
109 | if [[ ! -d $PANEL_BASE_DIR ]];then
110 | mkdir -p "$PANEL_BASE_DIR"
111 | log "$TXT_SELECTED_INSTALL_PATH $PANEL_BASE_DIR"
112 | fi
113 | else
114 | PANEL_BASE_DIR=/opt
115 | log "$TXT_SELECTED_INSTALL_PATH $PANEL_BASE_DIR"
116 | fi
117 | else
118 | PANEL_BASE_DIR=/opt
119 | log "$TXT_TIMEOUT_USE_DEFAULT_PATH"
120 | fi
121 | }
122 |
123 | ACCELERATOR_URL="https://docker.1panelproxy.com"
124 | DAEMON_JSON="/etc/docker/daemon.json"
125 | BACKUP_FILE="/etc/docker/daemon.json.1panel_bak"
126 |
127 | function create_daemon_json() {
128 | log "$TXT_CREATE_NEW_CONFIG ${DAEMON_JSON}..."
129 | mkdir -p /etc/docker
130 | echo '{
131 | "registry-mirrors": ["'"$ACCELERATOR_URL"'"]
132 | }' | tee "$DAEMON_JSON" > /dev/null
133 | log "$TXT_ACCELERATION_CONFIG_ADDED"
134 | }
135 |
136 | function configure_accelerator() {
137 | read -p "$TXT_ACCELERATION_CONFIG_ADD " configure_accelerator
138 | if [[ "$configure_accelerator" == "y" ]]; then
139 | if [ -f "$DAEMON_JSON" ]; then
140 | log "$TXT_ACCELERATION_CONFIG_EXISTS ${BACKUP_FILE}."
141 | cp "$DAEMON_JSON" "$BACKUP_FILE"
142 | create_daemon_json
143 | else
144 | create_daemon_json
145 | fi
146 |
147 | log "$TXT_RESTARTING_DOCKER"
148 | if command -v systemctl &>/dev/null; then
149 | systemctl daemon-reload && systemctl restart docker
150 | else
151 | service dockerd restart
152 | fi
153 | log "$TXT_DOCKER_RESTARTED"
154 | else
155 | log "$TXT_ACCELERATION_CONFIG_NOT"
156 | fi
157 | }
158 |
159 | function Install_Docker(){
160 | if which docker >/dev/null 2>&1; then
161 | docker_version=$(docker --version | grep -oE '[0-9]+\.[0-9]+' | head -n 1)
162 | major_version=${docker_version%%.*}
163 | minor_version=${docker_version##*.}
164 | if [[ $(which opkg &>/dev/null && service dockerd start && service dockerd status 2>&1 || systemctl start docker && systemctl status docker 2>&1) == *running* ]]; then
165 | log "$TXT_DOCKER_RESTARTED"
166 |
167 | else
168 | if [[ $major_version -lt 20 ]]; then
169 | log "$TXT_LOW_DOCKER_VERSION"
170 | fi
171 |
172 | if [[ $(curl -s ipinfo.io/country) == "CN" ]]; then
173 | configure_accelerator
174 | fi
175 | fi
176 | else
177 | log "$TXT_DOCKER_INSTALL_ONLINE"
178 | if command -v opkg &>/dev/null;then
179 | log $TXT_INSTALL_DOCKER_ONLINE
180 | opkg update
181 | opkg install luci-i18n-dockerman-zh-cn
182 | opkg install zoneinfo-asia
183 | service system restart
184 | if [[ $(curl -s ipinfo.io/country) == "CN" ]]; then
185 | configure_accelerator
186 | sleep 3
187 | fi
188 | else
189 | if [[ $(curl -s ipinfo.io/country) == "CN" ]]; then
190 | sources=(
191 | "https://mirrors.aliyun.com/docker-ce"
192 | "https://mirrors.tencent.com/docker-ce"
193 | "https://mirrors.163.com/docker-ce"
194 | "https://mirrors.cernet.edu.cn/docker-ce"
195 | )
196 |
197 | docker_install_scripts=(
198 | "https://get.docker.com"
199 | "https://testingcf.jsdelivr.net/gh/docker/docker-install@master/install.sh"
200 | "https://cdn.jsdelivr.net/gh/docker/docker-install@master/install.sh"
201 | "https://fastly.jsdelivr.net/gh/docker/docker-install@master/install.sh"
202 | "https://gcore.jsdelivr.net/gh/docker/docker-install@master/install.sh"
203 | "https://raw.githubusercontent.com/docker/docker-install/master/install.sh"
204 | )
205 |
206 | get_average_delay() {
207 | local source=$1
208 | local total_delay=0
209 | local iterations=2
210 | local timeout=2
211 |
212 | for ((i = 0; i < iterations; i++)); do
213 | delay=$(curl -o /dev/null -s -m $timeout -w "%{time_total}\n" "$source")
214 | if [ $? -ne 0 ]; then
215 | delay=$timeout
216 | fi
217 | total_delay=$(awk "BEGIN {print $total_delay + $delay}")
218 | done
219 |
220 | average_delay=$(awk "BEGIN {print $total_delay / $iterations}")
221 | echo "$average_delay"
222 | }
223 |
224 | min_delay=99999999
225 | selected_source=""
226 |
227 | for source in "${sources[@]}"; do
228 | average_delay=$(get_average_delay "$source" &)
229 |
230 | if (( $(awk 'BEGIN { print '"$average_delay"' < '"$min_delay"' }') )); then
231 | min_delay=$average_delay
232 | selected_source=$source
233 | fi
234 | done
235 | wait
236 |
237 | if [ -n "$selected_source" ]; then
238 | log "$TXT_CHOOSE_LOWEST_LATENCY_SOURCE $selected_source,$TXT_CHOOSE_LOWEST_LATENCY_DELAY $min_delay"
239 | export DOWNLOAD_URL="$selected_source"
240 |
241 | for alt_source in "${docker_install_scripts[@]}"; do
242 | log "$TXT_TRY_NEXT_LINK $alt_source $TXT_DOWNLOAD_DOCKER_SCRIPT"
243 | if curl -fsSL --retry 2 --retry-delay 3 --connect-timeout 5 --max-time 10 "$alt_source" -o get-docker.sh; then
244 | log "$TXT_DOWNLOAD_DOCKER_SCRIPT_SUCCESS $alt_source $TXT_SUCCESSFULLY_MESSAGE"
245 | break
246 | else
247 | log "$TXT_DOWNLOAD_FAIELD $alt_source $TXT_TRY_NEXT_LINK"
248 | fi
249 | done
250 |
251 | if [ ! -f "get-docker.sh" ]; then
252 | log "$TXT_ALL_DOWNLOAD_ATTEMPTS_FAILED"
253 | log "bash <(curl -sSL https://linuxmirrors.cn/docker.sh)"
254 | exit 1
255 | fi
256 |
257 | sh get-docker.sh 2>&1 | tee -a ${CURRENT_DIR}/install.log
258 |
259 | docker_config_folder="/etc/docker"
260 | if [[ ! -d "$docker_config_folder" ]];then
261 | mkdir -p "$docker_config_folder"
262 | fi
263 |
264 | docker version >/dev/null 2>&1
265 | if [[ $? -ne 0 ]]; then
266 | log "$TXT_DOCKER_INSTALL_FAIL"
267 | exit 1
268 | else
269 | log "$TXT_DOCKER_INSTALL_SUCCESS"
270 | systemctl enable docker 2>&1 | tee -a ${LOG_FILE}
271 | configure_accelerator
272 | fi
273 | else
274 | log "$TXT_CANNOT_SELECT_SOURCE"
275 | exit 1
276 | fi
277 | else
278 | log "$TXT_REGIONS_OTHER_THAN_CHINA"
279 | export DOWNLOAD_URL="https://download.docker.com"
280 | curl -fsSL "https://get.docker.com" -o get-docker.sh
281 | sh get-docker.sh 2>&1 | tee -a ${LOG_FILE}
282 |
283 | log "$TXT_DOCKER_START_NOTICE"
284 | systemctl enable docker; systemctl daemon-reload; systemctl start docker 2>&1 | tee -a ${LOG_FILE}
285 |
286 | docker_config_folder="/etc/docker"
287 | if [[ ! -d "$docker_config_folder" ]];then
288 | mkdir -p "$docker_config_folder"
289 | fi
290 | fi
291 | fi
292 |
293 | docker version >/dev/null 2>&1
294 | if [[ $? -ne 0 ]]; then
295 | log "$TXT_DOCKER_INSTALL_FAIL"
296 | exit 1
297 | else
298 | log "$TXT_DOCKER_INSTALL_SUCCESS"
299 | fi
300 | fi
301 | }
302 |
303 | function Install_Compose(){
304 | docker-compose version >/dev/null 2>&1
305 | if [[ $? -ne 0 ]]; then
306 | log "$TXT_DOCKER_COMPOSE_INSTALL_ONLINE"
307 | if which opkg &>/dev/null;then
308 | opkg update || log $TXT_DOCKER_COMPOSE_DOWNLOAD_FAIL
309 | opkg install docker-compose
310 | else
311 | arch=$(uname -m)
312 | if [ "$arch" == 'armv7l' ]; then
313 | arch='armv7'
314 | fi
315 | curl -L https://resource.fit2cloud.com/docker/compose/releases/download/v2.26.1/docker-compose-$(uname -s | tr A-Z a-z)-$arch -o /usr/local/bin/docker-compose 2>&1 | tee -a ${LOG_FILE}
316 | if [[ ! -f /usr/local/bin/docker-compose ]];then
317 | log $TXT_DOCKER_COMPOSE_DOWNLOAD_FAIL
318 | exit 1
319 | fi
320 | chmod +x /usr/local/bin/docker-compose
321 | ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
322 | fi
323 |
324 | docker-compose version >/dev/null 2>&1
325 | if [[ $? -ne 0 ]]; then
326 | log "$TXT_DOCKER_COMPOSE_INSTALL_FAIL"
327 | exit 1
328 | else
329 | log "$TXT_DOCKER_COMPOSE_INSTALL_SUCCESS"
330 | fi
331 | else
332 | compose_v=$(docker-compose -v)
333 | if [[ $compose_v =~ 'docker-compose' ]];then
334 | read -p "$TXT_LOWER_VERSION_DETECTED " UPGRADE_DOCKER_COMPOSE
335 | if [[ "$UPGRADE_DOCKER_COMPOSE" == "Y" ]] || [[ "$UPGRADE_DOCKER_COMPOSE" == "y" ]]; then
336 | rm -rf /usr/local/bin/docker-compose /usr/bin/docker-compose
337 | Install_Compose
338 | else
339 | log "$TXT_DOCKER_COMPOSE_VERSION $compose_v"
340 | fi
341 | else
342 | log "$TXT_DOCKER_COMPOSE_INSTALLED_SKIP"
343 | fi
344 | fi
345 | }
346 |
347 | function Set_Port(){
348 | DEFAULT_PORT=$(expr $RANDOM % 55535 + 10000)
349 |
350 | while true; do
351 | read -p "$TXT_SET_PANEL_PORT $DEFAULT_PORT): " PANEL_PORT
352 |
353 | if [[ "$PANEL_PORT" == "" ]];then
354 | PANEL_PORT=$DEFAULT_PORT
355 | fi
356 |
357 | if ! [[ "$PANEL_PORT" =~ ^[1-9][0-9]{0,4}$ && "$PANEL_PORT" -le 65535 ]]; then
358 | log "$TXT_INPUT_PORT_NUMBER"
359 | continue
360 | fi
361 | if command -v lsof >/dev/null 2>&1; then
362 | if lsof -i:$PANEL_PORT >/dev/null 2>&1; then
363 | log "$TXT_PORT_OCCUPIED $PANEL_PORT"
364 | continue
365 | fi
366 | elif command -v ss >/dev/null 2>&1; then
367 | if ss -tlun | grep -q ":$PANEL_PORT " >/dev/null 2>&1; then
368 | log "$TXT_PORT_OCCUPIED $PANEL_PORT"
369 | continue
370 | fi
371 | elif command -v netstat >/dev/null 2>&1; then
372 | if netstat -tlun | grep -q ":$PANEL_PORT " >/dev/null 2>&1; then
373 | log "$TXT_PORT_OCCUPIED $PANEL_PORT"
374 | continue
375 | fi
376 | fi
377 |
378 | log "$TXT_THE_PORT_U_SET $PANEL_PORT"
379 | break
380 | done
381 | }
382 |
383 | function Set_Firewall(){
384 | if which firewall-cmd >/dev/null 2>&1; then
385 | if systemctl status firewalld | grep -q "Active: active" >/dev/null 2>&1;then
386 | log "$TXT_FIREWALL_OPEN_PORT $PANEL_PORT"
387 | firewall-cmd --zone=public --add-port="$PANEL_PORT"/tcp --permanent
388 | firewall-cmd --reload
389 | else
390 | log "$TXT_FIREWALL_NOT_ACTIVE_SKIP"
391 | fi
392 | fi
393 |
394 | if which ufw >/dev/null 2>&1; then
395 | if systemctl status ufw | grep -q "Active: active" >/dev/null 2>&1;then
396 | log "$TXT_FIREWALL_OPEN_PORT $PANEL_PORT"
397 | ufw allow "$PANEL_PORT"/tcp
398 | ufw reload
399 | else
400 | log "$TXT_FIREWALL_NOT_ACTIVE_IGNORE"
401 | fi
402 | fi
403 | }
404 |
405 | function Set_Entrance(){
406 | DEFAULT_ENTRANCE=`cat /dev/urandom | head -n 16 | md5sum | head -c 10`
407 |
408 | while true; do
409 | read -p "$TXT_SET_PANEL_ENTRANCE $DEFAULT_ENTRANCE): " PANEL_ENTRANCE
410 | if [[ "$PANEL_ENTRANCE" == "" ]]; then
411 | PANEL_ENTRANCE=$DEFAULT_ENTRANCE
412 | fi
413 |
414 | if [[ ! "$PANEL_ENTRANCE" =~ ^[a-zA-Z0-9_]{3,30}$ ]]; then
415 | log "$TXT_INPUT_ENTRANCE_RULE"
416 | continue
417 | fi
418 |
419 | log "$TXT_SET_PANEL_ENTRANCE $PANEL_ENTRANCE"
420 | break
421 | done
422 | }
423 |
424 | function Set_Username(){
425 | DEFAULT_USERNAME=$(cat /dev/urandom | head -n 16 | md5sum | head -c 10)
426 |
427 | while true; do
428 | read -p "$TXT_SET_PANEL_USER $DEFAULT_USERNAME): " PANEL_USERNAME
429 |
430 | if [[ "$PANEL_USERNAME" == "" ]];then
431 | PANEL_USERNAME=$DEFAULT_USERNAME
432 | fi
433 |
434 | if [[ ! "$PANEL_USERNAME" =~ ^[a-zA-Z0-9_]{3,30}$ ]]; then
435 | log "$TXT_INPUT_USERNAME_RULE"
436 | continue
437 | fi
438 |
439 | log "$TXT_YOUR_PANEL_USERNAME $PANEL_USERNAME"
440 | break
441 | done
442 | }
443 |
444 |
445 | function passwd() {
446 | if which stty >/dev/null 2>&1; then
447 | charcount='0'
448 | reply=''
449 | while :; do
450 | char=$(
451 | stty cbreak -echo
452 | dd if=/dev/tty bs=1 count=1 2>/dev/null
453 | stty -cbreak echo
454 | )
455 | case $char in
456 | "$(printenv '\000')")
457 | break
458 | ;;
459 | "$(printf '\177')" | "$(printf '\b')")
460 | if [ $charcount -gt 0 ]; then
461 | printf '\b \b'
462 | reply="${reply%?}"
463 | charcount=$((charcount - 1))
464 | else
465 | printf ''
466 | fi
467 | ;;
468 | "$(printf '\033')") ;;
469 | *)
470 | printf '*'
471 | reply="${reply}${char}"
472 | charcount=$((charcount + 1))
473 | ;;
474 | esac
475 | done
476 | log "$TXT_SET_PANEL_PASSWORD $DEFAULT_PASSWORD): "
477 | printf '\n' >&2
478 | else
479 | read -s -p "$TXT_SET_PANEL_PASSWORD: $DEFAULT_PASSWORD):" reply
480 | printf '\n' >&2
481 | fi
482 | }
483 |
484 | function Set_Password(){
485 | DEFAULT_PASSWORD=$(cat /dev/urandom | head -n 16 | md5sum | head -c 10)
486 |
487 | while true; do
488 |
489 | passwd
490 | PANEL_PASSWORD=$reply
491 | if [[ "$PANEL_PASSWORD" == "" ]];then
492 | PANEL_PASSWORD=$DEFAULT_PASSWORD
493 | fi
494 |
495 | if [[ ! "$PANEL_PASSWORD" =~ ^[a-zA-Z0-9_!@#$%*,.?]{8,30}$ ]]; then
496 | log "$TXT_INPUT_PASSWORD_RULE"
497 | continue
498 | fi
499 |
500 | break
501 | done
502 | }
503 |
504 | init_configure() {
505 | cp ./1panel /usr/local/bin && chmod +x /usr/local/bin/1panel
506 | ln -s /usr/local/bin/1panel /usr/bin/1panel >/dev/null 2>&1
507 | cp ./1pctl /usr/local/bin && chmod +x /usr/local/bin/1pctl
508 | ln -s /usr/local/bin/1pctl /usr/bin/1pctl >/dev/null 2>&1
509 | sed -i -e "s#BASE_DIR=.*#BASE_DIR=${PANEL_BASE_DIR}#g" /usr/local/bin/1pctl
510 | sed -i -e "s#ORIGINAL_PORT=.*#ORIGINAL_PORT=${PANEL_PORT}#g" /usr/local/bin/1pctl
511 | sed -i -e "s#ORIGINAL_USERNAME=.*#ORIGINAL_USERNAME=${PANEL_USERNAME}#g" /usr/local/bin/1pctl
512 | ESCAPED_PANEL_PASSWORD=$(echo "$PANEL_PASSWORD" | sed 's/[!@#$%*_,.?]/\\&/g')
513 | sed -i -e "s#ORIGINAL_PASSWORD=.*#ORIGINAL_PASSWORD=${ESCAPED_PANEL_PASSWORD}#g" /usr/local/bin/1pctl
514 | sed -i -e "s#ORIGINAL_ENTRANCE=.*#ORIGINAL_ENTRANCE=${PANEL_ENTRANCE}#g" /usr/local/bin/1pctl
515 | sed -i -e "s#LANGUAGE=.*#LANGUAGE=${selected_lang}#g" /usr/local/bin/1pctl
516 | if [ -f "./GeoIP.mmdb" ]; then
517 | mkdir -p $RUN_BASE_DIR/geo/
518 | cp -r ./GeoIP.mmdb $RUN_BASE_DIR/geo/
519 | cp -r ./lang /usr/local/bin
520 | fi
521 | }
522 |
523 | install_and_configure() {
524 | if which opkg &>/dev/null; then
525 | mkdir -p /usr/local/bin
526 | init_configure
527 | echo "#!/bin/sh /etc/rc.common
528 | USE_PROCD=1
529 |
530 | START=95
531 | STOP=15
532 | NAME=1panel
533 | start_service() {
534 | procd_open_instance
535 | procd_set_param command 1panel
536 | procd_set_param stdout 0 # 默认设置不输出系统日志,如为1,在系统日志可看到1panel前端响应信息
537 | procd_set_param stderr 1
538 | procd_close_instance
539 | }
540 | " > /etc/init.d/1paneld
541 |
542 | chmod +x /etc/init.d/1paneld
543 | /etc/init.d/1paneld enable && /etc/init.d/1paneld reload 2>&1 | tee -a ${LOG_FILE}
544 | /etc/init.d/1paneld start | tee -a ${LOG_FILE}
545 | else
546 | init_configure
547 | cp ./1panel.service /etc/systemd/system
548 | systemctl enable 1panel.service; systemctl daemon-reload 2>&1 | tee -a ${LOG_FILE}
549 | systemctl start 1panel.service | tee -a ${LOG_FILE}
550 | fi
551 | }
552 |
553 | function Init_Panel(){
554 | log "$TXT_CONFIGURE_PANEL_SERVICE"
555 | MAX_ATTEMPTS=5
556 | RUN_BASE_DIR=$PANEL_BASE_DIR/1panel
557 | mkdir -p $RUN_BASE_DIR
558 | rm -rf $RUN_BASE_DIR/* 2>/dev/null
559 |
560 | cd ${CURRENT_DIR}
561 |
562 | install_and_configure
563 |
564 | for attempt in $(seq 1 $MAX_ATTEMPTS); do
565 | if [[ $(command -v opkg) && $(/etc/init.d/1paneld status 2>&1) == *running* ]]; then
566 | log "$TXT_START_PANEL_SERVICE"
567 | break
568 | elif [[ $(command -v systemctl) && $(systemctl status 1panel 2>&1) =~ Active.*running ]]; then
569 | log "$TXT_START_PANEL_SERVICE"
570 | break
571 | else
572 | if [ $attempt -eq $MAX_ATTEMPTS ]; then
573 | log "$TXT_PANEL_SERVICE_START_ERROR"
574 | exit 1
575 | else
576 | log $TXT_SERVICE_RETRY_MSG $((MAX_ATTEMPTS - attempt))
577 | sleep 2
578 | fi
579 | fi
580 | done
581 | }
582 |
583 |
584 | function Get_Ip(){
585 | active_interface=$(ip route get 8.8.8.8 | awk 'NR==1 {print $5}')
586 | PUBLIC_IP=`curl -s https://api64.ipify.org`
587 | if [[ -z $active_interface ]]; then
588 | LOCAL_IP="127.0.0.1"
589 | elif [[ $active_interface =~ pppoe ]]; then
590 | PUBLIC_IP=$(ip -4 addr show dev "$active_interface" | grep -oE 'inet[[:space:]]+([0-9]{1,3}\.){3}[0-9]{1,3}' | awk '{print $2}')
591 | LOCAL_IP=$(ip -4 addr show | grep -E 'br-lan.*' | grep -oE 'inet[[:space:]]+([0-9]{1,3}\.){3}[0-9]{1,3}' | awk '{print $2}')
592 | else
593 | if which opkg &>/dev/null;then
594 | LOCAL_IP=$(ip -4 addr show | grep -E 'br-lan.*' | grep -oE 'inet[[:space:]]+([0-9]{1,3}\.){3}[0-9]{1,3}' | awk '{print $2}' | awk -F '/' '{print $1}')
595 | else
596 | LOCAL_IP=`ip -4 addr show dev "$active_interface" | grep -oE 'inet[[:space:]]+([0-9]{1,3}\.){3}[0-9]{1,3}' | awk '{print $2}'`
597 | fi
598 | fi
599 |
600 | if [[ -z "$PUBLIC_IP" ]]; then
601 | PUBLIC_IP="N/A"
602 | fi
603 | if echo "$PUBLIC_IP" | grep -q ":"; then
604 | PUBLIC_IP=[${PUBLIC_IP}]
605 | 1pctl listen-ip ipv6
606 | fi
607 | }
608 |
609 | function Show_Result(){
610 | log ""
611 | log "$TXT_THANK_YOU_WAITING"
612 | log ""
613 | log "$TXT_BROWSER_ACCESS_PANEL"
614 | log "$TXT_EXTERNAL_ADDRESS http://$PUBLIC_IP:$PANEL_PORT/$PANEL_ENTRANCE"
615 | log "$TXT_INTERNAL_ADDRESS http://$LOCAL_IP:$PANEL_PORT/$PANEL_ENTRANCE"
616 | log "$TXT_PANEL_USER $PANEL_USERNAME"
617 | log "$TXT_PANEL_PASSWORD $PANEL_PASSWORD"
618 | log ""
619 | log "$TXT_PROJECT_OFFICIAL_WEBSITE"
620 | log "$TXT_PROJECT_DOCUMENTATION"
621 | log "$TXT_PROJECT_REPOSITORY"
622 | log "$TXT_COMMUNITY"
623 | log ""
624 | log "$TXT_OPEN_PORT_SECURITY_GROUP $PANEL_PORT"
625 | log ""
626 | log "$TXT_REMEMBER_YOUR_PASSWORD"
627 | log ""
628 | log "================================================================"
629 | sed -i -e "s#面板密码:.*#面板密码:${PASSWORD_MASK}#g" ${LOG_FILE}
630 | sed -i -e "s#ORIGINAL_PASSWORD=.*#ORIGINAL_PASSWORD=${PASSWORD_MASK}#g" /usr/local/bin/1pctl
631 | }
632 |
633 | function main(){
634 | Check_Root
635 | Prepare_System
636 | Set_Dir
637 | Install_Docker
638 | Install_Compose
639 | Set_Port
640 | Set_Firewall
641 | Set_Entrance
642 | Set_Username
643 | Set_Password
644 | Init_Panel
645 | Get_Ip
646 | Show_Result
647 | }
648 | main
649 |
--------------------------------------------------------------------------------
/lang/en.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | TXT_START_INSTALLATION="======================= Starting Installation ======================="
4 | TXT_RUN_AS_ROOT="Please run this script as root or with sudo permissions"
5 | TXT_SUCCESS_MESSAGE="Success"
6 | TXT_SUCCESSFULLY_MESSAGE="Successfully"
7 | TXT_FAIELD_MESSAGE="Failed"
8 | TXT_IGNORE_MESSAGE="Ignore"
9 | TXT_SKIP_MESSAGE="Skip"
10 | TXT_PANEL_ALREADY_INSTALLED="1Panel Linux server management panel is already installed, please do not install again"
11 | TXT_SET_INSTALL_DIR="Set 1Panel installation directory (default is /opt): "
12 | TXT_PROVIDE_FULL_PATH="Please provide the full path of the directory"
13 | TXT_SELECTED_INSTALL_PATH="The installation path you selected is"
14 | TXT_TIMEOUT_USE_DEFAULT_PATH="(Timeout set, using default installation path /opt)"
15 | TXT_CREATE_NEW_CONFIG="Creating new configuration file"
16 | TXT_ACCELERATION_CONFIG_ADDED="Image acceleration configuration has been added."
17 | TXT_ACCELERATION_CONFIG_NOT="Image acceleration is not configured."
18 | TXT_ACCELERATION_CONFIG_ADD="Do you want to configure image acceleration(y/n): "
19 | TXT_ACCELERATION_CONFIG_EXISTS="The configuration file already exists, we will backup the existing configuration file to: "
20 | TXT_RESTARTING_DOCKER="Restarting Docker service..."
21 | TXT_DOCKER_RESTARTED="Docker service successfully restarted."
22 | TXT_DOCKER_INSTALL_ONLINE="... Installing Docker online"
23 | TXT_ACCELERATOR_NOT_CONFIGURED="Image acceleration not configured."
24 | TXT_LOW_DOCKER_VERSION="Detected that the server’s Docker version is below 20.x. It is recommended to upgrade manually to avoid functionality limitations."
25 | TXT_INSTALL_DOCKER_ONLINE="... Installing Docker online"
26 | TXT_DOWNLOAD_DOCKER_SCRIPT_FAIL="Failed to download installation script from"
27 | TXT_DOWNLOAD_DOCKER_SCRIPT="downloading docker installation script"
28 | TXT_DOWNLOAD_DOCKER_SCRIPT_SUCCESS="Downloaded docker from"
29 | TXT_TRY_NEXT_LINK="trying the next alternative link"
30 | TXT_DOWNLOAD_FAIELD="Failed to download the installation script from"
31 | TXT_ALL_DOWNLOAD_ATTEMPTS_FAILED="All download attempts failed. You may try installing Docker manually by running the following command:"
32 | TXT_REGIONS_OTHER_THAN_CHINA="No need to change the source"
33 | TXT_DOCKER_INSTALL_SUCCESS="Docker installed successfully"
34 | TXT_DOCKER_INSTALL_FAIL="Docker installation failed\nYou may try installing Docker using an offline package, refer to the following link for detailed installation steps: https://docs.1panel.hk/installation/"
35 | TXT_CHOOSE_LOWEST_LATENCY_SOURCE="Choose the source with the lowest latency"
36 | TXT_CHOOSE_LOWEST_LATENCY_DELAY="Delay (in seconds)"
37 | TXT_CANNOT_SELECT_SOURCE="Unable to select source for installation"
38 | TXT_DOCKER_START_NOTICE="... start docker"
39 | TXT_DOCKER_COMPOSE_INSTALL_ONLINE="... Installing Docker Compose online"
40 | TXT_DOCKER_COMPOSE_DOWNLOAD_FAIL="Docker Compose download failed, please try again later"
41 | TXT_DOCKER_COMPOSE_INSTALL_SUCCESS="Docker Compose installed successfully"
42 | TXT_DOCKER_COMPOSE_INSTALL_FAIL="Docker Compose installation failed"
43 | TXT_LOWER_VERSION_DETECTED="A lower version of Docker Compose was detected (version must be greater than or equal to v2.0.0), do you want to upgrade [y/n] : "
44 | TXT_DOCKER_COMPOSE_VERSION="Docker Compose version"
45 | TXT_DOCKER_MAY_EFFECT_STORE="which may affect the normal use of the App Store."
46 | TXT_DOCKER_COMPOSE_INSTALLED_SKIP="Docker Compose is already installed, skipping installation step"
47 | TXT_SET_PANEL_PORT="Set 1Panel port (default is"
48 | TXT_INPUT_PORT_NUMBER="Error: The entered port number must be between 1 and 65535"
49 | TXT_THE_PORT_U_SET="The port you set is: "
50 | TXT_PORT_OCCUPIED="Port is occupied, please re-enter..."
51 | TXT_FIREWALL_OPEN_PORT="Opening firewall port"
52 | TXT_FIREWALL_NOT_ACTIVE_SKIP="Firewall is not active, skipping port opening"
53 | TXT_FIREWALL_NOT_ACTIVE_IGNORE="Firewall is not active, ignoring port opening"
54 | TXT_SET_PANEL_ENTRANCE="Set 1Panel secure entrance (default is"
55 | TXT_INPUT_ENTRANCE_RULE="Error: Panel secure entrance only supports letters, numbers, underscores, length 3-30 characters"
56 | TXT_YOUR_PANEL_ENTRANCE="The panel secure entrance you set is"
57 | TXT_SET_PANEL_USER="Set 1Panel panel user (default is"
58 | TXT_INPUT_USERNAME_RULE="Error: Panel user only supports letters, numbers, underscores, length 3-30 characters"
59 | TXT_YOUR_PANEL_USERNAME="The panel user you set is"
60 | TXT_SET_PANEL_PASSWORD="Set 1Panel panel password, press Enter to continue after setting (default is"
61 | TXT_INPUT_PASSWORD_RULE="Error: Panel password only supports letters, numbers, special characters (!@#$%*_,.?), length 8-30 characters"
62 | TXT_CONFIGURE_PANEL_SERVICE="Configuring 1Panel Service"
63 | TXT_START_PANEL_SERVICE="Starting 1Panel service"
64 | TXT_SERVICE_RETRY_MSG="Failed to start service, retrying..."
65 | TXT_PANEL_SERVICE_START_SUCCESS="1Panel service started successfully!"
66 | TXT_PANEL_SERVICE_START_ERROR="Error starting 1Panel service!"
67 | TXT_THANK_YOU_WAITING="=================Thank you for your patience, installation is complete=================="
68 | TXT_BROWSER_ACCESS_PANEL="Please access the panel using your browser:"
69 | TXT_EXTERNAL_ADDRESS="External address:"
70 | TXT_INTERNAL_ADDRESS="Internal address:"
71 | TXT_PANEL_USER="Panel user:"
72 | TXT_PANEL_PASSWORD="Panel password:"
73 | TXT_PROJECT_OFFICIAL_WEBSITE="Official website: https://1panel.hk"
74 | TXT_PROJECT_DOCUMENTATION="Project documentation: https://docs.1panel.hk"
75 | TXT_PROJECT_REPOSITORY="Code repository: https://github.com/1Panel-dev/1Panel"
76 | TXT_COMMUNITY="Join the 1Panel community on Discord for support and discussions: https://discord.gg/bUpUqWqdRr"
77 | TXT_OPEN_PORT_SECURITY_GROUP="If you are using a cloud server, please open the port in the security group"
78 | TXT_REMEMBER_YOUR_PASSWORD="For your server security, you will not be able to see your password again after leaving this screen, please remember your password."
79 | TXT_PANEL_SERVICE_STATUS="Check 1Panel service status"
80 | TXT_PANEL_SERVICE_RESTART="Restart 1Panel service"
81 | TXT_PANEL_SERVICE_STOP="Stop 1Panel service"
82 | TXT_PANEL_SERVICE_START="Start 1Panel service"
83 | TXT_PANEL_SERVICE_UNINSTALL="Uninstall 1Panel service"
84 | TXT_PANEL_SERVICE_USER_INFO="Get 1Panel user information"
85 | TXT_PANEL_SERVICE_LISTEN_IP="Switch 1Panel listening IP"
86 | TXT_PANEL_SERVICE_VERSION="Get 1Panel version information"
87 | TXT_PANEL_SERVICE_UPDATE="Update 1Panel system"
88 | TXT_PANEL_SERVICE_RESET="Reset 1Panel system"
89 | TXT_PANEL_SERVICE_RESTORE="Restore 1Panel system"
90 | TXT_PANEL_SERVICE_UNINSTALL_NOTICE="Uninstallation will completely clear 1Panel services and data directories. Do you want to continue? [y/n]"
91 | TXT_PANEL_SERVICE_UNINSTALL_START="Start uninstalling 1Panel"
92 | TXT_PANEL_SERVICE_UNINSTALL_STOP="Stop 1Panel service process..."
93 | TXT_PANEL_SERVICE_UNINSTALL_REMOVE="Delete 1Panel service and data directories..."
94 | TXT_PANEL_SERVICE_UNINSTALL_REMOVE_CONFIG="Reloading service configuration files..."
95 | TXT_PANEL_SERVICE_UNINSTALL_REMOVE_SUCCESS="uninstallation completed!"
96 | TXT_PANEL_SERVICE_RESTORE_NOTICE="1Panel will be restored to the last stable version. Do you want to continue? [y/n]"
97 | TXT_PANEL_SERVICE_UNSUPPORTED_PARAMETER="Unsupported parameters, please use help or --help parameter to get help"
98 | TXT_PANEL_CONTROL_SCRIPT="1Panel control script"
99 | TXT_LANG_SELECTED_MSG="Language already selected: "
100 | TXT_LANG_PROMPT_MSG="Select a language:"
101 | TXT_LANG_CHOICE_MSG="Enter the number corresponding to your language choice: "
102 | TXT_LANG_SELECTED_CONFIRM_MSG="You selected: "
103 | TXT_LANG_INVALID_MSG="Invalid selection. Defaulting to English (en)."
104 | TXT_LANG_NOT_FOUND_MSG="Language file not found:"
105 |
--------------------------------------------------------------------------------
/lang/fa.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | TXT_START_INSTALLATION="======================= shorooe nasb ======================="
4 | TXT_RUN_AS_ROOT="lotfan in eskript ra be onvane karbare root ya ba mojavez sudo ejra konid"
5 | TXT_SUCCESS_MESSAGE="moafagh"
6 | TXT_SUCCESSFULLY_MESSAGE="moafagh"
7 | TXT_FAIELD_MESSAGE="namovafagh"
8 | TXT_IGNORE_MESSAGE="nadide gereftan"
9 | TXT_SKIP_MESSAGE="rad kardan"
10 | TXT_PANEL_ALREADY_INSTALLED="panel modiriyat server linux 1Panel ghablan nasb shode ast, lotfan dobare nasb nakonid"
11 | TXT_SET_INSTALL_DIR="masire nasbe 1Panel ra tanzim konid (pish farz /opt ast): "
12 | TXT_PROVIDE_FULL_PATH="lotfan masire kamel poshe ra eraye dahid"
13 | TXT_SELECTED_INSTALL_PATH="masire nasbi ke entekhab kardid"
14 | TXT_TIMEOUT_USE_DEFAULT_PATH="(mohdoodiyat zamani tanzim shod, az masire pish farze nasb /opt estefade mishavad)"
15 | TXT_CREATE_NEW_CONFIG="ijade file pikerbandi jadid"
16 | TXT_ACCELERATION_CONFIG_ADDED="pikerbandiye shetab dahande tasvir ezafe shode ast."
17 | TXT_ACCELERATION_CONFIG_NOT="shetab dahande tasvir pikerbandi nashode ast."
18 | TXT_ACCELERATION_CONFIG_ADD="aya mikhahid shetab dahande tasvir ra pikerbandi konid(y/n): "
19 | TXT_ACCELERATION_CONFIG_EXISTS="file pikerbandi az ghabl vojud darad, ma file pikerbandiye mojood ra dar pashteebani khahim kard be: "
20 | TXT_RESTARTING_DOCKER="dar hale ra andaziye mojaddade service docker..."
21 | TXT_DOCKER_RESTARTED="service docker ba movafaghiat ra andaziye mojaddad shod."
22 | TXT_DOCKER_INSTALL_ONLINE="... nasbe docker online"
23 | TXT_ACCELERATOR_NOT_CONFIGURED="shetab dahande tasvir pikerbandi nashode ast."
24 | TXT_LOW_DOCKER_VERSION="Docker version server payin tar az 20.x tashkhis shode ast. Pishnahad mishavad baraye jelogiri az mahdudiyat haye karbordi, dastan be version balatar upgrade konid."
25 | TXT_INSTALL_DOCKER_ONLINE="... nasbe docker online"
26 | TXT_DOWNLOAD_DOCKER_SCRIPT_FAIL="daryaft eskripte nasb az"
27 | TXT_DOWNLOAD_DOCKER_SCRIPT="dar hale daryaft eskripte nasbe docker"
28 | TXT_DOWNLOAD_DOCKER_SCRIPT_SUCCESS="docker az"
29 | TXT_TRY_NEXT_LINK="dar hale azmoodane link jaygozin ba'di"
30 | TXT_DOWNLOAD_FAIELD="daryaft eskripte nasb az"
31 | TXT_ALL_DOWNLOAD_ATTEMPTS_FAILED="hame talashha-ye daryaft namovafagh bood. shoma mitavanid docker ra be soorate dastni ba ejraye dastoor zir nasb konid:"
32 | TXT_REGIONS_OTHER_THAN_CHINA="niaz be taghire manbae nist"
33 | TXT_DOCKER_INSTALL_SUCCESS="docker ba movafaghiat nasb shod"
34 | TXT_DOCKER_INSTALL_FAIL="nasbe docker namovafagh bood\nshoma mitavanid docker ra ba estefade az baste offline nasb konid, baraye marhalaye nasb tafsili be link zir moraje konid: https://docs.1panel.hk/installation/"
35 | TXT_CHOOSE_LOWEST_LATENCY_SOURCE="manbae ba kamtarin takhir ra entekhab konid"
36 | TXT_CHOOSE_LOWEST_LATENCY_DELAY="takhir (be sanie)"
37 | TXT_CANNOT_SELECT_SOURCE="emkan entekhabe manbae baraye nasb vojood nadarad"
38 | TXT_DOCKER_START_NOTICE="... shoroo docker"
39 | TXT_DOCKER_COMPOSE_INSTALL_ONLINE="... nasbe docker compose online"
40 | TXT_DOCKER_COMPOSE_DOWNLOAD_FAIL="daryaft docker compose namovafagh bood, lotfan ba'adan dobare talash konid"
41 | TXT_DOCKER_COMPOSE_INSTALL_SUCCESS="docker compose ba movafaghiat nasb shod"
42 | TXT_DOCKER_COMPOSE_INSTALL_FAIL="nasbe docker compose namovafagh bood"
43 | TXT_LOWER_VERSION_DETECTED="nashkhe paeen-tari az docker compose shenakhte shod (nashkhe bayad bozorgtar ya mosaavi ba v2.0.0 bashad), aya mikhahid ertegha dahid [y/n] : "
44 | TXT_DOCKER_COMPOSE_VERSION="nashkhe docker compose"
45 | TXT_DOCKER_MAY_EFFECT_STORE="ke momken ast bar estefade ye adi az App Store asar bogozarad."
46 | TXT_DOCKER_COMPOSE_INSTALLED_SKIP="docker compose ghablan nasb shode ast, marhale nasb rad mishavad"
47 | TXT_SET_PANEL_PORT="porte 1Panel ra tanzim konid (pish farz"
48 | TXT_INPUT_PORT_NUMBER="khata: shomare porte vared shode bayad beyn 1 ta 65535 bashad"
49 | TXT_THE_PORT_U_SET="porte ke tanzim kardid: "
50 | TXT_PORT_OCCUPIED="port eshghal shode ast, lotfan dobare vared konid..."
51 | TXT_FIREWALL_OPEN_PORT="dar hale baz kardane porte firewal"
52 | TXT_FIREWALL_NOT_ACTIVE_SKIP="firewal faal nist, baz kardane port rad mishavad"
53 | TXT_FIREWALL_NOT_ACTIVE_IGNORE="firewal faal nist, baz kardane port nadide gerefte mishavad"
54 | TXT_SET_PANEL_ENTRANCE="voroodie amne 1Panel ra tanzim konid (pish farz"
55 | TXT_INPUT_ENTRANCE_RULE="khata: voroodie amne panel faghat horof, adad, zirkhat va tool 3-30 karakter ra poshtibani mikonad"
56 | TXT_YOUR_PANEL_ENTRANCE="voroodie amni ke tanzim kardid"
57 | TXT_SET_PANEL_USER="karbare panel 1Panel ra tanzim konid (pish farz"
58 | TXT_INPUT_USERNAME_RULE="khata: name karbari panel faghat horof, adad, zirkhat va tool 3-30 karakter ra poshtibani mikonad"
59 | TXT_YOUR_PANEL_USERNAME="name karbari paneli ke tanzim kardid"
60 | TXT_SET_PANEL_PASSWORD="ramz oboor panel 1Panel ra tanzim konid, pas az tanzim baraye edame Enter ra feshar dahid (pish farz"
61 | TXT_INPUT_PASSWORD_RULE="khata: ramz oboor panel faghat horof, adad, karakterhaye khas (!@#$%*_,.?) va tool 8-30 karakter ra poshtibani mikonad"
62 | TXT_CONFIGURE_PANEL_SERVICE="pikerbandiye service 1Panel"
63 | TXT_START_PANEL_SERVICE="shorooe service 1Panel"
64 | TXT_SERVICE_RETRY_MSG="khata dar shorooe service, dobare talash..."
65 | TXT_PANEL_SERVICE_START_SUCCESS="service 1Panel ba movafaghiat shoroo shod!"
66 | TXT_PANEL_SERVICE_START_ERROR="khata dar shorooe service 1Panel!"
67 | TXT_THANK_YOU_WAITING="=================ba tashakor az sabre shoma, nasb be payan resid=================="
68 | TXT_BROWSER_ACCESS_PANEL="lotfan ba mororgar khod be panel dastresi peyda konid:"
69 | TXT_EXTERNAL_ADDRESS="adres khareji:"
70 | TXT_INTERNAL_ADDRESS="adres dakheli:"
71 | TXT_PANEL_USER="karbare panel:"
72 | TXT_PANEL_PASSWORD="ramz oboor panel:"
73 | TXT_PROJECT_OFFICIAL_WEBSITE="websaye rasmi: https://1panel.hk"
74 | TXT_PROJECT_DOCUMENTATION="mostanadate proje: https://docs.1panel.hk"
75 | TXT_PROJECT_REPOSITORY="mokhzan kod: https://github.com/1Panel-dev/1Panel"
76 | TXT_COMMUNITY="Rejoignez la communauté 1Panel sur Discord pour obtenir du support et discuter: https://discord.gg/bUpUqWqdRr"
77 | TXT_OPEN_PORT_SECURITY_GROUP="agar az server abri estefade mikonid, lotfan port ra dar goroohe amniyat baz konid"
78 | TXT_REMEMBER_YOUR_PASSWORD="be dalile amniyate server shoma, pas az khorooj az in safhe digar nemitavanid ramze oboor khod ra bebinid, lotfan ramze oboor khod ra be khater besparid."
79 | TXT_PANEL_SERVICE_STATUS="Barresi vaziyat servise 1Panel"
80 | TXT_PANEL_SERVICE_RESTART="Rah-andazi mojadad servise 1Panel"
81 | TXT_PANEL_SERVICE_STOP="Motaghaf kardan servise 1Panel"
82 | TXT_PANEL_SERVICE_START="Shoru' servise 1Panel"
83 | TXT_PANEL_SERVICE_UNINSTALL="Hazf servise 1Panel"
84 | TXT_PANEL_SERVICE_USER_INFO="Ettela'at kari 1Panel"
85 | TXT_PANEL_SERVICE_LISTEN_IP="Taghir IP shenoud 1Panel"
86 | TXT_PANEL_SERVICE_VERSION="Ettela'at nashe 1Panel"
87 | TXT_PANEL_SERVICE_UPDATE="Be-roozresani sistem 1Panel"
88 | TXT_PANEL_SERVICE_RESET="Bazneshani sistem 1Panel"
89 | TXT_PANEL_SERVICE_RESTORE="Bazyafti sistem 1Panel"
90 | TXT_PANEL_SERVICE_UNINSTALL_NOTICE="Hazar kardan kamelan 1Panel servise ha va directory haye data ra pak mikonad. Ay khahesh darid edame dahid? [y/n]"
91 | TXT_PANEL_SERVICE_UNINSTALL_START="Shoru' hazf kardan 1Panel"
92 | TXT_PANEL_SERVICE_UNINSTALL_STOP="Mataghaf kardan process servise 1Panel..."
93 | TXT_PANEL_SERVICE_UNINSTALL_REMOVE="Hazar kardan servise va directory haye data 1Panel..."
94 | TXT_PANEL_SERVICE_UNINSTALL_REMOVE_CONFIG="Barresi kardan file haye pishfarzi servise..."
95 | TXT_PANEL_SERVICE_UNINSTALL_REMOVE_SUCCESS="Hazar kardan be payan resid!"
96 | TXT_PANEL_SERVICE_RESTORE_NOTICE="1Panel be akharin version paydar bar migardad. Ay khahesh darid edame dahid? [y/n]"
97 | TXT_PANEL_SERVICE_UNSUPPORTED_PARAMETER="Mojaz nist, lotfan az komak ya parameter --help baray daryafte komak estefade konid"
98 | TXT_PANEL_CONTROL_SCRIPT="modiriat 1Panel"
99 | TXT_LANG_SELECTED_MSG="Language already selected: "
100 | TXT_LANG_PROMPT_MSG="Select a language:"
101 | TXT_LANG_CHOICE_MSG="Enter the number corresponding to your language choice: "
102 | TXT_LANG_SELECTED_CONFIRM_MSG="You selected: "
103 | TXT_LANG_INVALID_MSG="Invalid selection. Defaulting to English (en)."
104 | TXT_LANG_NOT_FOUND_MSG="Language file not found:"
105 |
--------------------------------------------------------------------------------
/lang/pt-BR.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | TXT_START_INSTALLATION="======================= Iniciando Instalação ======================="
4 | TXT_RUN_AS_ROOT="Por favor, execute esse script como root"
5 | TXT_SUCCESS_MESSAGE="Sucesso"
6 | TXT_SUCCESSFULLY_MESSAGE="Sucesso"
7 | TXT_FAIELD_MESSAGE="Falhou"
8 | TXT_IGNORE_MESSAGE="Ignorar"
9 | TXT_SKIP_MESSAGE="Pular"
10 | TXT_PANEL_ALREADY_INSTALLED="O gerenciador de servidores 1Panel Linux já está instalado, por favor não instale novamente."
11 | TXT_SET_INSTALL_DIR="Definir o diretório de instalação padrão do 1Panel. (O padrão é /opt): "
12 | TXT_PROVIDE_FULL_PATH="Por favor indique o caminho completo do diretório."
13 | TXT_SELECTED_INSTALL_PATH="O caminho selecionado para a instalação é:"
14 | TXT_TIMEOUT_USE_DEFAULT_PATH="(Tempo limite atingido, usando o caminho de instalação padrão /opt)"
15 | TXT_CREATE_NEW_CONFIG="Criando novo arquivo de configuração"
16 | TXT_ACCELERATION_CONFIG_ADDED="A aceleração de imagem foi adicionada."
17 | TXT_ACCELERATION_CONFIG_NOT="Aceleração de imagem não configurada."
18 | TXT_ACCELERATION_CONFIG_ADD="Você gostaria de configurar a aceleração de imagem (y/n): "
19 | TXT_ACCELERATION_CONFIG_EXISTS="O arquivo de configuração já existe, faremos backup do arquivo de configuração existente para: "
20 | TXT_RESTARTING_DOCKER="Reiniciando serviços Docker..."
21 | TXT_DOCKER_RESTARTED="Serviços Docker reiniciados com sucesso."
22 | TXT_DOCKER_INSTALL_ONLINE="... Instalando Docker Online"
23 | TXT_ACCELERATOR_NOT_CONFIGURED="Aceleração de imagem não configurada."
24 | TXT_LOW_DOCKER_VERSION="Detectado que a versão do Docker do servidor é inferior a 20.x. É recomendado atualizar manualmente para evitar limitações de funcionalidade."
25 | TXT_INSTALL_DOCKER_ONLINE="... Instalando Docker Online"
26 | TXT_DOWNLOAD_DOCKER_SCRIPT_FAIL="Falha ao baixar o script de instalação de"
27 | TXT_DOWNLOAD_DOCKER_SCRIPT="Baixando script de instalação do Docker"
28 | TXT_DOWNLOAD_DOCKER_SCRIPT_SUCCESS="Docker baixado de"
29 | TXT_TRY_NEXT_LINK="Tentando próximo link alternativo"
30 | TXT_DOWNLOAD_FAIELD="Falha ao baixar o script de instalação de"
31 | TXT_ALL_DOWNLOAD_ATTEMPTS_FAILED="Todas as tentativas de download falharam. Você pode tentar instalar o Docker manualmente executando o seguinte comando:"
32 | TXT_REGIONS_OTHER_THAN_CHINA="Não é necessário alterar a fonte"
33 | TXT_DOCKER_INSTALL_SUCCESS="Docker instalado com sucesso"
34 | TXT_DOCKER_INSTALL_FAIL="A instalação do Docker falhou\nVocê pode tentar instalar o Docker usando um pacote offline. Consulte o link a seguir para obter etapas detalhadas de instalação: https://docs.1panel.hk/installation/"
35 | TXT_CHOOSE_LOWEST_LATENCY_SOURCE="Escolha a fonte com menor latência"
36 | TXT_CHOOSE_LOWEST_LATENCY_DELAY="Atraso (em segundos)"
37 | TXT_CANNOT_SELECT_SOURCE="Não foi possível selecionar a fonte para instalação"
38 | TXT_DOCKER_START_NOTICE="... iniciando Docker"
39 | TXT_DOCKER_COMPOSE_INSTALL_ONLINE="... Instalando Docker Compose online"
40 | TXT_DOCKER_COMPOSE_DOWNLOAD_FAIL="Falha ao baixar o Docker Compose, tente novamente mais tarde"
41 | TXT_DOCKER_COMPOSE_INSTALL_SUCCESS="Docker Compose instalado com sucesso"
42 | TXT_DOCKER_COMPOSE_INSTALL_FAIL="A instalação do Docker Compose falhou"
43 | TXT_LOWER_VERSION_DETECTED="Uma versão mais antiga do Docker Compose foi detectada (a versão deve ser maior ou igual a v2.0.0), deseja atualizar [y/n]: "
44 | TXT_DOCKER_COMPOSE_VERSION="Versão do Docker Compose"
45 | TXT_DOCKER_MAY_EFFECT_STORE="o que pode afetar o uso normal da App Store."
46 | TXT_DOCKER_COMPOSE_INSTALLED_SKIP="Docker Compose já está instalado, pulando etapa de instalação"
47 | TXT_SET_PANEL_PORT="Definir porta do 1Panel (o padrão é"
48 | TXT_INPUT_PORT_NUMBER="Erro: O número da porta inserido deve estar entre 1 e 65535"
49 | TXT_THE_PORT_U_SET="A porta que você definiu é:"
50 | TXT_PORT_OCCUPIED="Porta ocupada, por favor insira novamente..."
51 | TXT_FIREWALL_OPEN_PORT="Abrindo porta no firewall"
52 | TXT_FIREWALL_NOT_ACTIVE_SKIP="O firewall não está ativo, pulando abertura de porta"
53 | TXT_FIREWALL_NOT_ACTIVE_IGNORE="O firewall não está ativo, ignorando abertura de porta"
54 | TXT_SET_PANEL_ENTRANCE="Definir entrada segura do 1Panel (o padrão é"
55 | TXT_INPUT_ENTRANCE_RULE="Erro: A entrada segura do painel suporta apenas letras, números, sublinhados, com comprimento de 3-30 caracteres"
56 | TXT_YOUR_PANEL_ENTRANCE="A entrada segura do painel que você definiu é:"
57 | TXT_SET_PANEL_USER="Definir usuário do painel 1Panel (o padrão é"
58 | TXT_INPUT_USERNAME_RULE="Erro: O nome de usuário do painel suporta apenas letras, números, sublinhados, com comprimento de 3-30 caracteres"
59 | TXT_YOUR_PANEL_USERNAME="O usuário do painel que você definiu é:"
60 | TXT_SET_PANEL_PASSWORD="Definir senha do painel 1Panel, pressione Enter para continuar após definir (o padrão é"
61 | TXT_INPUT_PASSWORD_RULE="Erro: A senha do painel suporta apenas letras, números, caracteres especiais (!@#$%*_,.?), com comprimento de 8-30 caracteres"
62 | TXT_CONFIGURE_PANEL_SERVICE="Configurando o serviço 1Panel"
63 | TXT_START_PANEL_SERVICE="Iniciando o serviço 1Panel"
64 | TXT_SERVICE_RETRY_MSG="Falha ao iniciar o serviço, tentando novamente..."
65 | TXT_PANEL_SERVICE_START_SUCCESS="Serviço 1Panel iniciado com sucesso!"
66 | TXT_PANEL_SERVICE_START_ERROR="Erro ao iniciar o serviço 1Panel!"
67 | TXT_THANK_YOU_WAITING="================= Obrigado pela sua paciência, a instalação está completa =================="
68 | TXT_BROWSER_ACCESS_PANEL="Por favor, acesse o painel usando o navegador:"
69 | TXT_EXTERNAL_ADDRESS="Endereço externo:"
70 | TXT_INTERNAL_ADDRESS="Endereço interno:"
71 | TXT_PANEL_USER="Usuário do painel:"
72 | TXT_PANEL_PASSWORD="Senha do painel:"
73 | TXT_PROJECT_OFFICIAL_WEBSITE="Site oficial: https://1panel.hk"
74 | TXT_PROJECT_DOCUMENTATION="Documentação do projeto: https://docs.1panel.hk"
75 | TXT_PROJECT_REPOSITORY="Repositório de código: https://github.com/1Panel-dev/1Panel"
76 | TXT_COMMUNITY="Junte-se à comunidade do 1Panel no Discord para suporte e discussões: https://discord.gg/bUpUqWqdRr"
77 | TXT_OPEN_PORT_SECURITY_GROUP="Se você estiver usando um servidor em nuvem, por favor, abra a porta no grupo de segurança"
78 | TXT_REMEMBER_YOUR_PASSWORD="Para a segurança do seu servidor, você não poderá ver sua senha novamente após sair desta tela, por favor, lembre-se dela."
79 | TXT_PANEL_SERVICE_STATUS="Verificar status do serviço 1Panel"
80 | TXT_PANEL_SERVICE_RESTART="Reiniciar serviço 1Panel"
81 | TXT_PANEL_SERVICE_STOP="Parar serviço 1Panel"
82 | TXT_PANEL_SERVICE_START="Iniciar serviço 1Panel"
83 | TXT_PANEL_SERVICE_UNINSTALL="Desinstalar serviço 1Panel"
84 | TXT_PANEL_SERVICE_USER_INFO="Obter informações do usuário do 1Panel"
85 | TXT_PANEL_SERVICE_LISTEN_IP="Trocar IP de escuta do 1Panel"
86 | TXT_PANEL_SERVICE_VERSION="Obter informações da versão do 1Panel"
87 | TXT_PANEL_SERVICE_UPDATE="Atualizar sistema 1Panel"
88 | TXT_PANEL_SERVICE_RESET="Redefinir sistema 1Panel"
89 | TXT_PANEL_SERVICE_RESTORE="Restaurar sistema 1Panel"
90 | TXT_PANEL_SERVICE_UNINSTALL_NOTICE="A desinstalação irá limpar completamente os serviços e diretórios de dados do 1Panel. Deseja continuar? [y/n]"
91 | TXT_PANEL_SERVICE_UNINSTALL_START="Iniciando desinstalação do 1Panel"
92 | TXT_PANEL_SERVICE_UNINSTALL_STOP="Parando processo do serviço 1Panel..."
93 | TXT_PANEL_SERVICE_UNINSTALL_REMOVE="Excluindo serviço e diretórios de dados do 1Panel..."
94 | TXT_PANEL_SERVICE_UNINSTALL_REMOVE_CONFIG="Recarregando arquivos de configuração do serviço..."
95 | TXT_PANEL_SERVICE_UNINSTALL_REMOVE_SUCCESS="Desinstalação concluída!"
96 | TXT_PANEL_SERVICE_RESTORE_NOTICE="O 1Panel será restaurado para a última versão estável. Deseja continuar? [y/n]"
97 | TXT_PANEL_SERVICE_UNSUPPORTED_PARAMETER="Parâmetros não suportados, use help ou o parâmetro --help para obter ajuda"
98 | TXT_PANEL_CONTROL_SCRIPT="Script de controle do 1Panel"
99 | TXT_LANG_SELECTED_MSG="Idioma já selecionado:"
100 | TXT_LANG_PROMPT_MSG="Selecione um idioma:"
101 | TXT_LANG_CHOICE_MSG="Digite o número correspondente à sua escolha de idioma:"
102 | TXT_LANG_SELECTED_CONFIRM_MSG="Você selecionou:"
103 | TXT_LANG_INVALID_MSG="Seleção inválida. Padrão definido para Inglês (en)."
104 | TXT_LANG_NOT_FOUND_MSG="Arquivo de idioma não encontrado:"
105 |
--------------------------------------------------------------------------------
/lang/ru.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | TXT_START_INSTALLATION="======================= Начало установки ======================="
4 | TXT_RUN_AS_ROOT="Пожалуйста, запустите этот скрипт от имени root или с правами sudo"
5 | TXT_SUCCESS_MESSAGE="Успешно"
6 | TXT_SUCCESSFULLY_MESSAGE="Успешно выполнено"
7 | TXT_FAIELD_MESSAGE="Ошибка"
8 | TXT_IGNORE_MESSAGE="Пропустить"
9 | TXT_SKIP_MESSAGE="Пропустить"
10 | TXT_PANEL_ALREADY_INSTALLED="Панель управления 1Panel уже установлена, повторная установка невозможна"
11 | TXT_SET_INSTALL_DIR="Укажите директорию для установки 1Panel (по умолчанию /opt): "
12 | TXT_PROVIDE_FULL_PATH="Пожалуйста, укажите полный путь к директории"
13 | TXT_SELECTED_INSTALL_PATH="Выбранный путь установки"
14 | TXT_TIMEOUT_USE_DEFAULT_PATH="(Время ожидания истекло, используется путь по умолчанию /opt)"
15 | TXT_CREATE_NEW_CONFIG="Создание нового конфигурационного файла"
16 | TXT_ACCELERATION_CONFIG_ADDED="Конфигурация ускорения образов добавлена."
17 | TXT_ACCELERATION_CONFIG_NOT="Ускорение образов не настроено."
18 | TXT_ACCELERATION_CONFIG_ADD="Хотите настроить ускорение образов (y/n): "
19 | TXT_ACCELERATION_CONFIG_EXISTS="Конфигурационный файл уже существует, будет создана резервная копия: "
20 | TXT_RESTARTING_DOCKER="Перезапуск службы Docker..."
21 | TXT_DOCKER_RESTARTED="Служба Docker успешно перезапущена."
22 | TXT_DOCKER_INSTALL_ONLINE="... Установка Docker онлайн"
23 | TXT_ACCELERATOR_NOT_CONFIGURED="Ускорение образов не настроено."
24 | TXT_LOW_DOCKER_VERSION="Обнаружена версия Docker ниже 20.x. Рекомендуется обновить вручную во избежание ограничений функциональности."
25 | TXT_INSTALL_DOCKER_ONLINE="... Установка Docker онлайн"
26 | TXT_DOWNLOAD_DOCKER_SCRIPT_FAIL="Не удалось загрузить скрипт установки из"
27 | TXT_DOWNLOAD_DOCKER_SCRIPT="загрузка скрипта установки docker"
28 | TXT_DOWNLOAD_DOCKER_SCRIPT_SUCCESS="Docker загружен из"
29 | TXT_TRY_NEXT_LINK="пробуем следующую альтернативную ссылку"
30 | TXT_DOWNLOAD_FAIELD="Не удалось загрузить скрипт установки из"
31 | TXT_ALL_DOWNLOAD_ATTEMPTS_FAILED="Все попытки загрузки не удались. Попробуйте установить Docker вручную, выполнив следующую команду:"
32 | TXT_REGIONS_OTHER_THAN_CHINA="Нет необходимости менять источник"
33 | TXT_DOCKER_INSTALL_SUCCESS="Docker успешно установлен"
34 | TXT_DOCKER_INSTALL_FAIL="Установка Docker не удалась\nВы можете попробовать установить Docker, используя оффлайн-пакет, обратитесь к следующей ссылке для подробных инструкций: https://docs.1panel.hk/installation/"
35 | TXT_CHOOSE_LOWEST_LATENCY_SOURCE="Выберите источник с наименьшей задержкой"
36 | TXT_CHOOSE_LOWEST_LATENCY_DELAY="Задержка (в секундах)"
37 | TXT_CANNOT_SELECT_SOURCE="Невозможно выбрать источник для установки"
38 | TXT_DOCKER_START_NOTICE="... запуск docker"
39 | TXT_DOCKER_COMPOSE_INSTALL_ONLINE="... Установка Docker Compose онлайн"
40 | TXT_DOCKER_COMPOSE_DOWNLOAD_FAIL="Загрузка Docker Compose не удалась, попробуйте позже"
41 | TXT_DOCKER_COMPOSE_INSTALL_SUCCESS="Docker Compose успешно установлен"
42 | TXT_DOCKER_COMPOSE_INSTALL_FAIL="Установка Docker Compose не удалась"
43 | TXT_LOWER_VERSION_DETECTED="Обнаружена более старая версия Docker Compose (версия должна быть не ниже v2.0.0), хотите обновить [y/n] : "
44 | TXT_DOCKER_COMPOSE_VERSION="Версия Docker Compose"
45 | TXT_DOCKER_MAY_EFFECT_STORE="что может повлиять на нормальную работу App Store."
46 | TXT_DOCKER_COMPOSE_INSTALLED_SKIP="Docker Compose уже установлен, пропускаем этап установки"
47 | TXT_SET_PANEL_PORT="Установите порт 1Panel (по умолчанию"
48 | TXT_INPUT_PORT_NUMBER="Ошибка: Введенный номер порта должен быть от 1 до 65535"
49 | TXT_THE_PORT_U_SET="Установленный порт: "
50 | TXT_PORT_OCCUPIED="Порт занят, пожалуйста, введите другой..."
51 | TXT_FIREWALL_OPEN_PORT="Открытие порта в брандмауэре"
52 | TXT_FIREWALL_NOT_ACTIVE_SKIP="Брандмауэр не активен, пропускаем открытие порта"
53 | TXT_FIREWALL_NOT_ACTIVE_IGNORE="Брандмауэр не активен, игнорируем открытие порта"
54 | TXT_SET_PANEL_ENTRANCE="Установите безопасный вход 1Panel (по умолчанию"
55 | TXT_INPUT_ENTRANCE_RULE="Ошибка: Безопасный вход панели поддерживает только буквы, цифры, подчеркивания, длина 3-30 символов"
56 | TXT_YOUR_PANEL_ENTRANCE="Установленный безопасный вход панели"
57 | TXT_SET_PANEL_USER="Установите пользователя панели 1Panel (по умолчанию"
58 | TXT_INPUT_USERNAME_RULE="Ошибка: Имя пользователя панели поддерживает только буквы, цифры, подчеркивания, длина 3-30 символов"
59 | TXT_YOUR_PANEL_USERNAME="Установленное имя пользователя панели"
60 | TXT_SET_PANEL_PASSWORD="Установите пароль панели 1Panel, нажмите Enter после установки (по умолчанию"
61 | TXT_INPUT_PASSWORD_RULE="Ошибка: Пароль панели поддерживает только буквы, цифры, специальные символы (!@#$%*_,.?), длина 8-30 символов"
62 | TXT_CONFIGURE_PANEL_SERVICE="Настройка службы 1Panel"
63 | TXT_START_PANEL_SERVICE="Запуск службы 1Panel"
64 | TXT_SERVICE_RETRY_MSG="Ошибка запуска службы, повторная попытка..."
65 | TXT_PANEL_SERVICE_START_SUCCESS="Служба 1Panel успешно запущена!"
66 | TXT_PANEL_SERVICE_START_ERROR="Ошибка запуска службы 1Panel!"
67 | TXT_THANK_YOU_WAITING="=================Спасибо за ожидание, установка завершена=================="
68 | TXT_BROWSER_ACCESS_PANEL="Пожалуйста, войдите в панель через браузер:"
69 | TXT_EXTERNAL_ADDRESS="Внешний адрес:"
70 | TXT_INTERNAL_ADDRESS="Внутренний адрес:"
71 | TXT_PANEL_USER="Пользователь панели:"
72 | TXT_PANEL_PASSWORD="Пароль панели:"
73 | TXT_PROJECT_OFFICIAL_WEBSITE="Официальный сайт: https://1panel.hk"
74 | TXT_PROJECT_DOCUMENTATION="Документация проекта: https://docs.1panel.hk"
75 | TXT_PROJECT_REPOSITORY="Репозиторий кода: https://github.com/1Panel-dev/1Panel"
76 | TXT_COMMUNITY="Присоединяйтесь к сообществу 1Panel в Discord для поддержки и обсуждений: https://discord.gg/bUpUqWqdRr"
77 | TXT_OPEN_PORT_SECURITY_GROUP="Если вы используете облачный сервер, пожалуйста, откройте порт в группе безопасности"
78 | TXT_REMEMBER_YOUR_PASSWORD="Для безопасности вашего сервера вы не сможете увидеть свой пароль после выхода с этого экрана, пожалуйста, запомните ваш пароль."
79 | TXT_PANEL_SERVICE_STATUS="Проверить статус службы 1Panel"
80 | TXT_PANEL_SERVICE_RESTART="Перезапустить службу 1Panel"
81 | TXT_PANEL_SERVICE_STOP="Остановить службу 1Panel"
82 | TXT_PANEL_SERVICE_START="Запустить службу 1Panel"
83 | TXT_PANEL_SERVICE_UNINSTALL="Удалить службу 1Panel"
84 | TXT_PANEL_SERVICE_USER_INFO="Получить информацию о пользователе 1Panel"
85 | TXT_PANEL_SERVICE_LISTEN_IP="Переключить IP прослушивания 1Panel"
86 | TXT_PANEL_SERVICE_VERSION="Получить информацию о версии 1Panel"
87 | TXT_PANEL_SERVICE_UPDATE="Обновить систему 1Panel"
88 | TXT_PANEL_SERVICE_RESET="Сбросить систему 1Panel"
89 | TXT_PANEL_SERVICE_RESTORE="Восстановить систему 1Panel"
90 | TXT_PANEL_SERVICE_UNINSTALL_NOTICE="Удаление полностью очистит службы 1Panel и каталоги данных. Хотите продолжить? [y/n]"
91 | TXT_PANEL_SERVICE_UNINSTALL_START="Начало удаления 1Panel"
92 | TXT_PANEL_SERVICE_UNINSTALL_STOP="Остановка процесса службы 1Panel..."
93 | TXT_PANEL_SERVICE_UNINSTALL_REMOVE="Удаление службы 1Panel и каталогов данных..."
94 | TXT_PANEL_SERVICE_UNINSTALL_REMOVE_CONFIG="Перезагрузка конфигурационных файлов службы..."
95 | TXT_PANEL_SERVICE_UNINSTALL_REMOVE_SUCCESS="удаление завершено!"
96 | TXT_PANEL_SERVICE_RESTORE_NOTICE="1Panel будет восстановлен до последней стабильной версии. Хотите продолжить? [y/n]"
97 | TXT_PANEL_SERVICE_UNSUPPORTED_PARAMETER="Неподдерживаемые параметры, используйте help или --help для получения справки"
98 | TXT_PANEL_CONTROL_SCRIPT="Скрипт управления 1Panel"
99 | TXT_LANG_SELECTED_MSG="Язык уже выбран: "
100 | TXT_LANG_PROMPT_MSG="Выберите язык:"
101 | TXT_LANG_CHOICE_MSG="Введите номер, соответствующий вашему выбору языка: "
102 | TXT_LANG_SELECTED_CONFIRM_MSG="Вы выбрали: "
103 | TXT_LANG_INVALID_MSG="Неверный выбор. Используется английский язык (en) по умолчанию."
104 | TXT_LANG_NOT_FOUND_MSG="Языковой файл не найден:"
105 |
--------------------------------------------------------------------------------
/lang/zh.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | TXT_START_INSTALLATION="======================= 开始安装 ======================="
4 | TXT_RUN_AS_ROOT="请以root用户身份运行此脚本或使用sudo权限"
5 | TXT_SUCCESS_MESSAGE="成功"
6 | TXT_SUCCESSFULLY_MESSAGE="成功"
7 | TXT_FAIELD_MESSAGE="失败"
8 | TXT_IGNORE_MESSAGE="忽略"
9 | TXT_SKIP_MESSAGE="跳过"
10 | TXT_PANEL_ALREADY_INSTALLED="1Panel Linux服务器管理面板已经安装,请勿重复安装"
11 | TXT_SET_INSTALL_DIR="设置1Panel安装目录 (默认为/opt): "
12 | TXT_PROVIDE_FULL_PATH="请提供目录的完整路径"
13 | TXT_SELECTED_INSTALL_PATH="您选择的安装路径是"
14 | TXT_TIMEOUT_USE_DEFAULT_PATH="(超时设定,使用默认安装路径/opt)"
15 | TXT_CREATE_NEW_CONFIG="创建新配置文件"
16 | TXT_ACCELERATION_CONFIG_ADDED="已添加镜像加速配置。"
17 | TXT_ACCELERATION_CONFIG_NOT="未配置镜像加速。"
18 | TXT_ACCELERATION_CONFIG_ADD="是否要配置镜像加速 [y/n]: "
19 | TXT_ACCELERATION_CONFIG_EXISTS="配置文件已存在,我们将备份现有的配置文件到: "
20 | TXT_RESTARTING_DOCKER="正在重启Docker服务..."
21 | TXT_DOCKER_RESTARTED="Docker服务已成功重启。"
22 | TXT_DOCKER_INSTALL_ONLINE="... 在线安装Docker"
23 | TXT_ACCELERATOR_NOT_CONFIGURED="镜像加速未配置。"
24 | TXT_LOW_DOCKER_VERSION="检测到服务器Docker版本低于20.x,建议手动升级以避免功能受限。"
25 | TXT_INSTALL_DOCKER_ONLINE="... 在线安装Docker"
26 | TXT_DOWNLOAD_DOCKER_SCRIPT_FAIL="下载安装脚本失败"
27 | TXT_DOWNLOAD_DOCKER_SCRIPT="正在下载Docker安装脚本"
28 | TXT_DOWNLOAD_DOCKER_SCRIPT_SUCCESS="已成功下载Docker安装脚本"
29 | TXT_TRY_NEXT_LINK="尝试下一个备用链接"
30 | TXT_DOWNLOAD_FAIELD="下载安装脚本失败"
31 | TXT_ALL_DOWNLOAD_ATTEMPTS_FAILED="所有下载尝试均已失败。您可以尝试通过运行以下命令手动安装Docker: "
32 | TXT_REGIONS_OTHER_THAN_CHINA="无需更改源"
33 | TXT_DOCKER_INSTALL_SUCCESS="Docker安装成功"
34 | TXT_DOCKER_INSTALL_FAIL="Docker安装失败\n您可以尝试使用离线包安装Docker,详细安装步骤请参见以下链接: https://1panel.cn/docs/installation/package_installation/"
35 | TXT_CHOOSE_LOWEST_LATENCY_SOURCE="选择延迟最低的源"
36 | TXT_CHOOSE_LOWEST_LATENCY_DELAY="延迟(秒)"
37 | TXT_CANNOT_SELECT_SOURCE="无法选择安装源"
38 | TXT_DOCKER_START_NOTICE="... 启动Docker"
39 | TXT_DOCKER_COMPOSE_INSTALL_ONLINE="... 在线安装Docker Compose"
40 | TXT_DOCKER_COMPOSE_DOWNLOAD_FAIL="Docker Compose下载失败,请稍后重试"
41 | TXT_DOCKER_COMPOSE_INSTALL_SUCCESS="Docker Compose安装成功"
42 | TXT_DOCKER_COMPOSE_INSTALL_FAIL="Docker Compose安装失败"
43 | TXT_LOWER_VERSION_DETECTED="检测到较低版本的Docker Compose (版本必须大于或等于v2.0.0),是否要升级[y/n]: "
44 | TXT_DOCKER_COMPOSE_VERSION="Docker Compose版本"
45 | TXT_DOCKER_MAY_EFFECT_STORE="这可能会影响App Store的正常使用。"
46 | TXT_DOCKER_COMPOSE_INSTALLED_SKIP="Docker Compose已安装,跳过安装步骤"
47 | TXT_SET_PANEL_PORT="设置1Panel端口 (默认是"
48 | TXT_INPUT_PORT_NUMBER="错误: 输入的端口号必须在1到65535之间"
49 | TXT_THE_PORT_U_SET="您设置的端口是: "
50 | TXT_PORT_OCCUPIED="端口被占用,请重新输入..."
51 | TXT_FIREWALL_OPEN_PORT="正在打开防火墙端口"
52 | TXT_FIREWALL_NOT_ACTIVE_SKIP="防火墙未激活,跳过端口打开"
53 | TXT_FIREWALL_NOT_ACTIVE_IGNORE="防火墙未激活,忽略端口打开"
54 | TXT_SET_PANEL_ENTRANCE="设置1Panel安全入口 (默认是"
55 | TXT_INPUT_ENTRANCE_RULE="错误: 面板安全入口仅支持字母、数字、下划线,长度为3-30个字符"
56 | TXT_YOUR_PANEL_ENTRANCE="您设置的面板安全入口是"
57 | TXT_SET_PANEL_USER="设置1Panel面板用户 (默认是"
58 | TXT_INPUT_USERNAME_RULE="错误: 面板用户仅支持字母、数字、下划线,长度为3-30个字符"
59 | TXT_YOUR_PANEL_USERNAME="您设置的面板用户是"
60 | TXT_SET_PANEL_PASSWORD="设置1Panel面板密码,设置后按回车键继续 (默认是"
61 | TXT_INPUT_PASSWORD_RULE="错误: 面板密码仅支持字母、数字、特殊字符(!@#$%*_,.?),长度为8-30个字符"
62 | TXT_CONFIGURE_PANEL_SERVICE="正在配置1Panel服务"
63 | TXT_START_PANEL_SERVICE="正在启动1Panel服务"
64 | TXT_SERVICE_RETRY_MSG="服务启动失败,重试中..."
65 | TXT_PANEL_SERVICE_START_SUCCESS="1Panel服务已成功启动!"
66 | TXT_PANEL_SERVICE_START_ERROR="启动1Panel服务时出错!"
67 | TXT_THANK_YOU_WAITING="=================感谢您的耐心等待,安装已完成=================="
68 | TXT_BROWSER_ACCESS_PANEL="请使用您的浏览器访问面板: "
69 | TXT_EXTERNAL_ADDRESS="外部地址: "
70 | TXT_INTERNAL_ADDRESS="内部地址: "
71 | TXT_PANEL_USER="面板用户: "
72 | TXT_PANEL_PASSWORD="面板密码: "
73 | TXT_PROJECT_OFFICIAL_WEBSITE="官方网站: https://1panel.cn"
74 | TXT_PROJECT_DOCUMENTATION="项目文档: https://1panel.cn/docs"
75 | TXT_PROJECT_REPOSITORY="代码仓库: https://github.com/1Panel-dev/1Panel"
76 | TXT_COMMUNITY="前往 1Panel 官方论坛获取帮助: https://bbs.fit2cloud.com/c/1p/7"
77 | TXT_OPEN_PORT_SECURITY_GROUP="如果您使用的是云服务器,请在安全组中打开端口"
78 | TXT_REMEMBER_YOUR_PASSWORD="为了您的服务器安全,离开此屏幕后您将无法再次看到您的密码,请记住您的密码。"
79 | TXT_PANEL_SERVICE_STATUS="检查 1Panel 服务状态"
80 | TXT_PANEL_SERVICE_RESTART="重启 1Panel 服务"
81 | TXT_PANEL_SERVICE_STOP="停止 1Panel 服务"
82 | TXT_PANEL_SERVICE_START="启动 1Panel 服务"
83 | TXT_PANEL_SERVICE_UNINSTALL="卸载 1Panel 服务"
84 | TXT_PANEL_SERVICE_USER_INFO="获取 1Panel 用户信息"
85 | TXT_PANEL_SERVICE_LISTEN_IP="切换 1Panel 监听 IP"
86 | TXT_PANEL_SERVICE_VERSION="查看 1Panel 版本信息"
87 | TXT_PANEL_SERVICE_UPDATE="修改 1Panel 系统信息"
88 | TXT_PANEL_SERVICE_RESET="重置 1Panel 系统信息"
89 | TXT_PANEL_SERVICE_RESTORE="恢复 1Panel 服务及数据"
90 | TXT_PANEL_SERVICE_UNINSTALL_NOTICE="卸载将会完全清除 1Panel 服务和数据目录,是否继续[y/n] "
91 | TXT_PANEL_SERVICE_UNINSTALL_START="开始卸载 1Panel Linux 服务器运维管理面板"
92 | TXT_PANEL_SERVICE_UNINSTALL_STOP="停止 1Panel 服务进程..."
93 | TXT_PANEL_SERVICE_UNINSTALL_REMOVE="删除 1Panel 服务和数据目录..."
94 | TXT_PANEL_SERVICE_UNINSTALL_REMOVE_CONFIG="重新加载服务配置文件..."
95 | TXT_PANEL_SERVICE_UNINSTALL_REMOVE_SUCCESS="卸载完成!"
96 | TXT_PANEL_SERVICE_RESTORE_NOTICE="1Panel 将会恢复至上一个稳定版本,是否继续 [y/n] "
97 | TXT_PANEL_SERVICE_UNSUPPORTED_PARAMETER="不支持的参数,请使用 help 或 --help 参数获取帮助"
98 | TXT_PANEL_CONTROL_SCRIPT="1Panel 控制脚本"
99 | TXT_LANG_SELECTED_MSG="已选择语言: "
100 | TXT_LANG_PROMPT_MSG="请选择一种语言: "
101 | TXT_LANG_CHOICE_MSG="请输入与您的语言对应的数字: "
102 | TXT_LANG_SELECTED_CONFIRM_MSG="您选择了: "
103 | TXT_LANG_INVALID_MSG="无效的选择,默认切换为英语。"
104 | TXT_LANG_NOT_FOUND_MSG="未找到语言文件: "
105 |
--------------------------------------------------------------------------------
/quick_start.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #Install Latest Stable 1Panel Release
3 | #新增安装版本选择:官方版本和wrt1panel仓库版本,检测opkg命令是否存在以判断;
4 |
5 | WRT_URL="https://github.com/gcsong023/wrt1panel/releases"
6 | BASE_URL="https://resource.fit2cloud.com/1panel/package"
7 |
8 | # 使用 uname -m 来直接获取系统架构
9 | function get_architecture() {
10 | case $(uname -m) in
11 | x86_64) echo "amd64";;
12 | aarch64|aarm64) echo "arm64";;
13 | armv7l) echo "armv7";;
14 | ppc64le) echo "ppc64le";;
15 | s390x) echo "s390x";;
16 | *) echo "暂不支持的系统架构,请参阅官方文档,选择受支持的系统。"; exit 1;;
17 | esac
18 | }
19 |
20 | function check_version() {
21 | local attempt=0
22 | local DEFAULT_BRANCH="${1}"
23 | local INSTALL_MODE="${2}"
24 | local MINIMUM_WAIT_TIME=5 # 最小尝试间隔时间
25 | local MAX_ATTEMPTS=5 # 最大尝试次数
26 |
27 | # 尝试获取最新版本
28 | until [[ "${attempt}" -ge "${MAX_ATTEMPTS}" ]]; do
29 | ((attempt++))
30 | if [[ "${attempt}" -gt 1 ]]; then
31 | # 如果不是第一次尝试,在尝试之间加入等待时间
32 | sleep "${MINIMUM_WAIT_TIME}"
33 | fi
34 | echo "尝试获取最新版本(第${attempt}次)..."
35 | case $DEFAULT_BRANCH in
36 | 1)
37 | VERSION=$(curl -s https://api.github.com/repos/gcsong023/wrt1panel/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
38 | ;;
39 | 2)
40 | VERSION=$(curl -s "${BASE_URL}/${INSTALL_MODE}/latest")
41 | ;;
42 | esac
43 | # 检查VERSION是否被成功获取
44 | if [[ "x${VERSION}" == "x" ]];then
45 | echo "当前尝试获取最新版本失败,${MINIMUM_WAIT_TIME}秒后下一尝试..."
46 | else
47 | echo "成功获取最新版本: ${VERSION}"
48 | break
49 | fi
50 | done
51 |
52 | if [[ "x${VERSION}" == "x" ]];then
53 | echo "无法获取最新版本,请检查网络环境或稍候重试"
54 | exit 1
55 | fi
56 | }
57 |
58 | function prepare_download_urls() {
59 | local install_mode="$1"
60 | local version="$2"
61 | local architecture="$3"
62 | # 根据 install_mode 构建正确的 URL
63 | case $install_mode in
64 | download)
65 | hash_file_url="${WRT_URL}/${install_mode}/${version}/checksums.txt"
66 | package_file_name="1panel-${version}-linux-${architecture}.tar.gz"
67 | package_download_url="${WRT_URL}/${install_mode}/${version}/${package_file_name}"
68 | ;;
69 | stable)
70 | hash_file_url="${BASE_URL}/${install_mode}/${version}/release/checksums.txt"
71 | package_file_name="1panel-${version}-linux-${architecture}.tar.gz"
72 | package_download_url="${BASE_URL}/${install_mode}/${version}/release/${package_file_name}"
73 | ;;
74 | esac
75 | }
76 |
77 | download_file() {
78 | local file_url=$1
79 | local file_name=$2
80 | # echo "正在下载: $file_url"
81 | curl -SL --fail --retry 3 --output "$file_name" "$file_url"
82 | if [ $? -ne 0 ]; then
83 | echo "下载失败,请检查网络或稍候重试..."
84 | exit 1
85 | fi
86 | }
87 |
88 | function select_branch() {
89 | local attempt=0
90 | local MINIMUM_WAIT_TIME=2 # 最小尝试间隔时间
91 | local MAX_ATTEMPTS=5 # 最大尝试次数
92 | DEFAULT_BRANCH="2"
93 | # local architecture="unknown"
94 | # local version="unknown"
95 | if [ -z "$architecture" ]; then
96 | architecture=$(get_architecture)
97 | fi
98 | # 检查 opkg 命令是否存在
99 | if command -v opkg &> /dev/null; then
100 | DEFAULT_BRANCH="1"
101 | fi
102 | # 设置8秒超时,用户未输入则使用默认值
103 | echo "请选择安装分支..."
104 | echo "1.wrt1panel仓库最新版"
105 | echo "2.1panel最新版"
106 | select_timeout=5
107 | until [[ "${attempt}" -ge "${MAX_ATTEMPTS}" ]]; do
108 | ((attempt++))
109 | # 等待用户输入
110 | read -t "$select_timeout" -p "当前默认选择为${DEFAULT_BRANCH}(确认请回车): " BRANCH
111 | BRANCH=${BRANCH:-$DEFAULT_BRANCH}
112 | # 如果用户输入了无效的选项,则重新选择
113 | if ! [[ "${BRANCH}" =~ ^[12]$ ]]; then
114 | echo "无效的输入,请重新输入..."
115 | echo "或按Ctrl+C退出安装..."
116 | sleep "${MINIMUM_WAIT_TIME}"
117 | else
118 | BRANCH=${BRANCH:-$DEFAULT_BRANCH}
119 | break
120 | fi
121 | done
122 |
123 | case $BRANCH in
124 | 1)
125 | install_mode="download"
126 | check_version "$BRANCH" "$install_mode"
127 | echo "当前安装版本为wrt1panel仓库最新版:${VERSION}"
128 | prepare_download_urls "$install_mode" "$VERSION" "$architecture"
129 | ;;
130 | 2)
131 | install_mode="stable"
132 | check_version "$BRANCH" "$install_mode"
133 | echo "当前安装版本为1panel最新版:${VERSION}"
134 | prepare_download_urls "$install_mode" "$VERSION" "$architecture"
135 | ;;
136 | esac
137 | }
138 |
139 | function package_verify() {
140 | if [ ! -f "$package_file_name" ]; then
141 | echo "开始下载${VERSION} 安装包..."
142 | # echo "安装包下载地址: ${package_download_url}"
143 | download_file "$package_download_url" "$package_file_name"
144 | else
145 | # echo "已存在安装包,检查哈希值..."
146 | actual_hash=$(sha256sum "$package_file_name" | awk '{print $1}')
147 | expected_hash=$(curl -sSL "$hash_file_url" | grep "$package_file_name" | awk '{print $1}')
148 | if [[ "$expected_hash" == "$actual_hash" ]]; then
149 | echo "安装包已存在且哈希值匹配,跳过下载"
150 | else
151 | echo "已存在安装包,但是哈希值不一致,开始重新下载"
152 | rm -f "$package_file_name"
153 | download_file "$package_download_url" "$package_file_name"
154 | fi
155 | fi
156 | }
157 | function install_panel() {
158 | tar zxvf "$package_file_name"
159 | cd "1panel-${VERSION}-linux-${architecture}"
160 | if [ "$BRANCH" == "2" ]; then
161 | download_file https://raw.githubusercontent.com/gcsong023/wrt_installer/1panel/install.sh install.sh
162 | download_file https://raw.githubusercontent.com/gcsong023/wrt_installer/1panel/1pctl 1pctl
163 | sed -i "s/ORIGINAL_VERSION=version/ORIGINAL_VERSION=${VERSION}/g" 1pctl
164 | fi
165 | chmod +x install.sh && chmod +x 1panel && chmod +x 1pctl
166 | /bin/bash install.sh
167 | exit 0
168 | }
169 | # 主流程
170 | select_branch
171 | package_verify
172 | install_panel
173 |
--------------------------------------------------------------------------------