├── .cspell
└── custom-dictionary-workspace.txt
├── .github
├── FUNDING.yml
├── ISSUE_TEMPLATE
│ ├── bug_report.yml
│ └── feature_request.md
├── filebrowser-cloudflared.png
└── jellyseerr.png
├── .vscode
└── settings.json
├── LICENSE
├── README.md
├── audiobookshelf.sh
├── autobrr.sh
├── brew.sh
├── cloudflared.sh
├── cross-seed.sh
├── filebrowser.sh
├── guestftp.sh
├── jellyseerr.sh
├── komga.sh
├── lidarr.sh
├── lounge.sh
├── microsocks.sh
├── migration.sh
├── motd
├── .hostingby.design.sh
└── .swizzin.net.sh
├── mylar3.sh
├── ngpost.sh
├── overseerr.sh
├── prowlarr.sh
├── qbit_manage.sh
├── race-ready.sh
├── radarr4k.sh
├── readarr.sh
├── recyclarr.sh
├── requestrr.sh
├── sonarr4k.sh
├── subsonic.sh
├── tailscale.sh
├── unpackerr.sh
└── whisparr.sh
/.cspell/custom-dictionary-workspace.txt:
--------------------------------------------------------------------------------
1 | # Custom Dictionary Words
2 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | github: brettpetch
2 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.yml:
--------------------------------------------------------------------------------
1 | name: Bug Report
2 | description: Report broken functionality of the swizzin toolset
3 | title: "[BUG] "
4 | labels: [bug]
5 | body:
6 | - type: markdown
7 | attributes:
8 | value: |
9 | Thanks for reporting bugs to us. Please make sure you've ran `box update` before, and that you checked that your issue is not covered in the [Documentation](https://swizzin.ltd)
10 | - type: textarea
11 | id: what-happened
12 | attributes:
13 | label: What happened?
14 | description: Also tell us, what did you expect to happen?
15 | value: |
16 | Steps to reproduce:
17 |
18 | 1. Install package '...'
19 | 2. Go to '....'
20 | 3. Error '...'
21 |
22 | Expected results:
23 |
24 | validations:
25 | required: true
26 | - type: textarea
27 | id: logs
28 | attributes:
29 | label: Relevant logs and output
30 | description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
31 | render: plaintext
32 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Is your feature request related to a problem? Please describe.**
11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12 |
13 | **Describe the solution you'd like**
14 | A clear and concise description of what you want to happen.
15 |
16 | **Describe alternatives you've considered**
17 | A clear and concise description of any alternative solutions or features you've considered.
18 |
19 | **Additional context**
20 | Add any other context or screenshots about the feature request here.
21 |
--------------------------------------------------------------------------------
/.github/filebrowser-cloudflared.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brettpetch/hosted-scripts/363a95ebfa4ccf76f15f8175fcc15cdefd58dba7/.github/filebrowser-cloudflared.png
--------------------------------------------------------------------------------
/.github/jellyseerr.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brettpetch/hosted-scripts/363a95ebfa4ccf76f15f8175fcc15cdefd58dba7/.github/jellyseerr.png
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "cSpell.customDictionaries": {
3 | "custom-dictionary-workspace": {
4 | "name": "custom-dictionary-workspace",
5 | "path": "${workspaceFolder:hosted-scripts}/.cspell/custom-dictionary-workspace.txt",
6 | "addWords": true,
7 | "scope": "workspace"
8 | }
9 | }
10 | }
--------------------------------------------------------------------------------
/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 | # Hosted Scripts
2 |
3 | This repo is a helper repo for Swizzin.net & HostingBy.Design appboxes. Here you will find additional scripts for installing frequently requested software that hasn't been baked into the real deal yet. Think of this as a beta of a beta. Some stuff might not work, but it's better than nothing at all. Some apps can have authentication configured by us, some can't. Some have no baseurl support, so we just run it on the port. There are no warranties for these scripts. You get whatever is here with no support guaranteed whatsoever.
4 |
5 | ## DO NOT RUN THESE SCRIPTS ON DEDICATED SERVERS!
6 | You should not run these scripts on servers running Swizzin Community Edition. This is meant for HostingBy.Design AppRange and Swizzin.net customers. If you DO NOT HAVE root on the server in question, you may consider using these. If you DO HAVE ROOT, please just yell in one of the Swizzin / HostingBy.Design support channels until I show up.
7 |
8 | This script makes major modifications to how node is installed for some applications. It can break apps that are run in userland that require node.
9 |
10 | ## Install
11 | If you actually want all this stuff, you can grab the repository by doing
12 |
13 | ### The Whole Enchilada
14 | ```bash
15 | mkdir -p $HOME/scripts/
16 | git clone https://github.com/brettpetch/hosted-scripts.git $HOME/scripts/hosted-scripts
17 | ```
18 |
19 | ### Just a Slice
20 | ```bash
21 | bash <(curl -sL "https://github.com/brettpetch/hosted-scripts/raw/master/scriptname.sh")
22 | ```
23 |
24 | ## Updates
25 |
26 | ```bash
27 | git -C $HOME/scripts/hosted-scripts pull
28 | ```
29 |
30 | ## Development
31 | Do you think you can do it better? Go nuts. PRs are welcome. Please ensure your permissions are set to 755 on commit.
32 |
33 | ## Support
34 | These scripts **come with no support**. If you have questions, feel free to ask them in their respective discords (dependant on vendor). Remember to respect the rules of the vendors in their discords and be respectful to community members lending their assistance.
35 |
36 | ### For Swizzin.net Customers:
37 |
38 | [Discord](https://discord.gg/2esbu2N)
39 |
40 | [Documentation](https://docs.swizzin.net)
41 |
42 | [Affiliate Link](https://clients.swizzin.net/aff.php?aff=33)
43 |
44 | ### For HostingBy.Design Customers:
45 |
46 | [Discord](https://discord.gg/wv67teS)
47 |
48 | [Documentation](https://docs.hostingby.design/)
49 |
50 | [Affiliate Link](https://my.hostingby.design/aff.php?aff=1119)
51 |
--------------------------------------------------------------------------------
/audiobookshelf.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Installer modified by TL27
3 |
4 | user=$(whoami)
5 | BASE_DIR="${HOME}/.config/audiobookshelf"
6 |
7 | if [[ ! -d $HOME/.logs ]]; then
8 | mkdir -p $HOME/.logs
9 | fi
10 |
11 | touch "$HOME/.logs/audiobookshelf.log"
12 | log="$HOME/.logs/audiobookshelf.log"
13 |
14 | function port() {
15 | LOW_BOUND=$1
16 | UPPER_BOUND=$2
17 | comm -23 <(seq ${LOW_BOUND} ${UPPER_BOUND} | sort) <(ss -Htan | awk '{print $4}' | cut -d':' -f2 | sort -u) | shuf | head -n 1
18 | }
19 |
20 | function github_latest_version() {
21 | # Argument expects the author/repo format
22 | # e.g. swizzin/swizzin
23 | repo=$1
24 | curl -fsSLI -o /dev/null -w %{url_effective} https://github.com/${repo}/releases/latest | grep -o '[^/]*$'
25 | }
26 |
27 | function audiobookshelf_install() {
28 | declare -a paths
29 | paths[1]="$BASE_DIR/ffmpeg"
30 | paths[2]="${HOME}/.config/systemd/user"
31 | paths[3]="${HOME}/bin"
32 | paths[4]="$BASE_DIR/tmp"
33 |
34 | for i in {1..4}; do
35 | if [ ! -d "${paths[${i}]}" ]; then
36 | mkdir -p "${paths[${i}]}"
37 | fi
38 | done
39 |
40 | ssl_port=$(port 14000 16000)
41 | port=$(port 10000 14000)
42 | domain=$(hostname -f)
43 |
44 | echo "Downloading Audiobookshelf..."
45 | mkdir -p "${HOME}/tmp/audiobookshelf" && cd "${HOME}/tmp/audiobookshelf"
46 | version=$(github_latest_version advplyr/audiobookshelf)
47 |
48 | wget -qO audiobookshelf.deb "https://github.com/advplyr/audiobookshelf-ppa/blob/master/audiobookshelf_${version//v/}_amd64.deb?raw=true" || {
49 | echo "Download failed."
50 | exit 1
51 | }
52 |
53 | ar x audiobookshelf.deb data.tar.xz
54 | tar xf data.tar.xz
55 | cp usr/share/audiobookshelf/audiobookshelf "$BASE_DIR"
56 | cd "${HOME}" && rm -rf "${HOME}/tmp"
57 | echo
58 | echo "Getting latest version of audiobookshelf-ffmpeg..."
59 | mkdir -p "${HOME}/.audiobookshelf-ffmpeg-tmp" && cd "${HOME}/.audiobookshelf-ffmpeg-tmp"
60 | rm -rf "$BASE_DIR/ffmpeg/*"
61 | wget -qO ffmpeg.tar.xz "https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-amd64-static.tar.xz" || {
62 | echo "Failed to get latest release of audiobookshelf-ffmpeg." && exit 1
63 | }
64 |
65 | tar xf ffmpeg.tar.xz -C "$BASE_DIR/ffmpeg" --strip-components 1
66 | echo
67 | echo "Getting latest version of audiobookshelf-ffmpeg-tone..."
68 | $((curl -s https://github.com/sandreas/tone | grep -om1 .*linux-x64.tar.gz) | sed s'/wget/wget -qO tone.tar.gz/g')
69 | tar xf tone.tar.gz -C "$BASE_DIR/ffmpeg" --strip-components 1
70 |
71 | cd "${HOME}" && rm -rf "${HOME}/.audiobookshelf-ffmpeg-tmp"
72 | echo
73 |
74 | if [[ ! -d $HOME/.config/systemd/user/ ]]; then
75 | mkdir -p $HOME/.config/systemd/user/
76 | fi
77 |
78 | echo "create systemd userservice"
79 |
80 | cat > "$HOME/.config/systemd/user/audiobookshelf.service" << EOF
81 |
82 | [Unit]
83 | Description=Self-hosted audiobook server for managing and playing audiobooks
84 |
85 | [Service]
86 | Type=simple
87 | Environment=SOURCE=local
88 | Environment=PORT=${port}
89 | Environment=TMPDIR=$BASE_DIR/tmp
90 | Environment=CONFIG_PATH=$BASE_DIR/config
91 | Environment=METADATA_PATH=$BASE_DIR/metadata
92 | Environment=FFMPEG_PATH=$BASE_DIR/ffmpeg/ffmpeg
93 | Environment=FFPROBE_PATH=$BASE_DIR/ffmpeg/ffprobe
94 | Environment=TONE_PATH=$BASE_DIR/ffmpeg/tone
95 | WorkingDirectory=$BASE_DIR
96 | ExecStart=$BASE_DIR/audiobookshelf
97 | ExecReload=/bin/kill -HUP \$MAINPID
98 | Restart=always
99 |
100 | [Install]
101 | WantedBy=default.target
102 | EOF
103 |
104 | echo "Starting Audiobookshelf"
105 | systemctl enable --now --user audiobookshelf.service
106 | echo
107 | echo "================================"
108 | echo "Audiobookshelf will be accessible at $(tput setaf 2)http://${domain}:${port}$(tput sgr0)"
109 | echo "================================"
110 | echo
111 | echo "Your library paths have to be entered manually as the File Browser function does not work on non-docker installs."
112 | echo "Click where it says $(tput setaf 4)New folder path$(tput sgr0)."
113 | echo "Your path MUST start with $(tput setaf 2)$(pwd -P)/$(tput sgr0) followed with with path to your audio books. e.g. $(tput setaf 2)$(pwd -P)/media/AudioBooks$(tput sgr0)"
114 | echo "Then TAB out of the field and click on $(tput setaf 4)Create $(tput sgr0)"
115 |
116 | }
117 |
118 | function _remove() {
119 | echo
120 | echo "Uninstalling audiobookshelf.."
121 | if systemctl --user is-enabled --quiet "audiobookshelf.service" || [ -f "${HOME}/.config/systemd/user/audiobookshelf.service" ]; then
122 | systemctl --user stop audiobookshelf.service
123 | systemctl --user disable audiobookshelf.service
124 | fi
125 |
126 | rm -f "${HOME}/.config/systemd/user/audiobookshelf.service"
127 | systemctl --user daemon-reload
128 | systemctl --user reset-failed
129 | rm -rf "${HOME}/.config/audiobookshelf"
130 | rm -rf "${HOME}/bin"/audiobookshelf*
131 | echo
132 | echo "Uninstallation Complete."
133 | }
134 |
135 | echo 'This is unsupported software. You will not get help with this, please answer `yes` if you understand and wish to proceed'
136 | if [[ -z ${eula} ]]; then
137 | read -r eula
138 | fi
139 |
140 | if ! [[ $eula =~ yes ]]; then
141 | echo "You did not accept the above. Exiting..."
142 | exit 1
143 | else
144 | echo "Proceeding with installation"
145 | fi
146 |
147 | echo "Welcome to Audiobookshelf installer..."
148 | echo "Logs are stored at ${log}"
149 | echo ""
150 | echo "What do you like to do?"
151 | echo ""
152 | echo "install = Install Audiobookshelf"
153 | echo "uninstall = Completely removes Audiobookshelf"
154 | echo "exit = Exits Installer"
155 | echo ""
156 |
157 |
158 | while true; do
159 | read -r -p "Enter it here: " choice
160 | case $choice in
161 | "install")
162 | audiobookshelf_install
163 | break
164 | ;;
165 | "uninstall")
166 | _remove
167 | break
168 | ;;
169 | "exit")
170 | break
171 | ;;
172 | *)
173 | echo "Unknown Option."
174 | ;;
175 | esac
176 | done
177 | exit
--------------------------------------------------------------------------------
/autobrr.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Refactored Swizzin version from Ze0s
3 | user=$(whoami)
4 | mkdir -p "$HOME/.logs/"
5 | export log="$HOME/.logs/autobrr.log"
6 | touch "$log"
7 |
8 | function port() {
9 | LOW_BOUND=$1
10 | UPPER_BOUND=$2
11 | comm -23 <(seq ${LOW_BOUND} ${UPPER_BOUND} | sort) <(ss -Htan | awk '{print $4}' | cut -d':' -f2 | sort -u) | shuf | head -n 1
12 | }
13 |
14 | function autobrr_download_latest() {
15 | echo "Downloading autobrr release archive"
16 |
17 | case "$(dpkg --print-architecture)" in
18 | "amd64") arch='x86_64' ;;
19 | "arm64") arch="arm64" ;;
20 | "armhf") arch="armv6" ;;
21 | *)
22 | echo "Arch not supported"
23 | exit 1
24 | ;;
25 | esac
26 |
27 | latest=$(curl -sL https://api.github.com/repos/autobrr/autobrr/releases/latest | grep "linux_$arch" | grep browser_download_url | cut -d \" -f4) || {
28 | echo "Failed to query GitHub for latest version"
29 | exit 1
30 | }
31 |
32 | mkdir -p "$HOME/.tmp/"
33 |
34 | if ! curl "$latest" -L -o "$HOME/.tmp/autobrr.tar.gz" >> "$log" 2>&1; then
35 | echo "Download failed, exiting"
36 | exit 1
37 | fi
38 | echo "Archive downloaded"
39 |
40 | echo "Extracting archive"
41 | mkdir -p "$HOME/.local/bin/"
42 | # the archive contains both autobrr and autobrrctl to easily setup the user
43 | tar xfv "$HOME/.tmp/autobrr.tar.gz" --directory "$HOME/.local/bin/" >> "$log" 2>&1 || {
44 | echo "Failed to extract"
45 | exit 1
46 | }
47 | rm -rf "$HOME/.tmp/autobrr.tar.gz"
48 | echo "Archive extracted"
49 | }
50 |
51 | _systemd() {
52 | type=simple
53 |
54 | if [[ $(systemctl --version | awk 'NR==1 {print $2}') -ge 240 ]]; then
55 | type=exec
56 | fi
57 | echo "Installing Systemd service"
58 | mkdir -p "$HOME/.config/systemd/user/"
59 | cat > "$HOME/.config/systemd/user/autobrr.service" << EOF
60 | [Unit]
61 | Description=autobrr service
62 | After=syslog.target network.target
63 | [Service]
64 | Type=${type}
65 | ExecStart=$HOME/.local/bin/autobrr --config=$HOME/.config/autobrr/
66 | [Install]
67 | WantedBy=default.target
68 | EOF
69 | echo "Service installed"
70 | }
71 |
72 | function _add_user {
73 | port=$(port 10000 12000)
74 | # generate a sessionSecret
75 | sessionSecret="$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c16)"
76 |
77 | mkdir -p "$HOME/.config/autobrr/"
78 | cat > "$HOME/.config/autobrr/config.toml" << CFG
79 | # config.toml
80 | # Hostname / IP
81 | #
82 | # Default: "localhost"
83 | #
84 | host = "0.0.0.0"
85 | # Port
86 | #
87 | # Default: 8989
88 | #
89 | port = ${port}
90 | # Base url
91 | # Set custom baseUrl eg /autobrr/ to serve in subdirectory.
92 | # Not needed for subdomain, or by accessing with the :port directly.
93 | #
94 | # Optional
95 | #
96 | # baseUrl = "/autobrr/"
97 | # autobrr logs file
98 | # If not defined, logs to stdout
99 | #
100 | # Optional
101 | #
102 | logPath = "$HOME/.config/autobrr/logs/autobrr.log"
103 | # Log level
104 | #
105 | # Default: "DEBUG"
106 | #
107 | # Options: "ERROR", "DEBUG", "INFO", "WARN"
108 | #
109 | logLevel = "DEBUG"
110 | # Session secret
111 | #
112 | sessionSecret = "${sessionSecret}"
113 | CFG
114 | read -rep "Please set a password for your autobrr user ${user}> " password
115 | echo "${password}" | "$HOME/.local/bin/autobrrctl" --config "$HOME/.config/autobrr" create-user "$user" || {
116 | echo "Failed to execute autobrrctl command"
117 | exit 1
118 | }
119 | systemctl --user enable --now autobrr 2>&1 | tee -a "${log}"
120 | touch "$HOME/.install/.autobrr.lock"
121 | echo "autobrr is now installed and running at http://$(hostname -f):${port}/" | tee -a "${log}"
122 | }
123 |
124 | function _remove(){
125 | if [[ ! -f $HOME/.install/.autobrr.lock ]]; then
126 | echo "Autobrr not installed!"
127 | exit 1
128 | fi
129 | systemctl stop --user autobrr
130 | systemctl disable --user autobrr
131 | rm "$HOME/.config/systemd/user/autobrr.service"
132 | rm -rf "$HOME/.config/autobrr"
133 | rm $HOME/.local/bin/*brr*
134 | rm "$HOME/.install/.autobrr.lock"
135 | }
136 |
137 | function _upgrade {
138 | if [[ ! -f $HOME/.install/.autobrr.lock ]]; then
139 | echo "Autobrr not installed!"
140 | exit 1
141 | fi
142 | autobrr_download_latest
143 | systemctl try-restart --user autobrr
144 | }
145 |
146 | echo 'This is unsupported software. You will not get help with this, please answer `yes` if you understand and wish to proceed'
147 | if [[ -z ${eula} ]]; then
148 | read -r eula
149 | fi
150 |
151 | if ! [[ $eula =~ yes ]]; then
152 | echo "You did not accept the above. Exiting..."
153 | exit 1
154 | else
155 | echo "Proceeding with installation"
156 | fi
157 |
158 | echo "Welcome to the AutoBrr installer..."
159 | echo ""
160 | echo "What do you like to do?"
161 | echo "Logs are stored at ${log}"
162 | echo "install = Install autobrr"
163 | echo "upgrade = upgrades autobrr to latest version"
164 | echo "uninstall = Completely removes autobrr"
165 | echo "exit = Exits Installer"
166 | while true; do
167 | read -r -p "Enter it here: " choice
168 | case $choice in
169 | "install")
170 | autobrr_download_latest
171 | _systemd
172 | _add_user
173 | break
174 | ;;
175 | "uninstall")
176 | _remove
177 | break
178 | ;;
179 | "upgrade")
180 | _upgrade
181 | break
182 | ;;
183 | "exit")
184 | break
185 | ;;
186 | *)
187 | echo "Unknown Option."
188 | ;;
189 | esac
190 | done
191 | exit
192 |
--------------------------------------------------------------------------------
/brew.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Homebrew Installer for Hosted
3 |
4 | user=$(whoami)
5 | mkdir -p "$HOME/.logs/"
6 | export log="$HOME/.logs/homebrew.log"
7 | touch "$log"
8 |
9 | function _install() {
10 | read -p "This application is unsupported in any way. Your slot will be reset if you ask for assistance. Do you wish to proceed? " prompt
11 | if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then
12 | git clone https://github.com/Homebrew/brew $HOME/homebrew
13 | eval "$($HOME/homebrew/bin/brew shellenv)"
14 | brew update --force --quiet
15 | brew analytics off
16 | chmod -R go-w "$(brew --prefix)/share/zsh"
17 | echo "eval \"\$(\$HOME/homebrew/bin/brew shellenv)\"" >> $HOME/.profile
18 | echo "Brew installed. Please run 'source \$HOME/.profile' to add the application to your shell environment."
19 | echo "Please note that this application will not be supported by any means at any point in time."
20 | echo "This includes asking for support in Discord."
21 | else
22 | echo "goodbye"
23 | exit 0
24 | fi
25 | }
26 |
27 | function _remove() {
28 | rm -rf $HOME/homebrew
29 | }
30 |
31 | echo "Welcome to the Homebrew installer..."
32 | echo ""
33 | echo "This action can cause irreperable damage."
34 | echo "The application is not supported in any way."
35 | echo "Use at your own risk."
36 | echo ""
37 | echo "What do you like to do?"
38 | echo "Logs are stored at ${log}"
39 | echo "install = Install Homebrew"
40 | echo "uninstall = Completely removes Homebrew"
41 | echo "exit = Exits Installer"
42 | while true; do
43 | read -r -p "Enter it here: " choice
44 | case $choice in
45 | "install")
46 | _install
47 | break
48 | ;;
49 | "uninstall")
50 | _remove
51 | break
52 | ;;
53 | "exit")
54 | break
55 | ;;
56 | *)
57 | echo "Unknown Option."
58 | ;;
59 | esac
60 | done
61 | exit
62 |
--------------------------------------------------------------------------------
/cloudflared.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Cloudflared Installer for HBD/Swizzin.net Appbox Environments
3 |
4 | mkdir -p "$HOME/.logs/"
5 | export log="$HOME/.logs/cloudflared.log"
6 | touch "$log"
7 |
8 |
9 | function github_latest_version() {
10 | # Argument expects the author/repo format
11 | # e.g. swizzin/swizzin
12 | repo=$1
13 | curl -fsSLI -o /dev/null -w %{url_effective} https://github.com/${repo}/releases/latest | grep -o '[^/]*$'
14 | }
15 |
16 | function _install() {
17 | echo "Downloading cloudflared"
18 | mkdir -p "$HOME/.local/bin"
19 | latest_version=$(github_latest_version cloudflare/cloudflared)
20 | curl -s -L "https://github.com/cloudflare/cloudflared/releases/download/${latest_version}/cloudflared-linux-amd64" -o "$HOME/.local/bin/cloudflared"
21 | chmod +x "$HOME/.local/bin/cloudflared"
22 |
23 | read -rep "Please enter your Cloudflare Zero Trust Tunnel Token: " CF_API_TOKEN
24 | mkdir -p "$HOME/.config/cloudflared/"
25 | touch "$HOME/.config/cloudflared/config.yml"
26 | echo "Installing Systemd Service"
27 | mkdir -p "$HOME/.config/systemd/user/"
28 |
29 | cat >> "$HOME/.config/systemd/user/cloudflared.service" <>"$log" 2>&1
31 | echo "nvm ${nvmVersion} installed."
32 | fi
33 | [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
34 |
35 | # try to use existing nodejs
36 | if nvm use 22 >>"$log" 2>&1; then
37 | echo "Using previous installed nodejs v22"
38 | elif nvm use 20 >>"$log" 2>&1; then
39 | echo "Using previous installed nodejs v20"
40 | else
41 | echo "Installing nodejs lts"
42 | nvm install --lts >>"$log" 2>&1 || {
43 | echo "nodejs failed to install."
44 | exit 1
45 | }
46 | fi
47 |
48 | echo "Upgrading npm"
49 | nvm install-latest-npm >>"$log"
50 | npm config set update-notifier=false fund=false
51 |
52 | NODE_VERSION=$(node -v)
53 | echo "nodejs $NODE_VERSION / npm $(npm -v)"
54 | }
55 |
56 | function _install() {
57 | ## Install cross-seed
58 | echo "Installing cross-seed"
59 | npm install -g cross-seed >>"$log" 2>&1 || {
60 | echo "cross-seed failed to install."
61 | exit 1
62 | }
63 | echo "cross-seed $(cross-seed -V) installed."
64 |
65 | mkdir -p "$HOME/.cross-seed"
66 | if [[ ! -f "$HOME/.cross-seed/config.js" ]]; then
67 | echo "Making config file"
68 | cross-seed gen-config >>"$log" 2>&1 || {
69 | echo "cross-seed failed to generate config"
70 | exit 1
71 | }
72 |
73 | _config
74 | else
75 | echo "config exists: ~/.cross-seed/config.js"
76 | fi
77 | }
78 |
79 | function _config() {
80 | configFile="$HOME/.cross-seed/config.js"
81 | daemonPort=$(port 12000 14000)
82 |
83 | clientArray=()
84 | [ -f "$HOME/.install/.deluge.lock" ] && clientArray+=("Deluge")
85 | [ -f "$HOME/.install/.qbittorrent.lock" ] && clientArray+=("qBittorrent")
86 | [ -f "$HOME/.install/.rtorrent.lock" ] && clientArray+=("rTorrent")
87 |
88 | if [[ ${#clientArray[*]} -ge 2 ]]; then
89 | echo "Multiple clients detected. Please choose one to setup paths"
90 | for i in "${!clientArray[@]}"; do
91 | echo "$i = ${clientArray[$i]}"
92 | done
93 |
94 | while true; do
95 | read -r -p "Enter it here: " selectedIndex
96 | [[ ! $selectedIndex =~ ^[0-9]+$ || -z "${clientArray[$selectedIndex]}" ]] && echo "Invalid option" || break
97 | done
98 | fi
99 |
100 | case "${clientArray[$selectedIndex]}" in
101 | "Deluge")
102 | torrentDir="$HOME/.config/deluge/state"
103 | savePath=$(grep '"download_location"' "$HOME/.config/deluge/core.conf" | awk -F '"' '{print $4}')
104 | ;;
105 | "qBittorrent")
106 | torrentDir="$HOME/.local/share/qBittorrent/BT_backup"
107 | savePath=$(grep 'Downloads\\SavePath=' "$HOME/.config/qBittorrent/qBittorrent.conf" | awk -F '=' '{print $2}')
108 | # set the qbittorrentUrl because it can bypass authentication for the subnet
109 | webuiPort=$(grep 'WebUI\\Port=' "$HOME/.config/qBittorrent/qBittorrent.conf" | awk -F '=' '{print $2}')
110 | sed -i "s|qbittorrentUrl:.*,|qbittorrentUrl: \"http://$subnet:$webuiPort\",|" "$configFile"
111 | ;;
112 | "rTorrent")
113 | torrentDir="$HOME/.sessions"
114 | savePath=$(grep "directory.default.set" "$HOME/.rtorrent.rc" | awk '{print $3}')
115 | ;;
116 | esac
117 |
118 | if [[ -n "${clientArray[$selectedIndex]}" ]]; then
119 | mkdir -p "$savePath/cross-seed"
120 | sed -i "s|linkDir:.*,|linkDir: \"${savePath%/}/cross-seed\",|" "$configFile"
121 | sed -i "s|torrentDir:.*,|torrentDir: \"$torrentDir\",|" "$configFile"
122 | fi
123 |
124 | mkdir -p "$HOME/.cross-seed/output"
125 | sed -i "s|outputDir:.*,|outputDir: \"$HOME/.cross-seed/output\",|" "$configFile"
126 | sed -i 's|host:.*,|host: "127.0.0.1",|' "$configFile"
127 | sed -i "s|port:.*,|port: $daemonPort,|" "$configFile"
128 |
129 | echo "config generated: ~/.cross-seed/config.js"
130 | }
131 |
132 | function _upgrade() {
133 | ## Upgrade cross-seed
134 | if [[ ! -f "$HOME/.install/.cross-seed.lock" ]]; then
135 | echo "cross-seed is not installed."
136 | exit 0
137 | fi
138 |
139 | if [[ "$(systemctl --user is-enabled cross-seed.service 2>&1)" == "enabled" ]]; then
140 | restartDaemon=true
141 | echo "Stopping cross-seed systemd service"
142 | systemctl --user stop cross-seed.service >>"$log" 2>&1
143 | fi
144 |
145 | _install
146 |
147 | if [[ "$restartDaemon" == "true" ]]; then
148 | echo "Starting cross-seed systemd service"
149 | systemctl --user start cross-seed.service >>"$log" 2>&1
150 | fi
151 | }
152 |
153 | function _service() {
154 | ## Create user service
155 | echo "Installing systemd service"
156 | mkdir -p "$HOME/.config/systemd/user"
157 | cat > "$HOME/.config/systemd/user/cross-seed.service" << EOF
158 | [Unit]
159 | Description=cross-seed daemon
160 |
161 | [Service]
162 | Environment=NODE_VERSION=$NODE_VERSION
163 | ExecStart=$NVM_DIR/nvm-exec cross-seed daemon
164 | Restart=on-failure
165 |
166 | [Install]
167 | WantedBy=default.target
168 | EOF
169 |
170 | mkdir -p "$HOME/.install"
171 | touch "$HOME/.install/.cross-seed.lock"
172 |
173 | echo ""
174 | echo "Additional configuration is required. Check the official documentation https://cross-seed.org"
175 | echo "Close and re-open the terminal or run \`source ~/.bashrc\`"
176 | }
177 |
178 | function _remove() {
179 | ## Remove cross-seed and files
180 | echo "Removing cross-seed"
181 | systemctl --user disable --now cross-seed.service >/dev/null 2>&1
182 | rm -f "$HOME/.config/systemd/user/cross-seed.service"
183 | npm uninstall -g cross-seed >>"$log" 2>&1
184 | rm -rf "$HOME/.cross-seed"
185 | rm -f "$HOME/.install/.cross-seed.lock"
186 |
187 | echo "cross-seed has been removed successfully!"
188 | }
189 |
190 | echo "This is unsupported software. You will not get help with this, please answer \`yes\` if you understand and wish to proceed"
191 | if [[ -z ${eula} ]]; then
192 | read -r eula
193 | fi
194 |
195 | if ! [[ $eula =~ yes ]]; then
196 | echo "You did not accept the above. Exiting..."
197 | exit 1
198 | else
199 | echo "Proceeding with installation"
200 | fi
201 |
202 | echo "Welcome to cross-seed installer..."
203 | echo "Logs are stored at ${log}"
204 | echo ""
205 | echo "What do you like to do?"
206 | echo ""
207 | echo "install = Install cross-seed"
208 | echo "uninstall = Completely removes cross-seed"
209 | echo "upgrade = Upgrades cross-seed to latest version"
210 | echo "exit = Exits Installer"
211 | echo ""
212 | while true; do
213 | read -r -p "Enter it here: " choice
214 | case $choice in
215 | "install")
216 | clear
217 | _deps
218 | _install
219 | _service
220 | break
221 | ;;
222 | "uninstall")
223 | _remove
224 | break
225 | ;;
226 | "upgrade")
227 | _upgrade
228 | break
229 | ;;
230 | "exit")
231 | break
232 | ;;
233 | *)
234 | echo "Unknown Option."
235 | ;;
236 | esac
237 | done
238 | exit
239 |
--------------------------------------------------------------------------------
/filebrowser.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Thx liara, userdocs
3 | username=$(whoami)
4 | mkdir -p "$HOME/.logs/"
5 | export log="$HOME/.logs/filebrowser.log"
6 | touch "$log"
7 |
8 | function _port() {
9 | LOW_BOUND=$1
10 | UPPER_BOUND=$2
11 | comm -23 <(seq "${LOW_BOUND}" "${UPPER_BOUND}" | sort) <(ss -Htan | awk '{print $4}' | cut -d':' -f2 | sort -u) | shuf | head -n 1
12 | }
13 |
14 | function create_self_ssl() {
15 | user=$1
16 | if [[ ! -f $HOME/.ssl/$user-self-signed.key ]]; then
17 | echo "Generating self-signed key for $user"
18 | mkdir -p "$HOME/.ssl"
19 | country=US
20 | state=California
21 | locality="San Fransisco"
22 | organization=swizzin
23 | organizationalunit=$user
24 | commonname=$user
25 | ssl_password=""
26 |
27 | openssl genrsa -out "$HOME/.ssl/$user-self-signed.key" 2048 >> /dev/null 2>&1
28 | openssl req -new -key "$HOME/.ssl/$user-self-signed.key" -out "$HOME/.ssl/$user-self-signed.csr" -passin pass:"$ssl_password" -subj "/C=$country/ST=$state/L=$locality/O=$organization/OU=$organizationalunit/CN=$commonname" >> /dev/null 2>&1
29 | openssl x509 -req -days 1095 -in "$HOME/.ssl/$user-self-signed.csr" -signkey "$HOME/.ssl/$user-self-signed.key" -out "$HOME/.ssl/$user-self-signed.crt" >> /dev/null 2>&1
30 | chown -R "$user": "$HOME/.ssl"
31 | chmod 750 "$HOME/.ssl"
32 | echo "Key for $user generated"
33 | fi
34 | }
35 | function _install() {
36 | read -rep "Please set a password for filebrowser: " -i "$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c10)" password
37 |
38 | app_port_http=$(_port 10001 20000)
39 |
40 | mkdir -p "$HOME/bin"
41 | mkdir -p "$HOME/.config/Filebrowser"
42 |
43 | wget -O "$HOME/filebrowser.tar.gz" "$(curl -sNL https://api.github.com/repos/filebrowser/filebrowser/releases/latest | grep -Po 'ht(.*)linux-amd64(.*)gz')" >> "$log" 2>&1
44 | tar -xvzf "$HOME/filebrowser.tar.gz" --exclude LICENSE --exclude README.md --exclude CHANGELOG.md -C "$HOME/bin" >> "$log" 2>&1
45 |
46 | rm -f "$HOME/filebrowser.tar.gz" >> "$log" 2>&1
47 | echo "Initialising database and configuring Filebrowser"
48 | create_self_ssl "${username}"
49 |
50 | "$HOME/bin/filebrowser" config init -d "$HOME/.config/Filebrowser/filebrowser.db" >> "$log" 2>&1
51 |
52 | "$HOME/bin/filebrowser" config set -t "$HOME/.ssl/${username}-self-signed.crt" -k "$HOME/.ssl/${username}-self-signed.key" -d "$HOME/.config/Filebrowser/filebrowser.db" >> "$log" 2>&1
53 | "$HOME/bin/filebrowser" config set -a 0.0.0.0 -p "${app_port_http}" -l "$HOME/.config/Filebrowser/filebrowser.log" -d "$HOME/.config/Filebrowser/filebrowser.db" >> "$log" 2>&1
54 | "$HOME/bin/filebrowser" users add "${username}" "${password}" --perm.admin -d "$HOME/.config/Filebrowser/filebrowser.db" >> "$log" 2>&1
55 |
56 | chown "${username}.${username}" -R "$HOME/bin" > /dev/null 2>&1
57 | chown "${username}.${username}" -R "$HOME/.config" > /dev/null 2>&1
58 | chmod 700 "$HOME/bin/filebrowser" > /dev/null 2>&1
59 | mkdir -p "$HOME/.config/systemd/user"
60 | cat > "$HOME/.config/systemd/user/filebrowser.service" <<- SERVICE
61 | [Unit]
62 | Description=filebrowser
63 | After=network.target
64 | [Service]
65 | UMask=002
66 | Type=simple
67 | WorkingDirectory=$HOME
68 | ExecStart=$HOME/bin/filebrowser -d $HOME/.config/Filebrowser/filebrowser.db
69 | TimeoutStopSec=20
70 | KillMode=process
71 | Restart=always
72 | RestartSec=2
73 | [Install]
74 | WantedBy=default.target
75 | SERVICE
76 |
77 | systemctl --user enable --now filebrowser
78 | echo "Systemd service installed"
79 | touch "$HOME/.install/.filebrowser.lock"
80 | echo "Filebrowser us up and running at https://$(hostname -f):${app_port_http}/"
81 | }
82 |
83 | function _upgrade() {
84 | echo "Stopping Filebrowser"
85 | systemctl --user stop filebrowser
86 | echo "Backing up Filebrowser"
87 | mv $HOME/bin/filebrowser $HOME/bin/filebrowser.bak
88 | echo "Downloading new release"
89 | wget -O "$HOME/filebrowser.tar.gz" "$(curl -sNL https://api.github.com/repos/filebrowser/filebrowser/releases/latest | grep -Po 'ht(.*)linux-amd64(.*)gz')" >> "$log" 2>&1
90 | echo "Extracting new release"
91 | tar -xvzf "$HOME/filebrowser.tar.gz" --exclude LICENSE --exclude README.md --exclude CHANGELOG.md -C "$HOME/bin" >> "$log" 2>&1
92 | rm -f "$HOME/filebrowser.tar.gz" >> "$log" 2>&1
93 | chmod 700 "$HOME/bin/filebrowser"
94 | if [[ -f $HOME/bin/filebrowser ]]; then
95 | rm $HOME/bin/filebrowser.bak
96 | else
97 | echo "Something went wrong during the upgrade, reverting changes"
98 | mv $HOME/bin/filebrowser.bak $HOME/bin/filebrowser
99 | fi
100 | echo "Restarting Filebrowser"
101 | systemctl restart filebrowser
102 | echo "Done."
103 | }
104 |
105 | function _remove() {
106 | systemctl --user stop filebrowser
107 | systemctl --user disable filebrowser
108 | rm -rf "$HOME/.config/Filebrowser"
109 | rm -rf "$HOME/.config/systemd/user/filebrowser.service"
110 | rm -f "$HOME/.install/.filebrowser.lock"
111 | }
112 |
113 | echo 'This is unsupported software. You will not get help with this, please answer `yes` if you understand and wish to proceed'
114 | if [[ -z ${eula} ]]; then
115 | read -r eula
116 | fi
117 |
118 | if ! [[ $eula =~ yes ]]; then
119 | echo "You did not accept the above. Exiting..."
120 | exit 1
121 | else
122 | echo "Proceeding with installation"
123 | fi
124 |
125 | echo "Welcome to Filebrowser installer..."
126 | echo ""
127 | echo "What do you like to do?"
128 | echo "Logs are stored at ${log}"
129 | echo "install = Install Filebrowser"
130 | echo "upgrade = Upgrades Filebrowser"
131 | echo "uninstall = Completely removes Filebrowser"
132 | echo "exit = Exits Installer"
133 | while true; do
134 | read -r -p "Enter it here: " choice
135 | case $choice in
136 | "install")
137 | _install
138 | break
139 | ;;
140 | "upgrade")
141 | _upgrade
142 | break
143 | ;;
144 | "uninstall")
145 | _remove
146 | break
147 | ;;
148 | "exit")
149 | break
150 | ;;
151 | *)
152 | echo "Unknown Option."
153 | ;;
154 | esac
155 | done
156 | exit
157 |
--------------------------------------------------------------------------------
/guestftp.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Refactored from the WalkerServers GuestFTP script by b.
3 | username=$(whoami)
4 | user=$1
5 | pw=$2
6 | dir=$3
7 |
8 | echo 'This is unsupported software. You will not get help with this, please answer `yes` if you understand and wish to proceed'
9 | if [[ -z ${eula} ]]; then
10 | read -r eula
11 | fi
12 |
13 | if ! [[ $eula =~ yes ]]; then
14 | echo "You did not accept the above. Exiting..."
15 | exit 1
16 | else
17 | echo "Proceeding with installation"
18 | fi
19 |
20 | if [[ -z $1 || -z $2 || -z $3 ]]; then echo "You must define a username, password and path (in that order)!"; exit 1; fi
21 |
22 | venv="/home/${username}/.config/venv/guestftp"
23 |
24 | ## Make venv
25 | mkdir -p /home/${username}/.config/venv/
26 | python3 -m venv ${venv}
27 |
28 | ## Ensure pip is updated to fix rust error
29 | ${venv}/bin/pip install --upgrade pip
30 |
31 | # Install pyftpdlib and deps
32 |
33 | ${venv}/bin/pip install wheel
34 | ${venv}/bin/pip install pyOpenSSL
35 | ${venv}/bin/pip install pyftpdlib
36 |
37 | function port() {
38 | LOW_BOUND=$1
39 | UPPER_BOUND=$2
40 | comm -23 <(seq ${LOW_BOUND} ${UPPER_BOUND} | sort) <(ss -Htan | awk '{print $4}' | cut -d':' -f2 | sort -u) | shuf | head -n 1
41 | }
42 |
43 | # Install script
44 |
45 | mkdir -p /home/${username}/.config/guest-ftp
46 | cd /home/${username}/.config/guest-ftp
47 | port=$(port 3000 16200)
48 | cat <> /home/${username}/.config/guest-ftp/ftpserver.py
49 | import logging
50 |
51 | from pyftpdlib.authorizers import DummyAuthorizer
52 | from pyftpdlib.handlers import TLS_FTPHandler
53 | from pyftpdlib.servers import FTPServer
54 |
55 |
56 | # The port the FTP server will listen on.
57 | # This must be greater than 1023 unless you run this script as root.
58 | FTP_PORT = $port
59 |
60 | # The name of the FTP user that can log in.
61 | FTP_USER = "$user"
62 |
63 | # The FTP user's password.
64 | FTP_PASSWORD = "$pw"
65 |
66 | # The directory the FTP user will have full read/write access to.
67 | FTP_DIRECTORY = "$dir"
68 |
69 |
70 | def main():
71 | authorizer = DummyAuthorizer()
72 |
73 | # Define a new user having read only permissions.
74 | authorizer.add_user(FTP_USER, FTP_PASSWORD, FTP_DIRECTORY, perm='elr')
75 |
76 | handler = TLS_FTPHandler
77 | handler.certfile = '/home/${username}/.config/guest-ftp/key.pem'
78 | handler.authorizer = authorizer
79 | handler.permit_foreign_addresses = True
80 |
81 | # Define logging
82 | logging.basicConfig(filename='/home/${username}/.config/guest-ftp/ftpserver.log', level=logging.INFO)
83 |
84 | # Define a customized banner (string returned when client connects)
85 | handler.banner = "ftpd managed by beeboo."
86 |
87 | # Optionally specify range of ports to use for passive connections.
88 | handler.passive_ports = range(60000, 65535)
89 |
90 | address = ('', FTP_PORT)
91 | server = FTPServer(address, handler)
92 |
93 | server.max_cons = 256
94 |
95 | server.serve_forever()
96 |
97 |
98 | if __name__ == '__main__':
99 | main()
100 | EOF
101 |
102 | # Make cert for login
103 |
104 | openssl genrsa -out server.key 2048
105 | openssl rsa -in server.key -out server.key
106 | openssl req -sha256 -new -key server.key -out server.csr -subj "/CN=$(hostname -f)"
107 | openssl x509 -req -sha256 -days 365 -in server.csr -signkey server.key -out server.crt
108 | cat server.crt server.key > key.pem
109 | chmod 777 key.pem
110 |
111 | ## Set permission
112 | chown -R ${username}: /home/${username}/.config/guest-ftp/ftpserver.py
113 |
114 | # Adding systemd file
115 | mkdir -p /home/${username}/.config/systemd/user/
116 | cat <>/home/${username}/.config/systemd/user/guest-ftp.service
117 | [Unit]
118 | Description=Guest FTPD Service
119 | After=network.target
120 |
121 | [Service]
122 | Type=simple
123 | ExecStart=${venv}/bin/python3 /home/${username}/.config/guest-ftp/ftpserver.py
124 | WorkingDirectory=/home/${username}/.config/guest-ftp/
125 |
126 | [Install]
127 | WantedBy=default.target
128 | EOF
129 |
130 | ## Enable and start systemd
131 |
132 | systemctl --user daemon-reload
133 | systemctl enable --user --now guest-ftp.service
134 |
135 | echo "GuestFTP will run on port $port"
136 | echo "Done installing guest ftp"
137 |
--------------------------------------------------------------------------------
/jellyseerr.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # thx flyingsausages and swizzin team
3 | # based on the overseerr install script
4 | export user=$(whoami)
5 | mkdir -p $HOME/.logs/
6 | touch $HOME/.logs/jellyseerr.log
7 | export log="$HOME/.logs/jellyseerr.log"
8 |
9 | function _deps() {
10 | ## Function for installing nvm.
11 | if [[ ! -d "$HOME/.nvm" ]]; then
12 | echo "Installing node"
13 | curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash >> "$log" 2>&1
14 | echo "nvm installed."
15 | else
16 | echo "nvm is already installed."
17 | fi
18 | export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
19 | [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
20 | nvm install --lts >> "$log" 2>&1 || {
21 | echo "node failed to install"
22 | exit 1
23 | }
24 | echo "Node LTS installed."
25 | echo "Installing pnpm"
26 | npm install -g pnpm@9.15.5 >> "$log" 2>&1 || {
27 | echo "pnpm failed to install"
28 | exit 1
29 | }
30 | source "$HOME/.bashrc"
31 | echo "pnpm installed."
32 | }
33 |
34 | function _jellyseerr_install() {
35 | echo "Downloading and extracting source code"
36 | dlurl="$(curl -sS https://api.github.com/repos/Fallenbagel/jellyseerr/releases/latest | jq .tarball_url -r)"
37 | wget "$dlurl" -q -O /home/${user}/jellyseerr.tar.gz >> "$log" 2>&1 || {
38 | echo "Download failed"
39 | exit 1
40 | }
41 | mkdir -p $HOME/jellyseerr
42 | tar --strip-components=1 -C $HOME/jellyseerr -xzvf /home/${user}/jellyseerr.tar.gz >> "$log" 2>&1
43 | rm /home/${user}/jellyseerr.tar.gz
44 | echo "Code extracted"
45 |
46 | # Changing baseurl before build
47 | # export JELLYSEERR_BASEURL='/baseurl'
48 |
49 | # Bypass Node version requirement, build with latest LTS.
50 | sed -i 's|engine-strict=true|engine-strict=false|g' $HOME/jellyseerr/.npmrc
51 |
52 | echo "Installing dependencies via pnpm"
53 | pnpm install --prefix $HOME/jellyseerr >> "$log" 2>&1 || {
54 | echo "Failed to install dependencies"
55 | exit 1
56 | }
57 | echo "Dependencies installed"
58 |
59 | echo "Building jellyseerr"
60 | # Limit CPU
61 | sed -i "s|256000,|256000,\n cpus: 6,|g" $HOME/jellyseerr/next.config.js
62 | pnpm --prefix $HOME/jellyseerr build >> "$log" 2>&1 || {
63 | echo "Failed to build jellyseerr sqlite"
64 | exit 1
65 | }
66 | echo "Succesfully built"
67 | }
68 |
69 | function _port() {
70 | LOW_BOUND=$1
71 | UPPER_BOUND=$2
72 | comm -23 <(seq "${LOW_BOUND}" "${UPPER_BOUND}" | sort) <(ss -Htan | awk '{print $4}' | cut -d':' -f2 | sort -u) | shuf | head -n 1
73 | }
74 |
75 | function _service() {
76 | mkdir -p "/home/$user/.config/systemd/user/"
77 | mkdir -p "/home/$user/.install/"
78 | mkdir -p "/home/$user/.config/jellyseerr/"
79 | # Adapted from https://aur.archlinux.org/cgit/aur.git/tree/overseerr.service?h=overseerr
80 | cat > $HOME/.config/systemd/user/jellyseerr.service << EOF
81 | [Unit]
82 | Description=Jellyseerr Service
83 | Wants=network-online.target
84 | After=network-online.target
85 | [Service]
86 | EnvironmentFile=%h/jellyseerr/env.conf
87 | Environment=NODE_ENV=production
88 | Type=exec
89 | Restart=on-failure
90 | WorkingDirectory=%h/jellyseerr
91 | ExecStart=$(which node) dist/index.js
92 | [Install]
93 | WantedBy=default.target
94 | EOF
95 | port=$(_port 1000 18000)
96 | cat > $HOME/jellyseerr/env.conf << EOF
97 | # specify on which port to listen
98 | PORT=$port
99 | EOF
100 |
101 | systemctl --user daemon-reload
102 | systemctl --user enable --now -q jellyseerr
103 | touch $HOME/.install/.jellyseerr.lock
104 | echo "Jellyseerr is up and running on http://$(hostname -f):$port/jellyseerr"
105 |
106 | }
107 |
108 | function _remove() {
109 | systemctl --user disable --now jellyseerr
110 | sleep 2
111 | rm -rf $HOME/jellyseerr
112 | rm -rf $HOME/.config/jellyseerr
113 | rm -rf $HOME/.config/systemd/user/jellyseerr.service
114 | rm -rf $HOME/.install/.jellyseerr.lock
115 | }
116 |
117 | echo 'This is unsupported software. You will not get help with this, please answer `yes` if you understand and wish to proceed'
118 | if [[ -z ${eula} ]]; then
119 | read -r eula
120 | fi
121 |
122 | if ! [[ $eula =~ yes ]]; then
123 | echo "You did not accept the above. Exiting..."
124 | exit 1
125 | else
126 | echo "Proceeding with installation"
127 | fi
128 |
129 | echo "Welcome to the Jellyseerr installer..."
130 | echo ""
131 | echo "What do you like to do?"
132 | echo ""
133 | echo "install = Install Jellyseerr"
134 | echo "uninstall = Completely removes Jellyseerr"
135 | echo "exit = Exits Installer"
136 | while true; do
137 | read -r -p "Enter it here: " choice
138 | case $choice in
139 | "install")
140 | clear
141 | _deps
142 | _jellyseerr_install
143 | _service
144 | break
145 | ;;
146 | "uninstall")
147 | _remove
148 | break
149 | ;;
150 | "exit")
151 | break
152 | ;;
153 | *)
154 | echo "Unknown Option."
155 | ;;
156 | esac
157 | done
158 | exit
159 |
--------------------------------------------------------------------------------
/komga.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Thanks to Snd from Komga Discord for telling us about how to re-bind tmpdir.
3 | user=$(whoami)
4 | mkdir -p "$HOME/.logs/"
5 | export log="$HOME/.logs/komga.log"
6 | touch "$log"
7 |
8 | function java_install() {
9 | type java || {
10 | echo "Java not installed..."
11 | # Java 8
12 | echo "Downloading java"
13 | curl -sL "https://download.oracle.com/java/17/archive/jdk-17.0.10_linux-x64_bin.tar.gz" -o /tmp/jre.tar.gz >> "$log" 2>&1
14 | echo "Extracting java"
15 | tar -xvf /tmp/jre.tar.gz --strip-components=1 -C "/home/${user}/.local/" >> "$log" 2>&1
16 | rm /tmp/jre.tar.gz
17 | . "/home/${user}/.profile"
18 | }
19 | }
20 |
21 | function port() {
22 | LOW_BOUND=$1
23 | UPPER_BOUND=$2
24 | comm -23 <(seq ${LOW_BOUND} ${UPPER_BOUND} | sort) <(ss -Htan | awk '{print $4}' | cut -d':' -f2 | sort -u) | shuf | head -n 1
25 | }
26 |
27 | function github_latest_version() {
28 | # Argument expects the author/repo format
29 | # e.g. swizzin/swizzin
30 | repo=$1
31 | curl -fsSLI -o /dev/null -w %{url_effective} https://github.com/${repo}/releases/latest | grep -o '[^/]*$'
32 | }
33 |
34 | function _install() {
35 | echo "Beginning installation..."
36 | mkdir -p "$HOME/komga"
37 | mkdir -p "$HOME/.tmp"
38 | java_install
39 | echo "Downloading Komga"
40 | version=$(github_latest_version gotson/komga)
41 | dlurl="https://github.com/gotson/komga/releases/download/$version/komga-${version//v}.jar"
42 | wget "$dlurl" -O "$HOME/komga/komga.jar" >> "${log}" 2>&1 || {
43 | echo "Download failed"
44 | exit 1
45 | }
46 | mkdir "$HOME/.config/systemd/user"
47 | echo "Figuring out a port to host komga on..."
48 | port=$(port 5900 9900)
49 | echo "Writing Service File"
50 | cat > "$HOME/.config/systemd/user/komga.service" <<- SERV
51 | [Unit]
52 | Description=Komga server
53 | [Service]
54 | WorkingDirectory=$HOME/komga/
55 | ExecStart=$HOME/.local/bin/java -jar -Xmx1g -Djava.io.tmpdir=$HOME/.tmp $HOME/komga/komga.jar --server.servlet.context-path="/komga" --server.port="${port}"
56 | Type=simple
57 | Restart=on-failure
58 | RestartSec=10
59 | StandardOutput=null
60 | StandardError=syslog
61 | [Install]
62 | WantedBy=default.target
63 | SERV
64 |
65 | echo "Starting service..."
66 | systemctl enable --user --now komga -q
67 | echo "Service stared."
68 | touch "$HOME/.install/.komga.lock"
69 | echo "Komga has been installed and should be running at http://$(hostname -f):${port}/komga/"
70 | }
71 |
72 | function _upgrade() {
73 | if [ ! -f /install/.komga.install ]; then
74 | echo "You ain't got no komga, whacha doen"
75 | exit 1
76 | fi
77 | echo "Downloading komga"
78 | version=$(github_latest_version gotson/komga)
79 | dlurl="https://github.com/gotson/komga/releases/download/$version/komga-${version//v}.jar"
80 | wget "$dlurl" -O "$HOME/komga/komga.jar" >> "${log}" 2>&1 || {
81 | echo_error "Download failed"
82 | exit 1
83 | }
84 | systemctl try-restart --user komga
85 | }
86 |
87 | function _remove() {
88 | systemctl stop --user komga
89 | systemctl disable --user komga
90 | rm -rf "$HOME/komga/"
91 | rm -f "$HOME/.config/systemd/user/komga.service"
92 | rm -f "$HOME/.install/.komga.lock"
93 | }
94 |
95 | echo 'This is unsupported software. You will not get help with this, please answer `yes` if you understand and wish to proceed'
96 | if [[ -z ${eula} ]]; then
97 | read -r eula
98 | fi
99 |
100 | if ! [[ $eula =~ yes ]]; then
101 | echo "You did not accept the above. Exiting..."
102 | exit 1
103 | else
104 | echo "Proceeding with installation"
105 | fi
106 |
107 | echo "Welcome to the Komga installer..."
108 | echo ""
109 | echo "What do you like to do?"
110 | echo "Logs are stored at ${log}"
111 | echo "install = Install Komga"
112 | echo "upgrade = upgrades Komga to latest version"
113 | echo "uninstall = Completely removes Komga"
114 | echo "exit = Exits Installer"
115 | while true; do
116 | read -r -p "Enter it here: " choice
117 | case $choice in
118 | "install")
119 | _install
120 | break
121 | ;;
122 | "upgrade")
123 | _upgrade
124 | break
125 | ;;
126 | "uninstall")
127 | _remove
128 | break
129 | ;;
130 | "exit")
131 | break
132 | ;;
133 | *)
134 | echo "Unknown Option."
135 | ;;
136 | esac
137 | done
138 | exit
139 |
--------------------------------------------------------------------------------
/lidarr.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Lidarr .NET Core Migration Script
3 |
4 | app=lidarr
5 |
6 | if [[ ! -d $HOME/.logs ]]; then
7 | mkdir -p $HOME/.logs
8 | fi
9 |
10 | touch "$HOME/.logs/$app.log"
11 | log="$HOME/.logs/$app.log"
12 |
13 | function _upgrade() {
14 |
15 | if [[ ! -f $HOME/.install/.lidarr.lock ]]; then
16 | echo "Lidarr not installed. Exiting"
17 | exit 1
18 | fi
19 |
20 | echo "Stopping old install"
21 |
22 | sudo box disable lidarr
23 | sudo box stop lidarr
24 |
25 | echo "Removing old Lidarr Install"
26 | rm -rf "$HOME/Lidarr"
27 | # Download App
28 | echo "Downloading Lidarr"
29 |
30 | mkdir -p "$HOME/.tmp/"
31 |
32 | curl -sL "http://lidarr.servarr.com/v1/update/master/updatefile?os=linux&runtime=netcore&arch=x64" -o "$HOME/.tmp/lidarr.tar.gz" >> "$log" 2>&1 || {
33 | echo "Download failed."
34 | exit 1
35 | }
36 |
37 | # Extract
38 | echo "Extracting Lidarr"
39 | tar xfv "$HOME/.tmp/lidarr.tar.gz" --directory $HOME/ >> "$log" 2>&1 || {
40 | echo_error "Failed to extract"
41 | exit 1
42 | }
43 | rm -rf "$HOME/.tmp/lidarr.tar.gz"
44 |
45 | if [[ ! -d $HOME/.config/systemd/user/ ]]; then
46 | mkdir -p $HOME/.config/systemd/user/
47 | fi
48 |
49 | # Service File
50 | echo "Writing service file"
51 | cat > "$HOME/.config/systemd/user/lidarr.service" << EOF
52 | [Unit]
53 | Description=Lidarr Daemon
54 | After=syslog.target network.target
55 | [Service]
56 | Type=simple
57 | Environment="TMPDIR=$HOME/.tmp"
58 | EnvironmentFile=$HOME/.install/.lidarr.lock
59 | ExecStart=$HOME/Lidarr/Lidarr -nobrowser -data=$HOME/.config/Lidarr/
60 | TimeoutStopSec=20
61 | KillMode=process
62 | Restart=on-failure
63 | [Install]
64 | WantedBy=default.target
65 | EOF
66 |
67 | # Enable/Start Prowlarr
68 | echo "Starting Lidarr"
69 | systemctl enable --now --user lidarr
70 |
71 | }
72 |
73 |
74 | echo 'This is unsupported software. You will not get help with this, please answer `yes` if you understand and wish to proceed'
75 | if [[ -z ${eula} ]]; then
76 | read -r eula
77 | fi
78 |
79 | if ! [[ $eula =~ yes ]]; then
80 | echo "You did not accept the above. Exiting..."
81 | exit 1
82 | else
83 | echo "Proceeding with installation"
84 | fi
85 |
86 | echo "Welcome to Lidarr .NET Core Migration Script..."
87 | echo ""
88 | echo "What do you like to do?"
89 | echo "Logs are stored at ${log}"
90 | echo "upgrade = Upgrade Lidarr"
91 | echo "exit = Exits Installer"
92 | while true; do
93 | read -r -p "Enter it here: " choice
94 | case $choice in
95 | "upgrade")
96 | _upgrade
97 | break
98 | ;;
99 | "exit")
100 | break
101 | ;;
102 | *)
103 | echo "Unknown Option."
104 | ;;
105 | esac
106 | done
107 | exit
108 |
--------------------------------------------------------------------------------
/lounge.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | ## Brett 2021
3 | user=$(whoami)
4 | mkdir -p $HOME/.logs/
5 | touch "$HOME/.logs/lounge.log"
6 | log="$HOME/.logs/lounge.log"
7 |
8 | function _deps() {
9 | ## Function for installing nvm.
10 | if [[ ! -d $HOME/.nvm ]]; then
11 | echo "Installing node"
12 | curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash >> "$log" 2>&1
13 | echo "nvm installed."
14 | else
15 | echo "nvm is already installed."
16 | fi
17 | export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
18 | [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
19 | nvm install --lts >> "$log" 2>&1 || {
20 | echo "node failed to install"
21 | exit 1
22 | }
23 | echo "Node LTS installed."
24 | echo "Installing Yarn"
25 | npm install -g yarn >> "$log" 2>&1 || {
26 | echo "Yarn failed to install"
27 | exit 1
28 | }
29 | echo "Yarn installed."
30 | }
31 |
32 | function port() {
33 | ## Function for generating a random unused port
34 | LOW_BOUND=$1
35 | UPPER_BOUND=$2
36 | comm -23 <(seq ${LOW_BOUND} ${UPPER_BOUND} | sort) <(ss -Htan | awk '{print $4}' | cut -d':' -f2 | sort -u) | shuf | head -n 1
37 | }
38 |
39 | function ssl_gen() {
40 | echo "Generating SSL keys"
41 | country="NL"
42 | state="Amsterdam"
43 | locality="North Holland"
44 | organization="$(hostname -f)"
45 | organizationalunit="$user"
46 | commonname="$user"
47 | ssl_password=""
48 | mkdir -p "/home/$user/.ssl/"
49 | openssl genrsa -out "$HOME/.ssl/$user-self-signed.key" 2048 >> /dev/null 2>&1
50 | openssl req -new -key "$HOME/.ssl/$user-self-signed.key" -out "$HOME/.ssl/$user-self-signed.csr" -passin pass:$ssl_password -subj "/C=$country/ST=$state/L=$locality/O=$organization/OU=$organizationalunit/CN=$commonname" >> /dev/null 2>&1
51 | openssl x509 -req -days 1095 -in "$HOME/.ssl/$user-self-signed.csr" -signkey "$HOME/.ssl/$user-self-signed.key" -out "$HOME/.ssl/$user-self-signed.crt" >> /dev/null 2>&1
52 | chown -R "$user": "$HOME/.ssl"
53 | chmod 750 "$HOME/.ssl"
54 | echo "SSL Key Generated"
55 | }
56 |
57 | function _install() {
58 | ssl_gen
59 | ## Function for node install of TheLounge
60 | echo "Installing The Lounge"
61 | yarn --non-interactive global add thelounge >> "$log" 2>&1
62 | echo "Configuring The Lounge"
63 | mkdir -p "$HOME/.thelounge/"
64 | port=($(port 10000 12000))
65 | cat > "$HOME/.thelounge/config.js" << EOF
66 | "use strict";
67 | module.exports = {
68 | //
69 | // Set the server mode.
70 | // Public servers does not require authentication.
71 | //
72 | // Set to 'false' to enable users.
73 | //
74 | // @type boolean
75 | // @default true
76 | //
77 | public: false,
78 | //
79 | // IP address or hostname for the web server to listen on.
80 | // Setting this to undefined will listen on all interfaces.
81 | //
82 | // @type string
83 | // @default undefined
84 | //
85 | host: undefined,
86 | //
87 | // Set the port to listen on.
88 | //
89 | // @type int
90 | // @default 9000
91 | //
92 | port: ${port},
93 | //
94 | // Set the local IP to bind to for outgoing connections. Leave to undefined
95 | // to let the operating system pick its preferred one.
96 | //
97 | // @type string
98 | // @default undefined
99 | //
100 | bind: undefined,
101 | //
102 | // Sets whether the server is behind a reverse proxy and should honor the
103 | // X-Forwarded-For header or not.
104 | //
105 | // @type boolean
106 | // @default false
107 | //
108 | reverseProxy: false,
109 | //
110 | // Set the default theme.
111 | // Find out how to add new themes at https://thelounge.github.io/docs/packages/themes
112 | //
113 | // @type string
114 | // @default "example"
115 | //
116 | theme: "thelounge-theme-zenburn",
117 | //
118 | // Prefetch URLs
119 | //
120 | // If enabled, The Lounge will try to load thumbnails and site descriptions from
121 | // URLs posted in channels.
122 | //
123 | // @type boolean
124 | // @default false
125 | //
126 | prefetch: true,
127 | //
128 | // Store and proxy prefetched images and thumbnails.
129 | // This improves security and privacy by not exposing client IP address,
130 | // and always loading images from The Lounge instance and making all assets secure,
131 | // which in result fixes mixed content warnings.
132 | //
133 | // If storage is enabled, The Lounge will fetch and store images and thumbnails
134 | // in ~/.lounge/storage folder, or %HOME%/storage if --home is used.
135 | //
136 | // Images are deleted when they are no longer referenced by any message (controlled by maxHistory),
137 | // and the folder is cleaned up on every The Lounge restart.
138 | //
139 | // @type boolean
140 | // @default false
141 | //
142 | prefetchStorage: false,
143 | //
144 | // Prefetch URLs Image Preview size limit
145 | //
146 | // If prefetch is enabled, The Lounge will only display content under the maximum size.
147 | // Specified value is in kilobytes. Default value is 512 kilobytes.
148 | //
149 | // @type int
150 | // @default 512
151 | //
152 | prefetchMaxImageSize: 4096,
153 | //
154 | // Display network
155 | //
156 | // If set to false network settings will not be shown in the login form.
157 | //
158 | // @type boolean
159 | // @default true
160 | //
161 | // displayNetwork: true,
162 | //
163 | // Lock network
164 | //
165 | // If set to true, users will not be able to modify host, port and tls
166 | // settings and will be limited to the configured network.
167 | //
168 | // @type boolean
169 | // @default false
170 | //
171 | lockNetwork: false,
172 | //
173 | // Hex IP
174 | //
175 | // If enabled, clients' username will be set to their IP encoded has hex.
176 | // This is done to share the real user IP address with the server for host masking purposes.
177 | //
178 | // @type boolean
179 | // @default false
180 | //
181 | useHexIp: false,
182 | //
183 | // WEBIRC support
184 | //
185 | // If enabled, The Lounge will pass the connecting user's host and IP to the
186 | // IRC server. Note that this requires to obtain a password from the IRC network
187 | // The Lounge will be connecting to and generally involves a lot of trust from the
188 | // network you are connecting to.
189 | //
190 | // Format (standard): {"irc.example.net": "hunter1", "irc.example.org": "passw0rd"}
191 | // Format (function):
192 | // {"irc.example.net": function(client, args, trusted) {
193 | // // here, we return a webirc object fed directly to \$(irc-framework)
194 | // return {username: "thelounge", password: "hunter1", address: args.ip, hostname: "webirc/"+args.hostname};
195 | // }}
196 | //
197 | // @type string | function(client, args):object(webirc)
198 | // @default null
199 | webirc: null,
200 | //
201 | // Maximum number of history lines per channel
202 | //
203 | // Defines the maximum number of history lines that will be kept in
204 | // memory per channel/query, in order to reduce the memory usage of
205 | // the server. Setting this to -1 will keep unlimited amount.
206 | //
207 | // @type integer
208 | // @default 10000
209 | maxHistory: 10000,
210 | //
211 | // Set socket.io transports
212 | //
213 | // @type array
214 | // @default ["polling", "websocket"]
215 | //
216 | transports: ["polling", "websocket"],
217 | //
218 | // Run The Lounge using encrypted HTTP/2.
219 | // This will fallback to regular HTTPS if HTTP/2 is not supported.
220 | //
221 | // @type object
222 | // @default {}
223 | //
224 | https: {
225 | //
226 | // Enable HTTP/2 / HTTPS support.
227 | //
228 | // @type boolean
229 | // @default false
230 | //
231 | enable: true,
232 | //
233 | // Path to the key.
234 | //
235 | // @type string
236 | // @example "sslcert/key.pem"
237 | // @default ""
238 | //
239 | key: "/home/$user/.ssl/$user-self-signed.key",
240 | //
241 | // Path to the certificate.
242 | //
243 | // @type string
244 | // @example "sslcert/key-cert.pem"
245 | // @default ""
246 | //
247 | certificate: "/home/$user/.ssl/$user-self-signed.crt",
248 | //
249 | // Path to the CA bundle.
250 | //
251 | // @type string
252 | // @example "sslcert/bundle.pem"
253 | // @default ""
254 | //
255 | ca: ""
256 | },
257 | //
258 | // Run The Lounge with identd support.
259 | //
260 | // @type object
261 | // @default {}
262 | //
263 | identd: {
264 | //
265 | // Run the identd daemon on server start.
266 | //
267 | // @type boolean
268 | // @default false
269 | //
270 | enable: false,
271 | //
272 | // Port to listen for ident requests.
273 | //
274 | // @type int
275 | // @default 113
276 | //
277 | port: 113
278 | },
279 | //
280 | // Enable oidentd support using the specified file
281 | //
282 | // Example: oidentd: "~/.oidentd.conf",
283 | //
284 | // @type string
285 | // @default null
286 | //
287 | oidentd: null,
288 | //
289 | // LDAP authentication settings (only available if public=false)
290 | // @type object
291 | // @default {}
292 | //
293 | ldap: {
294 | //
295 | // Enable LDAP user authentication
296 | //
297 | // @type boolean
298 | // @default false
299 | //
300 | enable: false,
301 | //
302 | // LDAP server URL
303 | //
304 | // @type string
305 | //
306 | url: "ldaps://example.com",
307 | //
308 | // LDAP base dn
309 | //
310 | // @type string
311 | //
312 | baseDN: "ou=accounts,dc=example,dc=com",
313 | //
314 | // LDAP primary key
315 | //
316 | // @type string
317 | // @default "uid"
318 | //
319 | primaryKey: "uid"
320 | },
321 | // Extra debugging
322 | //
323 | // @type object
324 | // @default {}
325 | //
326 | debug: {
327 | // Enables extra debugging output provided by irc-framework.
328 | //
329 | // @type boolean
330 | // @default false
331 | //
332 | ircFramework: false,
333 | // Enables logging raw IRC messages into each server window.
334 | //
335 | // @type boolean
336 | // @default false
337 | //
338 | raw: false,
339 | },
340 | };
341 | EOF
342 |
343 | mkdir -p "$HOME/.thelounge/users/"
344 | bash -c "thelounge install thelounge-theme-zenburn"
345 | # Figger out if hostname is Swizzin, LW Swizzin, or SBIO
346 | echo "thelounge will run on ${port}"
347 | echo "Your Lounge instance is up and running at https://$(hostname -f):${port}"
348 | }
349 | function _systemd() {
350 | ## Function responsible for everything systemd
351 | mkdir -p "$HOME/.config/systemd/user"
352 | cat > "$HOME/.config/systemd/user/lounge.service" << EOSD
353 | [Unit]
354 | Description=The Lounge IRC client
355 | After=znc.service
356 | [Service]
357 | Type=simple
358 | Environment=NODE_VERSION=$(node -v | cut -d "v" -f 2 | cut -d "." -f 1)
359 | ExecStart=$HOME/.nvm/nvm-exec $HOME/.yarn/bin/thelounge start
360 | Restart=on-failure
361 | RestartSec=5
362 | StartLimitInterval=60s
363 | StartLimitBurst=3
364 | [Install]
365 | WantedBy=default.target
366 | EOSD
367 | systemctl --user enable -q --now lounge.service >> "$log" 2>&1 || echo "Failed to start TheLounge, please check logs."
368 | }
369 |
370 | function _adduser() {
371 | read -rep "Please set a password for your The Lounge user, ${user}> " -i "" password
372 | crypt=$(node $HOME/.config/yarn/global/node_modules/bcryptjs/bin/bcrypt "${password}")
373 | cat > "$HOME/.thelounge/users/${user}.json" << EOU
374 | {
375 | "password": "${crypt}",
376 | "log": true,
377 | "awayMessage": "",
378 | "networks": [],
379 | "sessions": {}
380 | }
381 | EOU
382 | }
383 |
384 | function _remove() {
385 | ## Function Removes lounge and config files.
386 | systemctl --user disable -q lounge >> /dev/null 2>&1
387 | systemctl --user stop -q lounge
388 |
389 | npm uninstall -g thelounge --save >> /dev/null 2>&1
390 | yarn --non-interactive global remove thelounge
391 |
392 | rm -rf "$HOME/.thelounge" # just in case
393 |
394 | rm -f "$HOME/.config/systemd/user/lounge.service"
395 | rm -f "$HOME/install/.lounge.lock"
396 | }
397 |
398 | function upgrade() {
399 | echo "Upgrading The Lounge"
400 | echo "Stopping lounge.service"
401 | systemctl --user -q stop lounge
402 | npm remove -g thelounge
403 | yarn --non-interactive global add thelounge
404 | echo "Starting lounge.service"
405 | systemctl --user -q start lounge
406 | echo "The Lounge has been Upgraded."
407 | }
408 |
409 | echo 'This is unsupported software. You will not get help with this, please answer `yes` if you understand and wish to proceed'
410 | if [[ -z ${eula} ]]; then
411 | read -r eula
412 | fi
413 |
414 | if ! [[ $eula =~ yes ]]; then
415 | echo "You did not accept the above. Exiting..."
416 | exit 1
417 | else
418 | echo "Proceeding with installation"
419 | fi
420 |
421 | echo "Welcome to The Lounge installer..."
422 | echo ""
423 | echo "What do you like to do?"
424 | echo "Logs are stored at ${log}"
425 | echo "install = Install The Lounge"
426 | echo "uninstall = Completely removes The Lounge"
427 | echo "exit = Exits Installer"
428 | while true; do
429 | read -r -p "Enter it here: " choice
430 | case $choice in
431 | "install")
432 | _deps
433 | _install
434 | _systemd
435 | _adduser
436 | break
437 | ;;
438 | "uninstall")
439 | _remove
440 | break
441 | ;;
442 | "upgrade")
443 | upgrade
444 | break
445 | ;;
446 | "exit")
447 | break
448 | ;;
449 | *)
450 | echo "Unknown Option."
451 | ;;
452 | esac
453 | done
454 | exit
455 |
--------------------------------------------------------------------------------
/microsocks.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Installer by thcrt
3 | # Licensed under the MIT license
4 | set -eu
5 | IFS=$'\n\t'
6 |
7 |
8 |
9 | # Temporary working directory
10 | TEMP_DIR="${HOME}/.tmp/microsocks"
11 | # Path of executable once installed
12 | BIN_PATH="${HOME}/.local/bin/microsocks"
13 | # Port to listen on
14 | PORT=$(comm -23 <(seq 10000 20000 | sort) <(ss -Htan | awk '{print $4}' | cut -d':' -f2 | sort -u) | shuf | head -n 1)
15 | # Password to connect with
16 | PASS=$(tr -dc A-Za-z0-9 "
35 | echo ""
36 | if ! [[ $REPLY =~ "yes" ]]; then
37 | echo "Exiting installation!"
38 | exit 1
39 | else
40 | echo "Proceeding with installation!"
41 | fi
42 |
43 | # Ensure all standard directories exist
44 | mkdir -p "${TEMP_DIR}"
45 | mkdir -p "${HOME}/.local/bin"
46 | mkdir -p "${HOME}/.config/systemd/user"
47 |
48 | # Download and install binary
49 | echo -ne "[1/7] Downloading microsocks...\r"
50 | curl -sL "https://github.com/rofl0r/microsocks/archive/refs/tags/v1.0.4.tar.gz" -o "${TEMP_DIR}/microsocks.tar.gz"
51 | echo -ne "[2/7] Extracting...\r"
52 | tar xf "${TEMP_DIR}/microsocks.tar.gz" --directory "${TEMP_DIR}" --strip-components=1
53 | echo -ne "[3/7] Compiling from source...\r"
54 | make --directory "${TEMP_DIR}" >/dev/null 2>&1
55 | echo -ne "[4/7] Moving into place... \r"
56 | mv "${TEMP_DIR}/microsocks" "${BIN_PATH}"
57 | echo -ne "[5/7] Cleaning up...\r"
58 | rm -rf "${TEMP_DIR}"
59 |
60 | # Set up the service
61 | echo -ne "[6/7] Creating service file...\r"
62 | cat > "${SERVICE_PATH}" << EOF
63 | [Unit]
64 | Description=A tiny SOCKS5 server
65 | After=syslog.target network.target auditd.service
66 |
67 | [Service]
68 | Type=exec
69 | ExecStart=$BIN_PATH -p $PORT -u $USER -P $PASS
70 |
71 | [Install]
72 | WantedBy=default.target
73 | EOF
74 | echo -ne "[7/7] Starting microsocks...\r"
75 | systemctl --user enable --now microsocks.service >/dev/null 2>&1
76 |
77 | echo "### All done! ######################################################################################"
78 | echo "# #"
79 | echo "# microsocks has been installed successfully! #"
80 | echo "# #"
81 | echo "# You can connect with the credentials: #"
82 | echo "# Host $(hostname -f) #"
83 | echo "# Port ${PORT} #"
84 | echo "# User (your seedbox username) #"
85 | echo "# Password ${PASS} #"
86 | echo "# #"
87 | echo "# You can configure microsocks further by editing the service file at: #"
88 | echo "# ~/.config/systemd/user/microsocks.service #"
89 | echo "# and running: #"
90 | echo "# systemctl --user restart microsocks.service #"
91 | echo "# #"
92 | echo "# For more information, see https://github.com/rofl0r/microsocks. #"
93 | echo "# #"
94 | echo "####################################################################################################"
95 | }
96 |
97 |
98 |
99 | function _uninstall() {
100 | echo -ne "[1/3] Stopping the service...\r"
101 | systemctl --user disable --now microsocks.service >/dev/null 2>&1
102 | echo -ne "[2/3] Removing the service file...\r"
103 | rm "${SERVICE_PATH}"
104 | echo -ne "[3/3] Deleting the binary...\r"
105 | rm "${BIN_PATH}"
106 |
107 | echo "### All done! ######################################################################################"
108 | echo "# #"
109 | echo "# microsocks has been uninstalled successfully! #"
110 | echo "# #"
111 | echo "####################################################################################################"
112 | }
113 |
114 |
115 |
116 | echo "### Welcome ########################################################################################"
117 | echo "# #"
118 | echo "# This script lets you install or uninstall microsocks in a hosted app server environment. #"
119 | echo "# #"
120 | echo "# What would you like to do? #"
121 | echo "# install Install microsocks #"
122 | echo "# uninstall Uninstall microsocks #"
123 | echo "# exit Exit this script #"
124 | echo "# #"
125 | echo "####################################################################################################"
126 | while true; do
127 | read -r -p "=> "
128 | echo ""
129 | case $REPLY in
130 | "install")
131 | _install
132 | break
133 | ;;
134 | "uninstall")
135 | _uninstall
136 | break
137 | ;;
138 | *)
139 | echo "Exiting!"
140 | ;;
141 | esac
142 | exit
143 | done
144 |
--------------------------------------------------------------------------------
/migration.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Maintainer: Brett Petch
3 | # For Swizzin.net / HostingByDesign - NOT EVER for Dedicated Servers.
4 | # Only use on shared slots.
5 | # Licensed under GNU General Public License v3.0
6 | # Logs stored at $HOME/.logs/migration.log
7 | mkdir -p "$HOME/.logs/"
8 | export log="$HOME/.logs/migration.log"
9 | touch "$log"
10 |
11 | function new_port() {
12 | # Liara Get Free Port Between Range
13 | LOW_BOUND=$1
14 | UPPER_BOUND=$2
15 | comm -23 <(seq ${LOW_BOUND} ${UPPER_BOUND} | sort) <(ss -Htan | awk '{print $4}' | cut -d':' -f2 | sort -u) | shuf | head -n 1
16 | }
17 |
18 | function get_ini() {
19 | # Get value from ini file with [sections]
20 | # Saves several braincells and makes code far more readable
21 | file=$1
22 | section=$2
23 | param=$3
24 | sed -nr "/^\[${section}\]/ { :l /^${param}[ ]*=/ { s/[^=]*=[ ]*//; p; q;}; n; b l;}" "${file}"
25 | }
26 |
27 | function set_ini() {
28 | # Sets or appends if not exists within [sections]
29 | # Saves several braincells and makes code far more readable
30 | file=$1
31 | section=$2
32 | param=$3
33 | newval=$4
34 | if [[ -z $(get_ini "${file}" "${section}" "${param}") ]]; then
35 | sed -i "/^\[${section}\]/a ${param} = ${newval}" "${file}"
36 | else
37 | sed -i "/^\[${section}\]\$/,/^\[/ s/^${param}.*/${param} = ${newval}/" "${file}"
38 | fi
39 | }
40 |
41 | function get_attr() {
42 | file=$1
43 | param=$2
44 | grep -Pio "${param}=*\"\K[^\"]*" "$HOME/.plex/config/Library/Application Support/Plex Media Server/Preferences.xml.bak"
45 | }
46 |
47 | function set_attr() {
48 | file=$1
49 | param=$2
50 | set=$3
51 | sed -i "s|$(get_attr "${file}" "${param}")|${set}|g"
52 | }
53 |
54 | function read_tag() {
55 | file=$1
56 | tag=$2
57 | sed -n "s|\(.*\)<${tag}>\(.*\)${tag}>|\2|p" "${file}"
58 | }
59 |
60 | function check_scripts() {
61 | if [[ ! -f $HOME/scripts/hosted-scripts ]]; then
62 | mkdir -p "$HOME/scripts"
63 | git clone "https://github.com/brettpetch/hosted-scripts.git" "$HOME/scripts/hosted-scripts"
64 | fi
65 | }
66 |
67 | function github_latest_version() {
68 | # Liara (2022)
69 | # Argument expects the author/repo format
70 | # e.g. swizzin/swizzin
71 | repo=$1
72 | curl -fsSLI -o /dev/null -w %{url_effective} "https://github.com/${repo}/releases/latest" | grep -o '[^/]*$'
73 | }
74 |
75 |
76 | function install_stop() {
77 | sudo box install "$1"
78 | echo "Waiting 10 seconds in hopes of this not breaking things"
79 | sleep 10
80 | sudo box stop "$1"
81 | }
82 |
83 | function migrateData() {
84 | echo "Please make sure you're running this script inside a screen window... It will cause data loss if this is not done properly."
85 | echo "If you wish to stop, press ctl-c within the next 5 seconds..."
86 | sleep 5
87 |
88 | echo "Welcome to the HostingBy Migration Script"
89 | echo "This script will inventory your current slot and copy the data for you."
90 | echo "While we do provide partial support, we are not responsible should the slot explode in some unpredictable way."
91 |
92 | echo "Please enter your new hostname:"
93 | read -r newhost
94 | export newhost
95 |
96 | echo "Please enter your new username:"
97 | read -r newuser
98 | export newuser
99 |
100 | echo "Writing essential information to $HOME/.info.lock, $HOME/systemd.list, and $HOME/crontab.bak"
101 | if [[ -z $(crontab -l) ]]; then
102 | CT=FALSE
103 | else
104 | CT=TRUE
105 | fi
106 | cat > "$HOME/.info.lock" << EOF
107 | [general]
108 | HOME = $HOME
109 | USER = $USER
110 | UID = $(id -u "$USER")
111 | GID = $(id -g "$USER")
112 | GROUPS = $(id -G "$USER")
113 | SUBNET = $(cat "$HOME/.install/subnet.lock")
114 | CRONTAB = "${CT}"
115 | EOF
116 | systemctl list-units --type=service --user > "$HOME/systemd.list"
117 | crontab -l 1> "$HOME/crontab.bak" 2> /dev/null
118 | for i in $HOME/.install/.*.lock; do
119 | i=$(echo "$i" | cut -d/ -f5 | cut -d. -f2)
120 | echo "Attempting to stop $i"
121 | sudo box stop "${i}" || systemctl --user -q stop "${i}" || sudo systemctl stop -q "${i}@$(whoami)"
122 | echo "${i}" >> applist.txt
123 | done
124 | echo "Copying data from $HOME to ${newhost}:\$HOME/old... This could take some time."
125 | rsync -ahH --info=progress2 "$HOME/" "${newuser}@${newhost}:old/" -e 'ssh -p22'
126 | }
127 |
128 | function runner() {
129 | if [[ ! -f $HOME/old/.info.lock ]];
130 | echo "Old user info couldn’t be retrieved. Please ensure \$HOME/.info.lock was transferred into $HOME/old/.info.lock"
131 | exit 1
132 | fi
133 | export eula="yes"
134 | migrateAutoDL
135 | migrateBazarr
136 | migrateBTSync
137 | migrateDeluge
138 | migrateEmby
139 | migrateJackett
140 | migrateJellyfin
141 | migrateLidarr
142 | migrateMedusa
143 | migrateNZBGet
144 | migrateOmbi
145 | migratePlex
146 | migratePlexTunnel
147 | migrateQbit
148 | migrateRadarr
149 | migrateRtorrent
150 | migrateSabnzbd
151 | migrateSonarr
152 | migrateTautulli
153 | migrateFilebrowser
154 | migrateKativa
155 | migrateKomga
156 | migrateLounge
157 | migrateMylar
158 | migrateNGPost
159 | migrateOverseerr
160 | migrateProwlarr
161 | migrateRadarr4K
162 | migrateReadarr
163 | migrateSonarr4k
164 | migrateSubsonic
165 | migrateUnpackerr
166 | }
167 |
168 | function migrateAutoDL() {
169 | if [[ ! -f $HOME/old/.install/.autodl.lock ]]; then
170 | echo "Autodl was not previously installed... Skipping!"
171 | return
172 | fi
173 | install_stop autodl
174 | port=$(grep "gui-server-port" "$HOME/.autodl/autodl.cfg" | cut -d= -f2 | xargs)
175 | pass=$(grep "gui-server-password" "$HOME/.autodl/autodl.cfg" | cut -d= -f2 | xargs)
176 | sed -i "s/gui-server-port = */gui-server-port = ${port}/g" "$HOME/old/.autodl/autodl.cfg"
177 | sed -i "s/gui-server-password = */gui-server-port = ${pass}/g" "$HOME/old/.autodl/autodl.cfg"
178 | sudo box start autodl
179 | }
180 |
181 | function migrateBazarr() {
182 | if [[ ! -f $HOME/old/.install/.bazarr.lock ]]; then
183 | echo "Bazarr was not previously installed... Skipping!"
184 | return
185 | fi
186 | install_stop bazarr
187 | set_ini "$HOME/old/Apps/bazarr/data/config/config.ini" "general" "ip" $(cat $HOME/.install/subnet.lock)
188 | set_ini "$HOME/old/Apps/bazarr/data/config/config.ini" "general" "port" "$(get_ini \"$HOME/Apps/bazarr/data/config/config.ini\" \"general\" \"port\")"
189 | mv "$HOME/Apps/bazarr/data" "$HOME/Apps/bazarr/data.bak"
190 | mv "$HOME/old/Apps/bazarr/data" "$HOME/Apps/bazarr/data"
191 | }
192 |
193 | function migrateBTSync() {
194 | if [[ ! -f $HOME/old/.install/.btsync.lock ]]; then
195 | echo "btsync was not previously installed... Skipping!"
196 | return
197 | fi
198 | sudo box install btsync
199 | }
200 |
201 | function migrateDeluge() {
202 | if [[ ! -f $HOME/old/.install/.deluge.lock ]]; then
203 | echo "deluge was not previously installed... Skipping!"
204 | return
205 | fi
206 | echo "Deluge fastresume data is not easy to edit. We will move all torrents currently in Deluge over to qBittorrent."
207 | echo "You have 5 seconds to cancel this action by pressing ctl-c."
208 | sleep 5
209 | install_stop qbittorrent
210 | echo "Installing ludviglundgren/qbittorrent-cli to edit fastresume data. This will be accessible after as \`qbt\`"
211 | version=$(github_latest_version ludviglundgren/qbittorrent-cli)
212 | curl -sL "https://github.com/ludviglundgren/qbittorrent-cli/releases/download/${version}/qbittorrent-cli_${version//v}_linux_amd64.tar.gz" -o "$HOME/.tmp/qbittorrent-cli.tar.gz"
213 | cd "$HOME/.tmp/" || {
214 | echo "Failed to migrate qbittorrent" && exit 1
215 | }
216 | tar xvf "$HOME/.tmp/qbittorrent-cli.tar.gz"
217 | rm -f qbtcli.tar.gz README.md
218 | chmod +x "$HOME/.tmp/qbt"
219 | mkdir -p "$HOME/.local/bin"
220 | mv "$HOME/.tmp/qbt" "$HOME/.local/bin/qbt"
221 | oldhome=$(get_ini "$HOME/old/.info.lock" "general" "HOME")
222 | sudo box stop qbittorrent
223 | # Import Deluge torrents to qBit
224 | # Change dir.
225 | "$HOME/.local/bin/qbt" import --source deluge --source-dir "$HOME/old/.config/deluge/state/" --qbit-dir "$HOME/.local/share/data/qBittorrent/BT_backup"
226 | "$HOME/.local/bin/qbt" edit --dir "$HOME/.local/share/qBittorrent/BT_backup" --pattern "$oldhome" --replace "$HOME"
227 | echo "Data from Deluge has been migrated to qBittorrent."
228 | echo "Starting qBittorrent."
229 | sudo box start qbittorrent
230 | }
231 |
232 | function migrateEmby() {
233 | if [[ ! -f $HOME/old/.install/.emby.lock ]]; then
234 | echo "Emby was not previously installed... Skipping!"
235 | return
236 | fi
237 | install_stop emby
238 | # Old ports
239 | jellyfin_old_port=$(sed -n 's|\(.*\)\(.*\)|\2|p' "$HOME/old/.emby/config/config/network.xml")
240 | jellyfin_old_baseurl=$(sed -n 's|\(.*\)\(.*\)|\2|p' "$HOME/old/.emby/config/config/network.xml")
241 | jellyfin_old_kp=$(sed -n 's|\(.*\)\(.*\)|\2|p' "$HOME/old/.emby/config/config/network.xml")
242 | # Get new ports
243 | jellyfin_port=$(sed -n 's|\(.*\)\(.*\)|\2|p' "$HOME/.emby/config/config/network.xml")
244 | jellyfin_baseurl=$(sed -n 's|\(.*\)\(.*\)|\2|p' "$HOME/.emby/config/config/network.xml")
245 | jellyfin_kp=$(sed -n 's|\(.*\)\(.*\)|\2|p' "$HOME/.emby/config/config/network.xml")
246 | # good ol sed to select the old vals and replace
247 | sed -i "s|${jellyfin_old_port}|${jellyfin_port}|g" "$HOME/old/.emby/config/config/network.xml"
248 | sed -i "s|${jellyfin_old_baseurl}|${jellyfin_baseurl}|g" "$HOME/old/.emby/config/config/network.xml"
249 | sed -i "s|${jellyfin_old_kp}|${jellyfin_kp}|g" "$HOME/old/.emby/config/config/network.xml"
250 | # Move the new into a backup, move old into normal install location
251 | mv "$HOME/.emby" "$HOME/.emby.bak"
252 | mv "$HOME/old/.emby" "$HOME/.emby"
253 | sudo box start emby
254 | }
255 |
256 | function migrateJackett() {
257 | if [[ ! -f $HOME/old/.install/.jackett.lock ]]; then
258 | echo "btsync was not previously installed... Skipping!"
259 | return
260 | fi
261 | install_stop jackett
262 | cp "$HOME/.config/Jackett/ServerConfig.json" "$HOME/.config/Jackett/ServerConfig.json.bak"
263 | port=$(jq ".Port" "$HOME/.config/Jackett/ServerConfig.json.bak")
264 | admin_pass=$(jq ".AdminPassword" "$HOME/.config/Jackett/ServerConfig.json.bak")
265 | cp -r "$HOME/old/.config/Jackett/" "$HOME/.config/Jackett/"
266 | tmp=$(mktemp)
267 | jq ".Port=${port}" "$HOME/.config/Jackett/ServerConfig.json" > "$tmp" && mv "$tmp" "$HOME/.config/Jackett/ServerConfig.json"
268 | jq ".AdminPassword=${admin_pass}" "$HOME/.config/Jackett/ServerConfig.json.bak" > "$tmp" && mv "$tmp" "$HOME/.config/Jackett/ServerConfig.json"
269 | }
270 |
271 | function migrateJellyfin() {
272 | if [[ ! -f $HOME/old/.install/.jackett.lock ]]; then
273 | echo "Jackett was not previously installed... Skipping!"
274 | return
275 | fi
276 | install_stop jellyfin
277 | install_stop emby
278 | # Old ports
279 | jellyfin_old_port=$(sed -n 's|\(.*\)\(.*\)|\2|p' "$HOME/old/.jellyfin/config/config/network.xml")
280 | jellyfin_old_baseurl=$(sed -n 's|\(.*\)\(.*\)|\2|p' "$HOME/old/.jellyfin/config/config/network.xml")
281 | jellyfin_old_kp=$(sed -n 's|\(.*\)\(.*\)|\2|p' "$HOME/old/.jellyfin/config/config/network.xml")
282 | # Get new ports
283 | jellyfin_port=$(sed -n 's|\(.*\)\(.*\)|\2|p' "$HOME/.jellyfin/config/config/network.xml")
284 | jellyfin_baseurl=$(sed -n 's|\(.*\)\(.*\)|\2|p' "$HOME/.jellyfin/config/config/network.xml")
285 | jellyfin_kp=$(sed -n 's|\(.*\)\(.*\)|\2|p' "$HOME/.jellyfin/config/config/network.xml")
286 | # good ol sed to select the old vals and replace
287 | sed -i "s|${jellyfin_old_port}|${jellyfin_port}|g" "$HOME/old/.jellyfin/config/config/network.xml"
288 | sed -i "s|${jellyfin_old_baseurl}|${jellyfin_baseurl}|g" "$HOME/old/.jellyfin/config/config/network.xml"
289 | sed -i "s|${jellyfin_old_kp}|${jellyfin_kp}|g" "$HOME/old/.jellyfin/config/config/network.xml"
290 | # Move the new into a backup, move old into normal install location
291 | mv "$HOME/.jellyfin" "$HOME/.jellyfin.bak"
292 | mv "$HOME/old/.jellyfin" "$HOME/.jellyfin"
293 | sudo box start jellyfin
294 | }
295 |
296 | function migrateLidarr() {
297 | if [[ ! -f $HOME/old/.install/.lidarr.lock ]]; then
298 | echo "Lidarr was not previously installed... Skipping!"
299 | return
300 | fi
301 | install_stop lidarr
302 | lidarr_port=$(sed -n 's|\(.*\)\(.*\)|\2|p' "$HOME/.config/Lidarr/config.xml")
303 | old_lidarr_port=$(sed -n 's|\(.*\)\(.*\)|\2|p' "$HOME/old/.config/Lidarr/config.xml")
304 | old_subnet=$(get_ini $HOME/old/.info.lock general SUBNET)
305 | subnet=$(cat $HOME/.install/subnet.lock)
306 | sed -i "s|${old_subnet}|${subnet}|g" "$HOME/old/.config/Lidarr/config.xml"
307 | sed -i "s|${old_lidarr_port}|${lidarr_port}|g" "$HOME/old/.config/Lidarr/config.xml"
308 | mv "$HOME/.config/Lidarr" "$HOME/.config/Lidarr.bak"
309 | mv "$HOME/old/.config/Lidarr/" "$HOME/.config/Lidarr/"
310 | sudo box start lidarr
311 | }
312 |
313 | function migrateMedusa() {
314 | if [[ ! -f $HOME/old/.install/.medusa.lock ]]; then
315 | echo "Medusa was not previously installed... Skipping!"
316 | return
317 | fi
318 | install_stop medusa
319 | }
320 |
321 | function migrateNZBGet() {
322 | if [[ ! -f $HOME/old/.install/.nzbget.lock ]]; then
323 | echo "NZBGet was not previously installed... Skipping!"
324 | return
325 | fi
326 | install_stop nzbget
327 | subnet=$(cat $HOME/.install/subnet.lock)
328 | nzb_port=$(awk -F "=" '/ControlPort/ {print $2}' "$HOME/nzbget/nzbget.conf")
329 | sed -i "s|ControlIP=.*|ControlIP=${subnet}|g" "$HOME/old/nzbget/nzbget.conf"
330 | sed -i "s|ControlPort=.*|ControlPort=${nzb_port}|g" "$HOME/old/nzbget/nzbget.conf"
331 | cp "$HOME/old/nzbget/nzbget.conf" "$HOME/nzbget/nzbget.conf"
332 | sudo box start nzbget
333 | }
334 |
335 | function migrateOmbi() {
336 | if [[ ! -f $HOME/old/.install/.ombi.lock ]]; then
337 | echo "Ombi was not previously installed... Skipping!"
338 | return
339 | fi
340 | install_stop ombi
341 | }
342 |
343 | function migratePlex() {
344 | if [[ ! -f $HOME/old/.install/.plex.lock ]]; then
345 | echo "Plex was not previously installed... Skipping!"
346 | return
347 | fi
348 | install_stop plex
349 | echo "You MUST make sure your old Plex install is STOPPED. If it is not, this will NOT pick up easily. You will need to change library locations when this is completed."
350 | # Record All Ports & Custom Access stuff
351 | cp "$HOME/.plex/config/Library/Application Support/Plex Media Server/Preferences.xml" "$HOME/.plex/config/Library/Application Support/Plex Media Server/Preferences.xml.bak"
352 | plex_port=$(grep -Pio 'ManualPortMappingPort=*"\K[^"]*' "$HOME/.plex/config/Library/Application Support/Plex Media Server/Preferences.xml.bak")
353 | old_plex_port=$(grep -Pio 'ManualPortMappingPort=*"\K[^"]*' "$HOME/old/.plex/config/Library/Application Support/Plex Media Server/Preferences.xml")
354 | plex_custom_connections=$(grep -Pio 'customConnections=*"\K[^"]*' "$HOME/.plex/config/Library/Application Support/Plex Media Server/Preferences.xml.bak")
355 | old_plex_custom_connections=$(grep -Pio 'customConnections=*"\K[^"]*' "$HOME/old/.plex/config/Library/Application Support/Plex Media Server/Preferences.xml")
356 | sed -i "s|${old_plex_custom_connections}|${plex_custom_connections}|g" "$HOME/old/.plex/config/Library/Application Support/Plex Media Server/Preferences.xml"
357 | sed -i "s|${old_plex_port}|${plex_port}|g" "$HOME/old/.plex/config/Library/Application Support/Plex Media Server/Preferences.xml"
358 | cp -r "$HOME/old/.plex/config/Library/Application Support/Plex Media Server/" "$HOME/.plex/config/Library/Application Support/Plex Media Server/"
359 | sudo box start plex
360 | }
361 |
362 | function migratePlexTunnel() {
363 | if [[ ! -f $HOME/old/.install/.plex-tunnel.lock ]]; then
364 | echo "Plex Tunnel was not previously installed... Skipping!"
365 | return
366 | fi
367 | install_stop plex-tunnel
368 | }
369 |
370 | function migrateQbit() {
371 | if [[ ! -f $HOME/old/.install/.qbittorrent.lock ]]; then
372 | echo "qBittorrent was not previously installed... Skipping!"
373 | return
374 | fi
375 | install_stop qbittorrent
376 | mkdir -p "$HOME/.tmp/"
377 | echo "Installing ludviglundgren/qbittorrent-cli to edit fastresume data. This will be accessible after as \`qbt\`"
378 | version=$(github_latest_version ludviglundgren/qbittorrent-cli)
379 | curl -sL "https://github.com/ludviglundgren/qbittorrent-cli/releases/download/${version}/qbittorrent-cli_${version//v}_linux_amd64.tar.gz" -o "$HOME/.tmp/qbittorrent-cli.tar.gz"
380 | cd "$HOME/.tmp/" || {
381 | echo "Failed to migrate qbittorrent" && exit 1
382 | }
383 | tar xvf "$HOME/.tmp/qbittorrent-cli.tar.gz"
384 | rm -f qbtcli.tar.gz README.md
385 | chmod +x "$HOME/.tmp/qbt"
386 | mkdir -p "$HOME/.local/bin"
387 | mv "$HOME/.tmp/qbt" "$HOME/.local/bin/qbt"
388 | oldhome=$(get_ini "$HOME/old/.info.lock" "general" "HOME")
389 | "$HOME/.local/bin/qbt" edit --dir "$HOME/old/.local/share/qBittorrent/BT_backup" --pattern "${oldhome}" --replace "$HOME"
390 | cp -r "$HOME/old/.local/share/qBittorrent/BT_backup" "$HOME/.local/share/qBittorrent/BT_backup/"
391 | # Set config to pickup where we left off
392 | webui_port=$(get_ini "$HOME/.config/qBittorrent/qBittorrent.conf" "Preferences" "WebUI\\\Port")
393 | connection_port_min=$(get_ini "$HOME/.config/qBittorrent/qBittorrent.conf" "Preferences" "Connection\\\PortRangeMin")
394 | session_port=$(get_ini "$HOME/.config/qBittorrent/qBittorrent.conf" "BitTorrent" "Session\\\Port")
395 | qbit_encodedpass=$(get_ini "$HOME/.config/qBittorrent/qBittorrent.conf" "Preferences" "WebUI\\\Password_PBKDF2")
396 | set_ini "$HOME/old/.config/qBittorrent/qBittorrent.conf" "Preferences" "WebUI\\\Port" "${webui_port}"
397 | set_ini "$HOME/old/.config/qBittorrent/qBittorrent.conf" "Preferences" "WebUI\\\AlternativeUIEnabled" "false"
398 | set_ini "$HOME/old/.config/qBittorrent/qBittorrent.conf" "Preferences" "Connection\\\PortRangeMin" "${connection_port_min}"
399 | set_ini "$HOME/old/.config/qBittorrent/qBittorrent.conf" "BitTorrent" "Session\\\Port" "${session_port}"
400 | set_ini "$HOME/old/.config/qBittorrent/qBittorrent.conf" "Preferences" "WebUI\\\Password_PBKDF2" "${qbit_encodedpass}"
401 | cp "$HOME/old/.config/qBittorrent/qBittorrent.conf" "$HOME/.config/qBittorrent/qBittorrent.conf"
402 | box start qbittorrent
403 | }
404 |
405 | function migrateRadarr() {
406 | if [[ ! -f $HOME/old/.install/.radarr.lock ]]; then
407 | echo "Radarr was not previously installed... Skipping!"
408 | return
409 | fi
410 | install_stop radarr
411 | # keep old api, no need to use new one.
412 | subnet=$(cat "$HOME/.config/subnet.lock")
413 | radarr_port=$(sed -n 's|\(.*\)\(.*\)|\2|p' "$HOME/.config/Radarr/config.xml")
414 | old_radarr_port=$(sed -n 's|\(.*\)\(.*\)|\2|p' "$HOME/old/.config/Radarr/config.xml")
415 | old_subnet=$(get_ini $HOME/old/.info.lock general SUBNET)
416 | subnet=$(cat $HOME/.install/subnet.lock)
417 | sed -i "s|${old_subnet}|${subnet}|g" "$HOME/old/.config/Radarr/config.xml"
418 | sed -i "s|${old_radarr_port}|${radarr_port}|g" "$HOME/old/.config/Radarr/config.xml"
419 | mv "$HOME/.config/Radarr" "$HOME/.config/Radarr.bak"
420 | mv "$HOME/old/.config/Radarr/" "$HOME/.config/Radarr/"
421 | sudo box start radarr
422 | }
423 |
424 | function migrateRtorrent() {
425 | if [[ ! -f $HOME/old/.install/.rtorrent.lock ]]; then
426 | echo "rtorrent was not previously installed... Skipping!"
427 | return
428 | fi
429 | install_stop rtorrent
430 | mv $HOME/.sessions $HOME/.sessions.bak
431 | cp -r "$HOME/old/.sessions/" "$HOME/.sessions"
432 | sed -i "s|${old_home}/|${HOME}/|g" "$HOME/.sessions/*"
433 | sudo box start rtorrent
434 | }
435 |
436 | function migrateSabnzbd() {
437 | if [[ ! -f $HOME/old/.install/.sabnzbd.lock ]]; then
438 | echo "SABNzbd was not previously installed... Skipping!"
439 | return
440 | fi
441 | install_stop sabnzbd
442 | }
443 |
444 | function migrateSonarr() {
445 | if [[ ! -f $HOME/old/.install/.sonarr.lock ]]; then
446 | echo "Sonarr was not previously installed... Skipping!"
447 | return
448 | fi
449 | install_stop sonarr
450 | # keep old api, no need to use new one.
451 | subnet=$(cat "$HOME/.config/subnet.lock")
452 | sonarr_port=$(sed -n 's|\(.*\)\(.*\)|\2|p' "$HOME/.config/Sonarr/config.xml")
453 | old_sonarr_port=$(sed -n 's|\(.*\)\(.*\)|\2|p' "$HOME/old/.config/Sonarr/config.xml")
454 | old_subnet=$(get_ini $HOME/old/.info.lock general SUBNET)
455 | subnet=$(cat $HOME/.install/subnet.lock)
456 | sed -i "s|${old_subnet}|${subnet}|g" "$HOME/old/.config/Sonarr/config.xml"
457 | sed -i "s|${old_sonarr_port}|${sonarr_port}|g" "$HOME/old/.config/Sonarr/config.xml"
458 | mv "$HOME/.config/Sonarr" "$HOME/.config/Sonarr.bak"
459 | mv "$HOME/old/.config/Sonarr/" "$HOME/.config/Sonarr/"
460 | sudo box start sonarr
461 | }
462 |
463 | function migrateTautulli {
464 | if [[ ! -f $HOME/old/.install/.plexpy.lock ]]; then
465 | echo "Tautulli was not previously installed... Skipping!"
466 | return
467 | fi
468 | install_stop plexpy
469 | # edit ini
470 | taut_port=$(get_ini $HOME/plexpy/config.ini General http_port)
471 | old_home=$(get_ini "$HOME/old/.info.lock" "general" "HOME")
472 | subnet=$(cat $HOME/.install/subnet.lock)
473 | set_ini "$HOME/old/plexpy/config.ini" General http_host $subnet
474 | set_ini "$HOME/plexpy/config.ini" General http_port $taut_port
475 | sed -i "s|$old_home/|$HOME/|g" "$HOME/old/plexpy/config.ini"
476 | mv "$HOME/old/plexpy/" "$HOME/plexpy/"
477 | sudo box start plexpy
478 | }
479 |
480 | function migrateFilebrowser() {
481 | if [[ ! -f $HOME/old/.install/.filebrowser.lock ]]; then
482 | echo "Filebrowser was not previously installed... Skipping!"
483 | return
484 | fi
485 | check_scripts
486 | bash "$HOME/scripts/hosted-scripts/filebrowser.sh"
487 | }
488 |
489 | function migrateKativa() {
490 | if [[ ! -f $HOME/old/.install/.kativa.lock ]]; then
491 | echo "Kativa was not previously installed... Skipping!"
492 | return
493 | fi
494 | check_scripts
495 | bash "$HOME/scripts/hosted-scripts/kativa.sh"
496 | }
497 |
498 | function migrateKomga() {
499 | if [[ ! -f $HOME/old/.install/.komga.lock ]]; then
500 | echo "Komga was not previously installed... Skipping!"
501 | return
502 | fi
503 | check_scripts
504 | bash "$HOME/scripts/hosted-scripts/komga.sh"
505 |
506 | }
507 |
508 | function migrateLounge() {
509 | if [[ ! -f $HOME/old/.install/.lounge.lock ]]; then
510 | echo "Lounge was not previously installed... Skipping!"
511 | return
512 | fi
513 | check_scripts
514 | bash "$HOME/scripts/hosted-scripts/lounge.sh"
515 | }
516 |
517 | function migrateMylar() {
518 | if [[ ! -f $HOME/old/.install/.mylar.lock ]]; then
519 | echo "Mylar was not previously installed... Skipping!"
520 | return
521 | fi
522 | check_scripts
523 | bash "$HOME/scripts/hosted-scripts/mylar.sh"
524 | }
525 |
526 | function migrateNGPost() {
527 | if [[ ! -f $HOME/old/.install/.ngpost.lock ]]; then
528 | echo "NGPost was not previously installed... Skipping!"
529 | return
530 | fi
531 | check_scripts
532 | bash "$HOME/scripts/hosted-scripts/ngpost.sh"
533 |
534 | }
535 |
536 | function migrateOverseerr() {
537 | if [[ ! -f $HOME/old/.install/.overseerr.lock ]]; then
538 | echo "Overseerr was not previously installed... Skipping!"
539 | return
540 | fi
541 | check_scripts
542 | bash "$HOME/scripts/hosted-scripts/overseerr.sh"
543 | }
544 |
545 | function migrateProwlarr() {
546 | if [[ ! -f $HOME/old/.install/.prowlarr.lock ]]; then
547 | echo "Prowlarr was not previously installed... Skipping!"
548 | return
549 | fi
550 | check_scripts
551 | bash "$HOME/scripts/hosted-scripts/prowlarr.sh"
552 | prowlarr_port=$(new_port 9696 12000)
553 | old_prowlarr_port=$(sed -n 's|\(.*\)\(.*\)|\2|p' "$HOME/old/.config/Prowlarr/config.xml")
554 | sed -i "s|${old_prowlarr_port}|${prowlarr_port}|g" "$HOME/old/.config/Prowlarr/config.xml"
555 | mv "$HOME/.config/Prowlarr" "$HOME/.config/Prowlarr.bak"
556 | mv "$HOME/old/.config/Prowlarr/" "$HOME/.config/Prowlarr/"
557 |
558 | }
559 |
560 | function migrateRadarr4K() {
561 | if [[ ! -f $HOME/old/.install/.radarr4k.lock ]]; then
562 | echo "Radarr4k was not previously installed... Skipping!"
563 | return
564 | fi
565 | check_scripts
566 | bash "$HOME/scripts/hosted-scripts/radarr4k.sh"
567 | echo "Please secure your instance!"
568 | }
569 |
570 | function migrateReadarr() {
571 | if [[ ! -f $HOME/old/.install/.readarr.lock ]]; then
572 | echo "Readarr was not previously installed... Skipping!"
573 | return
574 | fi
575 | check_scripts
576 | bash "$HOME/scripts/hosted-scripts/readarr.sh"
577 | readarr_port=$(new_port 9696 12000)
578 | old_readarr_port=$(sed -n 's|\(.*\)\(.*\)|\2|p' "$HOME/old/.config/Readarr/config.xml")
579 | sed -i "s|${old_readarr_port}|${readarr_port}|g" "$HOME/old/.config/Readarr/config.xml"
580 | mv "$HOME/.config/Readarr" "$HOME/.config/Readarr.bak"
581 | mv "$HOME/old/.config/Readarr/" "$HOME/.config/Readarr/"
582 | echo "Please secure your instance!"
583 | }
584 |
585 | function migrateSonarr4k() {
586 | if [[ ! -f $HOME/old/.install/.sonarr4k.lock ]]; then
587 | echo "Sonarr4k was not previously installed... Skipping!"
588 | return
589 | fi
590 | check_scripts
591 | bash "$HOME/scripts/hosted-scripts/sonarr4k.sh"
592 | echo "Please secure your instance!"
593 | }
594 |
595 | function migrateSubsonic() {
596 | if [[ ! -f $HOME/old/.install/.subsonic.lock ]]; then
597 | echo "Subsonic was not previously installed... Skipping!"
598 | return
599 | fi
600 | # idk how this one works
601 | check_scripts
602 | bash "$HOME/scripts/hosted-scripts/subsonic.sh"
603 | }
604 |
605 | function migrateUnpackerr() {
606 | if [[ ! -f $HOME/old/.install/.unpackerr.lock ]]; then
607 | echo "Unpackerr was not previously installed... Skipping!"
608 | return
609 | fi
610 | # More than this is extra... will not happen.
611 | check_scripts
612 | bash "$HOME/scripts/hosted-scripts/unpackerr.sh"
613 | }
614 |
615 | echo "Welcome to the HostingBy Migration Script"
616 | echo "This script will inventory your current slot and copy the data for you."
617 | echo "While we do provide partial support, we are not responsible should the slot explode in some unpredictable way."
618 | echo "What do you like to do?"
619 | echo ""
620 | echo "move = Run me on your old slot!"
621 | echo "migrate = Run me on your new slot!"
622 | echo "exit = Exits Installer"
623 | while true; do
624 | read -r -p "Enter it here: " choice
625 | case $choice in
626 | "move")
627 | migrateData
628 | break
629 | ;;
630 | "migrate")
631 | runner
632 | break
633 | ;;
634 | "upgrade")
635 | _upgrade
636 | break
637 | ;;
638 | "exit")
639 | break
640 | ;;
641 | *)
642 | echo "Unknown Option."
643 | ;;
644 | esac
645 | done
646 | exit
647 |
--------------------------------------------------------------------------------
/motd/.hostingby.design.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | user=$(whoami)
3 | hostname=$(hostname -f)
4 | cpu_load=$(cat /proc/loadavg | cut -d" " -f 1 | echo "scale=4; ($(> $HOME/.bashrc
21 | echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> $HOME/.bashrc
22 | export PYENV_ROOT="$HOME/.local/opt/pyenv"
23 | export PATH="$PYENV_ROOT/bin:$PATH"
24 | }
25 |
26 | function pyenv_update(){
27 | $HOME/.local/opt/pyenv/bin/pyenv update
28 | }
29 |
30 | # Install a specific version of python through `pyenv` if not yet available
31 | # \
32 | # Parameters:
33 | # - `$1` = The version necessary
34 | function pyenv_install_version() {
35 | version=$1
36 | versions=$($HOME/.local/opt/pyenv/bin/pyenv versions 2>> "$log")
37 | if [[ ! $versions =~ $version ]]; then
38 | echo "Compiling Python $version. This may take some time"
39 | export TMPDIR="$HOME/.tmp"
40 | mkdir -p "$TMPDIR"
41 | $HOME/.local/opt/pyenv/bin/pyenv install "$version" >> "$log" 2>&1
42 | echo "Python $version compiled"
43 | else
44 | echo "Python $version already installed!"
45 | fi
46 | }
47 |
48 | # Install venv of a specific version
49 | # \
50 | # Parameters:
51 | # - `$1` = The version necessary
52 | # - `$2` = Full path of the destination to create it in
53 | function pyenv_create_venv() {
54 | version=$1
55 | destination=$2
56 | echo "Creating venv ($version) in $destination"
57 | mkdir -p $destination
58 | $HOME/.local/opt/pyenv/versions/"$version"/bin/python3 -m venv "$destination" >> "$log" 2>&1
59 | echo "venv created"
60 | }
61 |
62 | # Finds a random free port between a range
63 | # \
64 | # Parameters:
65 | # $1 = Lower bound
66 | # $2 = Upper bound
67 | # \
68 | # Returns an integer
69 | function port() {
70 | LOW_BOUND=$1
71 | UPPER_BOUND=$2
72 | comm -23 <(seq ${LOW_BOUND} ${UPPER_BOUND} | sort) <(ss -Htan | awk '{print $4}' | cut -d':' -f2 | sort -u) | shuf | head -n 1
73 | }
74 |
75 | function github_latest_version() {
76 | # Argument expects the author/repo format
77 | # e.g. swizzin/swizzin
78 | repo=$1
79 | curl -fsSLI -o /dev/null -w %{url_effective} https://github.com/${repo}/releases/latest | grep -o '[^/]*$'
80 | }
81 |
82 | http_port=$(port 3000 9000)
83 |
84 | function _download() {
85 | echo "Downloading Mylarr"
86 | mylar_latest=$(github_latest_version mylar3/mylar3)
87 | curl -sL https://github.com/mylar3/mylar3/archive/refs/tags/${mylar_latest}.tar.gz -o /tmp/mylar.tar.gz >> "$log" 2>&1 || {
88 | echo "Failed to download Mylar from GitHub"
89 | exit 1
90 | }
91 | echo "Downloaded Mylar"
92 |
93 | echo "Extracting Mylar"
94 | mkdir -p "$HOME/mylar"
95 | tar xvf /tmp/mylar.tar.gz --directory "$HOME/mylar" --strip-components=1 >> "$log" 2>&1 || {
96 | echo "Failed to download Mylar from GitHub"
97 | exit 1
98 | }
99 |
100 | rm -f /tmp/mylar.tar.gz
101 |
102 | echo "Installing Python Dependencies"
103 | $HOME/.venv/mylar/bin/pip install --upgrade pip &>> "${log}"
104 | $HOME/.venv/mylar/bin/pip install -r $HOME/mylar/requirements.txt &>> "${log}"
105 | echo "Intalled Python Dependencies"
106 | }
107 |
108 | function _install() {
109 | echo "Starting Mylar3 Install"
110 | # Not using system python because mylar likes to bump deps with no warning
111 | if [[ ! -d "$HOME/.local/opt/pyenv" ]]; then
112 | echo "Installing pyenv..."
113 | pyenv_install
114 | fi
115 | # Using most heavily tested for stability
116 | # https://github.com/mylar3/mylar3/wiki/Installation-Instructions
117 | pyenv_install_version 3.9.4
118 | pyenv_create_venv 3.9.4 "$HOME/.venv/mylar"
119 |
120 | # Download Latest
121 | _download
122 | echo "Installing systemd service"
123 | mkdir -p "$HOME/.config/systemd/user/"
124 | cat > "$HOME/.config/systemd/user/mylar.service" << EOS
125 | [Unit]
126 | Description=Mylar service
127 | After=network-online.target
128 |
129 | [Service]
130 | Type=forking
131 | ExecStart=$HOME/.venv/mylar/bin/python3 $HOME/mylar/Mylar.py --datadir $HOME/.config/mylar/ -v --daemon --nolaunch --quiet
132 | WorkingDirectory=$HOME/mylar/
133 | GuessMainPID=no
134 | Restart=on-failure
135 |
136 | [Install]
137 | WantedBy=default.target
138 | EOS
139 |
140 | echo "Please enter a password for Mylar user ${user} to use."
141 | read -rep "" pass
142 |
143 | mkdir -p "$HOME/.config/mylar/"
144 | cat > "$HOME/.config/mylar/config.ini" << EOF
145 | [Interface]
146 | http_port = ${http_port}
147 | http_host = 0.0.0.0
148 | http_root = /
149 | authentication = 1
150 | http_username = ${user}
151 | http_password = ${pass}
152 | EOF
153 |
154 | echo "Starting Systemd Service"
155 | systemctl --user -q daemon-reload
156 | systemctl --user enable -q --now mylar
157 | echo "Mylar is now installed."
158 | echo "You can find it running at http://$(hostname -f):${http_port}/ -- Enjoy!"
159 | }
160 |
161 | function _remove(){
162 | systemctl --user stop -q --now mylar
163 | systemctl --user disable -q --now mylar
164 | rm -rf "$HOME/.config/mylar"
165 | rm -f "$HOME/.config/systemd/user/mylar.service"
166 | rm -rf "$HOME/.venv/mylar"
167 | rm -rf "$HOME/mylar"
168 | echo "Python 3.9.4 has been left in tact to avoid breaking other things."
169 | echo "To remove it, please run pyenv uninstall 3.9.4"
170 | }
171 |
172 | function _upgrade(){
173 | systemctl --user -q stop mylar
174 | echo "Upgrading Mylarr"
175 | _download
176 | systemctl --user daemon-reload
177 | systemctl --user restart mylar
178 | echo "Upgrade Complete!"
179 | }
180 |
181 | echo 'This is unsupported software. You will not get help with this, please answer `yes` if you understand and wish to proceed'
182 | if [[ -z ${eula} ]]; then
183 | read -r eula
184 | fi
185 |
186 | if ! [[ $eula =~ yes ]]; then
187 | echo "You did not accept the above. Exiting..."
188 | exit 1
189 | else
190 | echo "Proceeding with installation"
191 | fi
192 |
193 | echo "Welcome to the Mylar3 installer..."
194 | echo ""
195 | echo "What do you like to do?"
196 | echo ""
197 | echo "install = Install Mylar"
198 | echo "upgrade = Upgrade existing Mylar installation"
199 | echo "uninstall = Completely removes Mylar"
200 | echo "exit = Exits Installer"
201 | while true; do
202 | read -r -p "Enter it here: " choice
203 | case $choice in
204 | "install")
205 | clear
206 | _install
207 | break
208 | ;;
209 | "uninstall")
210 | _remove
211 | break
212 | ;;
213 | "upgrade")
214 | _upgrade
215 | break
216 | ;;
217 | "exit")
218 | break
219 | ;;
220 | *)
221 | echo "Unknown Option."
222 | ;;
223 | esac
224 | done
225 | exit
226 |
--------------------------------------------------------------------------------
/ngpost.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | user="$(whoami)"
3 | mkdir -p "$HOME/.logs/"
4 | touch "$HOME/.logs/ngpost.log"
5 | log="$HOME/.logs/ngpost.log"
6 |
7 | function _install() {
8 | if [[ -f "/home/$user/.install/.ngpost.lock" ]]; then
9 | echo "ngpost is already installed."
10 | exit 0
11 | fi
12 | # Get dir structure ready
13 | echo "Starting ngPost installation"
14 | echo "Establishing directory structure"
15 | mkdir -p "$HOME/scripts"
16 | mkdir -p "$HOME/.local/bin"
17 | mkdir -p "$HOME/.install"
18 | cd "$HOME/scripts"
19 |
20 | # Clone the repo
21 | echo "Cloning the ngPost repo"
22 | git clone "https://github.com/mbruel/ngPost.git" >> "$log" 2>&1 || {
23 | echo "Failed to clone repo. Exiting."
24 | exit 1
25 | }
26 |
27 | cd "$HOME/scripts/ngPost"|| {
28 | echo "$HOME/scripts/ngPost"
29 | exit 1
30 | }
31 |
32 | # checkout latest tag
33 | echo "Checking out the latest release"
34 | git fetch --tags >> "$log" 2>&1
35 | latestTag=$(git describe --tags $(git rev-list --tags --max-count=1))
36 | git checkout $latestTag >> "$log" 2>&1 || {
37 | echo "Failed to checkout latest tag. Exiting..."
38 | exit 1
39 | }
40 |
41 | cd "$HOME/scripts/ngPost/src" || {
42 | echo "failed to cd to $HOME/scripts/ngPost/src"
43 | exit 1
44 | }
45 |
46 | # build
47 | echo "Building with qt5"
48 | qmake -qt=qt5 >> "$log" 2>&1 || {
49 | echo "Failed to run qmake... Exiting"
50 | exit 1
51 | }
52 |
53 | make -j$(nproc) >> "$log" 2>&1 || {
54 | echo "Failed to build... Exiting"
55 | exit 1
56 | }
57 |
58 | # Add to PATH
59 | echo "adding to path"
60 | ln -s "$HOME/scripts/ngPost/src/ngPost" "$HOME/.local/bin/"
61 | . "$HOME/.profile"
62 |
63 | "$HOME/.local/bin/ngPost" --help || {
64 | echo "something went wrong... exiting"
65 | exit 1
66 | }
67 |
68 | touch "$HOME/.install/.ngpost.lock"
69 | echo "Successfully built and added to PATH. You may need to run . $HOME/.profile or restart your terminal window to have these changes take effect."
70 | }
71 |
72 | function _remove() {
73 | if [[ ! -f "/home/$user/.install/.ngpost.lock" ]]; then
74 | echo "ngpost is not installed."
75 | exit 0
76 | fi
77 | echo "Removing ngPost"
78 | rm -f "$HOME/.local/bin/ngPost"
79 | rm -rf "$HOME/scripts/ngPost"
80 | rm "$HOME/.install/.ngpost.lock"
81 | echo "ngPost has been removed successfully!"
82 | }
83 |
84 | echo 'This is unsupported software. You will not get help with this, please answer `yes` if you understand and wish to proceed'
85 | if [[ -z ${eula} ]]; then
86 | read -r eula
87 | fi
88 |
89 | if ! [[ $eula =~ yes ]]; then
90 | echo "You did not accept the above. Exiting..."
91 | exit 1
92 | else
93 | echo "Proceeding with installation"
94 | fi
95 |
96 | echo "Welcome to The ngpost installer..."
97 | echo ""
98 | echo "What do you like to do?"
99 | echo "install = Install ngPost"
100 | echo "uninstall = Completely removes ngPost"
101 | echo "exit = Exits Installer"
102 | while true; do
103 | read -r -p "Enter it here: " choice
104 | case $choice in
105 | "install")
106 | _install
107 | break
108 | ;;
109 | "uninstall")
110 | _remove
111 | break
112 | ;;
113 | "exit")
114 | break
115 | ;;
116 | *)
117 | echo "Unknown Option."
118 | ;;
119 | esac
120 | done
121 | exit
122 |
--------------------------------------------------------------------------------
/overseerr.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # thx flyingsausages and swizzin team
3 | export user=$(whoami)
4 | mkdir -p ~/.logs/
5 | touch ~/.logs/overseerr.log
6 | export log="$HOME/.logs/overseerr.log"
7 |
8 | function _deps() {
9 | ## Function for installing nvm.
10 | if [[ ! -d /home/$user/.nvm ]]; then
11 | echo "Installing node"
12 | curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash >> "$log" 2>&1
13 | echo "nvm installed."
14 | else
15 | echo "nvm is already installed."
16 | fi
17 | export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
18 | [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
19 | nvm install --lts >> "$log" 2>&1 || {
20 | echo "node failed to install"
21 | exit 1
22 | }
23 | echo "Node LTS installed."
24 | echo "Installing Yarn"
25 | npm install -g yarn >> "$log" 2>&1 || {
26 | echo "Yarn failed to install"
27 | exit 1
28 | }
29 | echo "Yarn installed."
30 | }
31 |
32 | function _overseer_install() {
33 | echo "Downloading and extracting source code"
34 | dlurl="$(curl -sS https://api.github.com/repos/sct/overseerr/releases/latest | jq .tarball_url -r)"
35 | wget "$dlurl" -q -O /home/${user}/overseerr.tar.gz >> "$log" 2>&1 || {
36 | echo "Download failed"
37 | exit 1
38 | }
39 | mkdir -p ~/overseerr
40 | tar --strip-components=1 -C ~/overseerr -xzvf /home/${user}/overseerr.tar.gz >> "$log" 2>&1
41 | rm /home/${user}/overseerr.tar.gz
42 | echo "Code extracted"
43 |
44 | # Changing baseurl before build
45 | # export OVERSEERR_BASEURL='/baseurl'
46 |
47 | echo "Installing dependencies via yarn"
48 | yarn install --cwd ~/overseerr >> "$log" 2>&1 || {
49 | echo "Failed to install dependencies"
50 | exit 1
51 | }
52 | echo "Dependencies installed"
53 |
54 | echo "Building overseerr"
55 | yarn --cwd ~/overseerr build >> "$log" 2>&1 || {
56 | echo "Failed to build overseerr sqlite"
57 | exit 1
58 | }
59 | echo "Succesfully built"
60 | }
61 |
62 | function _port() {
63 | LOW_BOUND=$1
64 | UPPER_BOUND=$2
65 | comm -23 <(seq "${LOW_BOUND}" "${UPPER_BOUND}" | sort) <(ss -Htan | awk '{print $4}' | cut -d':' -f2 | sort -u) | shuf | head -n 1
66 | }
67 |
68 | function _service() {
69 | mkdir -p "/home/$user/.config/systemd/user/"
70 | mkdir -p "/home/$user/.install/"
71 | mkdir -p "/home/$user/.config/overseerr/"
72 | # Adapted from https://aur.archlinux.org/cgit/aur.git/tree/overseerr.service?h=overseerr
73 | cat > ~/.config/systemd/user/overseerr.service << EOF
74 | [Unit]
75 | Description=Overseerr Service
76 | Wants=network-online.target
77 | After=network-online.target
78 | [Service]
79 | EnvironmentFile=/home/$user/overseerr/env.conf
80 | Environment=NODE_ENV=production
81 | Type=exec
82 | Restart=on-failure
83 | WorkingDirectory=/home/$user/overseerr
84 | ExecStart=$(which node) dist/index.js
85 | [Install]
86 | WantedBy=default.target
87 | EOF
88 | port=$(_port 1000 18000)
89 | cat > ~/overseerr/env.conf << EOF
90 | # specify on which port to listen
91 | PORT=$port
92 | EOF
93 |
94 | systemctl --user daemon-reload
95 | systemctl --user enable --now -q overseerr
96 | touch ~/.install/.overseerr.lock
97 | echo "Overseerr is up and running on http://$(hostname -f):$port/overseerr"
98 |
99 | }
100 |
101 | function _remove() {
102 | systemctl --user disable --now overseerr
103 | sleep 2
104 | rm -rf ~/overseerr
105 | rm -rf ~/.config/overseerr
106 | rm -rf ~/.config/systemd/user/overseerr.service
107 | rm -rf ~/.install/.overseerr.lock
108 | }
109 |
110 | echo 'This is unsupported software. You will not get help with this, please answer `yes` if you understand and wish to proceed'
111 | if [[ -z ${eula} ]]; then
112 | read -r eula
113 | fi
114 |
115 | if ! [[ $eula =~ yes ]]; then
116 | echo "You did not accept the above. Exiting..."
117 | exit 1
118 | else
119 | echo "Proceeding with installation"
120 | fi
121 |
122 | echo "Welcome to the Overseerr installer..."
123 | echo ""
124 | echo "What do you like to do?"
125 | echo ""
126 | echo "install = Install Overseerr"
127 | echo "uninstall = Completely removes Overseerr"
128 | echo "exit = Exits Installer"
129 | while true; do
130 | read -r -p "Enter it here: " choice
131 | case $choice in
132 | "install")
133 | clear
134 | _deps
135 | _overseer_install
136 | _service
137 | break
138 | ;;
139 | "uninstall")
140 | _remove
141 | break
142 | ;;
143 | "exit")
144 | break
145 | ;;
146 | *)
147 | echo "Unknown Option."
148 | ;;
149 | esac
150 | done
151 | exit
152 |
--------------------------------------------------------------------------------
/prowlarr.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | ## Installer by b
3 | ## Thanks to Bakerboy, Sosig, Liara, and team for some of the functions / logic.
4 | ## b
5 |
6 | user=$(whoami)
7 |
8 | if [[ ! -d $HOME/.logs ]]; then
9 | mkdir -p $HOME/.logs
10 | fi
11 |
12 | touch "$HOME/.logs/prowlarr.log"
13 | log="$HOME/.logs/prowlarr.log"
14 |
15 | function port() {
16 | LOW_BOUND=$1
17 | UPPER_BOUND=$2
18 | comm -23 <(seq ${LOW_BOUND} ${UPPER_BOUND} | sort) <(ss -Htan | awk '{print $4}' | cut -d':' -f2 | sort -u) | shuf | head -n 1
19 | }
20 |
21 | function _install() {
22 | ssl_port=$(port 14000 16000)
23 | port=$(port 10000 14000)
24 | domain=$(hostname -f)
25 |
26 | # Download App
27 | echo "Downloading Prowlarr"
28 |
29 | curl -sL "http://prowlarr.servarr.com/v1/update/develop/updatefile?os=linux&runtime=netcore&arch=x64" -o /tmp/prowlarr.tar.gz >> "$log" 2>&1 || {
30 | echo "Download failed."
31 | exit 1
32 | }
33 |
34 | # Extract
35 | echo "Extracting Prowlarr"
36 | tar xfv "/tmp/prowlarr.tar.gz" --directory $HOME/ >> "$log" 2>&1 || {
37 | echo_error "Failed to extract"
38 | exit 1
39 | }
40 | rm -rf /tmp/prowlarr.tar.gz
41 |
42 | if [[ ! -d $HOME/.config/systemd/user/ ]]; then
43 | mkdir -p $HOME/.config/systemd/user/
44 | fi
45 |
46 | # Service File
47 | echo "Writing service file"
48 | cat > "$HOME/.config/systemd/user/prowlarr.service" << EOF
49 | [Unit]
50 | Description=Prowlarr Daemon
51 | After=syslog.target network.target
52 |
53 | [Service]
54 | Type=simple
55 | ExecStart=$HOME/Prowlarr/Prowlarr -nobrowser -data=$HOME/.config/prowlarr/
56 | TimeoutStopSec=20
57 | KillMode=process
58 | Restart=on-failure
59 |
60 | [Install]
61 | WantedBy=default.target
62 | EOF
63 | mkdir -p $HOME/.config/prowlarr/
64 | cat > $HOME/.config/prowlarr/config.xml << PROWLARR
65 |
66 | debug
67 | BuiltIn
68 | *
69 | ${port}
70 | ${ssl_port}
71 | False
72 | False
73 |
74 | None
75 |
76 | develop
77 |
78 | PROWLARR
79 |
80 | # Enable/Start Prowlarr
81 | echo "Starting Prowlarr"
82 | systemctl enable --now --user prowlarr.service
83 | echo "Prowlarr will be accessible at http://${domain}:${port}"
84 |
85 | echo "Waiting for Prowlarr to start"
86 | sleep 45
87 | apikey=$(grep -oPm1 "(?<=)[^<]+" "$HOME/.config/prowlarr/config.xml")
88 | echo "${apikey}"
89 | if ! timeout 5 bash -c -- "while ! curl -sfkL \"http://127.0.0.1:${port}/api/v1/system/status?apiKey=${apikey}\" >> \"$log\" 2>&1; do sleep 5; done"; then
90 | echo "Prowlarr API not respond as expected. Please make sure Prowlarr is running."
91 | exit 1
92 | fi
93 | read -rep "Please set a password for your prowlarr user ${user}> " -i "" password
94 | echo "Applying authentication"
95 | payload=$(curl -skL "http://127.0.0.1:${port}/api/v1/config/host?apikey=${apikey}" | jq ".authenticationMethod = \"forms\" | .username = \"${user}\" | .password = \"${password}\"")
96 | curl -sk "http://127.0.0.1:${port}/api/v1/config/host?apikey=${apikey}" -X PUT -H 'Accept: application/json, text/javascript, */*; q=0.01' --compressed -H 'Content-Type: application/json' --data-raw "${payload}" >> "$log"
97 | sleep 15
98 | echo "Restarting prowlarr"
99 | systemctl restart --user prowlarr
100 |
101 |
102 | echo "Prowlarr has been installed. You can access it at http://${domain}:${port}"
103 | echo "Remember to check your authentication. This is publicly accessible and will contain your API keys and stuff."
104 | }
105 |
106 | function _remove() {
107 | systemctl disable --now --user prowlarr
108 | rm -rf "$HOME/.config/prowlarr/"
109 | rm -rf "$HOME/Prowlarr/"
110 | echo "Prowlarr has been removed."
111 | }
112 |
113 | echo 'This is unsupported software. You will not get help with this, please answer `yes` if you understand and wish to proceed'
114 | if [[ -z ${eula} ]]; then
115 | read -r eula
116 | fi
117 |
118 | if ! [[ $eula =~ yes ]]; then
119 | echo "You did not accept the above. Exiting..."
120 | exit 1
121 | else
122 | echo "Proceeding with installation"
123 | fi
124 |
125 | echo "Welcome to Prowlarr installer..."
126 | echo ""
127 | echo "What do you like to do?"
128 | echo "Logs are stored at ${log}"
129 | echo "install = Install Prowlarr"
130 | echo "uninstall = Completely removes Prowlarr"
131 | echo "exit = Exits Installer"
132 | while true; do
133 | read -r -p "Enter it here: " choice
134 | case $choice in
135 | "install")
136 | _install
137 | break
138 | ;;
139 | "uninstall")
140 | _remove
141 | break
142 | ;;
143 | "exit")
144 | break
145 | ;;
146 | *)
147 | echo "Unknown Option."
148 | ;;
149 | esac
150 | done
151 | exit
152 |
--------------------------------------------------------------------------------
/qbit_manage.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # qbit_manage barebones installer
3 |
4 | export user=$(whoami)
5 | mkdir -p "$HOME/.logs/"
6 | export log="$HOME/.logs/qbit_manage.log"
7 | touch "$log"
8 |
9 | function pyenv_install(){
10 | mkdir -p $HOME/.local/opt
11 | # Clone pyenv
12 | git clone https://github.com/pyenv/pyenv.git $HOME/.local/opt/pyenv
13 | git clone https://github.com/pyenv/pyenv-virtualenv.git $HOME/.local/opt/pyenv/plugins/pyenv-virtualenv
14 | git clone https://github.com/pyenv/pyenv-update.git $HOME/.local/opt/pyenv/plugins/pyenv-update
15 | echo 'export PYENV_ROOT="$HOME/.local/opt/pyenv"' >> $HOME/.bashrc
16 | echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> $HOME/.bashrc
17 | export PYENV_ROOT="$HOME/.local/opt/pyenv"
18 | export PATH="$PYENV_ROOT/bin:$PATH"
19 | }
20 |
21 | function pyenv_update(){
22 | $HOME/.local/opt/pyenv/bin/pyenv update
23 | }
24 |
25 | # Install a specific version of python through `pyenv` if not yet available
26 | # \
27 | # Parameters:
28 | # - `$1` = The version necessary
29 | function pyenv_install_version() {
30 | version=$1
31 | versions=$("$HOME/.local/opt/pyenv/bin/pyenv" versions 2>> "$log")
32 | if [[ ! $versions =~ $version ]]; then
33 | echo "Compiling Python $version. This may take some time"
34 | export TMPDIR="$HOME/.tmp"
35 | mkdir -p "$TMPDIR"
36 | $HOME/.local/opt/pyenv/bin/pyenv install "$version" >> "$log" 2>&1
37 | echo "Python $version compiled"
38 | else
39 | echo "Python $version already installed!"
40 | fi
41 | }
42 |
43 | # Install venv of a specific version
44 | # \
45 | # Parameters:
46 | # - `$1` = The version necessary
47 | # - `$2` = Full path of the destination to create it in
48 | function pyenv_create_venv() {
49 | version=$1
50 | destination=$2
51 | echo "Creating venv ($version) in $destination"
52 | mkdir -p $destination
53 | $HOME/.local/opt/pyenv/versions/"$version"/bin/python3 -m venv "$destination" >> "$log" 2>&1
54 | echo "venv created"
55 | }
56 |
57 | function _install() {
58 | echo 'This is unsupported software. You will not get help with this, please answer `yes` if you understand and wish to proceed'
59 | if [[ -z ${eula} ]]; then
60 | read -r eula
61 | fi
62 |
63 | if ! [[ $eula =~ yes ]]; then
64 | echo "You did not accept the above. Exiting..."
65 | exit 1
66 | else
67 | echo "Proceeding with installation"
68 | fi
69 |
70 | if [[ ! -d "$HOME/.local/opt/pyenv" ]]; then
71 | echo "Installing pyenv..."
72 | pyenv_install
73 | fi
74 | echo "Starting installation of qbit_manage."
75 | mkdir -p "$HOME/.venv/"
76 | pyenv_install_version 3.10.9
77 | pyenv_create_venv 3.10.9 "$HOME/.venv/qbit_manage"
78 | mkdir -p "$HOME/scripts"
79 | echo "Cloning qbit_manage"
80 | git clone "https://github.com/StuffAnThings/qbit_manage" "$HOME/scripts/qbit_manage" >> "$log" 2>&1
81 | echo "Installing qbit_manage requirements"
82 | "$HOME/.venv/qbit_manage/bin/pip" install -U pip >> "$log" 2>&1
83 | "$HOME/.venv/qbit_manage/bin/pip" install wheel >> "$log" 2>&1
84 | "$HOME/.venv/qbit_manage/bin/pip3" install -r "$HOME/scripts/qbit_manage/requirements.txt" >> "$log" 2>&1
85 | }
86 |
87 | function _upgrade() {
88 | git -C "$HOME/scripts/qbit_manage" pull >> "$log" 2>&1
89 | "$HOME/.venv/qbit_manage/bin/pip" install -U pip >> "$log" 2>&1
90 | "$HOME/.venv/qbit_manage/bin/pip3" install -r "$HOME/scripts/qbit_manage/requirements.txt" >> "$log" 2>&1
91 | }
92 |
93 | function _remove() {
94 | rm -rf "$HOME/scripts/qbit_manage"
95 | rm -rf "$HOME/.venv/qbit_manage"
96 | }
97 |
98 | echo "Welcome to the qbit_manage installer..."
99 | echo ""
100 | echo "What do you like to do?"
101 | echo ""
102 | echo "install = Install qbit_manage"
103 | echo "upgrade = Upgrade existing qbit_manage installation"
104 | echo "uninstall = Completely removes qbit_manage"
105 | echo "exit = Exits Installer"
106 |
107 | while true; do
108 | read -r -p "Enter it here: " choice
109 | case $choice in
110 | "install")
111 | clear
112 | _install
113 | break
114 | ;;
115 | "uninstall")
116 | _remove
117 | break
118 | ;;
119 | "upgrade")
120 | _upgrade
121 | break
122 | ;;
123 | "exit")
124 | break
125 | ;;
126 | *)
127 | echo "Unknown Option."
128 | ;;
129 | esac
130 | done
131 | exit
132 |
--------------------------------------------------------------------------------
/race-ready.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # By B
3 | user=$(whoami)
4 | mkdir -p /home/${user}/.logs/
5 | touch /home/${user}/.logs/race-ready.log
6 | log="/home/${user}/.logs/race-ready.log"
7 | port=$(grep 'WebUI\\Port' /home/${user}/.config/qBittorrent/qBittorrent.conf | cut -d= -f2)
8 | subnet=$(cat /home/${user}/.install/subnet.lock)
9 |
10 | function github_latest_version() {
11 | # Function by Liara
12 | # Argument expects the author/repo format
13 | # e.g. swizzin/swizzin
14 | repo=$1
15 | curl -fsSLI -o /dev/null -w %{url_effective} https://github.com/${repo}/releases/latest | grep -o '[^/]*$'
16 | }
17 |
18 | function _nvm() {
19 | ## Function for installing nvm.
20 | if [[ ! -d /home/$user/.nvm ]]; then
21 | echo "Installing node"
22 | curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash >> "$log" 2>&1
23 | echo "nvm installed."
24 | else
25 | echo "nvm is already installed."
26 | fi
27 | export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
28 | [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
29 | nvm install --lts >> "$log" 2>&1 || {
30 | echo "node failed to install"
31 | exit 1
32 | }
33 | echo "Node LTS installed."
34 | }
35 |
36 | function qbit_race() {
37 | _nvm
38 | . /home/${user}/.bashrc
39 | echo "Installing qbit-race"
40 | RACE_DIR="/home/${user}/scripts/qbit-race"
41 | mkdir -p "${RACE_DIR}"
42 |
43 | version=$(github_latest_version ckcr4lyf/qbit-race)
44 | curl -sL "https://github.com/ckcr4lyf/qbit-race/archive/refs/tags/${version}.tar.gz" -o /tmp/qbit-race.tar.gz
45 | tar xvf "/tmp/qbit-race.tar.gz" --directory "${RACE_DIR}" --strip-components=1 >> "$log" 2>&1
46 | rm -f /tmp/qbit-race.tar.gz
47 |
48 | cp "${RACE_DIR}/sample.env" "${RACE_DIR}/.env"
49 | sed -i "s|QBIT_HOST=127.0.0.1|QBIT_HOST=${subnet}|g" "${RACE_DIR}/.env"
50 | sed -i "s|QBIT_PORT=8080|QBIT_PORT=${port}|g" "${RACE_DIR}/.env"
51 | cp "${RACE_DIR}/sample.settings.js" "${RACE_DIR}/settings.js"
52 | sed -i 's|REANNOUNCE_INTERVAL: 5000,|REANNOUNCE_INTERVAL: 7000,|g' "${RACE_DIR}/settings.js"
53 | sed -i 's|CONCURRENT_RACES: 1,|CONCURRENT_RACES: 3,|g' "${RACE_DIR}/sample.settings.js"
54 | npm --prefix "${RACE_DIR}" install "${RACE_DIR}" >> "$log" 2>&1 || {
55 | echo "Could not install dependencies. Please check the logs and consult the community support channel for your vendor."
56 | exit 1
57 | }
58 | echo "Your script path is $(which node)"
59 | echo "Your script argument is '${RACE_DIR}/bin/autodl_feed.js \"\$(InfoHash)\" \"\$(InfoName)\" \"\$(Tracker)\" \"\$(TorrentPathName)\"'"
60 | echo "Your post-script is '$(which node) ${RACE_DIR}/bin/post_race.js \"%I\" \"%N\" \"%T\"'"
61 | echo "qbit-race has been installed."
62 | touch ~/.install/.qbit-race.lock
63 | }
64 |
65 | function nightwalker() {
66 | echo "Cloning Nightwalker Repo"
67 | git clone "https://github.com/brettpetch/nightwalker.git" /home/${user}/scripts/nightwalker >> "$log" 2>&1 || {
68 | echo "Failed to clone nightwalker... Exiting."
69 | exit 1
70 | }
71 | echo "Nightwalker cloned."
72 | sudo box stop qbittorrent
73 | sed -i "s|^.*AlternativeUIEnabled.*|WebUI\AlternativeUIEnabled=true|g" /home/${user}/.config/qBittorrent/qBittorrent.conf
74 | sed -i "s|^.*RootFolder.*|WebUI\\\RootFolder=/home/${user}/scripts/nightwalker/|g" /home/${user}/.config/qBittorrent/qBittorrent.conf
75 | sudo box start qbittorrent
76 | touch ~/.install/.nightwalker.lock
77 | }
78 |
79 | echo 'This is unsupported software. You will not get help with this, please answer `yes` if you understand and wish to proceed'
80 | if [[ -z ${eula} ]]; then
81 | read -r eula
82 | fi
83 |
84 | if ! [[ $eula =~ yes ]]; then
85 | echo "You did not accept the above. Exiting..."
86 | exit 1
87 | else
88 | echo "Proceeding with installation"
89 | fi
90 |
91 | echo "Welcome to qbit-race installer..."
92 | echo ""
93 | echo "What do you like to do?"
94 | echo "Logs are stored at ${log}"
95 | echo "node = Install Node."
96 | echo "qbitrace = Installs qbit-race + node (Depreciated/Unsupported)"
97 | echo "nightwalker = Installs nightwalker"
98 | echo "exit = Exits Installer"
99 | while true; do
100 | read -r -p "Enter it here: " choice
101 | case $choice in
102 | "node")
103 | _nvm
104 | break
105 | ;;
106 | "qbitrace")
107 | qbit_race
108 | break
109 | ;;
110 | "nightwalker")
111 | nightwalker
112 | break
113 | ;;
114 | "exit")
115 | break
116 | ;;
117 | *)
118 | echo "Unknown Option."
119 | ;;
120 | esac
121 | done
122 | exit
123 |
--------------------------------------------------------------------------------
/radarr4k.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | user=$(whoami)
3 | mkdir -p "/home/$user/.logs/"
4 | touch "/home/$user/.logs/radarr4k.log"
5 | log="/home/$user/.logs/radarr4k.log"
6 |
7 | function port() {
8 | LOW_BOUND=$1
9 | UPPER_BOUND=$2
10 | comm -23 <(seq "${LOW_BOUND}" "${UPPER_BOUND}" | sort) <(ss -Htan | awk '{print $4}' | cut -d':' -f2 | sort -u) | shuf | head -n 1
11 | }
12 |
13 | function _install() {
14 | if [[ ! -f "/home/$user/.install/.radarr.lock" ]]; then
15 | echo "Radarr is not installed. Exiting..."
16 | exit 1
17 | fi
18 | mkdir -p "/home/$user/.config/systemd/user/"
19 | mkdir -p "/home/$user/.config/Radarr4k/"
20 | echo "Installing the service"
21 | cat > "/home/$user/.config/systemd/user/radarr4k.service" << SERV
22 | [Unit]
23 | Description=Radarr4k
24 | After=syslog.target network.target
25 |
26 | [Service]
27 | Type=simple
28 | Environment="TMPDIR=%h/.tmp"
29 | ExecStart=%h/Radarr/Radarr -nobrowser -data=%h/.config/Radarr4k
30 | TimeoutStopSec=20
31 | KillMode=process
32 | Restart=on-failure
33 | WorkingDirectory=%h
34 |
35 | [Install]
36 | WantedBy=default.target
37 | SERV
38 | port=$(port 12000 14000)
39 | echo "Installing Configuration"
40 | cat > "/home/$user/.config/Radarr4k/config.xml" << EOF
41 |
42 | ${port}
43 |
44 | *
45 | 8787
46 | False
47 | Info
48 | develop
49 | False
50 | BuiltIn
51 | False
52 |
53 | None
54 |
55 | EOF
56 | echo "Starting the userland service."
57 | systemctl enable --user --now -q radarr4k
58 | sleep 45
59 | apikey=$(grep -oPm1 "(?<=)[^<]+" /home/"$user"/.config/Radarr4k/config.xml)
60 | if ! timeout 45 bash -c -- "while ! curl -fL \"http://127.0.0.1:${port}/api/v3/system/status?apiKey=${apikey}\" >> \"$log\" 2>&1; do sleep 5; done"; then
61 | echo "Radarr API did not respond as expected. Please make sure Radarr is on v3 and running."
62 | exit 1
63 | fi
64 | read -rep "Please set a password for your radarr4k user ${user}> " -i "" password
65 | echo "Applying authentication"
66 | payload=$(curl -sL "http://127.0.0.1:${port}/api/v3/config/host?apikey=${apikey}" | jq ".authenticationMethod = \"forms\" | .username = \"${user}\" | .password = \"${password}\"")
67 | curl -s "http://127.0.0.1:${port}/api/v3/config/host?apikey=${apikey}" -X PUT -H 'Accept: application/json, text/javascript, */*; q=0.01' --compressed -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' --data-raw "${payload}" >> "$log"
68 | sleep 15
69 | echo "Restarting Radarr4k"
70 | systemctl restart --user radarr4k
71 | echo "Now up and running at http://$(hostname -f):${port}"
72 | mkdir -p "/home/${user}/.install/"
73 | touch "/home/${user}/.install/.radarr4k.lock"
74 | }
75 |
76 | function _remove {
77 | systemctl stop --user radarr4k
78 | systemctl disable --user radarr4k
79 | rm -rf "/home/$user/.config/Radarr4k"
80 | rm "/home/$user/.config/systemd/user/radarr4k.service"
81 | rm "/home/${user}/.install/.radarr4k.lock"
82 | }
83 |
84 | echo 'This is unsupported software. You will not get help with this, please answer `yes` if you understand and wish to proceed'
85 | if [[ -z ${eula} ]]; then
86 | read -r eula
87 | fi
88 |
89 | if ! [[ $eula =~ yes ]]; then
90 | echo "You did not accept the above. Exiting..."
91 | exit 1
92 | else
93 | echo "Proceeding with installation"
94 | fi
95 |
96 | echo "Welcome to The Radarr 4K installer..."
97 | echo ""
98 | echo "What do you like to do?"
99 | echo "install = Install Radarr 4K"
100 | echo "uninstall = Completely removes Radarr 4K"
101 | echo "exit = Exits Installer"
102 | while true; do
103 | read -r -p "Enter it here: " choice
104 | case $choice in
105 | "install")
106 | if [[ -f "/home/$user/.install/.radarr4k.lock" ]]; then
107 | echo "Radarr 4K is already installed."
108 | else
109 | _install
110 | fi
111 | break
112 | ;;
113 | "uninstall")
114 | if [[ ! -f "/home/$user/.install/.radarr4k.lock" ]]; then
115 | echo "Radarr 4K is not installed."
116 | break
117 | else
118 | _remove
119 | fi
120 | break
121 | ;;
122 | "exit")
123 | break
124 | ;;
125 | *)
126 | echo "Unknown Option."
127 | ;;
128 | esac
129 | done
130 | exit
131 |
--------------------------------------------------------------------------------
/readarr.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | ## Installer by b
3 | ## Thanks to Bakerboy, Sosig, Liara, and team for some of the functions / logic.
4 | ## b
5 |
6 | user=$(whoami)
7 |
8 | if [[ ! -d $HOME/.logs ]]; then
9 | mkdir -p $HOME/.logs
10 | fi
11 |
12 | touch "$HOME/.logs/readarr.log"
13 | log="$HOME/.logs/readarr.log"
14 |
15 | function port() {
16 | LOW_BOUND=$1
17 | UPPER_BOUND=$2
18 | comm -23 <(seq ${LOW_BOUND} ${UPPER_BOUND} | sort) <(ss -Htan | awk '{print $4}' | cut -d':' -f2 | sort -u) | shuf | head -n 1
19 | }
20 |
21 | function _install() {
22 | ssl_port=$(port 14000 16000)
23 | port=$(port 10000 14000)
24 | domain=$(hostname -f)
25 |
26 | # Download App
27 | echo "Downloading Readarr"
28 |
29 | curl -sL "http://readarr.servarr.com/v1/update/develop/updatefile?os=linux&runtime=netcore&arch=x64" -o /tmp/readarr.tar.gz >> "$log" 2>&1 || {
30 | echo "Download failed."
31 | exit 1
32 | }
33 |
34 | # Extract
35 | echo "Extracting Readarr"
36 | tar xfv "/tmp/readarr.tar.gz" --directory $HOME/ >> "$log" 2>&1 || {
37 | echo_error "Failed to extract"
38 | exit 1
39 | }
40 | rm -rf /tmp/readarr.tar.gz
41 |
42 | if [[ ! -d $HOME/.config/systemd/user/ ]]; then
43 | mkdir -p $HOME/.config/systemd/user/
44 | fi
45 |
46 | # Service File
47 | echo "Writing service file"
48 | cat > "$HOME/.config/systemd/user/readarr.service" << EOF
49 | [Unit]
50 | Description=Readarr Daemon
51 | After=syslog.target network.target
52 |
53 | [Service]
54 | Type=simple
55 | ExecStart=$HOME/Readarr/Readarr -nobrowser -data=$HOME/.config/readarr/
56 | TimeoutStopSec=20
57 | KillMode=process
58 | Restart=on-failure
59 |
60 | [Install]
61 | WantedBy=default.target
62 | EOF
63 | mkdir -p $HOME/.config/readarr/
64 | cat > $HOME/.config/readarr/config.xml << PROWLARR
65 |
66 | debug
67 | BuiltIn
68 | *
69 | ${port}
70 | ${ssl_port}
71 | False
72 | False
73 |
74 | None
75 |
76 | develop
77 |
78 | PROWLARR
79 |
80 | # Enable/Start Readarr
81 | echo "Starting Readarr"
82 | systemctl enable --now --user readarr.service
83 | echo "Readarr will be accessible at http://${domain}:${port}"
84 |
85 | echo "Waiting for Readarr to start"
86 | sleep 45
87 | apikey=$(grep -oPm1 "(?<=)[^<]+" "$HOME/.config/readarr/config.xml")
88 | echo "${apikey}"
89 | if ! timeout 5 bash -c -- "while ! curl -sfkL \"http://127.0.0.1:${port}/api/v1/system/status?apiKey=${apikey}\" >> \"$log\" 2>&1; do sleep 5; done"; then
90 | echo "Readarr API not respond as expected. Please make sure Readarr is running."
91 | exit 1
92 | fi
93 | read -rep "Please set a password for your readarr user ${user}> " -i "" password
94 | echo "Applying authentication"
95 | payload=$(curl -skL "http://127.0.0.1:${port}/api/v1/config/host?apikey=${apikey}" | jq ".authenticationMethod = \"forms\" | .username = \"${user}\" | .password = \"${password}\"")
96 | curl -sk "http://127.0.0.1:${port}/api/v1/config/host?apikey=${apikey}" -X PUT -H 'Accept: application/json, text/javascript, */*; q=0.01' --compressed -H 'Content-Type: application/json' --data-raw "${payload}" >> "$log"
97 | sleep 15
98 | echo "Restarting readarr"
99 | systemctl restart --user readarr
100 |
101 |
102 | echo "Readarr has been installed. You can access it at http://${domain}:${port}"
103 | echo "Remember to check your authentication. This is publicly accessible and will contain your API keys and stuff."
104 | }
105 |
106 | function _remove() {
107 | systemctl disable --now --user readarr
108 | rm -rf "$HOME/.config/readarr/"
109 | rm -rf "$HOME/Readarr/"
110 | echo "Readarr has been removed."
111 | }
112 |
113 | echo 'This is unsupported software. You will not get help with this, please answer `yes` if you understand and wish to proceed'
114 | if [[ -z ${eula} ]]; then
115 | read -r eula
116 | fi
117 |
118 | if ! [[ $eula =~ yes ]]; then
119 | echo "You did not accept the above. Exiting..."
120 | exit 1
121 | else
122 | echo "Proceeding with installation"
123 | fi
124 |
125 | echo "Welcome to Readarr installer..."
126 | echo ""
127 | echo "What do you like to do?"
128 | echo "Logs are stored at ${log}"
129 | echo "install = Install Readarr"
130 | echo "uninstall = Completely removes Readarr"
131 | echo "exit = Exits Installer"
132 | while true; do
133 | read -r -p "Enter it here: " choice
134 | case $choice in
135 | "install")
136 | _install
137 | break
138 | ;;
139 | "uninstall")
140 | _remove
141 | break
142 | ;;
143 | "exit")
144 | break
145 | ;;
146 | *)
147 | echo "Unknown Option."
148 | ;;
149 | esac
150 | done
151 | exit
152 |
--------------------------------------------------------------------------------
/recyclarr.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Recyclarr Installer for SBIO/Swizzin Hosted
3 |
4 | function github_latest_version() {
5 | # Function by Liara from the Swizzin Project
6 | # Argument expects the author/repo format
7 | # e.g. swizzin/swizzin
8 | repo=$1
9 | curl -fsSLI -o /dev/null -w %{url_effective} https://github.com/${repo}/releases/latest | grep -o '[^/]*$'
10 | }
11 |
12 | function _download() {
13 | # make $HOME/.tmp and $HOME/.local/bin dirs
14 | mkdir -p "$HOME/.tmp"
15 | mkdir -p "$HOME/.local/bin"
16 | echo "Downloading the latest Recyclarr release"
17 | # Download latest version of Recylarr via github releases
18 | latest=$(github_latest_version recyclarr/recyclarr)
19 | dlurl="https://github.com/recyclarr/recyclarr/releases/download/${latest}/recyclarr-linux-x64.tar.xz"
20 | curl -sLo "$HOME/.tmp/recyclarr.tar.xz" "${dlurl}" || {
21 | echo "Unable to download recyclarr. Exiting..."
22 | exit 1
23 | }
24 | echo "Recyclarr downloaded."
25 | tar xvf "$HOME/.tmp/recyclarr.tar.xz" -C $HOME/.local/bin/
26 | rm -f "$HOME/.tmp/recyclarr.tar.xz"
27 | }
28 |
29 | function _install() {
30 | _download
31 | # Create example config
32 | "$HOME/.local/bin/recyclarr" config create
33 | echo "Recylarr installed. Additional configuration is required. Please see https://recyclarr.dev/wiki/yaml/config-reference/ for additional setup information."
34 | touch $HOME/.install/.recyclarr.lock
35 | }
36 |
37 | function _update() {
38 | _download
39 | }
40 |
41 | function _remove() {
42 | rm -rf "$HOME/.config/recyclarr"
43 | rm -f "$HOME/.local/bin/recyclarr"
44 | rm -f $HOME/.install/.recyclarr.lock
45 | }
46 |
47 |
48 | echo 'This is unsupported software. You will not get help with this, please answer `yes` if you understand and wish to proceed'
49 | if [[ -z ${eula} ]]; then
50 | read -r eula
51 | fi
52 |
53 | if ! [[ $eula =~ yes ]]; then
54 | echo "You did not accept the above. Exiting..."
55 | exit 1
56 | else
57 | echo "Proceeding with installation"
58 | fi
59 |
60 | echo "Welcome to the Recyclarr installer..."
61 | echo ""
62 | echo "What do you like to do?"
63 | echo ""
64 | echo "install = Install Recyclarr"
65 | echo "upgrade = Completely removes Recyclarr"
66 | echo "uninstall = Completely removes Recyclarr"
67 | echo "exit = Exits Installer"
68 | while true; do
69 | read -r -p "Enter it here: " choice
70 | case $choice in
71 | "install")
72 | _install
73 | break
74 | ;;
75 | "upgrade")
76 | _update
77 | break
78 | ;;
79 | "uninstall")
80 | _remove
81 | break
82 | ;;
83 | "exit")
84 | break
85 | ;;
86 | *)
87 | echo "Unknown Option."
88 | ;;
89 | esac
90 | done
91 | exit
92 |
--------------------------------------------------------------------------------
/requestrr.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | user=$(whoami)
3 | mkdir -p "$HOME/.logs/"
4 | touch "$HOME/.logs/requestrr.log"
5 | log="$HOME/.logs/requestrr.log"
6 |
7 | function _port() {
8 | LOW_BOUND=$1
9 | UPPER_BOUND=$2
10 | comm -23 <(seq ${LOW_BOUND} ${UPPER_BOUND} | sort) <(ss -Htan | awk '{print $4}' | cut -d':' -f2 | sort -u) | shuf | head -n 1
11 | }
12 |
13 | function _os_arch() {
14 | dpkg --print-architecture
15 | }
16 |
17 | function github_latest_version() {
18 | # Argument expects the author/repo format
19 | # e.g. swizzin/swizzin
20 | repo=$1
21 | curl -fsSLI -o /dev/null -w %{url_effective} https://github.com/${repo}/releases/latest | grep -o '[^/]*$'
22 | }
23 |
24 | function _requestrr_download() {
25 | echo "Downloading source files"
26 | version=$(github_latest_version thomst08/requestrr)
27 | case "$(_os_arch)" in
28 | "amd64") arch=x64 ;;
29 | "armhf") arch=arm ;;
30 | "arm64") arch=arm64 ;;
31 | *)
32 | echo "Arch not supported"
33 | exit 1
34 | ;;
35 | esac
36 |
37 | dlurl="https://github.com/thomst08/requestrr/releases/download/${version}/requestrr-linux-${arch}.zip"
38 | mkdir -p "$HOME/.tmp"
39 |
40 | if ! curl "$dlurl" -L -o $HOME/.tmp/requestrr.zip >> "$log" 2>&1; then
41 | echo "Download failed, exiting"
42 | exit 1
43 | fi
44 |
45 | echo "Requestrr downloaded"
46 | }
47 | # shellcheck disable=SC2086
48 |
49 | function _get_sonarr_vars() {
50 | if [[ -f $HOME/.install/.sonarr.lock ]]; then
51 | echo "Found Sonarr. Grabbing config."
52 | # Grab config deets from xml
53 | export s_address=$(sed -n 's|\(.*\)\(.*\)|\2|p' $HOME/.config/Sonarr/config.xml) >> ${log} 2>&1
54 | export s_port=$(sed -n 's|\(.*\)\(.*\)|\2|p' $HOME/.config/Radarr/config.xml) >> ${log} 2>&1
55 | export s_base=$(sed -n 's|\(.*\)\(.*\)|\2|p' $HOME/.config/Radarr/config.xml) >> ${log} 2>&1
56 | export s_key=$(sed -n 's|\(.*\)\(.*\)|\2|p' $HOME/.config/Radarr/config.xml) >> ${log} 2>&1
57 | echo "Grabbed Sonarr config."
58 | else
59 | export s_port="8989"
60 | fi
61 | }
62 |
63 | function _get_radarr_vars() {
64 | if [[ -f $HOME/.install/.radarr.lock ]]; then
65 | echo "Found Radarr. Grabbing config."
66 | # Grab config deets from xml
67 | export r_address=$(sed -n 's|\(.*\)\(.*\)|\2|p' $HOME/.config/Radarr/config.xml) >> ${log} 2>&1
68 | export r_port=$(sed -n 's|\(.*\)\(.*\)|\2|p' $HOME/.config/Radarr/config.xml) >> ${log} 2>&1
69 | export r_base=$(sed -n 's|\(.*\)\(.*\)|\2|p' $HOME/.config/Radarr/config.xml) >> ${log} 2>&1
70 | export r_key=$(sed -n 's|\(.*\)\(.*\)|\2|p' $HOME/.config/Radarr/config.xml) >> ${log} 2>&1
71 | echo "Radarr config has been retrieved."
72 | else
73 | export r_port="7878"
74 | fi
75 | }
76 |
77 | function _write_configs() {
78 | _get_radarr_vars
79 | _get_sonarr_vars
80 | mkdir -p "$HOME/Requestrr/config/"
81 | cat > "$HOME/Requestrr/SettingsTemplate.json" << CFG
82 | {
83 | "Authentication": {
84 | "Username": "",
85 | "Password": "",
86 | "PrivateKey": "[PRIVATEKEY]"
87 | },
88 | "ChatClients": {
89 | "Discord": {
90 | "BotToken": "",
91 | "ClientId": "",
92 | "StatusMessage": "/help",
93 | "TvShowRoles": [],
94 | "MovieRoles": [],
95 | "MonitoredChannels": [],
96 | "EnableRequestsThroughDirectMessages": false,
97 | "AutomaticallyNotifyRequesters": true,
98 | "NotificationMode": "PrivateMessages",
99 | "NotificationChannels": [],
100 | "AutomaticallyPurgeCommandMessages": true
101 | },
102 | "Language": "english"
103 | },
104 | "DownloadClients": {
105 | "Ombi": {
106 | "Hostname": "",
107 | "Port": 3579,
108 | "ApiKey": "",
109 | "ApiUsername": "",
110 | "BaseUrl": "",
111 | "UseSSL": false,
112 | "Version": "3"
113 | },
114 | "Overseerr": {
115 | "Hostname": "",
116 | "Port": 5055,
117 | "ApiKey": "",
118 | "Movies": {
119 | "DefaultApiUserID": "",
120 | "Categories": []
121 | },
122 | "TvShows": {
123 | "DefaultApiUserID": "",
124 | "Categories": []
125 | },
126 | "UseSSL": false,
127 | "Version": "1",
128 | "UseMovieIssue": false,
129 | "UseTVIssue": false
130 | },
131 | "Radarr": {
132 | "Hostname": "${r_address}",
133 | "Port": ${r_port},
134 | "ApiKey": "${r_key}",
135 | "BaseUrl": "/${r_base}",
136 | "Categories": [
137 | {
138 | "Id": 0,
139 | "Name": "movie",
140 | "ProfileId": "1",
141 | "RootFolder": "",
142 | "MinimumAvailability": "announced",
143 | "Tags": []
144 | }
145 | ],
146 | "SearchNewRequests": true,
147 | "MonitorNewRequests": true,
148 | "UseSSL": false,
149 | "Version": "3"
150 | },
151 | "Sonarr": {
152 | "Hostname": "${s_address}",
153 | "Port": ${s_port},
154 | "ApiKey": "${s_key}",
155 | "BaseUrl": "/${s_base}",
156 | "Categories": [
157 | {
158 | "Id": 0,
159 | "Name": "tv",
160 | "ProfileId": "1",
161 | "RootFolder": "",
162 | "Tags": [],
163 | "LanguageId": "1",
164 | "UseSeasonFolders": true,
165 | "SeriesType": "standard"
166 | }
167 | ],
168 | "SearchNewRequests": true,
169 | "MonitorNewRequests": true,
170 | "UseSSL": false,
171 | "Version": "4"
172 | }
173 | },
174 | "BotClient": {
175 | "Client": ""
176 | },
177 | "Movies": {
178 | "Client": "Disabled"
179 | },
180 | "TvShows": {
181 | "Client": "Disabled",
182 | "Restrictions": "None"
183 | },
184 | "Port": $port,
185 | "BaseUrl" : "/requestrr",
186 | "DisableAuthentication": false,
187 | "Version": "2.1.1"
188 | }
189 | CFG
190 |
191 | echo "Requestrr config applied."
192 |
193 | echo "Installing Systemd service"
194 | cat > $HOME/.config/systemd/user/requestrr.service << EOF
195 | [Unit]
196 | Description=Requestrr Daemon
197 | After=syslog.target network.target
198 | [Service]
199 | Type=simple
200 | WorkingDirectory=/home/$user/Requestrr/
201 | ExecStart=/home/$user/Requestrr/Requestrr.WebApi
202 | TimeoutStopSec=20
203 | KillMode=process
204 | Restart=on-failure
205 | [Install]
206 | WantedBy=default.target
207 | EOF
208 |
209 | cat > $HOME/Requestrr/appsettings.json << SET
210 | {
211 | "Logging": {
212 | "LogLevel": {
213 | "Default": "None"
214 | }
215 | },
216 | "AllowedHosts": "*"
217 | }
218 | SET
219 | }
220 | function _install() {
221 | if [[ ! -f $HOME/.install/.requestrr.lock ]]; then
222 | port=$(_port 1000 18000)
223 | _requestrr_download
224 | unzip -q "$HOME/.tmp/requestrr.zip" -d $HOME/ >> ${log} 2>&1
225 | rm -rf "$HOME/.tmp/requestrr.zip"
226 | mkdir -p "$HOME/Requestrr"
227 | mv $HOME/requestrr*/* "$HOME/Requestrr"
228 | rm -rf $HOME/requestrr*/
229 | echo "archive extracted."
230 | chmod u+x "$HOME/Requestrr/Requestrr.WebApi"
231 | find "$HOME/Requestrr" -type d -print -exec chmod 755 {} \; >> ${log} 2>&1
232 | echo "Requestrr permissions set"
233 | mkdir -p "$HOME/.config/Requestrr/"
234 | mkdir -p "$HOME/.config/systemd/user/"
235 | echo "Configuring "
236 | _write_configs
237 | systemctl --user -q enable --now requestrr >> ${log} 2>&1
238 | touch $HOME/.install/.requestrr.lock
239 | echo "Requestrr service installed and enabled"
240 | echo "Requestrr is available at http://$(hostname):$port/requestrr; Secure your installation manually through the web interface."
241 | else
242 | echo "requestrr is already installed."
243 | fi
244 | }
245 |
246 | function _remove() {
247 | systemctl --user disable --now requestrr
248 | sleep 2
249 | rm -rf $HOME/Requestrr
250 | rm -rf $HOME/.config/Requestrr
251 | rm -rf $HOME/.config/systemd/user/requestrr.service
252 | rm -rf $HOME/.install/.requestrr.lock
253 | }
254 |
255 | echo 'This is unsupported software. You will not get help with this, please answer `yes` if you understand and wish to proceed'
256 | if [[ -z ${eula} ]]; then
257 | read -r eula
258 | fi
259 |
260 | if ! [[ $eula =~ yes ]]; then
261 | echo "You did not accept the above. Exiting..."
262 | exit 1
263 | else
264 | echo "Proceeding with installation"
265 | fi
266 |
267 | echo "What do you like to do?"
268 | echo ""
269 | echo "install = Install Requestrr"
270 | echo "uninstall = Completely removes Requestrr"
271 | echo "exit = Exits Installer"
272 | while true; do
273 | read -r -p "Enter it here: " choice
274 | case $choice in
275 | "install")
276 | _install
277 | break
278 | ;;
279 | "uninstall")
280 | _remove
281 | break
282 | ;;
283 | "exit")
284 | break
285 | ;;
286 | *)
287 | echo "Unknown Option."
288 | ;;
289 | esac
290 | done
291 | exit
292 |
--------------------------------------------------------------------------------
/sonarr4k.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | user=$(whoami)
3 | mkdir -p "/home/$user/.logs/"
4 | touch "/home/$user/.logs/sonarr4k.log"
5 | log="/home/$user/.logs/sonarr4k.log"
6 |
7 | function port() {
8 | LOW_BOUND=$1
9 | UPPER_BOUND=$2
10 | comm -23 <(seq ${LOW_BOUND} ${UPPER_BOUND} | sort) <(ss -Htan | awk '{print $4}' | cut -d':' -f2 | sort -u) | shuf | head -n 1
11 | }
12 |
13 | function _systemd() {
14 | cat > /home/${USER}/.config/systemd/user/sonarr4k.service << SERVICE
15 | [Unit]
16 | Description=Sonarr4k
17 | After=syslog.target network.target
18 |
19 | [Service]
20 | Type=simple
21 | Environment="TMPDIR=%h/.tmp"
22 | ExecStart=%h/Sonarr/Sonarr -nobrowser -data=%h/.config/Sonarr4k
23 | WorkingDirectory=%h
24 | Restart=on-failure
25 |
26 | [Install]
27 | WantedBy=default.target
28 | SERVICE
29 |
30 | }
31 | function _install() {
32 | if [[ ! -f "/home/$user/.install/.sonarr.lock" ]]; then
33 | echo "Sonarr is not installed. Exiting..."
34 | exit 1
35 | fi
36 | mkdir -p /home/$user/.config/systemd/user/
37 | mkdir -p /home/$user/.config/Sonarr4k/
38 | port=$(port 8000 11000)
39 | _systemd
40 |
41 | cat > /home/$user/.config/Sonarr4k/config.xml << EOF
42 |
43 | info
44 | False
45 | ${port}
46 | 9898
47 |
48 | *
49 | None
50 | BuiltIn
51 | main
52 | False
53 |
54 |
55 | EOF
56 | systemctl enable --user --now -q sonarr4k
57 | sleep 45
58 | apikey=$(grep -oPm1 "(?<=)[^<]+" /home/"$user"/.config/Sonarr4k/config.xml)
59 | if ! timeout 45 bash -c -- "while ! curl -fL \"http://127.0.0.1:${port}/api/v3/system/status?apiKey=${apikey}\" >> \"$log\" 2>&1; do sleep 5; done"; then
60 | echo "Sonarr API did not respond as expected. Please make sure Sonarr is on v3 and running."
61 | exit 1
62 | fi
63 | read -rep "Please set a password for your sonarr4k user ${user}> " -i "" password
64 | payload=$(curl -sL "http://127.0.0.1:${port}/api/v3/config/host?apikey=${apikey}" | jq ".authenticationMethod = \"forms\" | .username = \"${user}\" | .password = \"${password}\"")
65 | curl -s "http://127.0.0.1:${port}/api/v3/config/host?apikey=${apikey}" -X PUT -H 'Accept: application/json, text/javascript, */*; q=0.01' --compressed -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' --data-raw "${payload}" >> "$log"
66 | sleep 15
67 | systemctl restart --user sonarr4k
68 | echo "Now up and running at http://$(hostname -f):${port}"
69 | mkdir -p "/home/${user}/.install/"
70 | touch "/home/${user}/.install/.sonarr4k.lock"
71 | }
72 |
73 | function _remove {
74 | systemctl stop --user sonarr4k
75 | systemctl disable --user sonarr4k
76 | rm -rf /home/$user/.config/Sonarr4k
77 | rm /home/$user/.config/systemd/user/sonarr4k.service
78 | rm "/home/${user}/.install/.sonarr4k.lock"
79 | }
80 |
81 | echo 'This is unsupported software. You will not get help with this, please answer `yes` if you understand and wish to proceed'
82 | if [[ -z ${eula} ]]; then
83 | read -r eula
84 | fi
85 |
86 | if ! [[ $eula =~ yes ]]; then
87 | echo "You did not accept the above. Exiting..."
88 | exit 1
89 | else
90 | echo "Proceeding with installation"
91 | fi
92 |
93 | echo "Welcome to The Sonarr 4K installer..."
94 | echo ""
95 | echo "What do you like to do?"
96 | echo "install = Install Sonarr 4K"
97 | echo "uninstall = Completely removes Sonarr 4K"
98 | echo "exit = Exits Installer"
99 | while true; do
100 | read -r -p "Enter it here: " choice
101 | case $choice in
102 | "install")
103 | if [[ -f "/home/$user/.install/.sonarr4k.lock" ]]; then
104 | echo "Sonarr 4K is already installed."
105 | else
106 | _install
107 | fi
108 | break
109 | ;;
110 | "upgrade")
111 | if [[ -f "/home/$user/.install/.sonarr4k.lock" ]]; then
112 | echo "Upgrading Sonarr 4K systemd"
113 | _systemd
114 | systemctl --user daemon-reload
115 | systemctl --user try-restart sonarr4k
116 | else
117 | echo "Sonarr 4K is not installed"
118 | break
119 | fi
120 | ;;
121 | "uninstall")
122 | if [[ ! -f "/home/$user/.install/.sonarr4k.lock" ]]; then
123 | echo "Sonarr 4K is not installed."
124 | break
125 | else
126 | _remove
127 | fi
128 | break
129 | ;;
130 | "exit")
131 | break
132 | ;;
133 | *)
134 | echo "Unknown Option."
135 | ;;
136 | esac
137 | done
138 | exit
139 |
--------------------------------------------------------------------------------
/subsonic.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Subsonic Installer
3 | # By B for Swizzin Hosted (2022)
4 | user=$(whoami)
5 | mkdir -p "/home/${user}/.logs/"
6 | export log="/home/${user}/.logs/subsonic.log"
7 | touch "$log"
8 |
9 | function java_install() {
10 | type java || {
11 | echo "Java not installed..."
12 | # Java 8
13 | echo "Downloading java"
14 | curl -sL "https://javadl.oracle.com/webapps/download/AutoDL?BundleId=246255_165374ff4ea84ef0bbd821706e29b123" -o /tmp/jre.tar.gz >> "$log" 2>&1
15 | echo "Extracting java"
16 | tar -xvf /tmp/jre.tar.gz --strip-components=1 -C "/home/${user}/.local/" >> "$log" 2>&1
17 | rm /tmp/jre.tar.gz
18 | . "/home/${user}/.profile"
19 | }
20 | }
21 |
22 | function port() {
23 | LOW_BOUND=$1
24 | UPPER_BOUND=$2
25 | comm -23 <(seq ${LOW_BOUND} ${UPPER_BOUND} | sort) <(ss -Htan | awk '{print $4}' | cut -d':' -f2 | sort -u) | shuf | head -n 1
26 | }
27 |
28 | function _install() {
29 | java_install
30 | echo "Downloading subsonic"
31 | mkdir -p "$HOME/.config/subsonic"
32 | mkdir -p "$HOME/subsonic"
33 | mkdir -p "$HOME/subsonic/transcode/"
34 | ln -s "$(which ffmpeg)" "$HOME/subsonic/transcode/"
35 | curl -sL "https://s3-eu-west-1.amazonaws.com/subsonic-public/download/subsonic-6.1.6-standalone.tar.gz" -o "$HOME/subsonic/subsonic.tar.gz" >> "$log" 2>&1
36 |
37 | echo "Extracting Subsonic"
38 | tar -xvf "$HOME/subsonic" -C "$HOME/subsonic/subsonic.tar.gz" >> "$log" 2>&1
39 | port=$(port 4096 12000)
40 |
41 | echo "Setting up service file"
42 | mkdir -p "$HOME/.config/systemd/user"
43 | cat > "$HOME/.config/systemd/user/subsonic.service" << EOF
44 | [Unit]
45 | Description=Subsonic Media Server
46 | After=remote-fs.target network.target
47 | AssertPathExists=$HOME/subsonic
48 |
49 | [Service]
50 | Type=simple
51 | WorkingDirectory=$HOME/subsonic/
52 | ExecStart=$HOME/.local/bin/java -Xmx700m \\
53 | -Dsubsonic.home=$HOME/subsonic \\
54 | -Dsubsonic.host=0.0.0.0 \\
55 | -Dsubsonic.port=${port} \\
56 | -Dsubsonic.contextPath=/subsonic \\
57 | -Djava.awt.headless=true \\
58 | -verbose:gc \\
59 | -jar subsonic-booter-jar-with-dependencies.jar
60 |
61 | [Install]
62 | WantedBy=default.target
63 | EOF
64 |
65 | echo "Starting the subsonic service"
66 | systemctl -q --user enable --now subsonic
67 | echo "Subsonic will run on http://$(hostname -f):${port}/subsonic"
68 | echo "The default login is admin/admin. Please change this!"
69 | echo "Please be sure to disable the uPNP service!"
70 | }
71 |
72 | function subsonic_remove() {
73 | systemctl --user stop subsonic >> "$log" 2>&1
74 | systemctl --user disable subsonic >> "$log" 2>&1
75 | rm -r "$HOME/subsonic"
76 | rm "$HOME/.config/systemd/user/subsonic.service"
77 | rm -r "$HOME/.config/subsonic"
78 | }
79 |
80 | echo 'This is unsupported software. You will not get help with this, please answer `yes` if you understand and wish to proceed'
81 | if [[ -z ${eula} ]]; then
82 | read -r eula
83 | fi
84 |
85 | if ! [[ $eula =~ yes ]]; then
86 | echo "You did not accept the above. Exiting..."
87 | exit 1
88 | else
89 | echo "Proceeding with installation"
90 | fi
91 |
92 | echo "Welcome to the Subsonic installer..."
93 | echo ""
94 | echo "What do you like to do?"
95 | echo "Logs are stored at ${log}"
96 | echo "install = Install Subsonic"
97 | echo "upgrade = upgrades Subsonic to latest version"
98 | echo "uninstall = Completely removes Subsonic"
99 | echo "exit = Exits Installer"
100 | while true; do
101 | read -r -p "Enter it here: " choice
102 | case $choice in
103 | "install")
104 | _install
105 | break
106 | ;;
107 | "uninstall")
108 | subsonic_remove
109 | break
110 | ;;
111 | "exit")
112 | break
113 | ;;
114 | *)
115 | echo "Unknown Option."
116 | ;;
117 | esac
118 | done
119 | exit
120 |
--------------------------------------------------------------------------------
/tailscale.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Tailscale with userland wireguard
3 |
4 | mkdir -p "$HOME/.logs/"
5 | export log="$HOME/.logs/tailscale.log"
6 | touch "$log"
7 | export subnet=$(cat $HOME/.subnet.lock)
8 |
9 | function port() {
10 | LOW_BOUND=$1
11 | UPPER_BOUND=$2
12 | comm -23 <(seq ${LOW_BOUND} ${UPPER_BOUND} | sort) <(ss -Htan | awk '{print $4}' | cut -d':' -f2 | sort -u) | shuf | head -n 1
13 | }
14 |
15 | function github_latest_version() {
16 | # Argument expects the author/repo format
17 | # e.g. swizzin/swizzin
18 | repo=$1
19 | curl -fsSLI -o /dev/null -w %{url_effective} https://github.com/${repo}/releases/latest | grep -o '[^/]*$'
20 | }
21 |
22 | function _install(){
23 | version=$(github_latest_version "tailscale/tailscale")
24 | mkdir -p "$HOME/.local/bin"
25 | echo "Downloading tailscale"
26 | # Tempdir
27 | mkdir -p "$HOME/.tmp"
28 | # Download
29 | curl -sL "https://pkgs.tailscale.com/stable/tailscale_${version//v}_amd64.tgz" -o "$HOME/.tmp/tailscale.tgz"
30 | tar -xzf "$HOME/.tmp/tailscale.tgz" -C "$HOME/.tmp/"
31 | mv "$HOME/.tmp/tailscale_${version//v}_amd64/tailscale" "$HOME/.local/bin/tailscale"
32 | mv "$HOME/.tmp/tailscale_${version//v}_amd64/tailscaled" "$HOME/.local/bin/tailscaled"
33 | chmod +x "$HOME/.local/bin/tailscale"
34 | chmod +x "$HOME/.local/bin/tailscaled"
35 | rm -rf "$HOME/.tmp/tailscale_${version//v}_amd64/"
36 | rm -f "$HOME/.tmp/tailscale.tgz"
37 |
38 | # Configure Tailscale"
39 | mkdir -p "$HOME/.config/tailscale"
40 | echo "Setting up tailscale userland environment"
41 | cat > $HOME/.config/tailscale/env.conf << EOE
42 | TAILSCALED_SOCKET="$HOME/.tmp/tailscaled.sock"
43 | TAILSCALED_STATE="$HOME/.tmp/tailscale/tailscaled.state"
44 | EOE
45 |
46 | mkdir -p "$HOME/.config/systemd/user"
47 | echo "Installing tailscaled service"
48 | socks5_port=$(port 6999 9999)
49 | proxy_port=$(port 10000 12000)
50 | cat > "$HOME/.config/systemd/user/tailscaled.service" << EOS
51 | [Unit]
52 | Description=Tailscale Daemon
53 | After=network.target
54 |
55 | [Service]
56 | EnvironmentFile=$HOME/.config/tailscale/env.conf
57 | ExecStart=$HOME/.local/bin/tailscaled --tun=userspace-networking --state=$HOME/.tmp/tailscale/tailscaled.state --socket=$HOME/.tmp/tailscale/tailscaled.sock --outbound-http-proxy-listen=${subnet}:${proxy_port} --socks5-server=${subnet}:${socks5_port}
58 | Restart=always
59 | RestartSec=3
60 | StartLimitInterval=0
61 | StartLimitBurst=10
62 |
63 | [Install]
64 | WantedBy=default.target
65 |
66 | EOS
67 |
68 | systemctl --user enable --now tailscaled
69 | echo "Tailscaled started"
70 | echo "Setting up tailscale"
71 | tailscale --socket="$HOME/.tmp/tailscale/tailscaled.sock" up
72 |
73 | echo "Writing tailscale alias to bashrc"
74 | echo "alias tailscale='$HOME/.local/bin/tailscale --socket=$HOME/.tmp/tailscale/tailscaled.sock'" >> "$HOME/.bashrc"
75 |
76 | touch "$HOME/.install/.tailscale.dev.lock"
77 |
78 | echo "Tailscale installed. Please run 'source $HOME/.bashrc' via ssh or open a new ssh connection to start using tailscale"
79 | }
80 |
81 | function _upgrade(){
82 | if [[ ! -f "$HOME/.install/.tailscale.dev.lock" ]]; then
83 | echo 'Tailscale may not be installed. If it is, please run `touch "$HOME/.install/.tailscale.dev.lock"`'
84 | exit 1
85 | fi
86 | systemctl --user stop tailscaled
87 | version=$(github_latest_version "tailscale/tailscale")
88 | curl -sL "https://pkgs.tailscale.com/stable/tailscale_${version//v}_amd64.tgz" -o "$HOME/.tmp/tailscale.tgz"
89 | tar -xzf "$HOME/.tmp/tailscale.tgz" -C "$HOME/.tmp/"
90 | mv "$HOME/.tmp/tailscale_${version//v}_amd64/tailscale" "$HOME/.local/bin/tailscale"
91 | mv "$HOME/.tmp/tailscale_${version//v}_amd64/tailscaled" "$HOME/.local/bin/tailscaled"
92 |
93 | chmod +x "$HOME/.local/bin/tailscale"
94 | chmod +x "$HOME/.local/bin/tailscaled"
95 | rm -rf "$HOME/.tmp/tailscale_${version//v}_amd64/"
96 | if [[ ! -f "$HOME/.install/.tailscale.dev.lock" ]]; then
97 | touch "$HOME/.install/.tailscale.dev.lock"
98 | fi
99 | systemctl --user restart tailscaled
100 | }
101 |
102 | function _remove(){
103 | if [[ ! -f "$HOME/.install/.tailscale.dev.lock" ]]; then
104 | echo 'Tailscale may not be installed. If it is, please run `touch "$HOME/.install/.tailscale.dev.lock"` before continuing with your removal.'
105 | exit 1
106 | fi
107 | "$HOME/.local/bin/tailscale" --socket="$HOME/.tmp/tailscale/tailscaled.sock" logout
108 | systemctl --user stop tailscaled
109 | systemctl --user disable --now tailscaled
110 | rm -f "$HOME/.local/bin/tailscale"
111 | rm -f "$HOME/.local/bin/tailscaled"
112 | rm -rf "$HOME/.tmp/tailscale"
113 | rm -rf "$HOME/.config/tailscale/"
114 | rm -rf "$HOME/.local/share/tailscale"
115 | rm -f "$HOME/.config/systemd/user/tailscaled.service"
116 | sed -i "s|alias tailscale=.*||g" "$HOME/.bashrc"
117 | echo "Tailscale removed"
118 | }
119 |
120 | echo 'This is unsupported software. You will not get help with this, please answer `yes` if you understand and wish to proceed'
121 | if [[ -z ${eula} ]]; then
122 | read -r eula
123 | fi
124 |
125 | if ! [[ $eula =~ yes ]]; then
126 | echo "You did not accept the above. Exiting..."
127 | exit 1
128 | else
129 | echo "Proceeding with installation"
130 | fi
131 |
132 | echo "Welcome to the Tailscale installer..."
133 | echo ""
134 | echo "What do you like to do?"
135 | echo "Logs are stored at ${log}"
136 | echo "install = Install Tailscale"
137 | echo "upgrade = Upgrade Tailscale"
138 | echo "uninstall = Completely removes Tailscale"
139 | echo "exit = Exits Installer"
140 | while true; do
141 | read -r -p "Enter it here: " choice
142 | case $choice in
143 | "install")
144 | _install
145 | break
146 | ;;
147 | "upgrade")
148 | _upgrade
149 | break
150 | ;;
151 | "uninstall")
152 | _remove
153 | break
154 | ;;
155 | "exit")
156 | break
157 | ;;
158 | *)
159 | echo "Unknown Option."
160 | ;;
161 | esac
162 | done
163 | exit
164 |
--------------------------------------------------------------------------------
/unpackerr.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Unpackerr Installer by b
3 | # Swizzin/Seedbox.io 2021
4 |
5 | user=$(whoami)
6 | mkdir -p "$HOME/.logs/"
7 | export log="$HOME/.logs/unpackerr.log"
8 | touch "$log"
9 | app="unpackerr"
10 |
11 | function _get_latest_release() {
12 | case "$(dpkg --print-architecture)" in
13 | "amd64") arch='amd64' ;;
14 | "arm64") arch="arm64" ;;
15 | "armhf") arch="armhf" ;;
16 | "i386") arch="i386" ;;
17 | *)
18 | echo "Arch not supported"
19 | exit 1
20 | ;;
21 | esac
22 | latest=$(curl -sL https://api.github.com/repos/davidnewhall/unpackerr/releases/latest | grep "${arch}.linux" | grep browser_download_url | cut -d \" -f4) || {
23 | echo "Failed to query GitHub for latest version"
24 | exit 1
25 | }
26 |
27 | if ! curl "$latest" -L -o "/tmp/unpackerr.gz" >> "$log" 2>&1; then
28 | echo "Download failed, exiting"
29 | exit 1
30 | fi
31 | gzip -d "/tmp/unpackerr.gz" || {
32 | echo "Failed to extract"
33 | exit 1
34 | }
35 | mkdir -p "$HOME/.local/bin/"
36 | mv /tmp/unpackerr "$HOME/.local/bin/"
37 | chmod +x "$HOME/.local/bin/unpackerr"
38 | rm -rf /tmp/unpackerr.gz
39 | echo "Archive Extracted."
40 | }
41 |
42 | function _install() {
43 |
44 | echo "Downloading latest release"
45 | _get_latest_release
46 | echo "Latest release installed."
47 |
48 | echo "Configuring Unpackerr"
49 | subnet=$(cat "$HOME/.install/subnet.lock")
50 | mkdir -p "$HOME/.config/unpackerr"
51 | cat > "$HOME/.config/unpackerr/unpackerr.conf" << EOF
52 | debug = false
53 | quiet = false
54 | log_file = "$HOME/.config/unpackerr/unpackerr.log"
55 | log_files = 1
56 | log_file_mb = 10
57 | interval = "2m"
58 | start_delay = "1m"
59 | retry_delay = "5m"
60 | parallel = 1
61 | file_mode = "0644"
62 | dir_mode = "0755"
63 | EOF
64 | # Add API data to config for installed arrs.
65 | if [[ -f $HOME/.install/.sonarr.lock ]]; then
66 | sonarr_base=$(sed -n 's|\(.*\)\(.*\)|\2|p' "$HOME/.config/Sonarr/config.xml")
67 | sonarr_api=$(sed -n 's|\(.*\)\(.*\)|\2|p' "$HOME/.config/Sonarr/config.xml")
68 | sonarr_port=$(sed -n 's|\(.*\)\(.*\)|\2|p' "$HOME/.config/Sonarr/config.xml")
69 | echo "[[sonarr]]" >> "$HOME/.config/unpackerr/unpackerr.conf"
70 | echo " url = \"http://${subnet}:${sonarr_port}/${sonarr_base}\"" >> "$HOME/.config/unpackerr/unpackerr.conf"
71 | echo " api_key = \"${sonarr_api}\"" >> "$HOME/.config/unpackerr/unpackerr.conf"
72 | echo " paths = [\"$HOME/torrents/rtorrent/\",\"$HOME/torrents/qbittorrent/\",\"$HOME/torrents/deluge/\"]" >> "$HOME/.config/unpackerr/unpackerr.conf"
73 | echo " protocols = \"torrent\"" >> "$HOME/.config/unpackerr/unpackerr.conf"
74 | echo " timeout = \"10s\"" >> "$HOME/.config/unpackerr/unpackerr.conf"
75 | echo " delete_delay = \"5m\"" >> "$HOME/.config/unpackerr/unpackerr.conf"
76 | echo " delete_orig = false" >> "$HOME/.config/unpackerr/unpackerr.conf"
77 | fi
78 |
79 | if [[ -f $HOME/.install/.radarr.lock ]]; then
80 | radarr_api=$(sed -n 's|\(.*\)\(.*\)|\2|p' "$HOME/.config/Radarr/config.xml")
81 | radarr_port=$(sed -n 's|\(.*\)\(.*\)|\2|p' "$HOME/.config/Radarr/config.xml")
82 | radarr_base=$(sed -n 's|\(.*\)\(.*\)|\2|p' "/$HOME/.config/Radarr/config.xml")
83 | echo " [[radarr]]" >> "$HOME/.config/unpackerr/unpackerr.conf"
84 | echo " url = \"http://${subnet}:${radarr_port}/${radarr_base}\"" >> "$HOME/.config/unpackerr/unpackerr.conf"
85 | echo " api_key = \"${radarr_api}\"" >> "$HOME/.config/unpackerr/unpackerr.conf"
86 | echo " paths = [\"$HOME/torrents/rtorrent/\",\"$HOME/torrents/qbittorrent/\",\"$HOME/torrents/deluge/\"]" >> "$HOME/.config/unpackerr/unpackerr.conf"
87 | echo " protocols = \"torrent\"" >> "$HOME/.config/unpackerr/unpackerr.conf"
88 | echo " timeout = \"10s\"" >> "$HOME/.config/unpackerr/unpackerr.conf"
89 | echo " delete_delay = \"5m\"" >> "$HOME/.config/unpackerr/unpackerr.conf"
90 | echo " delete_orig = false" >> "$HOME/.config/unpackerr/unpackerr.conf"
91 | fi
92 |
93 | if [[ -f $HOME/.install/.lidarr.lock ]]; then
94 | lidarr_api=$(sed -n 's|\(.*\)\(.*\)|\2|p' "$HOME/.config/Lidarr/config.xml")
95 | lidarr_port=$(sed -n 's|\(.*\)\(.*\)|\2|p' "$HOME/.config/Lidarr/config.xml")
96 | lidarr_base=$(sed -n 's|\(.*\)\(.*\)|\2|p' "$HOME/.config/Lidarr/config.xml")
97 | echo " [[lidarr]]" >> "$HOME/.config/unpackerr/unpackerr.conf"
98 | echo " url = \"http://${subnet}:${lidarr_port}/${lidarr_base}\"" >> "$HOME/.config/unpackerr/unpackerr.conf"
99 | echo " api_key = \"${lidarr_api}\"" >> "$HOME/.config/unpackerr/unpackerr.conf"
100 | echo " paths = [\"$HOME/torrents/rtorrent/\",\"$HOME/torrents/qbittorrent/\",\"$HOME/torrents/deluge/\"]" >> "$HOME/.config/unpackerr/unpackerr.conf"
101 | echo " protocols = \"torrent\"" >> "$HOME/.config/unpackerr/unpackerr.conf"
102 | echo " timeout = \"10s\"" >> "$HOME/.config/unpackerr/unpackerr.conf"
103 | echo " delete_delay = \"5m\"" >> "$HOME/.config/unpackerr/unpackerr.conf"
104 | echo " delete_orig = false" >> "$HOME/.config/unpackerr/unpackerr.conf"
105 | fi
106 |
107 | mkdir -p "$HOME/.config/systemd/user/"
108 | cat > "$HOME/.config/systemd/user/unpackerr.service" << EOF
109 | [Unit]
110 | Description=unpackerr - Extracts downloads so Radarr, Sonarr, Lidarr or Readarr may import them.
111 |
112 | [Service]
113 | ExecStart=$HOME/.local/bin/unpackerr --config $HOME/.config/unpackerr/unpackerr.conf
114 | Restart=always
115 | RestartSec=10
116 | SyslogIdentifier=unpackerr
117 | Type=simple
118 | WorkingDirectory=/tmp
119 |
120 | [Install]
121 | WantedBy=default.target
122 | EOF
123 | echo "Starting the unpackerr service"
124 | systemctl enable --user --now unpackerr >> "$log" 2>&1
125 | touch "$HOME/.install/.unpackerr.lock"
126 | echo "Unpackerr installed."
127 | }
128 |
129 | function _remove() {
130 | echo "Removing unpackerr."
131 | systemctl stop --user unpackerr
132 | systemctl disable --user unpackerr
133 | rm -rf "$HOME/.config/unpackerr"
134 | rm -rf "$HOME/.local/bin/unpackerr"
135 | rm "$HOME/.install/.unpackerr.lock"
136 | echo "Unpackerr removed."
137 | }
138 |
139 | function _upgrade() {
140 | echo "Upgrading unpackerr."
141 | systemctl stop --user unpackerr
142 | _get_latest_release
143 | systemctl start --user unpackerr
144 | echo "Unpackerr has been Upgraded."
145 | }
146 |
147 | echo 'This is unsupported software. You will not get help with this, please answer `yes` if you understand and wish to proceed'
148 | if [[ -z ${eula} ]]; then
149 | read -r eula
150 | fi
151 |
152 | if ! [[ $eula =~ yes ]]; then
153 | echo "You did not accept the above. Exiting..."
154 | exit 1
155 | else
156 | echo "Proceeding with installation"
157 | fi
158 |
159 | echo "Welcome to the Unpackerr installer..."
160 | echo ""
161 | echo "What do you like to do?"
162 | echo "Logs are stored at ${log}"
163 | echo "install = Install ${app}"
164 | echo "upgrade = upgrades ${app} to latest version"
165 | echo "uninstall = Completely removes ${app}"
166 | echo "exit = Exits Installer"
167 | while true; do
168 | read -r -p "Enter it here: " choice
169 | case $choice in
170 | "install")
171 | _install
172 | break
173 | ;;
174 | "uninstall")
175 | _remove
176 | break
177 | ;;
178 | "upgrade")
179 | _upgrade
180 | break
181 | ;;
182 | "exit")
183 | break
184 | ;;
185 | *)
186 | echo "Unknown Option."
187 | ;;
188 | esac
189 | done
190 | exit
191 |
--------------------------------------------------------------------------------
/whisparr.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | ## Installer by b
3 | ## Thanks to Bakerboy, Sosig, Liara, and team for some of the functions / logic.
4 |
5 | user=$(whoami)
6 |
7 | if [[ ! -d $HOME/.logs ]]; then
8 | mkdir -p $HOME/.logs
9 | fi
10 |
11 | touch "$HOME/.logs/whisparr.log"
12 | log="$HOME/.logs/whisparr.log"
13 |
14 | function port() {
15 | LOW_BOUND=$1
16 | UPPER_BOUND=$2
17 | comm -23 <(seq ${LOW_BOUND} ${UPPER_BOUND} | sort) <(ss -Htan | awk '{print $4}' | cut -d':' -f2 | sort -u) | shuf | head -n 1
18 | }
19 |
20 | function _install() {
21 | ssl_port=$(port 14000 16000)
22 | port=$(port 8000 13000)
23 | domain=$(hostname -f)
24 |
25 | # Download App
26 | echo "Downloading Whisparr"
27 |
28 | mkdir -p "$HOME/.tmp"
29 |
30 | curl -sL "http://whisparr.servarr.com/v1/update/nightly/updatefile?os=linux&runtime=netcore&arch=x64" -o $HOME/.tmp/whisparr.tar.gz >> "$log" 2>&1 || {
31 | echo "Download failed."
32 | exit 1
33 | }
34 |
35 | # Extract
36 | echo "Extracting Whisparr"
37 | tar xfv "$HOME/.tmp/whisparr.tar.gz" --directory $HOME/ >> "$log" 2>&1 || {
38 | echo_error "Failed to extract"
39 | exit 1
40 | }
41 | rm -rf /tmp/whisparr.tar.gz
42 |
43 | if [[ ! -d $HOME/.config/systemd/user/ ]]; then
44 | mkdir -p $HOME/.config/systemd/user/
45 | fi
46 |
47 | # Service File
48 | echo "Writing service file"
49 | cat > "$HOME/.config/systemd/user/whisparr.service" << EOF
50 | [Unit]
51 | Description=Whisparr Daemon
52 | After=syslog.target network.target
53 |
54 | [Service]
55 | Type=simple
56 | ExecStart=$HOME/Whisparr/Whisparr -nobrowser -data=$HOME/.config/Whisparr/
57 | TimeoutStopSec=20
58 | KillMode=process
59 | Restart=on-failure
60 |
61 | [Install]
62 | WantedBy=default.target
63 | EOF
64 | mkdir -p $HOME/.config/Whisparr/
65 | cat > $HOME/.config/Whisparr/config.xml << WHISPARR
66 |
67 | debug
68 | BuiltIn
69 | *
70 | ${port}
71 | ${ssl_port}
72 | False
73 | False
74 |
75 | None
76 |
77 | develop
78 |
79 | WHISPARR
80 |
81 | # Enable/Start Whisparr
82 | echo "Starting Whisparr"
83 | systemctl enable --now --user whisparr.service
84 | touch "$HOME/.install/.whisparr.lock"
85 |
86 | echo "Whisparr has been installed. You can access it at http://${domain}:${port}"
87 | echo "Remember to check your authentication. This is publicly accessible and will contain your API keys and stuff."
88 | }
89 |
90 | function _remove() {
91 | systemctl disable --now --user whisparr
92 | rm -rf "$HOME/.config/Whisparr/"
93 | rm -rf "$HOME/Whisparr/"
94 | echo "Whisparr has been removed."
95 | }
96 |
97 | echo 'This is unsupported software. You will not get help with this, please answer `yes` if you understand and wish to proceed'
98 | if [[ -z ${eula} ]]; then
99 | read -r eula
100 | fi
101 |
102 | if ! [[ $eula =~ yes ]]; then
103 | echo "You did not accept the above. Exiting..."
104 | exit 1
105 | else
106 | echo "Proceeding with installation"
107 | fi
108 |
109 | echo "Welcome to Whisparr installer..."
110 | echo ""
111 | echo "What do you like to do?"
112 | echo "Logs are stored at ${log}"
113 | echo "install = Install Whisparr"
114 | echo "uninstall = Completely removes Whisparr"
115 | echo "exit = Exits Installer"
116 | while true; do
117 | read -r -p "Enter it here: " choice
118 | case $choice in
119 | "install")
120 | _install
121 | break
122 | ;;
123 | "uninstall")
124 | _remove
125 | break
126 | ;;
127 | "exit")
128 | break
129 | ;;
130 | *)
131 | echo "Unknown Option."
132 | ;;
133 | esac
134 | done
135 | exit
136 |
--------------------------------------------------------------------------------