├── .editorconfig
├── .github
└── workflows
│ └── ci.yml
├── .gitignore
├── CODE_OF_CONDUCT.md
├── LICENSE
├── Makefile
├── README.md
├── guest
├── Singularity
├── bin
│ ├── internal-makepkg
│ ├── internal-makepkg-depends
│ └── x11-wrapper
└── etc
│ ├── makepkg.conf.append
│ └── pacman.conf
├── install-hpc-cluster.sh
├── package.json
├── services
├── chaotic-afternoon.service
├── chaotic-afternoon.timer
├── chaotic-hourly.service
├── chaotic-hourly.timer
├── chaotic-midnight.service
├── chaotic-midnight.timer
├── chaotic-morning.service
├── chaotic-morning.timer
├── chaotic-nightly.service
├── chaotic-nightly.timer
├── chaotic-sort-logs.service
├── chaotic-sort-logs.timer
├── chaotic-tkg-kernels.service
├── chaotic-tkg-kernels.timer
├── chaotic-tkg-wine.service
└── chaotic-tkg-wine.timer
├── slurm-jobs
└── ufscar-hpc
│ ├── common.sh
│ ├── daily.1.sh
│ ├── hourly.1.sh
│ └── hourly.2.sh
├── src
├── chaotic.c
├── chaotic.sh
└── lib
│ ├── aur.sh
│ ├── base-make.sh
│ ├── cleanup.sh
│ ├── database.sh
│ ├── deploy.sh
│ ├── interfere.sh
│ ├── mirror.sh
│ ├── package-make.sh
│ ├── package-makedir.sh
│ ├── package-prepare.sh
│ ├── pkgrel-incrementer.sh
│ ├── routines-garuda.sh
│ ├── routines-tkg-wine.sh
│ ├── routines-tkg.sh
│ ├── routines.sh
│ ├── sync.sh
│ └── utils.sh
├── wrappers
├── README.md
├── git
├── gpg
├── pacman
├── repoctl
└── telegram-send
└── yarn.lock
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | end_of_line = lf
5 | insert_final_newline = true
6 |
7 | [{**.sh,guest/bin/*}]
8 | indent_style = space
9 | indent_size = 2
10 |
11 | [Makefile]
12 | indent_style = tab
13 |
--------------------------------------------------------------------------------
/.github/workflows/ci.yml:
--------------------------------------------------------------------------------
1 | name: CI
2 | on:
3 | pull_request:
4 | types: [opened, synchronize, reopened, ready_for_review]
5 | push:
6 | branches: [main]
7 | tags:
8 | - "*"
9 |
10 | jobs:
11 | lint:
12 | runs-on: ubuntu-latest
13 | if: github.event.pull_request.draft == false
14 |
15 | steps:
16 | - name: Checkout
17 | uses: actions/checkout@v3
18 |
19 | - uses: actions/setup-node@v3
20 | with:
21 | node-version: "lts/*"
22 | cache: "yarn"
23 |
24 | - name: Install/Update dependencies
25 | run: yarn install
26 |
27 | - name: Run lint
28 | run: yarn run lint
29 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | /build/
3 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | Code of Conduct is available at:
2 | https://github.com/chaotic-cx/code-of-conduct
3 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU AFFERO GENERAL PUBLIC LICENSE
2 | Version 3, 19 November 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 Affero General Public License is a free, copyleft license for
11 | software and other kinds of works, specifically designed to ensure
12 | cooperation with the community in the case of network server software.
13 |
14 | The licenses for most software and other practical works are designed
15 | to take away your freedom to share and change the works. By contrast,
16 | our General Public Licenses are intended to guarantee your freedom to
17 | share and change all versions of a program--to make sure it remains free
18 | software for all its users.
19 |
20 | When we speak of free software, we are referring to freedom, not
21 | price. Our General Public Licenses are designed to make sure that you
22 | have the freedom to distribute copies of free software (and charge for
23 | them if you wish), that you receive source code or can get it if you
24 | want it, that you can change the software or use pieces of it in new
25 | free programs, and that you know you can do these things.
26 |
27 | Developers that use our General Public Licenses protect your rights
28 | with two steps: (1) assert copyright on the software, and (2) offer
29 | you this License which gives you legal permission to copy, distribute
30 | and/or modify the software.
31 |
32 | A secondary benefit of defending all users' freedom is that
33 | improvements made in alternate versions of the program, if they
34 | receive widespread use, become available for other developers to
35 | incorporate. Many developers of free software are heartened and
36 | encouraged by the resulting cooperation. However, in the case of
37 | software used on network servers, this result may fail to come about.
38 | The GNU General Public License permits making a modified version and
39 | letting the public access it on a server without ever releasing its
40 | source code to the public.
41 |
42 | The GNU Affero General Public License is designed specifically to
43 | ensure that, in such cases, the modified source code becomes available
44 | to the community. It requires the operator of a network server to
45 | provide the source code of the modified version running there to the
46 | users of that server. Therefore, public use of a modified version, on
47 | a publicly accessible server, gives the public access to the source
48 | code of the modified version.
49 |
50 | An older license, called the Affero General Public License and
51 | published by Affero, was designed to accomplish similar goals. This is
52 | a different license, not a version of the Affero GPL, but Affero has
53 | released a new version of the Affero GPL which permits relicensing under
54 | this license.
55 |
56 | The precise terms and conditions for copying, distribution and
57 | modification follow.
58 |
59 | TERMS AND CONDITIONS
60 |
61 | 0. Definitions.
62 |
63 | "This License" refers to version 3 of the GNU Affero General Public License.
64 |
65 | "Copyright" also means copyright-like laws that apply to other kinds of
66 | works, such as semiconductor masks.
67 |
68 | "The Program" refers to any copyrightable work licensed under this
69 | License. Each licensee is addressed as "you". "Licensees" and
70 | "recipients" may be individuals or organizations.
71 |
72 | To "modify" a work means to copy from or adapt all or part of the work
73 | in a fashion requiring copyright permission, other than the making of an
74 | exact copy. The resulting work is called a "modified version" of the
75 | earlier work or a work "based on" the earlier work.
76 |
77 | A "covered work" means either the unmodified Program or a work based
78 | on the Program.
79 |
80 | To "propagate" a work means to do anything with it that, without
81 | permission, would make you directly or secondarily liable for
82 | infringement under applicable copyright law, except executing it on a
83 | computer or modifying a private copy. Propagation includes copying,
84 | distribution (with or without modification), making available to the
85 | public, and in some countries other activities as well.
86 |
87 | To "convey" a work means any kind of propagation that enables other
88 | parties to make or receive copies. Mere interaction with a user through
89 | a computer network, with no transfer of a copy, is not conveying.
90 |
91 | An interactive user interface displays "Appropriate Legal Notices"
92 | to the extent that it includes a convenient and prominently visible
93 | feature that (1) displays an appropriate copyright notice, and (2)
94 | tells the user that there is no warranty for the work (except to the
95 | extent that warranties are provided), that licensees may convey the
96 | work under this License, and how to view a copy of this License. If
97 | the interface presents a list of user commands or options, such as a
98 | menu, a prominent item in the list meets this criterion.
99 |
100 | 1. Source Code.
101 |
102 | The "source code" for a work means the preferred form of the work
103 | for making modifications to it. "Object code" means any non-source
104 | form of a work.
105 |
106 | A "Standard Interface" means an interface that either is an official
107 | standard defined by a recognized standards body, or, in the case of
108 | interfaces specified for a particular programming language, one that
109 | is widely used among developers working in that language.
110 |
111 | The "System Libraries" of an executable work include anything, other
112 | than the work as a whole, that (a) is included in the normal form of
113 | packaging a Major Component, but which is not part of that Major
114 | Component, and (b) serves only to enable use of the work with that
115 | Major Component, or to implement a Standard Interface for which an
116 | implementation is available to the public in source code form. A
117 | "Major Component", in this context, means a major essential component
118 | (kernel, window system, and so on) of the specific operating system
119 | (if any) on which the executable work runs, or a compiler used to
120 | produce the work, or an object code interpreter used to run it.
121 |
122 | The "Corresponding Source" for a work in object code form means all
123 | the source code needed to generate, install, and (for an executable
124 | work) run the object code and to modify the work, including scripts to
125 | control those activities. However, it does not include the work's
126 | System Libraries, or general-purpose tools or generally available free
127 | programs which are used unmodified in performing those activities but
128 | which are not part of the work. For example, Corresponding Source
129 | includes interface definition files associated with source files for
130 | the work, and the source code for shared libraries and dynamically
131 | linked subprograms that the work is specifically designed to require,
132 | such as by intimate data communication or control flow between those
133 | subprograms and other parts of the work.
134 |
135 | The Corresponding Source need not include anything that users
136 | can regenerate automatically from other parts of the Corresponding
137 | Source.
138 |
139 | The Corresponding Source for a work in source code form is that
140 | same work.
141 |
142 | 2. Basic Permissions.
143 |
144 | All rights granted under this License are granted for the term of
145 | copyright on the Program, and are irrevocable provided the stated
146 | conditions are met. This License explicitly affirms your unlimited
147 | permission to run the unmodified Program. The output from running a
148 | covered work is covered by this License only if the output, given its
149 | content, constitutes a covered work. This License acknowledges your
150 | rights of fair use or other equivalent, as provided by copyright law.
151 |
152 | You may make, run and propagate covered works that you do not
153 | convey, without conditions so long as your license otherwise remains
154 | in force. You may convey covered works to others for the sole purpose
155 | of having them make modifications exclusively for you, or provide you
156 | with facilities for running those works, provided that you comply with
157 | the terms of this License in conveying all material for which you do
158 | not control copyright. Those thus making or running the covered works
159 | for you must do so exclusively on your behalf, under your direction
160 | and control, on terms that prohibit them from making any copies of
161 | your copyrighted material outside their relationship with you.
162 |
163 | Conveying under any other circumstances is permitted solely under
164 | the conditions stated below. Sublicensing is not allowed; section 10
165 | makes it unnecessary.
166 |
167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
168 |
169 | No covered work shall be deemed part of an effective technological
170 | measure under any applicable law fulfilling obligations under article
171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
172 | similar laws prohibiting or restricting circumvention of such
173 | measures.
174 |
175 | When you convey a covered work, you waive any legal power to forbid
176 | circumvention of technological measures to the extent such circumvention
177 | is effected by exercising rights under this License with respect to
178 | the covered work, and you disclaim any intention to limit operation or
179 | modification of the work as a means of enforcing, against the work's
180 | users, your or third parties' legal rights to forbid circumvention of
181 | technological measures.
182 |
183 | 4. Conveying Verbatim Copies.
184 |
185 | You may convey verbatim copies of the Program's source code as you
186 | receive it, in any medium, provided that you conspicuously and
187 | appropriately publish on each copy an appropriate copyright notice;
188 | keep intact all notices stating that this License and any
189 | non-permissive terms added in accord with section 7 apply to the code;
190 | keep intact all notices of the absence of any warranty; and give all
191 | recipients a copy of this License along with the Program.
192 |
193 | You may charge any price or no price for each copy that you convey,
194 | and you may offer support or warranty protection for a fee.
195 |
196 | 5. Conveying Modified Source Versions.
197 |
198 | You may convey a work based on the Program, or the modifications to
199 | produce it from the Program, in the form of source code under the
200 | terms of section 4, provided that you also meet all of these conditions:
201 |
202 | a) The work must carry prominent notices stating that you modified
203 | it, and giving a relevant date.
204 |
205 | b) The work must carry prominent notices stating that it is
206 | released under this License and any conditions added under section
207 | 7. This requirement modifies the requirement in section 4 to
208 | "keep intact all notices".
209 |
210 | c) You must license the entire work, as a whole, under this
211 | License to anyone who comes into possession of a copy. This
212 | License will therefore apply, along with any applicable section 7
213 | additional terms, to the whole of the work, and all its parts,
214 | regardless of how they are packaged. This License gives no
215 | permission to license the work in any other way, but it does not
216 | invalidate such permission if you have separately received it.
217 |
218 | d) If the work has interactive user interfaces, each must display
219 | Appropriate Legal Notices; however, if the Program has interactive
220 | interfaces that do not display Appropriate Legal Notices, your
221 | work need not make them do so.
222 |
223 | A compilation of a covered work with other separate and independent
224 | works, which are not by their nature extensions of the covered work,
225 | and which are not combined with it such as to form a larger program,
226 | in or on a volume of a storage or distribution medium, is called an
227 | "aggregate" if the compilation and its resulting copyright are not
228 | used to limit the access or legal rights of the compilation's users
229 | beyond what the individual works permit. Inclusion of a covered work
230 | in an aggregate does not cause this License to apply to the other
231 | parts of the aggregate.
232 |
233 | 6. Conveying Non-Source Forms.
234 |
235 | You may convey a covered work in object code form under the terms
236 | of sections 4 and 5, provided that you also convey the
237 | machine-readable Corresponding Source under the terms of this License,
238 | in one of these ways:
239 |
240 | a) Convey the object code in, or embodied in, a physical product
241 | (including a physical distribution medium), accompanied by the
242 | Corresponding Source fixed on a durable physical medium
243 | customarily used for software interchange.
244 |
245 | b) Convey the object code in, or embodied in, a physical product
246 | (including a physical distribution medium), accompanied by a
247 | written offer, valid for at least three years and valid for as
248 | long as you offer spare parts or customer support for that product
249 | model, to give anyone who possesses the object code either (1) a
250 | copy of the Corresponding Source for all the software in the
251 | product that is covered by this License, on a durable physical
252 | medium customarily used for software interchange, for a price no
253 | more than your reasonable cost of physically performing this
254 | conveying of source, or (2) access to copy the
255 | Corresponding Source from a network server at no charge.
256 |
257 | c) Convey individual copies of the object code with a copy of the
258 | written offer to provide the Corresponding Source. This
259 | alternative is allowed only occasionally and noncommercially, and
260 | only if you received the object code with such an offer, in accord
261 | with subsection 6b.
262 |
263 | d) Convey the object code by offering access from a designated
264 | place (gratis or for a charge), and offer equivalent access to the
265 | Corresponding Source in the same way through the same place at no
266 | further charge. You need not require recipients to copy the
267 | Corresponding Source along with the object code. If the place to
268 | copy the object code is a network server, the Corresponding Source
269 | may be on a different server (operated by you or a third party)
270 | that supports equivalent copying facilities, provided you maintain
271 | clear directions next to the object code saying where to find the
272 | Corresponding Source. Regardless of what server hosts the
273 | Corresponding Source, you remain obligated to ensure that it is
274 | available for as long as needed to satisfy these requirements.
275 |
276 | e) Convey the object code using peer-to-peer transmission, provided
277 | you inform other peers where the object code and Corresponding
278 | Source of the work are being offered to the general public at no
279 | charge under subsection 6d.
280 |
281 | A separable portion of the object code, whose source code is excluded
282 | from the Corresponding Source as a System Library, need not be
283 | included in conveying the object code work.
284 |
285 | A "User Product" is either (1) a "consumer product", which means any
286 | tangible personal property which is normally used for personal, family,
287 | or household purposes, or (2) anything designed or sold for incorporation
288 | into a dwelling. In determining whether a product is a consumer product,
289 | doubtful cases shall be resolved in favor of coverage. For a particular
290 | product received by a particular user, "normally used" refers to a
291 | typical or common use of that class of product, regardless of the status
292 | of the particular user or of the way in which the particular user
293 | actually uses, or expects or is expected to use, the product. A product
294 | is a consumer product regardless of whether the product has substantial
295 | commercial, industrial or non-consumer uses, unless such uses represent
296 | the only significant mode of use of the product.
297 |
298 | "Installation Information" for a User Product means any methods,
299 | procedures, authorization keys, or other information required to install
300 | and execute modified versions of a covered work in that User Product from
301 | a modified version of its Corresponding Source. The information must
302 | suffice to ensure that the continued functioning of the modified object
303 | code is in no case prevented or interfered with solely because
304 | modification has been made.
305 |
306 | If you convey an object code work under this section in, or with, or
307 | specifically for use in, a User Product, and the conveying occurs as
308 | part of a transaction in which the right of possession and use of the
309 | User Product is transferred to the recipient in perpetuity or for a
310 | fixed term (regardless of how the transaction is characterized), the
311 | Corresponding Source conveyed under this section must be accompanied
312 | by the Installation Information. But this requirement does not apply
313 | if neither you nor any third party retains the ability to install
314 | modified object code on the User Product (for example, the work has
315 | been installed in ROM).
316 |
317 | The requirement to provide Installation Information does not include a
318 | requirement to continue to provide support service, warranty, or updates
319 | for a work that has been modified or installed by the recipient, or for
320 | the User Product in which it has been modified or installed. Access to a
321 | network may be denied when the modification itself materially and
322 | adversely affects the operation of the network or violates the rules and
323 | protocols for communication across the network.
324 |
325 | Corresponding Source conveyed, and Installation Information provided,
326 | in accord with this section must be in a format that is publicly
327 | documented (and with an implementation available to the public in
328 | source code form), and must require no special password or key for
329 | unpacking, reading or copying.
330 |
331 | 7. Additional Terms.
332 |
333 | "Additional permissions" are terms that supplement the terms of this
334 | License by making exceptions from one or more of its conditions.
335 | Additional permissions that are applicable to the entire Program shall
336 | be treated as though they were included in this License, to the extent
337 | that they are valid under applicable law. If additional permissions
338 | apply only to part of the Program, that part may be used separately
339 | under those permissions, but the entire Program remains governed by
340 | this License without regard to the additional permissions.
341 |
342 | When you convey a copy of a covered work, you may at your option
343 | remove any additional permissions from that copy, or from any part of
344 | it. (Additional permissions may be written to require their own
345 | removal in certain cases when you modify the work.) You may place
346 | additional permissions on material, added by you to a covered work,
347 | for which you have or can give appropriate copyright permission.
348 |
349 | Notwithstanding any other provision of this License, for material you
350 | add to a covered work, you may (if authorized by the copyright holders of
351 | that material) supplement the terms of this License with terms:
352 |
353 | a) Disclaiming warranty or limiting liability differently from the
354 | terms of sections 15 and 16 of this License; or
355 |
356 | b) Requiring preservation of specified reasonable legal notices or
357 | author attributions in that material or in the Appropriate Legal
358 | Notices displayed by works containing it; or
359 |
360 | c) Prohibiting misrepresentation of the origin of that material, or
361 | requiring that modified versions of such material be marked in
362 | reasonable ways as different from the original version; or
363 |
364 | d) Limiting the use for publicity purposes of names of licensors or
365 | authors of the material; or
366 |
367 | e) Declining to grant rights under trademark law for use of some
368 | trade names, trademarks, or service marks; or
369 |
370 | f) Requiring indemnification of licensors and authors of that
371 | material by anyone who conveys the material (or modified versions of
372 | it) with contractual assumptions of liability to the recipient, for
373 | any liability that these contractual assumptions directly impose on
374 | those licensors and authors.
375 |
376 | All other non-permissive additional terms are considered "further
377 | restrictions" within the meaning of section 10. If the Program as you
378 | received it, or any part of it, contains a notice stating that it is
379 | governed by this License along with a term that is a further
380 | restriction, you may remove that term. If a license document contains
381 | a further restriction but permits relicensing or conveying under this
382 | License, you may add to a covered work material governed by the terms
383 | of that license document, provided that the further restriction does
384 | not survive such relicensing or conveying.
385 |
386 | If you add terms to a covered work in accord with this section, you
387 | must place, in the relevant source files, a statement of the
388 | additional terms that apply to those files, or a notice indicating
389 | where to find the applicable terms.
390 |
391 | Additional terms, permissive or non-permissive, may be stated in the
392 | form of a separately written license, or stated as exceptions;
393 | the above requirements apply either way.
394 |
395 | 8. Termination.
396 |
397 | You may not propagate or modify a covered work except as expressly
398 | provided under this License. Any attempt otherwise to propagate or
399 | modify it is void, and will automatically terminate your rights under
400 | this License (including any patent licenses granted under the third
401 | paragraph of section 11).
402 |
403 | However, if you cease all violation of this License, then your
404 | license from a particular copyright holder is reinstated (a)
405 | provisionally, unless and until the copyright holder explicitly and
406 | finally terminates your license, and (b) permanently, if the copyright
407 | holder fails to notify you of the violation by some reasonable means
408 | prior to 60 days after the cessation.
409 |
410 | Moreover, your license from a particular copyright holder is
411 | reinstated permanently if the copyright holder notifies you of the
412 | violation by some reasonable means, this is the first time you have
413 | received notice of violation of this License (for any work) from that
414 | copyright holder, and you cure the violation prior to 30 days after
415 | your receipt of the notice.
416 |
417 | Termination of your rights under this section does not terminate the
418 | licenses of parties who have received copies or rights from you under
419 | this License. If your rights have been terminated and not permanently
420 | reinstated, you do not qualify to receive new licenses for the same
421 | material under section 10.
422 |
423 | 9. Acceptance Not Required for Having Copies.
424 |
425 | You are not required to accept this License in order to receive or
426 | run a copy of the Program. Ancillary propagation of a covered work
427 | occurring solely as a consequence of using peer-to-peer transmission
428 | to receive a copy likewise does not require acceptance. However,
429 | nothing other than this License grants you permission to propagate or
430 | modify any covered work. These actions infringe copyright if you do
431 | not accept this License. Therefore, by modifying or propagating a
432 | covered work, you indicate your acceptance of this License to do so.
433 |
434 | 10. Automatic Licensing of Downstream Recipients.
435 |
436 | Each time you convey a covered work, the recipient automatically
437 | receives a license from the original licensors, to run, modify and
438 | propagate that work, subject to this License. You are not responsible
439 | for enforcing compliance by third parties with this License.
440 |
441 | An "entity transaction" is a transaction transferring control of an
442 | organization, or substantially all assets of one, or subdividing an
443 | organization, or merging organizations. If propagation of a covered
444 | work results from an entity transaction, each party to that
445 | transaction who receives a copy of the work also receives whatever
446 | licenses to the work the party's predecessor in interest had or could
447 | give under the previous paragraph, plus a right to possession of the
448 | Corresponding Source of the work from the predecessor in interest, if
449 | the predecessor has it or can get it with reasonable efforts.
450 |
451 | You may not impose any further restrictions on the exercise of the
452 | rights granted or affirmed under this License. For example, you may
453 | not impose a license fee, royalty, or other charge for exercise of
454 | rights granted under this License, and you may not initiate litigation
455 | (including a cross-claim or counterclaim in a lawsuit) alleging that
456 | any patent claim is infringed by making, using, selling, offering for
457 | sale, or importing the Program or any portion of it.
458 |
459 | 11. Patents.
460 |
461 | A "contributor" is a copyright holder who authorizes use under this
462 | License of the Program or a work on which the Program is based. The
463 | work thus licensed is called the contributor's "contributor version".
464 |
465 | A contributor's "essential patent claims" are all patent claims
466 | owned or controlled by the contributor, whether already acquired or
467 | hereafter acquired, that would be infringed by some manner, permitted
468 | by this License, of making, using, or selling its contributor version,
469 | but do not include claims that would be infringed only as a
470 | consequence of further modification of the contributor version. For
471 | purposes of this definition, "control" includes the right to grant
472 | patent sublicenses in a manner consistent with the requirements of
473 | this License.
474 |
475 | Each contributor grants you a non-exclusive, worldwide, royalty-free
476 | patent license under the contributor's essential patent claims, to
477 | make, use, sell, offer for sale, import and otherwise run, modify and
478 | propagate the contents of its contributor version.
479 |
480 | In the following three paragraphs, a "patent license" is any express
481 | agreement or commitment, however denominated, not to enforce a patent
482 | (such as an express permission to practice a patent or covenant not to
483 | sue for patent infringement). To "grant" such a patent license to a
484 | party means to make such an agreement or commitment not to enforce a
485 | patent against the party.
486 |
487 | If you convey a covered work, knowingly relying on a patent license,
488 | and the Corresponding Source of the work is not available for anyone
489 | to copy, free of charge and under the terms of this License, through a
490 | publicly available network server or other readily accessible means,
491 | then you must either (1) cause the Corresponding Source to be so
492 | available, or (2) arrange to deprive yourself of the benefit of the
493 | patent license for this particular work, or (3) arrange, in a manner
494 | consistent with the requirements of this License, to extend the patent
495 | license to downstream recipients. "Knowingly relying" means you have
496 | actual knowledge that, but for the patent license, your conveying the
497 | covered work in a country, or your recipient's use of the covered work
498 | in a country, would infringe one or more identifiable patents in that
499 | country that you have reason to believe are valid.
500 |
501 | If, pursuant to or in connection with a single transaction or
502 | arrangement, you convey, or propagate by procuring conveyance of, a
503 | covered work, and grant a patent license to some of the parties
504 | receiving the covered work authorizing them to use, propagate, modify
505 | or convey a specific copy of the covered work, then the patent license
506 | you grant is automatically extended to all recipients of the covered
507 | work and works based on it.
508 |
509 | A patent license is "discriminatory" if it does not include within
510 | the scope of its coverage, prohibits the exercise of, or is
511 | conditioned on the non-exercise of one or more of the rights that are
512 | specifically granted under this License. You may not convey a covered
513 | work if you are a party to an arrangement with a third party that is
514 | in the business of distributing software, under which you make payment
515 | to the third party based on the extent of your activity of conveying
516 | the work, and under which the third party grants, to any of the
517 | parties who would receive the covered work from you, a discriminatory
518 | patent license (a) in connection with copies of the covered work
519 | conveyed by you (or copies made from those copies), or (b) primarily
520 | for and in connection with specific products or compilations that
521 | contain the covered work, unless you entered into that arrangement,
522 | or that patent license was granted, prior to 28 March 2007.
523 |
524 | Nothing in this License shall be construed as excluding or limiting
525 | any implied license or other defenses to infringement that may
526 | otherwise be available to you under applicable patent law.
527 |
528 | 12. No Surrender of Others' Freedom.
529 |
530 | If conditions are imposed on you (whether by court order, agreement or
531 | otherwise) that contradict the conditions of this License, they do not
532 | excuse you from the conditions of this License. If you cannot convey a
533 | covered work so as to satisfy simultaneously your obligations under this
534 | License and any other pertinent obligations, then as a consequence you may
535 | not convey it at all. For example, if you agree to terms that obligate you
536 | to collect a royalty for further conveying from those to whom you convey
537 | the Program, the only way you could satisfy both those terms and this
538 | License would be to refrain entirely from conveying the Program.
539 |
540 | 13. Remote Network Interaction; Use with the GNU General Public License.
541 |
542 | Notwithstanding any other provision of this License, if you modify the
543 | Program, your modified version must prominently offer all users
544 | interacting with it remotely through a computer network (if your version
545 | supports such interaction) an opportunity to receive the Corresponding
546 | Source of your version by providing access to the Corresponding Source
547 | from a network server at no charge, through some standard or customary
548 | means of facilitating copying of software. This Corresponding Source
549 | shall include the Corresponding Source for any work covered by version 3
550 | of the GNU General Public License that is incorporated pursuant to the
551 | following paragraph.
552 |
553 | Notwithstanding any other provision of this License, you have
554 | permission to link or combine any covered work with a work licensed
555 | under version 3 of the GNU General Public License into a single
556 | combined work, and to convey the resulting work. The terms of this
557 | License will continue to apply to the part which is the covered work,
558 | but the work with which it is combined will remain governed by version
559 | 3 of the GNU General Public License.
560 |
561 | 14. Revised Versions of this License.
562 |
563 | The Free Software Foundation may publish revised and/or new versions of
564 | the GNU Affero General Public License from time to time. Such new versions
565 | will be similar in spirit to the present version, but may differ in detail to
566 | address new problems or concerns.
567 |
568 | Each version is given a distinguishing version number. If the
569 | Program specifies that a certain numbered version of the GNU Affero General
570 | Public License "or any later version" applies to it, you have the
571 | option of following the terms and conditions either of that numbered
572 | version or of any later version published by the Free Software
573 | Foundation. If the Program does not specify a version number of the
574 | GNU Affero General Public License, you may choose any version ever published
575 | by the Free Software Foundation.
576 |
577 | If the Program specifies that a proxy can decide which future
578 | versions of the GNU Affero General Public License can be used, that proxy's
579 | public statement of acceptance of a version permanently authorizes you
580 | to choose that version for the Program.
581 |
582 | Later license versions may give you additional or different
583 | permissions. However, no additional obligations are imposed on any
584 | author or copyright holder as a result of your choosing to follow a
585 | later version.
586 |
587 | 15. Disclaimer of Warranty.
588 |
589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
597 |
598 | 16. Limitation of Liability.
599 |
600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
608 | SUCH DAMAGES.
609 |
610 | 17. Interpretation of Sections 15 and 16.
611 |
612 | If the disclaimer of warranty and limitation of liability provided
613 | above cannot be given local legal effect according to their terms,
614 | reviewing courts shall apply local law that most closely approximates
615 | an absolute waiver of all civil liability in connection with the
616 | Program, unless a warranty or assumption of liability accompanies a
617 | copy of the Program in return for a fee.
618 |
619 | END OF TERMS AND CONDITIONS
620 |
621 | How to Apply These Terms to Your New Programs
622 |
623 | If you develop a new program, and you want it to be of the greatest
624 | possible use to the public, the best way to achieve this is to make it
625 | free software which everyone can redistribute and change under these terms.
626 |
627 | To do so, attach the following notices to the program. It is safest
628 | to attach them to the start of each source file to most effectively
629 | state the exclusion of warranty; and each file should have at least
630 | the "copyright" line and a pointer to where the full notice is found.
631 |
632 |
633 | Copyright (C)
634 |
635 | This program is free software: you can redistribute it and/or modify
636 | it under the terms of the GNU Affero General Public License as published
637 | by the Free Software Foundation, either version 3 of the License, or
638 | (at your option) any later version.
639 |
640 | This program is distributed in the hope that it will be useful,
641 | but WITHOUT ANY WARRANTY; without even the implied warranty of
642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
643 | GNU Affero General Public License for more details.
644 |
645 | You should have received a copy of the GNU Affero General Public License
646 | along with this program. If not, see .
647 |
648 | Also add information on how to contact you by electronic and paper mail.
649 |
650 | If your software can interact with users remotely through a computer
651 | network, you should also make sure that it provides a way for users to
652 | get its source. For example, if your program is a web application, its
653 | interface could display a "Source" link that leads users to an archive
654 | of the code. There are many ways you could offer source, and different
655 | solutions will be better for different programs; see section 13 for the
656 | specific requirements.
657 |
658 | You should also get your employer (if you work as a programmer) or school,
659 | if any, to sign a "copyright disclaimer" for the program, if necessary.
660 | For more information on this, and how to apply and follow the GNU AGPL, see
661 | .
662 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env make
2 | ifeq ($(PREFIX),)
3 | PREFIX := /usr/local
4 | endif
5 |
6 | LIBS = \
7 | aur \
8 | base-make \
9 | cleanup \
10 | database \
11 | deploy \
12 | interfere \
13 | mirror \
14 | package-make \
15 | package-makedir \
16 | package-prepare \
17 | pkgrel-incrementer \
18 | routines \
19 | routines-garuda \
20 | routines-tkg \
21 | routines-tkg-wine \
22 | sync \
23 | utils
24 | ROUTINES = \
25 | hourly \
26 | morning \
27 | afternoon \
28 | nightly \
29 | midnight \
30 | garuda \
31 | tkg-kernels \
32 | tkg-wine
33 |
34 | GUEST_ETC = pacman.conf makepkg.conf.append
35 | GUEST_BIN = internal-makepkg internal-makepkg-depends x11-wrapper
36 |
37 | dir_guard=@install -dm755 "$(@D)"
38 |
39 | build/chaotic.elf: src/chaotic.c
40 | $(dir_guard)
41 | gcc -DPREFIX="\"$(PREFIX)\"" $< -o $@
42 |
43 | $(DESTDIR)$(PREFIX)/bin/chaotic.sh: src/chaotic.sh
44 | $(dir_guard)
45 | install -m755 $< $@
46 |
47 | $(DESTDIR)$(PREFIX)/bin/chaotic: build/chaotic.elf
48 | $(dir_guard)
49 | install -o root -g chaotic_op -m4750 $< $@
50 |
51 | $(DESTDIR)$(PREFIX)/lib/chaotic/%.sh: src/lib/%.sh
52 | $(dir_guard)
53 | install -m755 $< $@
54 |
55 | $(DESTDIR)$(PREFIX)/lib/chaotic/guest/etc/%: guest/etc/%
56 | $(dir_guard)
57 | install -m644 $< $@
58 |
59 | $(DESTDIR)$(PREFIX)/lib/chaotic/guest/bin/%: guest/bin/%
60 | $(dir_guard)
61 | install -m755 $< $@
62 |
63 | $(DESTDIR)/var/lib/chaotic/interfere:
64 | $(dir_guard)
65 | cd "$(@D)" && git clone 'https://github.com/chaotic-aur/interfere.git' interfere
66 |
67 | $(DESTDIR)/var/lib/chaotic/packages:
68 | $(dir_guard)
69 | cd "$(@D)" && git clone 'https://github.com/chaotic-aur/packages.git' packages
70 |
71 | $(DESTDIR)/var/cache/chaotic:
72 | @install -dm755 $@
73 |
74 | $(DESTDIR)/usr/lib/systemd/system/%: services/%
75 | install -o root -g root -m755 $< $@
76 |
77 | build: build/chaotic.elf
78 |
79 | install: \
80 | $(foreach f, $(LIBS), $(DESTDIR)$(PREFIX)/lib/chaotic/${f}.sh) \
81 | $(foreach l, $(GUEST_ETC), $(DESTDIR)$(PREFIX)/lib/chaotic/guest/etc/${l}) \
82 | $(foreach l, $(GUEST_BIN), $(DESTDIR)$(PREFIX)/lib/chaotic/guest/bin/${l}) \
83 | $(DESTDIR)$(PREFIX)/bin/chaotic.sh \
84 | $(DESTDIR)$(PREFIX)/bin/chaotic \
85 | $(DESTDIR)/var/lib/chaotic/interfere \
86 | $(DESTDIR)/var/lib/chaotic/packages \
87 | $(DESTDIR)/var/cache/chaotic
88 |
89 | install-services: \
90 | $(foreach s, $(ROUTINES), $(DESTDIR)/usr/lib/systemd/system/chaotic-${s}.service) \
91 | $(foreach s, $(ROUTINES), $(DESTDIR)/usr/lib/systemd/system/chaotic-${s}.timer)
92 | systemctl daemon-reload
93 |
94 | .PHONY: install install-services build
95 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Chaotic AUR
2 |
3 | ## CLI
4 |
5 | - `chaotic pr{,epare} ${INPUTDIR} $@`
6 |
7 | It generates a building script to be later run in a containerized environment.
8 | `$INPUTDIR` is the name of the directory in "$PWD" which contains a PKGBUILD.
9 |
10 | - `chaotic {lw,lowerstrap}`
11 |
12 | It generates a lowerdir for later chrooting.
13 |
14 | - `chaotic {mk,makepkg} ${INPUTDIR} $@`
15 |
16 | Builds the package in a container using systemd-nspawn.
17 | `$INPUTDIR` is the result of a `prepare`
18 |
19 | - `chaotic {mkd,makepwd} [${PACKAGES[@]}]`
20 |
21 | Prepare and build all packages in the current directory.
22 | If `PACKAGES` are not provided then it will try to build all sub-directories.
23 |
24 | - `chaotic {si,interfere-sync}`
25 |
26 | Sync packages' interference repo.
27 |
28 | - `chaotic {bump,interfere-bump} [${PACKAGES[@]}]`
29 |
30 | Generate and push a PKGREL_BUMPS file for use in interfere. Old entries will automatically be removed.
31 | Uses `repoctl`.
32 |
33 | - `chaotic {sp,package-lists-sync}`
34 |
35 | Sync package list repo.
36 |
37 | - `chaotic {dp,deploy} ${INPUTDIR}`
38 |
39 | Sign the package and send to primary node.
40 |
41 | - `chaotic {dbb,db-bump}`
42 |
43 | Add recently deployed packages to the database, while moving replaced packages to the archive.
44 | Uses `repoctl`.
45 |
46 | - `chaotic db-rebuild`
47 | Completely rebuild the database and files database from scratch, keeping the original DB around until the rebuild is finished.
48 |
49 | - `chaotic {rm,remove} ${PACKAGES[@]}`
50 |
51 | Remove and archive all listed packages.
52 | Uses `repoctl`.
53 |
54 | - `chaotic {get,aur-download} [-r] ${PACKAGES[@]}`
55 |
56 | Download listed packages' sources from AUR.
57 | Uses `repoctl`.
58 |
59 | - `chaotic cl{,eanup} ${INPUTDIR}`
60 |
61 | Safely deletes old package sources.
62 |
63 | - `chaotic help {syncthing,rsync}`
64 |
65 | Instructions to the mirroring services.
66 | RSync is one-way (primary->cluster) only, and Syncthing is both ways.
67 |
68 | - `chaotic routine {hourly,morning,afternoon,nightly,midnight}`
69 |
70 | Run the specified routine.
71 |
72 | - `chaotic routine clean-archive`
73 |
74 | When on a primary node, clean up the archive folder.
75 |
76 | - `chaotic {clean-duplicates,dedup}`
77 |
78 | Moves packages which have been replaced by newer (modify time) packages to the archive folder.
79 |
80 | - `chaotic {clg,clean-logs}`
81 |
82 | After a `chaotic makepwd`, remove successfull and "already built" logs.
83 |
84 | - `chaotic {cls,clean-srccache} ${PACKAGE}`
85 |
86 | Removes cached sources from a specific package.
87 |
88 | - `chaotic clean-sigs {,-q}`
89 |
90 | Moves package files or archive files without their corresponding signature or archive file to the package archive.
91 | Files have to be at least 1 hour old to be considered.
92 |
93 | - `chaotic {srt,sort-logs}`
94 |
95 | Unclutters and sorts the raw log directory into easy to read subcategories
96 |
97 | - `chaotic find-discarded`
98 |
99 | Find and print discarded packages. All packages that are in the database, but do not exist in the package list repo, are considered discarded, but have to be deleted manually.
100 |
101 | ## Involved directories
102 |
103 | - `/var/cache/chaotic/sources/${PACKAGETAG}`
104 |
105 | Per-package `SRCDEST`.
106 |
107 | - `/var/cache/chaotic/lower/{latest,$DATESTAMP}`
108 |
109 | Lowerdirs.
110 |
111 | - `/var/cache/chaotic/cc/{PACKAGETAG}`
112 |
113 | Per-package `~/.ccache`.
114 |
115 | - `/var/cache/chaotic/packages`
116 |
117 | Container-shared pacman's cache.
118 |
119 | - `/var/lib/chaotic/interfere`
120 |
121 | Cloned version of [interfere repository](https://github.com/chaotic-aur/interfere)
122 |
123 | # Dependencies
124 |
125 | `pacman -S --needed base-devel git arch-install-scripts repoctl fuse-overlayfs rsync python-telegram-send openssh`
126 |
127 | One needs an active mirror or a setting (in /etc/chaotic.conf) like this:
128 |
129 | ```sh
130 | export CAUR_URL='https://builds.garudalinux.org/repos/chaotic-aur/x86_64'
131 | export REPOCTL_CONFIG='/etc/chaotic/repoctl.conf'
132 | export CAUR_REPOCTL_DB_URL="${CAUR_URL}/chaotic-aur.db.tar.zst"
133 | export CAUR_REPOCTL_DB_FILE="/tmp/chaotic/db.tar.zst"
134 | ```
135 |
136 | To create a gpg key for the root user refer to this [ArchWiki article](https://wiki.archlinux.org/index.php/GnuPG#Create_a_key_pair) for more information. If you find problems when using "sudo", read the "[su](https://wiki.archlinux.org/index.php/GnuPG#su)" subsection.
137 | Then generate a ssh keypair for the root user.
138 |
139 | ```sh
140 | sudo ssh-keygen
141 | ```
142 |
143 | The ssh public key (cat /root/.ssh/id_rsa.pub) then needs to be added to the primary servers' root authorized keys (/root/.ssh/authorized_keys). After that follow these [instructions](https://wiki.archlinux.org/index.php/GnuPG#Export_your_public_key) to export the gpg public key. This key will have to be [uploaded](https://wiki.archlinux.org/index.php/GnuPG#Sending_keys) to [keyserver.ubuntu.com](keyserver.ubuntu.com) in order for the key to be verified.
144 | Then, configure it as follows in `/etc/chaotic.conf`, like this:
145 |
146 | ```sh
147 | export CAUR_DEPLOY_PKGS="/var/www/chaotic-aur/x86_64"
148 | export CAUR_URL="http://localhost:8080/chaotic-aur/x86_64"
149 | export CAUR_SIGN_KEY='8A9E14A07010F7E3'
150 | export CAUR_TYPE='cluster'
151 | export REPOCTL_CONFIG='/etc/chaotic/repoctl.toml'
152 | ```
153 |
154 | You'll find more options in `src/chaotic` first lines.
155 |
156 | Supported `type` values are `primary`, `cluster`, and `dev`.
157 |
158 | Furthermore, a valid `.gitconfig` needs to be supplied in `/root/.gitconfig` to allow bumping packages via `chaotic bump` with a meaningful `email` and `name` supplied:
159 |
160 | ```ini
161 | [user]
162 | email = "team@chaotic.cx"
163 | name = "Chaotic Dragon (Node) ☭"
164 | ```
165 |
166 | To allow pushing to the interfere repo, a fitting ssh key also needs to be added to authenticate the node.
167 |
168 | To have clean logs & less bandwidth usage `/etc/pacman.conf` settings need to be adjusted:
169 |
170 | - Enable `NoProgressBar`
171 |
172 | - Use `Server = file:///path-to-local-repo` as repo link if a local mirror is available
173 |
174 | - Don't use `ILoveCandy`
175 |
176 | To deploy faster replace `openssh` with `openssh-hpn` on all nodes (adds performance-related [patches](https://www.psc.edu/research/networking/hpn-ssh/)). It should be noted that `openssh-hpn` recently changed its configuration and behavior and therefore doesn't provide a 1:1 replacement for `openssh` anymore.
177 |
178 | ## Installation
179 |
180 | Install dependencies, then:
181 |
182 | ```
183 | sudo groupadd chaotic_op
184 | sudo usermod -aG chaotic_op $(whoami)
185 |
186 | make build && sudo make install
187 | ```
188 |
189 | ## Lint
190 |
191 | ```sh
192 | pacman -S --needed yarn shellcheck
193 | yarn install
194 | yarn run lint
195 | ```
196 |
--------------------------------------------------------------------------------
/guest/Singularity:
--------------------------------------------------------------------------------
1 | Bootstrap: docker
2 | From: docker.io/library/archlinux:base-devel
3 |
4 | %files
5 | etc/* /etc/
6 | bin/* /usr/local/bin/
7 |
8 | %post
9 | stee() { command tee "$@" >/dev/null; }
10 |
11 | cat /etc/makepkg.conf.append | tee -a /etc/makepkg.conf
12 | echo 'PACKAGER="UFSCar HPC Builder "' | tee -a /etc/makepkg.conf
13 | rm /etc/makepkg.conf.append
14 | echo 'Server = http://mirror.ufscar.br/archlinux/$repo/os/$arch' | stee /etc/pacman.d/mirrorlist
15 |
16 | stee -a '/etc/pacman.conf' </dev/null
18 | }
19 |
20 | merge_arch_attrs() {
21 | local attr supported_attrs=(
22 | provides conflicts depends replaces optdepends
23 | makedepends checkdepends)
24 |
25 | for attr in "${supported_attrs[@]}"; do
26 | eval "$attr+=(\"\${${attr}_${CARCH}[@]}\")"
27 | done
28 |
29 | # ensure that calling this function is idempotent.
30 | unset -v "${supported_attrs[@]/%/_${CARCH}}"
31 | }
32 |
33 | BUILDFILE=${BUILDFILE:-$BUILDSCRIPT}
34 | unset "${!makedepends_@}" "${!depends_@}" "${!checkdepends_@}"
35 | source_buildfile "$BUILDFILE"
36 |
37 | merge_arch_attrs
38 |
39 | printf '%s\n' "${depends[@]}" "${makedepends[@]}" "${checkdepends[@]}"
40 |
41 | trap - EXIT
42 |
--------------------------------------------------------------------------------
/guest/bin/x11-wrapper:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | xvfb-run -a -n 97 \
3 | -s '-extension GLX -screen 0 1280x1024x24' \
4 | "$@"
5 |
--------------------------------------------------------------------------------
/guest/etc/makepkg.conf.append:
--------------------------------------------------------------------------------
1 | BUILDENV=(!distcc !color !ccache check !sign)
2 | PKGDEST=/var/pkgdest
3 | SRCDEST=/home/main-builder/pkgsrc
4 | LOGDEST=/home/main-builder/makepkglogs
5 | JOBS=8
6 | MAKEFLAGS="-j$JOBS"
7 | export SCONSFLAGS="-j$JOBS"
8 | OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !debug lto)
9 |
--------------------------------------------------------------------------------
/guest/etc/pacman.conf:
--------------------------------------------------------------------------------
1 | #
2 | # /etc/pacman.conf
3 | #
4 | # See the pacman.conf(5) manpage for option and repository directives
5 |
6 | #
7 | # GENERAL OPTIONS
8 | #
9 | [options]
10 | # The following paths are commented out with their default values listed.
11 | # If you wish to use different paths, uncomment and update the paths.
12 | #RootDir = /
13 | #DBPath = /var/lib/pacman/
14 | #CacheDir = /var/cache/pacman/pkg/
15 | #LogFile = /var/log/pacman.log
16 | #GPGDir = /etc/pacman.d/gnupg/
17 | #HookDir = /etc/pacman.d/hooks/
18 | HoldPkg = pacman glibc
19 | ##XferCommand = /usr/bin/curl -L -C - -f -o %o %u
20 | #XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
21 | #CleanMethod = KeepInstalled
22 | Architecture = auto
23 |
24 | # Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
25 | #IgnorePkg =
26 | #IgnoreGroup =
27 |
28 | #NoUpgrade =
29 | #NoExtract =
30 |
31 | # Misc options
32 | #UseSyslog
33 | #Color
34 | #TotalDownload
35 | CheckSpace
36 | #VerbosePkgLists
37 | ParallelDownloads = 10
38 |
39 | # By default, pacman accepts packages signed by keys that its local keyring
40 | # trusts (see pacman-key and its man page), as well as unsigned packages.
41 | SigLevel = Required DatabaseOptional
42 | LocalFileSigLevel = Optional
43 | #RemoteFileSigLevel = Required
44 |
45 | # NOTE: You must run `pacman-key --init` before first using pacman; the local
46 | # keyring can then be populated with the keys of all official Arch Linux
47 | # packagers with `pacman-key --populate archlinux`.
48 |
49 | #
50 | # REPOSITORIES
51 | # - can be defined here or included from another file
52 | # - pacman will search repositories in the order defined here
53 | # - local/custom mirrors can be added here or in separate files
54 | # - repositories listed first will take precedence when packages
55 | # have identical names, regardless of version number
56 | # - URLs will have $repo replaced by the name of the current repo
57 | # - URLs will have $arch replaced by the name of the architecture
58 | #
59 | # Repository entries are of the format:
60 | # [repo-name]
61 | # Server = ServerName
62 | # Include = IncludePath
63 | #
64 | # The header [repo-name] is crucial - it must be present and
65 | # uncommented to enable the repo.
66 | #
67 |
68 | # The testing repositories are disabled by default. To enable, uncomment the
69 | # repo name header and Include lines. You can add preferred servers immediately
70 | # after the header, and they will be used before the default mirrors.
71 |
72 | #[core-testing]
73 | #Include = /etc/pacman.d/mirrorlist
74 |
75 | [core]
76 | Include = /etc/pacman.d/mirrorlist
77 |
78 | #[extra-testing]
79 | #Include = /etc/pacman.d/mirrorlist
80 |
81 | [extra]
82 | Include = /etc/pacman.d/mirrorlist
83 |
84 | # If you want to run 32 bit applications on your x86_64 system,
85 | # enable the multilib repositories as required here.
86 |
87 | #[multilib-testing]
88 | #Include = /etc/pacman.d/mirrorlist
89 |
90 | [multilib]
91 | Include = /etc/pacman.d/mirrorlist
92 |
93 | # An example of a custom package repository. See the pacman manpage for
94 | # tips on creating your own repositories.
95 | #[custom]
96 | #SigLevel = Optional TrustAll
97 | #Server = file:///home/custompkgs
98 |
--------------------------------------------------------------------------------
/install-hpc-cluster.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -xeuo pipefail
3 |
4 | mkdir -p "${HOME}/.chaotic"
5 | cat >"${HOME}/.chaotic/chaotic.conf" <<'EOF'
6 | #!/bin/bash
7 | CAUR_CLUSTER_NAME='ufscar-hpc'
8 | CAUR_INTERFERE="${HOME}/chaotic/interfere"
9 | CAUR_PACKAGE_LISTS="${HOME}/chaotic/packages"
10 |
11 | CAUR_ENGINE="singularity"
12 | CAUR_SCP_STREAMS=2
13 | CAUR_CACHE="/tmp/chaotic"
14 | CAUR_CACHE_CC="${CAUR_CACHE}/cc"
15 | CAUR_CACHE_PKG="${CAUR_CACHE}/packages"
16 | CAUR_CACHE_SRC="${CAUR_CACHE}/sources"
17 | CAUR_GUEST="${HOME}/chaotic/toolbox/guest"
18 | CAUR_LIB="${HOME}/chaotic/toolbox/src/lib"
19 | CAUR_LOWER_DIR="${HOME}/chaotic/cache/lower"
20 | CAUR_LOWER_PKGS=(base base-devel) # hardcoded in Singularity engine
21 | CAUR_SANDBOX='/tmp/chaotic/sandbox'
22 | CAUR_ROUTINES="${CAUR_CACHE}/routines"
23 | CAUR_SIGN_KEY='EF925EA60F33D0CB85C44AD13056513887B78AEB'
24 | CAUR_SIGN_USER='' # leave empty to run as current user
25 | CAUR_TYPE='cluster'
26 | CAUR_URL="https://builds.garudalinux.org/repos/${CAUR_DB_NAME}/x86_64" # hardcoded in Singularity engine
27 | CAUR_GPG_PATH="${HOME}/chaotic/toolbox/wrappers/gpg"
28 |
29 | CAUR_REPOCTL_DB_URL='https://builds.garudalinux.org/repos/chaotic-aur/x86_64/chaotic-aur.db.tar.zst'
30 | CAUR_REPOCTL_DB_FILE="${CAUR_CACHE}/chaotic-aur.db.tar.zst"
31 | CAUR_TELEGRAM_TAG='@thotypous'
32 | EOF
33 |
34 | mkdir -p "${HOME}/chaotic"
35 | for repo in toolbox interfere packages pkgrel_incrementer; do
36 | [[ -d "${HOME}/chaotic/${repo}" ]] || git clone "https://github.com/chaotic-aur/${repo}.git" "${HOME}/chaotic/${repo}"
37 | done
38 |
39 | pushd "${HOME}/chaotic/toolbox/pkgrel_incrementer"
40 | make
41 | popd
42 |
43 | pushd "${HOME}/chaotic/toolbox/src"
44 | ln -sf "./chaotic.sh" "./chaotic"
45 | popd
46 |
47 | FILE="${HOME}/.bashrc"
48 | # shellcheck disable=SC2016
49 | LINE='export PATH="$PATH:$HOME/chaotic/toolbox/src:$HOME/chaotic/toolbox/wrappers"'
50 | grep -qF -- "$LINE" "$FILE" || echo "$LINE" >>"$FILE"
51 |
52 | "${HOME}/chaotic/toolbox/wrappers/pacman" -Syu
53 |
54 | echo 'Now set up ~/.config/telegram*.conf and GnuPG key'
55 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "license": "AGPL-3.0",
3 | "devDependencies": {
4 | "prettier": "^2.6.2",
5 | "prettier-plugin-sh": "^0.6.1",
6 | "shellcheck": "^1.1.0"
7 | },
8 | "scripts": {
9 | "lint": "prettier --check . && shellcheck src/*.sh src/lib/*.sh guest/bin/* slurm-jobs/*/*.sh",
10 | "prettify": "prettier --write ."
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/services/chaotic-afternoon.service:
--------------------------------------------------------------------------------
1 | [Unit]
2 | Description=Chaotic's afternoon routine
3 | After=network-online.target
4 | Wants=network-online.target
5 |
6 | [Service]
7 | User=root
8 | Group=chaotic_op
9 | WorkingDirectory=/tmp
10 | ExecStart=/usr/local/bin/chaotic -j 4 routine afternoon
11 |
12 | TimeoutStopSec=21000
13 | TimeoutStopFailureMode=abort
14 | WatchdogSignal=SIGUSR1
15 | TimeoutAbortSec=600
16 |
17 | [Install]
18 | WantedBy=multi-user.target
19 |
--------------------------------------------------------------------------------
/services/chaotic-afternoon.timer:
--------------------------------------------------------------------------------
1 | [Unit]
2 | Description=Chaotic's afternoon routine
3 |
4 | [Timer]
5 | OnCalendar=*-*-* 12:20:00
6 | Persistent=false
7 |
8 | [Install]
9 | WantedBy=timers.target
10 |
--------------------------------------------------------------------------------
/services/chaotic-hourly.service:
--------------------------------------------------------------------------------
1 | [Unit]
2 | Description=Chaotic's hourly routine
3 | After=network-online.target
4 | Wants=network-online.target
5 |
6 | [Service]
7 | User=root
8 | Group=chaotic_op
9 | WorkingDirectory=/tmp
10 | ExecStart=/usr/local/bin/chaotic -j 0 routine hourly
11 |
12 | TimeoutStopSec=13800
13 | TimeoutStopFailureMode=abort
14 | WatchdogSignal=SIGUSR1
15 | TimeoutAbortSec=600
16 |
17 | [Install]
18 | WantedBy=multi-user.target
19 |
--------------------------------------------------------------------------------
/services/chaotic-hourly.timer:
--------------------------------------------------------------------------------
1 | [Unit]
2 | Description=Chaotic's hourly routine
3 |
4 | [Timer]
5 | OnCalendar=hourly
6 | Persistent=false
7 |
8 | [Install]
9 | WantedBy=timers.target
10 |
--------------------------------------------------------------------------------
/services/chaotic-midnight.service:
--------------------------------------------------------------------------------
1 | [Unit]
2 | Description=Chaotic's midnight routine
3 | After=network-online.target
4 | Wants=network-online.target
5 |
6 | [Service]
7 | User=root
8 | Group=chaotic_op
9 | WorkingDirectory=/tmp
10 | ExecStart=/usr/local/bin/chaotic routine midnight
11 |
12 | TimeoutStopSec=21000
13 | TimeoutStopFailureMode=abort
14 | WatchdogSignal=SIGUSR1
15 | TimeoutAbortSec=600
16 |
17 | [Install]
18 | WantedBy=multi-user.target
19 |
--------------------------------------------------------------------------------
/services/chaotic-midnight.timer:
--------------------------------------------------------------------------------
1 | [Unit]
2 | Description=Chaotic's midnight routine
3 |
4 | [Timer]
5 | OnCalendar=*-*-* 00:20:00
6 | Persistent=false
7 |
8 | [Install]
9 | WantedBy=timers.target
10 |
--------------------------------------------------------------------------------
/services/chaotic-morning.service:
--------------------------------------------------------------------------------
1 | [Unit]
2 | Description=Chaotic's morning routine
3 | After=network-online.target
4 | Wants=network-online.target
5 |
6 | [Service]
7 | User=root
8 | Group=chaotic_op
9 | WorkingDirectory=/tmp
10 | ExecStart=/usr/local/bin/chaotic routine morning
11 |
12 | TimeoutStopSec=21000
13 | TimeoutStopFailureMode=abort
14 | WatchdogSignal=SIGUSR1
15 | TimeoutAbortSec=600
16 |
17 | [Install]
18 | WantedBy=multi-user.target
19 |
--------------------------------------------------------------------------------
/services/chaotic-morning.timer:
--------------------------------------------------------------------------------
1 | [Unit]
2 | Description=Chaotic's morning routine
3 |
4 | [Timer]
5 | OnCalendar=*-*-* 6:20:00
6 | Persistent=false
7 |
8 | [Install]
9 | WantedBy=timers.target
10 |
--------------------------------------------------------------------------------
/services/chaotic-nightly.service:
--------------------------------------------------------------------------------
1 | [Unit]
2 | Description=Chaotic's nightly routine
3 | After=network-online.target
4 | Wants=network-online.target
5 |
6 | [Service]
7 | User=root
8 | Group=chaotic_op
9 | WorkingDirectory=/tmp
10 | ExecStart=/usr/local/bin/chaotic routine nightly
11 |
12 | TimeoutStopSec=21000
13 | TimeoutStopFailureMode=abort
14 | WatchdogSignal=SIGUSR1
15 | TimeoutAbortSec=600
16 |
17 | [Install]
18 | WantedBy=multi-user.target
19 |
--------------------------------------------------------------------------------
/services/chaotic-nightly.timer:
--------------------------------------------------------------------------------
1 | [Unit]
2 | Description=Chaotic's nightly routine
3 |
4 | [Timer]
5 | OnCalendar=*-*-* 19:20:00
6 | Persistent=false
7 |
8 | [Install]
9 | WantedBy=timers.target
10 |
--------------------------------------------------------------------------------
/services/chaotic-sort-logs.service:
--------------------------------------------------------------------------------
1 | [Unit]
2 | Description=Chaotic's automatic log sorting utility
3 | After=network-online.target
4 | Wants=network-online.target
5 |
6 | [Service]
7 | User=root
8 | Group=chaotic_op
9 | WorkingDirectory=/tmp
10 | ExecStart=/usr/local/bin/chaotic sort-logs
11 |
12 | [Install]
13 | WantedBy=multi-user.target
14 |
--------------------------------------------------------------------------------
/services/chaotic-sort-logs.timer:
--------------------------------------------------------------------------------
1 | [Unit]
2 | Description=Chaotic's automatic log sorting utility
3 |
4 | [Timer]
5 | OnCalendar=hourly
6 | Persistent=false
7 |
8 | [Install]
9 | WantedBy=timers.target
10 |
--------------------------------------------------------------------------------
/services/chaotic-tkg-kernels.service:
--------------------------------------------------------------------------------
1 | [Unit]
2 | Description=Chaotic+TkG's kernels routine
3 | After=network-online.target
4 | Wants=network-online.target
5 |
6 | [Service]
7 | User=root
8 | Group=chaotic_op
9 | WorkingDirectory=/tmp
10 | ExecStart=/usr/local/bin/chaotic routine tkg-kernels
11 |
12 | TimeoutStopSec=85800
13 | TimeoutStopFailureMode=abort
14 | WatchdogSignal=SIGUSR1
15 | TimeoutAbortSec=600
16 |
17 | [Install]
18 | WantedBy=multi-user.target
19 |
--------------------------------------------------------------------------------
/services/chaotic-tkg-kernels.timer:
--------------------------------------------------------------------------------
1 | [Unit]
2 | Description=Chaotic+TkG's kernels routine
3 |
4 | [Timer]
5 | OnCalendar=*-*-* 10:20:00
6 | Persistent=false
7 |
8 | [Install]
9 | WantedBy=timers.target
10 |
--------------------------------------------------------------------------------
/services/chaotic-tkg-wine.service:
--------------------------------------------------------------------------------
1 | [Unit]
2 | Description=Chaotic+TkG's wine routine
3 | After=network-online.target
4 | Wants=network-online.target
5 |
6 | [Service]
7 | User=root
8 | Group=chaotic_op
9 | WorkingDirectory=/tmp
10 | ExecStart=/usr/local/bin/chaotic routine tkg-wine
11 |
12 | TimeoutStopSec=21000
13 | TimeoutStopFailureMode=abort
14 | WatchdogSignal=SIGUSR1
15 | TimeoutAbortSec=600
16 |
17 | [Install]
18 | WantedBy=multi-user.target
19 |
--------------------------------------------------------------------------------
/services/chaotic-tkg-wine.timer:
--------------------------------------------------------------------------------
1 | [Unit]
2 | Description=Chaotic+TkG's wine routine
3 |
4 | [Timer]
5 | OnCalendar=*-*-* 15:20:00
6 | Persistent=false
7 |
8 | [Install]
9 | WantedBy=timers.target
10 |
--------------------------------------------------------------------------------
/slurm-jobs/ufscar-hpc/common.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | function _requeue() {
4 | local now timespec
5 | now="$(date '+%s')"
6 | timespec="$(date --date="@$(((now / JOB_PERIOD + 1) * JOB_PERIOD + JOB_OFFSET))" '+%Y-%m-%dT%H:%M:%S')"
7 |
8 | echo "$(date): requeing job $SLURM_JOB_ID ($SLURM_JOB_NAME) to run at $timespec"
9 |
10 | scontrol requeue "$SLURM_JOB_ID"
11 | scontrol update JobId="$SLURM_JOB_ID" StartTime="$timespec"
12 | }
13 |
14 | function _near_timeout() {
15 | if [[ -n "$CHILD_PID" ]]; then
16 | echo "$(date): notifying child $CHILD_PID about timeout"
17 | kill -SIGUSR1 "$CHILD_PID" || true
18 | sleep 5
19 | fi
20 | _requeue
21 | }
22 |
23 | function sane-wait() {
24 | # https://stackoverflow.com/a/35755784/13649511
25 | local status=0
26 | while :; do
27 | wait "$@" || local status="$?"
28 | if [[ "$status" -lt 128 ]]; then
29 | return "$status"
30 | fi
31 | done
32 | }
33 |
34 | trap '_near_timeout' SIGUSR1 # job needs to specify --signal=B:SIGUSR1@90
35 | trap '_requeue' EXIT HUP INT TERM ERR # handle requeue on other conditions
36 |
37 | echo "$(date): job $SLURM_JOB_ID ($SLURM_JOB_NAME) starting on $SLURM_NODELIST"
38 |
39 | chaotic routine "$SLURM_JOB_NAME" &
40 | CHILD_PID="$!"
41 |
42 | echo "$(date): child running with pid $CHILD_PID"
43 | sane-wait "$CHILD_PID"
44 |
--------------------------------------------------------------------------------
/slurm-jobs/ufscar-hpc/daily.1.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #SBATCH --job-name=daily.1
3 | #SBATCH --mincpus 40
4 | #SBATCH --exclusive
5 | #SBATCH --mem 0
6 | #SBATCH --partition fast
7 | #SBATCH --nodes 1
8 | #SBATCH --dependency=singleton
9 | #SBATCH --time=04:50:00
10 | #SBATCH --signal=B:SIGUSR1@90
11 |
12 | # shellcheck disable=SC2034
13 | JOB_PERIOD=$((24 * 3600))
14 | # shellcheck disable=SC2034
15 | JOB_OFFSET=$((10 * 3600))
16 |
17 | export CAUR_PARALLEL=2
18 |
19 | # shellcheck source=/dev/null
20 | source common.sh
21 |
--------------------------------------------------------------------------------
/slurm-jobs/ufscar-hpc/hourly.1.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #SBATCH --job-name=hourly.1
3 | #SBATCH --mincpus 40
4 | #SBATCH --exclusive
5 | #SBATCH --mem 0
6 | #SBATCH --partition fast
7 | #SBATCH --nodes 1
8 | #SBATCH --dependency=singleton
9 | #SBATCH --time=02:20:00
10 | #SBATCH --signal=B:SIGUSR1@90
11 |
12 | # shellcheck disable=SC2034
13 | JOB_PERIOD=3600
14 | # shellcheck disable=SC2034
15 | JOB_OFFSET=0
16 |
17 | export CAUR_PARALLEL=10
18 |
19 | # shellcheck source=/dev/null
20 | source common.sh
21 |
--------------------------------------------------------------------------------
/slurm-jobs/ufscar-hpc/hourly.2.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #SBATCH --job-name=hourly.2
3 | #SBATCH --mincpus 40
4 | #SBATCH --exclusive
5 | #SBATCH --mem 0
6 | #SBATCH --partition fast
7 | #SBATCH --nodes 1
8 | #SBATCH --dependency=singleton
9 | #SBATCH --time=02:20:00
10 | #SBATCH --signal=B:SIGUSR1@90
11 |
12 | # shellcheck disable=SC2034
13 | JOB_PERIOD=3600
14 | # shellcheck disable=SC2034
15 | JOB_OFFSET=0
16 |
17 | export CAUR_PARALLEL=10
18 |
19 | # shellcheck source=/dev/null
20 | source common.sh
21 |
--------------------------------------------------------------------------------
/src/chaotic.c:
--------------------------------------------------------------------------------
1 | #define _GNU_SOURCE
2 | #include
3 | #include
4 | #include
5 | #include
6 |
7 | #define ME_ENV "CAUR_REAL_USER"
8 | #define UID_ENV "CAUR_REAL_UID"
9 |
10 | int main(int argc, char *argv[]) {
11 | char **envp=NULL, *me, *meEnv, euidEnv[sizeof(ME_ENV) + 12];
12 |
13 | me = getenv("USER");
14 | if (me) {
15 | meEnv = (char*)malloc(sizeof(ME_ENV) + 1 + strlen(me));
16 | sprintf(meEnv, ME_ENV"=%s", me);
17 | sprintf(euidEnv, UID_ENV"=%u", getuid());
18 | envp = malloc(3 * sizeof(char*));
19 | memcpy(envp, (char*[]){meEnv, euidEnv, NULL}, sizeof envp);
20 | }
21 |
22 | setuid(0);
23 | execvpe(PREFIX "/bin/chaotic.sh",
24 | argv,
25 | envp);
26 | }
27 |
--------------------------------------------------------------------------------
/src/chaotic.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # shellcheck disable=SC2034,SC2164
3 |
4 | pushd() { command pushd "$@" >/dev/null; }
5 | popd() { command popd >/dev/null; }
6 | stee() { command tee "$@" >/dev/null; }
7 |
8 | pushd "$(dirname "$0")/.." || exit 2
9 | CAUR_PREFIX="$(pwd -P)"
10 | [[ -z "${HOME:-}" ]] && HOME="$(getent passwd "$(whoami)" | cut -d: -f6)"
11 | export HOME
12 | CAUR_MAINTAINER="${CAUR_REAL_USER:-${CAUR_REAL_UID:-${USER:-$UID}}}"
13 | popd || exit 2
14 |
15 | CAUR_CACHE='/var/cache/chaotic'
16 | CAUR_CLUSTER_NAME=''
17 | CAUR_DB_NAME='chaotic-aur'
18 | CAUR_INTERFERE='/var/lib/chaotic/interfere'
19 | CAUR_PACKAGE_LISTS='/var/lib/chaotic/packages'
20 |
21 | CAUR_ARCH_MIRROR="Server = https://cloudflaremirrors.com/archlinux/\$repo/os/\$arch\nServer = https://mirror.rackspace.com/archlinux/\$repo/os/\$arch"
22 | CAUR_BASH_WIZARD='wizard.sh'
23 | CAUR_CACHE_CC="${CAUR_CACHE}/cc"
24 | CAUR_CACHE_PKG="${CAUR_CACHE}/packages"
25 | CAUR_CACHE_SRC="${CAUR_CACHE}/sources"
26 | CAUR_CLEAN_ONLY_DEPLOYED=0
27 | CAUR_DB_EXT='tar.zst'
28 | CAUR_DB_LOCK="${CAUR_CACHE}/db.lock"
29 | CAUR_CHECKPOINT="${CAUR_CACHE}/checkpoint"
30 | CAUR_DEPLOY_HOST='builds.garudalinux.org'
31 | CAUR_DEPLOY_PKGS="/srv/http/repos/${CAUR_DB_NAME}/x86_64"
32 | CAUR_DEPLOY_LOGS="/srv/http/repos/${CAUR_DB_NAME}/logs"
33 | CAUR_DEPLOY_LOGS_FILTERED="$CAUR_DEPLOY_LOGS/filtered"
34 | CAUR_DEPLOY_LAST="/srv/http/repos/${CAUR_DB_NAME}/lastupdate"
35 | CAUR_USERNS_EXEC_CMD="podman unshare"
36 | CAUR_ENGINE="systemd-nspawn"
37 | CAUR_FILL_DEST='https://builds.garudalinux.org/repos/chaotic-aur/pkgs.files.txt'
38 | CAUR_GPG_PATH="/usr/bin/gpg"
39 | CAUR_LIB="${CAUR_PREFIX}/lib/chaotic"
40 | CAUR_GUEST="${CAUR_LIB}/guest"
41 | CAUR_LOWER_DIR="${CAUR_CACHE}/lower"
42 | CAUR_LOWER_PKGS=(base base-devel)
43 | CAUR_MAKEPKG_EXTRA_APPEND_FILE=""
44 | CAUR_OVERLAY_TYPE='kernel'
45 | CAUR_TEMP='/tmp/chaotic'
46 | CAUR_ROUTINES="${CAUR_TEMP}/routines"
47 | CAUR_SANDBOX='' # singularity only
48 | CAUR_SIGN_KEY=''
49 | CAUR_SIGN_USER='root' # who owns the key in gnupg's keyring.
50 | CAUR_PACKAGER='Chaotic-AUR Team '
51 | CAUR_SILENT=0
52 | CAUR_TELEGRAM="$HOME/.config/telegram-send-group.conf"
53 | CAUR_TELEGRAM_LOG="$HOME/.config/telegram-send-log.conf"
54 | CAUR_TYPE='primary' # only the primary cluster manages the database.
55 | CAUR_URL="http://localhost/${CAUR_DB_NAME}/x86_64"
56 | CAUR_TELEGRAM_TAG="@pedrohlc"
57 | CAUR_STAMPROUTINES=0
58 | CAUR_REPOCTL_DB_URL='' # only required when not hosting a local mirror
59 | CAUR_REPOCTL_DB_FILE='' # only required when not hosting a local mirror
60 |
61 | # shellcheck source=/dev/null
62 | [[ -f '/etc/chaotic.conf' ]] && source '/etc/chaotic.conf'
63 |
64 | # shellcheck source=/dev/null
65 | [[ -f "$HOME/.chaotic/chaotic.conf" ]] && source "$HOME/.chaotic/chaotic.conf"
66 |
67 | [[ -z "${CAUR_DEPLOY_LABEL:-}" ]] && CAUR_DEPLOY_LABEL="${CAUR_CLUSTER_NAME:-Unknown Machine}"
68 |
69 | if [ "$EUID" -ne 0 ] && [ "$CAUR_ENGINE" != "singularity" ]; then
70 | echo 'This script must be run as root.'
71 | exit 255
72 | fi
73 |
74 | if [[ -n "${XDG_RUNTIME_DIR:-}" ]] && [[ ! -e "${XDG_RUNTIME_DIR:-}" ]]; then
75 | # avoid error if $XDG_RUNTIME_DIR does not exist
76 | unset XDG_RUNTIME_DIR
77 | fi
78 |
79 | shopt -s extglob
80 | for _LIB in "${CAUR_LIB}"/*.sh; do
81 | # shellcheck source=/dev/null
82 | source "${_LIB}"
83 | done
84 |
85 | function main() {
86 | set -euo pipefail
87 |
88 | local _CMD
89 |
90 | _CMD="${1:-}"
91 | # Note: there is usage of "${@:2}" below.
92 |
93 | case "${_CMD}" in
94 | '--jobs' | '-j')
95 | optional-parallel "${2:-}"
96 | main "${@:3}"
97 | ;;
98 | '--only-nuke-deployed' | '-D')
99 | optional-nuke-only-deployed
100 | main "${@:2}"
101 | ;;
102 | '--silent' | '-s')
103 | CAUR_SILENT=1
104 | export CAUR_SILENT
105 | main "${@:2}"
106 | ;;
107 | 'prepare' | 'pr')
108 | prepare "${@:2}"
109 | ;;
110 | 'lowerstrap' | 'lw')
111 | lowerstrap "${@:2}"
112 | ;;
113 | 'makepkg' | 'mk')
114 | makepkg "${@:2}"
115 | ;;
116 | 'makepwd' | 'mkd')
117 | makepwd "${@:2}"
118 | ;;
119 | 'interfere-sync' | 'si')
120 | interfere-sync "${@:2}"
121 | ;;
122 | 'interfere-bump' | 'bump')
123 | interference-bump "${@:2}"
124 | ;;
125 | 'package-lists-sync' | 'sp')
126 | package-lists-sync "${@:2}"
127 | ;;
128 | 'repoctl-sync-db' | 'sd')
129 | repoctl-sync-db
130 | ;;
131 | 'clean-duplicates' | 'dedup')
132 | clean-duplicates "${@:2}"
133 | ;;
134 | 'clean-pkgcache' | 'clp')
135 | clean-pkgcache "${@:2}"
136 | ;;
137 | 'clean-sigs')
138 | clean-sigs "${@:2}"
139 | ;;
140 | 'deploy' | 'dp')
141 | deploy "${@:2}"
142 | ;;
143 | 'db-add' | 'dba')
144 | db-add "${@:2}"
145 | ;;
146 | 'db-bump' | 'dbb')
147 | db-bump "${@:2}"
148 | ;;
149 | 'db-rebuild')
150 | db-rebuild "${@:2}"
151 | ;;
152 | 'remove' | 'rm')
153 | remove "${@:2}"
154 | ;;
155 | 'aur-download' | 'get')
156 | aur-download "${@:2}"
157 | ;;
158 | 'cleanup' | 'cl')
159 | for f in "${@:2}"; do cleanup "$f"; done
160 | ;;
161 | 'cleanpwd' | 'cld')
162 | cleanpwd "${@:2}"
163 | ;;
164 | 'help' | '?')
165 | help-mirror "${@:2}"
166 | ;;
167 | 'routine')
168 | for f in "${@:2}"; do routine "$f"; done
169 | ;;
170 | 'clean-logs' | 'clg')
171 | clean-logs "${@:2}"
172 | ;;
173 | 'clean-srccache' | 'cls')
174 | clean-srccache "${@:2}"
175 | ;;
176 | 'reset-fakeroot-chown' | 'rfc')
177 | for f in "${@:2}"; do reset-fakeroot-chown "$f"; done
178 | ;;
179 | 'send-group' | 'ag')
180 | send-group "${@:2}"
181 | ;;
182 | 'send-log' | 'al')
183 | send-log "${@:2}"
184 | ;;
185 | 'sort-logs' | 'srt')
186 | sort-logs "${@:2}"
187 | ;;
188 | 'find-discarded')
189 | find-discarded "${@:2}"
190 | ;;
191 | 'whoami')
192 | echo "#$UID or ${USER:-$(whoami)}, identified as ${CAUR_MAINTAINER} at \"$CAUR_DEPLOY_LABEL\"."
193 | ;;
194 | *)
195 | echo 'Wrong usage, check https://github.com/chaotic-aur/toolbox/blob/main/README.md for details on how to use.'
196 | return 254
197 | ;;
198 | esac
199 | }
200 |
201 | main "$@"
202 |
--------------------------------------------------------------------------------
/src/lib/aur.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | function aur-download() {
4 | set -euo pipefail
5 |
6 | local _LIST _PACKAGES _PKGBASE _REPOCTL _GIT _OUT
7 | _REPOCTL=()
8 | declare -A _GIT
9 | _PACKAGES="$(find "${CAUR_PACKAGE_LISTS}" -name '*.txt' | while read -r _LIST; do parse-package-list "$_LIST"; done)"
10 | for _PKGBASE in "$@"; do
11 | _OUT="$(awk -F ':' -v pkgbase="${_PKGBASE}" '$1==pkgbase { OFS = FS; $1=""; print substr($0, 2); exit }' <<<"$_PACKAGES")"
12 | if [[ -z "${_OUT}" ]]; then
13 | _REPOCTL+=("${_PKGBASE}")
14 | else
15 | _GIT["${_PKGBASE}"]="${_OUT}"
16 | fi
17 | done
18 |
19 | if [ ${#_REPOCTL[@]} -ne 0 ]; then
20 | repoctl down "${_REPOCTL[@]}"
21 | fi
22 | for _PKGBASE in "${!_GIT[@]}"; do
23 | git clone --depth 1 "${_GIT[${_PKGBASE}]}" "${_PKGBASE}"
24 | done
25 | }
26 |
--------------------------------------------------------------------------------
/src/lib/base-make.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | function lowerstrap() {
4 | set -euo pipefail
5 |
6 | local _LOCK_FN _LOCK_FD
7 |
8 | [[ ! -e "$CAUR_LOWER_DIR" ]] && install -o"$(whoami)" -dDm755 "$CAUR_LOWER_DIR"
9 |
10 | _LOCK_FN="${CAUR_LOWER_DIR}/lock"
11 | touch "${_LOCK_FN}"
12 | exec {_LOCK_FD}<>"${_LOCK_FN}" # Lock
13 |
14 | if ! flock -x -n "$_LOCK_FD"; then
15 | echo 'Someone is already building a lowerdir, waiting...'
16 | flock -x "$_LOCK_FD" -c true
17 | echo 'Finished'
18 | exec {_LOCK_FD}>&- # Unlock
19 | return 0
20 | fi
21 |
22 | if [[ "${CAUR_ENGINE}" = "systemd-nspawn" ]]; then
23 | lowerstrap-systemd-nspawn "$@"
24 | elif [[ "${CAUR_ENGINE}" = "singularity" ]]; then
25 | lowerstrap-singularity "$@"
26 | else
27 | echo "Unsupported engine '${CAUR_ENGINE}'"
28 | exec {_LOCK_FD}>&- # Unlock
29 | return 26
30 | fi
31 |
32 | exec {_LOCK_FD}>&- # Unlock
33 | return 0
34 | }
35 |
36 | function lowerstrap-systemd-nspawn() {
37 | set -euo pipefail
38 |
39 | echo 'Building a systemd-nspawn lowerdir'
40 |
41 | local _CURRENT
42 |
43 | install -o"$(whoami)" -dDm755 "$CAUR_LOWER_DIR"
44 | pushd "$CAUR_LOWER_DIR"
45 |
46 | _CURRENT="$(date +%Y%m%d%H%M%S)"
47 |
48 | install -o"$(whoami)" -dm755 "$_CURRENT"
49 | pacstrap -c "./$_CURRENT" "${CAUR_LOWER_PKGS[@]}"
50 | pushd "$_CURRENT"
51 |
52 | install -dm755 './usr/local/bin'
53 | install -m644 "$CAUR_GUEST"/etc/pacman.conf './etc/pacman.conf'
54 | tee -a './etc/makepkg.conf' <"${CAUR_GUEST}/etc/makepkg.conf.append"
55 | if [[ -n "$CAUR_ARCH_MIRROR" ]]; then
56 | echo -e "$CAUR_ARCH_MIRROR" | stee './etc/pacman.d/mirrorlist'
57 | fi
58 | if [[ -n "$CAUR_MAKEPKG_EXTRA_APPEND_FILE" ]]; then
59 | stee -a './etc/makepkg.conf' <"$CAUR_MAKEPKG_EXTRA_APPEND_FILE"
60 | fi
61 | echo "PACKAGER=\"${CAUR_PACKAGER}\"" | tee -a './etc/makepkg.conf'
62 | install -m755 "$CAUR_GUEST"/bin/* './usr/local/bin/'
63 |
64 | stee -a './etc/pacman.conf' <"${_LOCK_FN}" # Lock
21 |
22 | if ! flock -x -n "$_LOCK_FD"; then
23 | if [[ -e "${_INPUTDIR}/building.pid" ]]; then
24 | echo "Package is still building in PID: $(cat "${_INPUTDIR}/building.pid")."
25 | else
26 | echo 'Package is still in use by another chaotic script.'
27 | fi
28 |
29 | return 11
30 | fi
31 |
32 | pushd "${_INPUTDIR}"
33 |
34 | if [[ ! -e 'PKGTAG' ]] && [[ ! -e 'PKGBUILD' ]]; then
35 | echo 'Invalid package directory.'
36 | popd # _INPUTDIR
37 | exec {_LOCK_FD}>&- # Unlock
38 | return 12
39 | fi
40 |
41 | if [[ -d 'machine/root' ]]; then
42 | if ! (umount -Rv 'machine/root' || rmdir 'machine/root'); then
43 | echo 'Package rootfs is still busy.'
44 | popd # _INPUTDIR
45 | exec {_LOCK_FD}>&- # Unlock
46 | return 11
47 | fi
48 | fi
49 |
50 | if [[ "$CAUR_CLEAN_ONLY_DEPLOYED" == '1' ]] \
51 | && { [[ ! -f 'building.result' ]] \
52 | || [[ "$(cat building.result)" != 'deployed' ]]; }; then
53 | popd # _INPUTDIR
54 | exec {_LOCK_FD}>&- # Unlock
55 | return 0
56 | fi
57 |
58 | popd # _INPUTDIR
59 |
60 | echo "Cleaning \"${1:-}\"..."
61 | rm-as-root "${_INPUTDIR}"
62 |
63 | exec {_LOCK_FD}>&- # Unlock
64 |
65 | return 0
66 | }
67 |
68 | function clean-srccache() {
69 | set -euo pipefail
70 |
71 | local _PKG_CACHE_DIR
72 |
73 | if [[ -z "${1:-}" ]]; then
74 | echo 'Invalid parameters'
75 | return 34
76 | fi
77 |
78 | _PKG_CACHE_DIR="${CAUR_CACHE_SRC}/${1}"
79 |
80 | if [[ ! -d "$_PKG_CACHE_DIR" ]]; then
81 | echo 'Invalid parameters or non-exiting cache directory.'
82 | echo "$_PKG_CACHE_DIR"
83 | return 0
84 | fi
85 |
86 | _PKG_CACHE_DIR="$(
87 | cd "${_PKG_CACHE_DIR}"
88 | pwd -P
89 | )"
90 |
91 | if [[ "$_PKG_CACHE_DIR" != "$CAUR_CACHE_SRC/"* ]]; then
92 | echo 'Stop trying to destroy my machine!'
93 | return 35
94 | fi
95 |
96 | for entry in "$_PKG_CACHE_DIR"/*; do
97 | if [[ ! -e "$entry" ]]; then
98 | echo 'Empty cache directory.'
99 | return 0
100 | fi
101 | rm -vrf --one-file-system "$entry"
102 | done
103 |
104 | return 0
105 | }
106 |
107 | function clean-duplicates() {
108 | set -euo pipefail
109 |
110 | if [[ "$CAUR_TYPE" != 'primary' ]]; then
111 | echo 'Only primary node needs to de-dup.'
112 | return 0
113 | fi
114 |
115 | if [[ ! -d "$CAUR_DEPLOY_PKGS" ]]; then
116 | echo 'Deploying directory not found.'
117 | return 0
118 | fi
119 |
120 | pushd "${CAUR_DEPLOY_PKGS}"
121 |
122 | local _DUPLICATED _TO_MV _U_SURE
123 |
124 | _DUPLICATED=$(
125 | # shellcheck disable=SC2010
126 | ls \
127 | | grep -Po "^(.*)(?=(?:(?:-[^-]*){3}\.pkg\.tar(?>\.xz|\.zst)?)\.sig$)" \
128 | | uniq -d
129 | )
130 |
131 | if [[ -z "${_DUPLICATED}" ]]; then
132 | echo "No duplicate packages were found!"
133 | else
134 | _TO_MV=$(
135 | echo "${_DUPLICATED[@]}" \
136 | | awk '{print "find -name \""$1"*\" -printf \"%T@ %p\\n\" | sort -n | grep -Po \"\\.\\/"$1"(((-[^-]*){3}\\.pkg\\.tar(?>\\.xz|\\.zst)?))\\.sig$\" | head -n -1;"}' \
137 | | sed 's/\+/\\+/g' \
138 | | bash \
139 | | awk '{sub(/\.sig$/,"");print $1"\n"$1".sig"}'
140 | )
141 |
142 | echo "[!] Moving:"
143 | echo "${_TO_MV[*]}"
144 |
145 | echo "[!] Total: $(echo -n "${_TO_MV[*]}" | wc -l)"
146 | if [[ "${1:-}" == '-q' ]]; then
147 | _U_SURE='Y'
148 | else
149 | read -r -p "[?] Are you sure? [y/N] " _U_SURE
150 | fi
151 |
152 | case "${_U_SURE}" in
153 | [yY])
154 | # shellcheck disable=SC2086
155 | echo "${_TO_MV[@]}" | xargs mv -v -f -t ../archive/
156 | # Make sure we don't instantly delete them from archive if the package is too old
157 | echo "${_TO_MV[@]}" | xargs touch --no-create
158 | ;;
159 | esac
160 | fi
161 |
162 | popd # CAUR_DEPLOY_PKGS
163 |
164 | return 0
165 | }
166 |
167 | function clean-pkgcache() {
168 | set -euo pipefail
169 |
170 | if [[ ! -d "$CAUR_CACHE_PKG" ]]; then
171 | echo 'Non-exiting cache directory'
172 | return 0
173 | fi
174 |
175 | pushd "${CAUR_CACHE_PKG}"
176 |
177 | local _DUPLICATED _TO_MV _U_SURE
178 |
179 | _DUPLICATED=$(
180 | # shellcheck disable=SC2010
181 | ls \
182 | | grep -Po "^(.*)(?=(?:(?:-[^-]*){3}\.pkg\.tar(?>\.xz|\.zst)?)$)" \
183 | | uniq -d
184 | )
185 |
186 | if [[ -z "${_DUPLICATED}" ]]; then
187 | echo "No duplicate packages were found!"
188 | else
189 | _TO_MV=$(
190 | echo "${_DUPLICATED[@]}" \
191 | | awk '{print "find -name \""$1"*\" -printf \"%T@ %p\\n\" | sort -n | grep -Po \"\\.\\/"$1"(((-[^-]*){3}\\.pkg\\.tar(?>\\.xz|\\.zst)?))$\" | head -n -1;"}' \
192 | | bash \
193 | | awk '{print $1"\n"$1".sig"}'
194 | )
195 |
196 | echo "[!] Deleting:"
197 | echo "${_TO_MV[*]}"
198 |
199 | echo "[!] Total: $(echo -n "${_TO_MV[*]}" | wc -l)"
200 | if [[ "${1:-}" == '-q' ]]; then
201 | _U_SURE='Y'
202 | else
203 | read -r -p "[?] Are you sure? [y/N] " _U_SURE
204 | fi
205 |
206 | case "${_U_SURE}" in
207 | [yY])
208 | # shellcheck disable=SC2086
209 | echo "${_TO_MV[@]}" | xargs rm -vf
210 | ;;
211 | esac
212 | fi
213 |
214 | popd # CAUR_CACHE_PKG
215 |
216 | return 0
217 | }
218 |
219 | function clean-archive() {
220 | set -euo pipefail
221 |
222 | [[ "$CAUR_TYPE" != 'primary' ]] && return 0
223 |
224 | # Let's save time!
225 | (clean-duplicates -q) || true
226 |
227 | if [[ ! -d "${CAUR_DEPLOY_PKGS}/../archive" ]]; then
228 | echo 'Non-exiting archive directory'
229 | return 0
230 | fi
231 |
232 | pushd "${CAUR_DEPLOY_PKGS}/../archive"
233 |
234 | find . -type f -mtime +7 -name '*' -execdir rm -- '{}' \; || true
235 |
236 | popd
237 | return 0
238 | }
239 |
240 | function clean-sigs() {
241 | set -euo pipefail
242 |
243 | [[ "$CAUR_TYPE" != 'primary' ]] && return 0
244 |
245 | local _TO_MV=()
246 |
247 | pushd "${CAUR_DEPLOY_PKGS}"
248 |
249 | readarray -d '' _TO_MV < <(find . -name "*.pkg.${CAUR_DB_EXT}" -mmin +59 -exec sh -c '[[ ! -f "${1}.sig" ]]' -- "{}" \; -print0)
250 | readarray -d '' -O "${#_TO_MV[@]}" _TO_MV < <(find . -name "*.pkg.${CAUR_DB_EXT}.sig" -mmin +59 -exec sh -c '[[ ! -f "${1%.*}" ]]' -- "{}" \; -print0)
251 |
252 | if [[ -z "${_TO_MV:-}" ]]; then
253 | if [[ "${1:-}" != '-q' ]]; then
254 | echo '[!] Nothing to do...'
255 | fi
256 | exit 0
257 | fi
258 |
259 | echo '[!] Missing sig or archive:'
260 | printf '%s\n' "${_TO_MV[@]}"
261 |
262 | echo "[!] Total: ${#_TO_MV[@]}"
263 | if [[ "${1:-}" == '-q' ]]; then
264 | _U_SURE='Y'
265 | else
266 | read -r -p "[?] Are you sure? [y/N] " _U_SURE
267 | fi
268 |
269 | case "${_U_SURE}" in
270 | [yY])
271 | # shellcheck disable=SC2086
272 | echo "${_TO_MV[@]}" | xargs mv -v -f -t ../archive/
273 | # Make sure we don't instantly delete them from archive if the package is too old
274 | echo "${_TO_MV[@]}" | xargs touch --no-create
275 | ;;
276 | esac
277 |
278 | popd
279 |
280 | return 0
281 | }
282 |
283 | function clean-post-routine() {
284 | set -euo pipefail
285 |
286 | [[ "$CAUR_TYPE" != 'primary' ]] && return 0
287 |
288 | (clean-archive -q) || true
289 | (clean-sigs -q) || true
290 |
291 | return 0
292 | }
293 |
--------------------------------------------------------------------------------
/src/lib/database.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | function db-add() {
4 | set -euo pipefail
5 |
6 | if [ ${#@} -lt 1 ]; then
7 | echo 'Invalid db-add parameters'
8 | return 23
9 | fi
10 |
11 | if [[ "$CAUR_TYPE" != 'primary' ]]; then
12 | echo 'Only primary node can do this action.'
13 | return 19
14 | fi
15 |
16 | # Lock bump operations
17 | db-lock
18 |
19 | # Add them all
20 | if repo-add "${CAUR_DB_NAME}.db.${CAUR_DB_EXT}" "$@"; then
21 | (db-pkglist) || true # we want to unlock even if it fails
22 | else
23 | db-unlock
24 | return 20
25 | fi
26 |
27 | db-unlock
28 | return 0
29 | }
30 |
31 | function db-bump() {
32 | set -euo pipefail
33 |
34 | local _RUN_TIME _NEW_SIGS _DB_FILE
35 |
36 | _DB_FILE="${CAUR_DB_NAME}.db.${CAUR_DB_EXT}"
37 |
38 | if [[ "$CAUR_TYPE" == 'cluster' ]]; then
39 | # shellcheck disable=SC2029
40 | ssh "$CAUR_DEPLOY_HOST" 'chaotic db-bump'
41 |
42 | return 0
43 | fi
44 |
45 | # Lock bump operations
46 | db-lock
47 |
48 | pushd "$CAUR_DEPLOY_PKGS"
49 |
50 | {
51 | if [[ "${CAUR_DATABASE_BUMPER:-}" == 'repoctl' ]]; then
52 | repoctl update -r \
53 | && db-last-bump && db-pkglist
54 |
55 | else
56 | if [[ ! -f "$CAUR_CHECKPOINT" ]]; then
57 | touch -d "$(date -R -r "$_DB_FILE")" "$CAUR_CHECKPOINT"
58 | fi
59 | _RUN_TIME="$(date -R)"
60 |
61 | _NEW_SIGS="$(find ./*.sig -newer "$CAUR_CHECKPOINT")" || true
62 |
63 | if [[ -n "${_NEW_SIGS:-}" ]]; then
64 | echo "$_NEW_SIGS" \
65 | | grep -Po '.*(?:-(?:[^-]*)){3}\.pkg\.tar(?:\.xz|\.zst)?(?=\.sig)' \
66 | | xargs repo-add "$_DB_FILE" \
67 | && db-last-bump && db-pkglist && touch -d "$_RUN_TIME" "$CAUR_CHECKPOINT"
68 | fi
69 | fi
70 | } || true
71 |
72 | popd # CAUR_DEPLOY_PKGS
73 |
74 | db-unlock
75 | return 0
76 | }
77 |
78 | function db-last-bump() {
79 | set -euo pipefail
80 |
81 | date +'%s' >"${CAUR_DEPLOY_LAST}"
82 | echo 'Checkpoints updated'
83 |
84 | return 0
85 | }
86 |
87 | function db-pkglist() {
88 | set -euo pipefail
89 |
90 | pushd "${CAUR_DEPLOY_PKGS}"
91 | if (tar -tv --zstd \
92 | -f "${CAUR_DB_NAME}.db.${CAUR_DB_EXT}" \
93 | | awk '/^d/{print $6}' >../pkgs.txt); then
94 |
95 | if [[ -e ../pkgs.files.txt ]]; then
96 | mv ../pkgs.files.txt ../pkgs.files.old.txt
97 | fi
98 |
99 | ls -- *.pkg.* >../pkgs.files.txt
100 |
101 | if [[ -e ../pkgs.files.old.txt ]]; then
102 | diff ../pkgs.files.old.txt ../pkgs.files.txt \
103 | | grep '^[\<\>]' \
104 | | send-log --stdin --pre
105 | fi
106 |
107 | echo "Database's package list dumped"
108 | else
109 | echo 'Failed to dump package list'
110 | fi
111 | popd # CAUR_DEPLOY_PKGS
112 |
113 | return 0
114 | }
115 |
116 | function db-rebuild() {
117 | set -euo pipefail
118 |
119 | local _DESTDIR
120 |
121 | if [[ "$CAUR_TYPE" != 'primary' ]]; then
122 | echo 'Only primary node can do this action.'
123 | return 19
124 | fi
125 |
126 | _DESTDIR="$(mktemp -d)"
127 |
128 | # Lock bump operations
129 | db-lock
130 |
131 | {
132 | # Reset checkpoint to epoch
133 | touch -d "@0" "$CAUR_CHECKPOINT"
134 | CAUR_DATABASE_BUMPER="repo-add" CAUR_DB_LOCK_DISABLE=true CAUR_DB_NAME="${_DESTDIR}/${CAUR_DB_NAME}" db-bump
135 | mv "${_DESTDIR}/"* "${CAUR_DEPLOY_PKGS}"
136 | } || true
137 |
138 | db-unlock
139 | rm -r --one-file-system "${_DESTDIR}"
140 |
141 | return 0
142 | }
143 |
144 | function db-lock() {
145 | set -euo pipefail
146 |
147 | if [[ -v CAUR_DB_LOCK_DISABLE ]]; then
148 | return 0
149 | fi
150 |
151 | touch "${CAUR_DB_LOCK}"
152 | exec {CAUR_LOCK_FD}<>"${CAUR_DB_LOCK}"
153 |
154 | echo 'Lock work: Waiting for the other process to finish...'
155 | if ! flock -x -w 360 "$CAUR_LOCK_FD"; then
156 | db-lock-notify
157 | return 33
158 | fi
159 | echo "Lock acquired."
160 |
161 | export CAUR_LOCK_FD
162 |
163 | return 0
164 | }
165 |
166 | function db-unlock() {
167 | if [[ -v CAUR_DB_LOCK_DISABLE ]]; then
168 | return 0
169 | fi
170 |
171 | exec {CAUR_LOCK_FD}>&-
172 |
173 | unset CAUR_LOCK_FD
174 | echo 'Lock released.'
175 |
176 | return 0
177 | }
178 |
179 | function remove() {
180 | set -euo pipefail
181 |
182 | if [[ "${CAUR_TYPE}" == 'cluster' ]]; then
183 | # shellcheck disable=SC2029
184 | ssh "$CAUR_DEPLOY_HOST" "chaotic -s rm $*"
185 |
186 | remove-notify "$@"
187 |
188 | return 0
189 | fi
190 |
191 | # Lock bump operations
192 | db-lock
193 |
194 | # Remove them all
195 | if repoctl remove "$@"; then
196 | (db-pkglist) || true # we want to unlock even if it fails
197 | else
198 | db-unlock
199 | return 21
200 | fi
201 |
202 | db-unlock
203 |
204 | remove-notify "$@"
205 |
206 | return 0
207 | }
208 |
209 | function db-lock-notify() {
210 | send-log "OwO database wock has timed-out (${CAUR_TELEGRAM_TAG})"
211 | }
212 |
213 | function remove-notify() {
214 | set -euo pipefail
215 |
216 | [[ -z "$*" ]] && return 0
217 |
218 | local _AUTHOR
219 |
220 | _AUTHOR="${CAUR_MAINTAINER}@$CAUR_DEPLOY_LABEL"
221 |
222 | send-log --format markdown \
223 | "${_AUTHOR} just removed \`$*\`" \
224 | || true
225 |
226 | return 0
227 | }
228 |
--------------------------------------------------------------------------------
/src/lib/deploy.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | function deploy() {
4 | set -euo pipefail
5 |
6 | local _INPUTDIR _RESULT _NON_KISS_SUDO _UPLOAD_PID _PKGTAG
7 |
8 | _INPUTDIR="$(
9 | cd "${1:-}"
10 | pwd -P
11 | )"
12 |
13 | _LOCK_FN="${_INPUTDIR}.lock"
14 | touch "${_LOCK_FN}"
15 | exec {_LOCK_FD}<>"${_LOCK_FN}" # Lock
16 |
17 | if ! flock -x -n "$_LOCK_FD"; then
18 | echo 'This package is already in use.'
19 | exec {_LOCK_FD}>&- # Unlock
20 | return 16
21 | elif [[ ! -f "${_INPUTDIR}/PKGTAG" ]]; then
22 | echo "\"${_INPUTDIR}\" doesn't look like a valid input directory."
23 | exec {_LOCK_FD}>&- # Unlock
24 | return 14
25 | fi
26 |
27 | _PKGTAG="$(cat "${_INPUTDIR}/PKGTAG")"
28 | if [[ -f "${_INPUTDIR}/PKGVAR" ]]; then
29 | _PKGTAG+="-$(cat "${_INPUTDIR}/PKGVAR")"
30 | fi
31 |
32 | _RESULT="${_INPUTDIR}/building.result"
33 |
34 | _NON_KISS_SUDO=""
35 | if [[ -n "${CAUR_SIGN_USER}" ]]; then
36 | _NON_KISS_SUDO="sudo -u ${CAUR_SIGN_USER}"
37 | fi
38 |
39 | if [[ -f "${_INPUTDIR}.log" ]]; then
40 | echo 'Trying to deploy log file...'
41 | if [[ "$CAUR_TYPE" == 'cluster' ]]; then
42 | rsync --timeout=60 --verbose -e 'ssh -T -o Compression=no -o "ConnectionAttempts 5" -o "ConnectTimeout 10" -x' \
43 | "${_INPUTDIR}.log" "$CAUR_DEPLOY_HOST:$CAUR_DEPLOY_LOGS/${_PKGTAG}.log"
44 | else
45 | cp -v "${_INPUTDIR}.log" "$CAUR_DEPLOY_LOGS/${_PKGTAG}.log" || true
46 | fi
47 | fi
48 |
49 | if [[ -z "${CAUR_SIGN_KEY}" ]]; then
50 | echo 'A signing key is required for deploying.'
51 | exec {_LOCK_FD}>&- # Unlock
52 | return 17
53 | elif [[ ! -e "${_RESULT}" ]] \
54 | || [[ "$(cat "${_RESULT}")" != 'success' ]]; then
55 | echo 'Invalid package, last build did not succeed, or already deployed.'
56 | exec {_LOCK_FD}>&- # Unlock
57 | return 18
58 | fi
59 |
60 | pushd "${_INPUTDIR}/dest"
61 |
62 | # get files back to us
63 | reset-fakeroot-chown .
64 | if [[ -n "${CAUR_SIGN_USER}" ]]; then
65 | chown "${CAUR_SIGN_USER}" .
66 | fi
67 |
68 | # delete files created with "fill-dest"
69 | unfill-dest
70 | if [[ -n "$(find . -type f -size 0 -print 2>&1)" ]]; then
71 | echo 'Failure in delete package placeholders.'
72 | exec {_LOCK_FD}>&- # Unlock
73 | return 28
74 | fi
75 |
76 | echo "Trying to deploy packages."
77 | _UPLOAD_PID=()
78 | for f in !(*.sig); do
79 | [[ "$f" == '!(*.sig)' ]] && continue
80 |
81 | if [[ ! -e "${f}.sig" ]]; then
82 | ${_NON_KISS_SUDO} \
83 | "${CAUR_GPG_PATH}" --detach-sign \
84 | --use-agent -u "${CAUR_SIGN_KEY}" \
85 | --no-armor "$f"
86 | fi
87 |
88 | if [[ "$CAUR_TYPE" == 'cluster' ]]; then
89 | {
90 | if ! rsync --timeout=60 --verbose --partial -e 'ssh -T -o Compression=no -o "ConnectionAttempts 5" -o "ConnectTimeout 10" -x' \
91 | "./$f" "${CAUR_DEPLOY_HOST}:${CAUR_DEPLOY_PKGS}/"; then
92 | echo "$f" >>../deploy.failures
93 | fi
94 | } &
95 | _UPLOAD_PID+=("$!")
96 | else
97 | cp -v "$f" "${CAUR_DEPLOY_PKGS}/"
98 | fi
99 | done
100 |
101 | [[ -n "${_UPLOAD_PID:-}" ]] && sane-wait "${_UPLOAD_PID[@]}"
102 | if [[ -e '../deploy.failures' ]]; then
103 | echo 'Some packages failed to upload.'
104 | exec {_LOCK_FD}>&- # Unlock
105 | return 29
106 | fi
107 |
108 | echo "Trying to deploy signatures."
109 | _UPLOAD_PID=()
110 | for f in *.sig; do
111 | [[ "$f" == '*.sig' ]] && continue
112 |
113 | if [[ "$CAUR_TYPE" == 'cluster' ]]; then
114 | {
115 | if ! rsync --timeout=60 --verbose --partial -e 'ssh -T -o Compression=no -o "ConnectionAttempts 5" -o "ConnectTimeout 10" -x' \
116 | "./$f" "${CAUR_DEPLOY_HOST}:${CAUR_DEPLOY_PKGS}/"; then
117 | echo "$f" >>../deploy.failures
118 | fi
119 | } &
120 | _UPLOAD_PID+=("$!")
121 | else
122 | cp -v "$f" "${CAUR_DEPLOY_PKGS}/"
123 | fi
124 | done
125 |
126 | [[ -n "${_UPLOAD_PID:-}" ]] && sane-wait "${_UPLOAD_PID[@]}"
127 | if [[ -e '../deploy.failures' ]]; then
128 | echo 'Some signatures failed to upload.'
129 | exec {_LOCK_FD}>&- # Unlock
130 | return 29
131 | fi
132 |
133 | popd # "${_INPUTDIR}/dest"
134 |
135 | (deploy-notify "${_PKGTAG}") || true
136 |
137 | echo 'deployed' >"${_RESULT}"
138 |
139 | exec {_LOCK_FD}>&- # Unlock
140 | return 0
141 | }
142 |
143 | function deploypwd() {
144 | set -euo pipefail
145 |
146 | local _LS
147 |
148 | if [ ${#@} -eq 0 ]; then
149 | _LS=(./*/)
150 | else
151 | _LS=("$@")
152 | fi
153 |
154 | if [[ -z "${CAUR_SIGN_KEY}" ]]; then
155 | echo 'A signing key is required for deploying.'
156 | return 17
157 | fi
158 |
159 | for _pkg in "${_LS[@]}"; do
160 | (deploy "$_pkg") || continue
161 | done
162 |
163 | return 0
164 | }
165 |
166 | function deploy-notify() {
167 | set -euo pipefail
168 |
169 | local _PKGTAG _AUTHOR
170 |
171 | _PKGTAG="${1:-}"
172 | [[ -z "$_PKGTAG" ]] && return 36
173 |
174 | _AUTHOR="$CAUR_DEPLOY_LABEL"
175 | [[ "${CAUR_IN_ROUTINE:-0}" != '1' ]] && _AUTHOR="${CAUR_MAINTAINER}@$CAUR_DEPLOY_LABEL"
176 |
177 | send-log --format markdown \
178 | "${_AUTHOR} just deployed \`${_PKGTAG}\` successfully!" \
179 | || true
180 |
181 | return 0
182 | }
183 |
--------------------------------------------------------------------------------
/src/lib/interfere.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | function interference-apply() {
3 | set -euo pipefail
4 |
5 | local _INTERFERE _PREPEND _PKGBUILD
6 |
7 | _INTERFERE="${1:-}"
8 |
9 | interference-generic "${_PKGTAG}"
10 |
11 | [[ -d "${_INTERFERE}" ]] && echo 'optdepends+=("chaotic-interfere")' >>PKGBUILD
12 |
13 | # shellcheck source=/dev/null
14 | [[ -f "${_INTERFERE}/prepare" ]] \
15 | && source "${_INTERFERE}/prepare"
16 |
17 | if [[ -f "${_INTERFERE}/interfere.patch" ]]; then
18 | if patch -Np1 <"${_INTERFERE}/interfere.patch"; then
19 | echo 'Patches applied with success'
20 | else
21 | echo 'Ignoring patch failure...'
22 | fi
23 | fi
24 |
25 | if [[ -f "${_INTERFERE}/PKGBUILD.prepend" ]]; then
26 | # The worst one, but KISS and easier to maintain
27 | _PREPEND="$(cat "${_INTERFERE}/PKGBUILD.prepend")"
28 | _PKGBUILD="$(cat PKGBUILD)"
29 | echo "$_PREPEND" >PKGBUILD
30 | echo "$_PKGBUILD" >>PKGBUILD
31 | fi
32 |
33 | [[ -f "${_INTERFERE}/PKGBUILD.append" ]] \
34 | && cat "${_INTERFERE}/PKGBUILD.append" >>PKGBUILD
35 |
36 | interference-pkgrel "${_PKGTAG}"
37 |
38 | return 0
39 | }
40 |
41 | function interference-generic() {
42 | set -euo pipefail -o functrace
43 |
44 | local _PKGTAG
45 | local _PKGTAG_NON_VCS
46 |
47 | _PKGTAG="${1:-}"
48 |
49 | # * Treats VCs
50 | if (echo "$_PKGTAG" | grep -qP '\-git$'); then
51 | extra_pkgs+=("git")
52 | _PKGTAG_NON_VCS="${_PKGTAG%-git}"
53 | fi
54 | if (echo "$_PKGTAG" | grep -qP '\-svn$'); then
55 | extra_pkgs+=("subversion")
56 | _PKGTAG_NON_VCS="${_PKGTAG%-svn}"
57 | fi
58 | if (echo "$_PKGTAG" | grep -qP '\-bzr$'); then
59 | extra_pkgs+=("breezy")
60 | _PKGTAG_NON_VCS="${_PKGTAG%-bzr}"
61 | fi
62 | if (echo "$_PKGTAG" | grep -qP '\-hg$'); then
63 | extra_pkgs+=("mercurial")
64 | _PKGTAG_NON_VCS="${_PKGTAG%-hg}"
65 | fi
66 |
67 | # * Multilib
68 | if (echo "$_PKGTAG" | grep -qP '^lib32-'); then
69 | extra_pkgs+=("multilib-devel")
70 | fi
71 |
72 | # * Special cookie for TKG kernels
73 | if (echo "$_PKGTAG" | grep -qP '^linux.*tkg'); then
74 | extra_pkgs+=("git")
75 | fi
76 |
77 | # * Read options
78 | if (grep -qPo "^options=\([a-z! \"']*(?>PKGBUILD
93 |
94 | # * Get rid of 'native optimizations'
95 | if (grep -qP '\-march=native' PKGBUILD); then
96 | sed -i'' 's/-march=native//g' PKGBUILD
97 | fi
98 |
99 | return 0
100 | }
101 |
102 | function interference-pkgrel() {
103 | set -euo pipefail
104 |
105 | local _BUMPSFILE _PKGTAG _EPOCH _PKGVER _PKGREL _BUMPCOUNT
106 |
107 | _PKGTAG="${1:-}"
108 | _BUMPSFILE="${CAUR_INTERFERE}/PKGREL_BUMPS"
109 |
110 | if [ ! -f "${_BUMPSFILE}" ]; then
111 | return 0
112 | fi
113 |
114 | IFS=";" read -r _EPOCH _PKGVER _PKGREL _BUMPCOUNT <<<"$(awk -v pkgtag="${_PKGTAG}" '$1==pkgtag { epoch_index=index($2,":"); pkgrel_index=index($2,"-"); print (epoch_index==0 ? "0" : substr($2,0,epoch_index-1)) ";" substr($2,epoch_index+1,pkgrel_index-epoch_index-1) ";" substr($2,pkgrel_index+1) ";" $3; exit}' "${_BUMPSFILE}")"
115 |
116 | if [[ -z "${_EPOCH}" ]] || [[ -z "${_PKGVER}" ]] || [[ -z "${_PKGREL}" ]]; then
117 | return 0
118 | fi
119 | if [[ -z "${_BUMPCOUNT}" ]]; then
120 | _BUMPCOUNT=1
121 | fi
122 |
123 | echo "case \"\$(vercmp \"${_EPOCH}:${_PKGVER}\" \"\$epoch:\$pkgver\")\" in
124 | \"1\")
125 | pkgrel=1
126 | pkgver=\"${_PKGVER}\"
127 | epoch=\"${_EPOCH}\"
128 | ;&
129 | \"0\")
130 | if [[ \"\$pkgrel\" == \"${_PKGREL}\" ]]; then
131 | pkgrel=\"\$pkgrel.${_BUMPCOUNT}\"
132 | fi
133 | ;;
134 | esac" >>PKGBUILD
135 | }
136 |
137 | function interference-makepkg() {
138 | set -euo pipefail
139 |
140 | $CAUR_PUSH exec /usr/local/bin/internal-makepkg --skippgpcheck "$@" "${TARGET_ARGS:-}" \$\@
141 |
142 | return 0
143 | }
144 |
145 | function interference-bump() {
146 | set -euo pipefail
147 |
148 | local _PACKAGES _PKGTAG _VERSION _BUMPSFILE _BUMPS _BUMP
149 |
150 | _BUMPSFILE="${CAUR_INTERFERE}/PKGREL_BUMPS"
151 |
152 | if [ -f "${_BUMPSFILE}" ]; then
153 | _BUMPS=$(<"${_BUMPSFILE}")
154 | else
155 | _BUMPS=""
156 | fi
157 |
158 | _PACKAGES="$(repoctl list -v)"
159 |
160 | # Clear old bumps
161 | while IFS= read -r _BUMP; do
162 | _PKGTAG=${_BUMP%% *}
163 | _VERSION="$(awk -v pkgtag="${_PKGTAG}" '$1==pkgtag { print $NF; exit }' <<<"${_PACKAGES}")"
164 | local _INTERNALVERSION _INTERNALBUMPCOUNT
165 | IFS=";" read -r _INTERNALVERSION _INTERNALBUMPCOUNT <<<"$(awk -v pkgtag="${_PKGTAG}" '$1==pkgtag { print $2 ";" $3; exit }' <<<"${_BUMPS}")"
166 | if [[ -z "${_INTERNALVERSION}" ]] || [[ -z "${_INTERNALBUMPCOUNT}" ]]; then
167 | continue
168 | fi
169 | if [[ "$(vercmp "${_VERSION}" "${_INTERNALVERSION}.${_INTERNALBUMPCOUNT}")" -gt 0 ]]; then
170 | _BUMPS="$(awk -v pkgtag="$_PKGTAG" '/^$/ {next} $1==pkgtag { next } 1' <<<"${_BUMPS}")"
171 | fi
172 | done <<<"$_BUMPS"
173 |
174 | # Add/increase existing bumps
175 | for _PKGTAG in "$@"; do
176 | _VERSION="$(awk -v pkgtag="${_PKGTAG}" '$1==pkgtag { print $NF; exit }' <<<"${_PACKAGES}")"
177 | if [ -z "${_VERSION}" ]; then
178 | echo "Package ${_PKGTAG} not found in repo" >&2
179 | return 1
180 | fi
181 | _VERSION="${_VERSION##* }"
182 | _BUMPS="$(awk -v pkgtag="$_PKGTAG" -v version="$_VERSION" '/^$/ {next} $1==pkgtag { if (!set) { print $1 " " $2 " " $3+1; set=1 }; next } ENDFILE { if (!set) { print pkgtag " " version " " "1" }; exit } 1' <<<"${_BUMPS}")"
183 | done
184 |
185 | echo "${_BUMPS}"
186 | echo "${_BUMPS}" >"${_BUMPSFILE}"
187 |
188 | interfere-push-bumps || interfere-sync
189 | return 0
190 | }
191 |
192 | function interference-finish() {
193 | set -euo pipefail
194 |
195 | unset TARGET_ARGS || true
196 |
197 | if [[ -n "${TARGET_RUN:-}" ]]; then
198 | echo "${TARGET_RUN}" >'CONTAINER_ARGS'
199 | fi
200 |
201 | unset TARGET_RUN || true
202 |
203 | return 0
204 | }
205 |
--------------------------------------------------------------------------------
/src/lib/mirror.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | function help-mirror() {
4 | set -euo pipefail
5 |
6 | local _MIRROR_TYPE="${1:-}"
7 |
8 | case "${_MIRROR_TYPE}" in
9 | 'syncthing')
10 | echo "Sorry, I haven't automated this yet!"
11 | echo '1) Install syncthing'
12 | echo '2) Add my device: ZDHVMSP-EW4TMWX-DBH2W4P-HV5A6OY-BBEFABO-QTENANJ-RJ6GKNX-6KCG7QY, then check "Introducer" and "Auto accept"'
13 | echo '3) Add folder "jhcrt-m2dra" as "Receive Only" with "Ignore Permissions" and "Pull Order" by "Oldest First".'
14 | echo '4) Wait for me to accept it!'
15 | ;;
16 | *)
17 | echo 'Unsupported protocol.'
18 | ;;
19 | esac
20 |
21 | return 0
22 | }
23 |
--------------------------------------------------------------------------------
/src/lib/package-make.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | function makepkg() {
4 | set -euo pipefail
5 |
6 | if [[ "${CAUR_ENGINE}" = "systemd-nspawn" ]]; then
7 | makepkg-systemd-nspawn "$@"
8 | elif [[ "${CAUR_ENGINE}" = "singularity" ]]; then
9 | makepkg-singularity "$@"
10 | else
11 | echo "Unsupported engine '${CAUR_ENGINE}'"
12 | return 25
13 | fi
14 | }
15 |
16 | function makepkg-systemd-nspawn() {
17 | set -euo pipefail
18 |
19 | local _INPUTDIR _PKGTAG _INTERFERE _ROOTDIR \
20 | _LOWER _HOME _CCACHE _SRCCACHE _PKGDEST \
21 | _CAUR_WIZARD _MECHA_NAME _BUILD_FAILED \
22 | _CONTAINER_ARGS _LOCK_FD _LOCK_FN _FAILURE
23 |
24 | _INPUTDIR="$(
25 | cd "${1:-}"
26 | pwd -P
27 | )"
28 | # Note: there is usage of "${@:2}" below.
29 |
30 | _LOCK_FN="${_INPUTDIR}.lock"
31 | touch "${_LOCK_FN}"
32 | exec {_LOCK_FD}<>"${_LOCK_FN}" # Lock
33 |
34 | if ! flock -x -n "$_LOCK_FD"; then
35 | echo 'This package is already building.'
36 | exec {_LOCK_FD}>&- # Unlock
37 | return 16
38 | elif [[ ! -f "${_INPUTDIR}/PKGTAG" ]]; then
39 | echo "\"${_INPUTDIR}\" doesn't look like a valid input directory."
40 | exec {_LOCK_FD}>&- # Unlock
41 | return 14
42 | elif [[ -f "${_INPUTDIR}/PKGBUILD" ]]; then
43 | echo "\"${_INPUTDIR}\" was not prepared yet."
44 | exec {_LOCK_FD}>&- # Unlock
45 | return 15
46 | fi
47 |
48 | echo -n $$ >"${_INPUTDIR}/building.pid"
49 |
50 | # Check if we are missing a lowerdir or our lowerdir is out of date
51 | if { [[ ! -e "${CAUR_LOWER_DIR}/latest" ]] || [[ "$(date -r "${CAUR_LOWER_DIR}/latest" "+%F")" != "$(date "+%F")" ]]; } && ! lowerstrap; then
52 | _FAILURE=$?
53 | exec {_LOCK_FD}>&- # Unlock
54 | return ${_FAILURE}
55 | fi
56 |
57 | pushd "${_INPUTDIR}"
58 | [[ -e 'building.result' ]] && rm 'building.result'
59 | _PKGTAG=$(cat PKGTAG)
60 | _INTERFERE="${CAUR_INTERFERE}/${_PKGTAG}"
61 | _LOWER="$(
62 | cd "${CAUR_LOWER_DIR}"
63 | cd "$(readlink latest)"
64 | pwd -P
65 | )"
66 |
67 | echo "Building package \"${_PKGTAG}\""
68 |
69 | _ROOTDIR='machine/root'
70 | _HOME="${_ROOTDIR}/home/main-builder"
71 | _CCACHE="${CAUR_CACHE_CC}/${_PKGTAG}"
72 | _SRCCACHE="${CAUR_CACHE_SRC}/${_PKGTAG}"
73 | _PKGDEST="${_ROOTDIR}/var/pkgdest"
74 | _CAUR_WIZARD="machine/root/home/main-builder/${CAUR_BASH_WIZARD}"
75 |
76 | install -o"$(whoami)" -dDm755 machine/{up,work,root} dest "${_CCACHE}" "${_SRCCACHE}" "${CAUR_CACHE_PKG}"
77 | mount-overlayfs -olowerdir="${_LOWER}",upperdir='machine/up',workdir='machine/work' 'machine/root'
78 | chown 1000:1000 'dest'
79 |
80 | mount --bind 'pkgwork' "${_HOME}/pkgwork"
81 | mount --bind "${_CCACHE}" "${_HOME}/.ccache"
82 | mount --bind "${_SRCCACHE}" "${_HOME}/pkgsrc"
83 | mount --bind "${CAUR_CACHE_PKG}" 'machine/root/var/cache/pacman/pkg'
84 | mount --bind 'dest' "${_PKGDEST}"
85 |
86 | (fill-dest)
87 |
88 | cp "${CAUR_BASH_WIZARD}" "${_CAUR_WIZARD}"
89 | chmod 755 "${_CAUR_WIZARD}"
90 |
91 | [[ -f 'CONTAINER_ARGS' ]] && _CONTAINER_ARGS="$('building.result'
107 | if [[ -f "${_INTERFERE}/on-success.sh" ]]; then
108 | # shellcheck source=/dev/null
109 | source "${_INTERFERE}/on-success.sh"
110 | fi
111 | else
112 | echo "${_BUILD_FAILED}" >'building.result'
113 | if [[ -f "${_INTERFERE}/on-failure.sh" ]]; then
114 | # shellcheck source=/dev/null
115 | source "${_INTERFERE}/on-failure.sh"
116 | fi
117 | fi
118 |
119 | umount -Rv machine/root \
120 | && rm --one-file-system -rf machine
121 |
122 | rm 'building.pid'
123 | exec {_LOCK_FD}>&- # Unlock
124 |
125 | popd # "${_INPUTDIR}"
126 | [[ -n "${_BUILD_FAILED}" ]] \
127 | && return ${_BUILD_FAILED}
128 | return 0
129 | }
130 |
131 | function makepkg-singularity() {
132 | set -euo pipefail
133 |
134 | local _INPUTDIR _PKGTAG _INTERFERE _FAILURE \
135 | _LOWER _HOME _CCACHE _SRCCACHE _CAUR_WIZARD \
136 | _BUILD_FAILED _MECHA_NAME _SANDBOX _LOCK_FD _LOCK_FN
137 |
138 | _INPUTDIR="$(
139 | cd "${1:-}"
140 | pwd -P
141 | )"
142 | # Note: there is usage of "${@:2}" below.
143 |
144 | _LOCK_FN="${_INPUTDIR}.lock"
145 | touch "${_LOCK_FN}"
146 | exec {_LOCK_FD}<>"${_LOCK_FN}" # Lock
147 |
148 | if ! flock -x -n "$_LOCK_FD"; then
149 | echo 'This package is already building.'
150 | exec {_LOCK_FD}>&- # Unlock
151 | return 16
152 | elif [[ ! -f "${_INPUTDIR}/PKGTAG" ]]; then
153 | echo "\"${_INPUTDIR}\" doesn't look like a valid input directory."
154 | exec {_LOCK_FD}>&- # Unlock
155 | return 14
156 | elif [[ -f "${_INPUTDIR}/PKGBUILD" ]]; then
157 | echo "\"${_INPUTDIR}\" was not prepared yet."
158 | exec {_LOCK_FD}>&- # Unlock
159 | return 15
160 | fi
161 |
162 | echo -n $$ >"${_INPUTDIR}/building.pid"
163 |
164 | # Check if we are missing a lowerdir or our lowerdir is out of date
165 | if { [[ ! -e "${CAUR_LOWER_DIR}/latest" ]] || [[ "$(date -r "${CAUR_LOWER_DIR}/latest" "+%F")" != "$(date "+%F")" ]]; } && ! lowerstrap; then
166 | _FAILURE=$?
167 | exec {_LOCK_FD}>&- # Unlock
168 | return ${_FAILURE}
169 | fi
170 |
171 | pushd "${_INPUTDIR}"
172 | [[ -e 'building.result' ]] && rm 'building.result'
173 | _PKGTAG=$(cat PKGTAG)
174 | _INTERFERE="${CAUR_INTERFERE}/${_PKGTAG}"
175 | _LOWER="$(
176 | cd "${CAUR_LOWER_DIR}"
177 | readlink -f latest
178 | )"
179 |
180 | echo "Building package \"${_PKGTAG}\""
181 |
182 | if ! install -o"$(whoami)" -dDm755 "${CAUR_SANDBOX}"; then
183 | exec {_LOCK_FD}>&- # Unlock
184 | return 32
185 | fi
186 |
187 | _MECHA_NAME="pkg$(echo -n "$_PKGTAG" | sha256sum | cut -c1-11)"
188 | _SANDBOX="${CAUR_SANDBOX}/${_MECHA_NAME}"
189 | if [[ -e "${_SANDBOX}" ]]; then
190 | echo "Sandbox ${_SANDBOX} already exists. Trying to clean it up..."
191 | rm-as-root "${_SANDBOX}"
192 |
193 | if [[ -e "${_SANDBOX}" ]]; then
194 | echo "It was not possible to clean ${_SANDBOX}"
195 | exec {_LOCK_FD}>&- # Unlock
196 | return 30
197 | fi
198 | fi
199 |
200 | singularity build --sandbox "${_SANDBOX}" "${_LOWER}"
201 |
202 | _HOME="/home/main-builder"
203 | _CCACHE="${CAUR_CACHE_CC}/${_PKGTAG}"
204 | _SRCCACHE="${CAUR_CACHE_SRC}/${_PKGTAG}"
205 | _CAUR_WIZARD="${_SANDBOX}/home/main-builder/${CAUR_BASH_WIZARD}"
206 |
207 | install -o"$(whoami)" -dDm755 "${CAUR_CACHE}" || return 32
208 | mkdir -p "${_CCACHE}" "${_SRCCACHE}" "${CAUR_CACHE_PKG}" "./dest"
209 |
210 | (fill-dest)
211 |
212 | cp "${CAUR_BASH_WIZARD}" "${_CAUR_WIZARD}"
213 | chmod 755 "${_CAUR_WIZARD}"
214 |
215 | _BUILD_FAILED=''
216 | singularity exec --writable --fakeroot --no-home --containall --workdir /tmp \
217 | -B "./pkgwork:${_HOME}/pkgwork" \
218 | -B "./dest:/var/pkgdest" \
219 | -B "${_CCACHE}:${_HOME}/.ccache" \
220 | -B "${_SRCCACHE}:${_HOME}/pkgsrc" \
221 | -B "${CAUR_CACHE_PKG}:/var/cache/pacman/pkg" \
222 | --dns 1.1.1.1,8.8.8.8 \
223 | "${_SANDBOX}" \
224 | "/home/main-builder/wizard.sh" "${@:2}" || local _BUILD_FAILED="$?"
225 |
226 | rm-as-root "${_SANDBOX}"
227 |
228 | $CAUR_USERNS_EXEC_CMD find "${_SRCCACHE}" -exec touch '{}' +
229 |
230 | if [[ -z "${_BUILD_FAILED}" ]]; then
231 | echo 'success' >'building.result'
232 | if [[ -f "${_INTERFERE}/on-success.sh" ]]; then
233 | # shellcheck source=/dev/null
234 | source "${_INTERFERE}/on-success.sh"
235 | fi
236 | else
237 | echo "${_BUILD_FAILED}" >'building.result'
238 | if [[ -f "${_INTERFERE}/on-failure.sh" ]]; then
239 | # shellcheck source=/dev/null
240 | source "${_INTERFERE}/on-failure.sh"
241 | fi
242 | fi
243 |
244 | rm 'building.pid'
245 | exec {_LOCK_FD}>&- # Unlock
246 |
247 | popd # "${_INPUTDIR}"
248 | [[ -n "${_BUILD_FAILED}" ]] \
249 | && return ${_BUILD_FAILED}
250 | return 0
251 | }
252 |
253 | function fill-dest() {
254 | set -euo pipefail
255 |
256 | pushd 'dest'
257 |
258 | curl --fail -Lfs "$CAUR_FILL_DEST" \
259 | | sed 's/\//.pkg.tar.zst/g' | xargs touch
260 |
261 | popd # dest
262 |
263 | return 0
264 | }
265 |
266 | function unfill-dest() {
267 | set -euo pipefail
268 |
269 | find . -type f -empty -delete || return 28
270 |
271 | return 0
272 | }
273 |
--------------------------------------------------------------------------------
/src/lib/package-makedir.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | function makepwd() {
4 | set -euo pipefail
5 |
6 | local _LS _pkg _BUILDING_PIDS _MAX_JOBS
7 |
8 | _MAX_JOBS="${CAUR_PARALLEL:-1}"
9 | if [[ ${_MAX_JOBS} -lt 1 ]]; then
10 | _MAX_JOBS="$(nproc)"
11 | fi
12 |
13 | echo 'Trying to make directory...'
14 |
15 | if [ ${#@} -eq 0 ]; then
16 | _LS=(./*/)
17 | else
18 | _LS=("$@")
19 | fi
20 |
21 | for _pkg in "${_LS[@]}"; do
22 | if [[ ! -d "${_pkg}" ]]; then
23 | echo "Skipping \"${_pkg}\", not a directory."
24 | continue
25 | elif [[ ! -f "${_pkg}/PKGBUILD" ]]; then
26 | echo "Skipping \"${_pkg}\", does not contain a PKGBUILD."
27 | continue
28 | fi
29 | (prepare "${_pkg}") || true # we want build to continue even if one pkg failed
30 | done
31 |
32 | _BUILDING_PIDS=()
33 | for _pkg in "${_LS[@]}"; do
34 | if [[ "$_pkg" == '--' ]]; then
35 | echo 'Trapped, waiting jobs until here.'
36 | if [[ -n "${_BUILDING_PIDS[*]}" ]]; then
37 | sane-wait "${_BUILDING_PIDS[@]}" || true
38 | fi
39 | _BUILDING_PIDS=()
40 | echo 'Keep going...'
41 | elif [[ "${_MAX_JOBS}" == '1' ]]; then
42 | pipepkg "$_pkg" || true
43 | else
44 | while [[ -n "${_BUILDING_PIDS:-}" ]] \
45 | && [[ $(comm -12 <(printf "%s\n" "${_BUILDING_PIDS[@]}" | sort) <(jobs -rp | sort) | wc -l) -gt ${_MAX_JOBS} ]]; do
46 | sleep 1
47 | done
48 | pipepkg "$_pkg" &
49 | _BUILDING_PIDS+=("$!")
50 | sleep 1
51 | fi
52 | done
53 |
54 | echo 'Waiting all jobs to finish'
55 | sane-wait
56 |
57 | return 0
58 | }
59 |
60 | function pipepkg() {
61 | set -euo pipefail
62 |
63 | local _pkg
64 |
65 | if [ ${#@} -ne 1 ]; then
66 | echo 'Invalid number of parameters.'
67 | return 24
68 | fi
69 |
70 | _pkg="$(basename "$1")"
71 |
72 | if [[ -z "${_pkg}" ]] || [[ ! -f "${_pkg}/PKGTAG" ]]; then
73 | echo 'Invalid package name.'
74 | return 24
75 | fi
76 |
77 | echo "Starting making ${_pkg} at $(date)"
78 | ({ time makepkg "${_pkg}" --noconfirm; } 2>&1 | tee "${_pkg}.log") \
79 | || if grep -qP "is not a clone of" "${_pkg}.log"; then
80 | echo 'The cached git repo is invalid, clearing source and retrying.'
81 | clean-srccache "${_pkg}" # To fight failed builds due to changed git source
82 | ({ time makepkg "${_pkg}" --noconfirm; } 2>&1 | tee "${_pkg}.log") \
83 | || true
84 | elif grep -qP "One or more files did not pass the validity check!" "${_pkg}.log"; then
85 | echo 'The cached file did not pass validity check, clearing source and retrying.'
86 | clean-srccache "${_pkg}" # To fight failed builds due to wrong cached files
87 | ({ time makepkg "${_pkg}" --noconfirm; } 2>&1 | tee "${_pkg}.log") \
88 | || true
89 | fi \
90 | || true # we want to cleanup even if it failed
91 |
92 | (deploy "${_pkg}" && db-bump 2>&1 | tee -a "${_pkg}.log") || true
93 | (cleanup "${_pkg}" 2>&1 | tee -a "${_pkg}.log") || true
94 |
95 | return 0
96 | }
97 |
98 | function clean-logs() {
99 | set -euo pipefail
100 |
101 | local _TOREM
102 |
103 | mapfile -t _TOREM < <(grep -l -P 'ERROR: (A|The) package( group)? has already been built' ./*.log)
104 | [ ${#_TOREM[@]} -eq 0 ] || echo "${_TOREM[@]}" | xargs rm || true
105 |
106 | mapfile -t _TOREM < <(grep -l 'Finished making: ' ./*.log)
107 | [ ${#_TOREM[@]} -eq 0 ] || echo "${_TOREM[@]}" | xargs rm || true
108 |
109 | mapfile -t _TOREM < <(grep -l 'PKGBUILD does not exist.' ./*.log)
110 | [ ${#_TOREM[@]} -eq 0 ] || echo "${_TOREM[@]}" | xargs rm || true
111 |
112 | return 0
113 | }
114 |
115 | function cleanpwd() {
116 | set -euo pipefail
117 |
118 | for f in ./*/; do
119 | [[ "$f" == './*/' ]] && continue
120 | cleanup "$f" || true
121 | done
122 |
123 | clean-logs
124 |
125 | rm ./*.lock || true
126 |
127 | return 0
128 | }
129 |
--------------------------------------------------------------------------------
/src/lib/package-prepare.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | function prepare() {
4 | set -euo pipefail
5 |
6 | local _PKGDIR _PKGTAG _INTERFERE _LS
7 |
8 | _PKGDIR="$(
9 | cd "${1:-}"
10 | pwd -P
11 | )"
12 | # Note: there is usage of "${@:2}" below.
13 |
14 | if [[ -e "${_PKGDIR}/PKGTAG" ]]; then
15 | echo "Package already was prepared."
16 | return 0
17 | elif [[ ! -e "${_PKGDIR}/PKGBUILD" ]]; then
18 | echo "Invalid parameter, \"${_PKGDIR}\" does not contain a PKGBUILD."
19 | return 10
20 | fi
21 |
22 | pushd "${_PKGDIR}"
23 | if [[ -f 'PKGBASE' ]]; then
24 | _PKGTAG="$('PKGTAG'
37 |
38 | makepkg-gen-bash-init "${_PKGDIR}"
39 |
40 | pushd 'pkgwork'
41 | interference-apply "${_INTERFERE}"
42 | popd # pkgwork
43 |
44 | interference-makepkg "${@:2}"
45 | interference-finish
46 |
47 | popd #_PKGDIR
48 | makepkg-gen-bash-finish
49 |
50 | echo "Finished preparing ${_PKGTAG}."
51 |
52 | return 0
53 | }
54 |
55 | function makepkg-gen-bash-init() {
56 | set -euo pipefail
57 |
58 | local _DEST="${1:-}"
59 |
60 | export CAUR_WIZARD="${_DEST}/${CAUR_BASH_WIZARD}"
61 | stee "${CAUR_WIZARD}" </dev/null
75 |
76 | return 0
77 | }
78 |
79 | function makepkg-gen-bash-finish() {
80 | set -euo pipefail
81 |
82 | unset CAUR_PUSH
83 | unset CAUR_WIZARD
84 |
85 | return 0
86 | }
87 |
--------------------------------------------------------------------------------
/src/lib/pkgrel-incrementer.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | function pkgrel-incrementer-start() {
4 | set -euo pipefail
5 |
6 | if [[ "${CAUR_ENGINE}" = 'singularity' ]]; then
7 | singularity run -B "$HOME/chaotic/pkgrel_incrementer/data":/data "$HOME/chaotic/pkgrel_incrementer/pkgrel_incrementer.sif" &
8 | PKGREL_INCREMENTER_PID="$!"
9 | fi
10 | }
11 |
12 | function pkgrel-incrementer-stop() {
13 | set -euo pipefail
14 |
15 | if [[ -n "${PKGREL_INCREMENTER_PID:-}" ]]; then
16 | kill "${PKGREL_INCREMENTER_PID}"
17 | fi
18 | }
19 |
--------------------------------------------------------------------------------
/src/lib/routines-garuda.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | function routine-garuda() {
4 | set -euo pipefail
5 | clean-xdg
6 | interfere-sync
7 | push-routine-dir 'garuda'
8 |
9 | [[ -d "_repo" ]] && rm -rf --one-file-system '_repo'
10 | git clone 'https://gitlab.com/garuda-linux/pkgbuilds.git' '_repo'
11 | mv _repo/* .
12 |
13 | (makepwd) || true
14 |
15 | clean-logs
16 | popd #routine-dir
17 | return 0
18 | }
19 |
--------------------------------------------------------------------------------
/src/lib/routines-tkg-wine.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | function routine-tkg-wine() {
4 | set -euo pipefail
5 | clean-xdg
6 | interfere-sync
7 | push-routine-dir 'tkg.wine'
8 |
9 | [[ -d "_repo" ]] && rm -rf --one-file-system '_repo'
10 | git clone 'https://github.com/Frogging-Family/wine-tkg-git.git' '_repo'
11 |
12 | local _VARIATIONS _VARIATION _i _DEST _PROFILES _VARIATION_WITHOUT_EXT
13 |
14 | _PROFILES='_repo/wine-tkg-git/wine-tkg-profiles'
15 |
16 | pushd "${_PROFILES}"
17 | _VARIATIONS=(./chaotic-*.cfg)
18 | popd
19 | echo "Building: ${_VARIATIONS[*]}"
20 |
21 | [[ "${_VARIATIONS[*]}" == './chaotic-*.cfg' ]] && return 0
22 |
23 | _i=0
24 | for _VARIATION in "${_VARIATIONS[@]}"; do
25 | _i=$((_i + 1))
26 | _DEST="wine-tkg-git.$(printf '%04d' $_i)"
27 | _VARIATION_WITHOUT_EXT="${_VARIATION%.cfg}"
28 |
29 | mkdir "$_DEST"
30 | cp -r '_repo/wine-tkg-git'/* "$_DEST/"
31 | echo 'wine-tkg' >"$_DEST/PKGBASE"
32 | echo "${_VARIATION_WITHOUT_EXT##./chaotic-}" >"$_DEST/PKGVAR"
33 |
34 | pushd "$_DEST"
35 | echo '' >'wine-tkg-profiles/advanced-customization.cfg'
36 | cat 'wine-tkg-profiles/sample-external-config.cfg' >./customization.cfg
37 | cat "wine-tkg-profiles/$_VARIATION" >>./customization.cfg
38 | popd
39 | done
40 |
41 | rm -rf --one-file-system '_repo' || true
42 |
43 | (makepwd) || true
44 | clean-logs
45 | popd #routine-dir
46 | return 0
47 | }
48 |
--------------------------------------------------------------------------------
/src/lib/routines-tkg.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | function tkg-kernel-variate() {
4 | set -euo pipefail
5 |
6 | local _VER _SCHED _YIELD _MARCH _PKGNAME _TIMER_FREQ _RQ _LTS _patches
7 |
8 | if [ ${#@} -ne 4 ]; then
9 | echo 'Invalid variate parameters'
10 | return 23
11 | fi
12 |
13 | _VER="$1"
14 | _SCHED="$2"
15 | _YIELD="$3"
16 | _MARCH="$4"
17 | _LTS=0
18 | _LTO=0
19 | _patches=("OpenRGB.mypatch")
20 |
21 | _PKGNAME="linux-tkg-${_SCHED}-${_MARCH}"
22 | if [ "${_MARCH}" == 'generic' ]; then
23 | _PKGNAME="linux-tkg-${_SCHED}"
24 | elif [ "${_MARCH}" == 'lts' ]; then # LTS is generic-only
25 | _PKGNAME="linux-lts-tkg-${_SCHED}"
26 | _MARCH='generic'
27 | _LTS=1
28 | elif [ "${_MARCH}" == 'generic_v3_lto' ]; then
29 | _PKGNAME="linux-tkg-${_SCHED}-lto_v3"
30 | _MARCH='generic_v3'
31 | _LTO=1
32 | fi
33 |
34 | _TIMER_FREQ=750
35 | if [ "${_SCHED}" == 'muqss' ]; then
36 | _TIMER_FREQ=100
37 | fi
38 |
39 | _RQ='none'
40 | if [ "${_MARCH}" == 'zen' ]; then
41 | _RQ='mc-llc'
42 | fi
43 |
44 | _COMPILER='gcc'
45 | _LTO_MODE=''
46 | if [ "${_LTO}" == '1' ]; then
47 | _COMPILER='llvm'
48 | _LTO_MODE='thin'
49 | fi
50 |
51 | sed -i'' "
52 | s/_distro=\"[^\"]*\"/_distro=\"Arch\"/g
53 | s/_version=\"[^\"]*\"/_version=\"${_VER}\"/g
54 | s/_NUKR=\"[^\"]*\"/_NUKR=\"false\"/g
55 | s/_OPTIPROFILE=\"[^\"]*\"/_OPTIPROFILE=\"1\"/g
56 | s/_modprobeddb=\"[^\"]*\"/_modprobeddb=\"false\"/g
57 | s/_menunconfig=\"[^\"]*\"/_menunconfig=\"false\"/g
58 | s/_diffconfig=\"[^\"]*\"/_diffconfig=\"false\"/g
59 | s/_configfile=\"[^\"]*\"/_configfile=\"config.x86_64\"/g
60 | s/_cpusched=\"[^\"]*\"/_cpusched=\"${_SCHED}\"/g
61 | s/_compiler=\"[^\"]*\"/_compiler=\"${_COMPILER}\"/g
62 | s/_lto_mode=\"[^\"]*\"/_lto_mode=\"${_LTO_MODE}\"/g
63 | s/_sched_yield_type=\"[^\"]*\"/_sched_yield_type=\"${_YIELD}\"/g
64 | s/_rr_interval=\"[^\"]*\"/_rr_interval=\"default\"/g
65 | s/_ftracedisable=\"[^\"]*\"/_ftracedisable=\"true\"/g
66 | s/_numadisable=\"[^\"]*\"/_numadisable=\"false\"/g
67 | s/_tickless=\"[^\"]*\"/_tickless=\"2\"/g
68 | s/_voluntary_preempt=\"[^\"]*\"/_voluntary_preempt=\"false\"/g
69 | s/_acs_override=\"[^\"]*\"/_acs_override=\"true\"/g
70 | s/_ksm_uksm=\"[^\"]*\"/_ksm_uksm=\"true\"/g
71 | s/_bcachefs=\"[^\"]*\"/_bcachefs=\"false\"/g
72 | s/_bfqmq=\"[^\"]*\"/_bfqmq=\"true\"/g
73 | s/_zfsfix=\"[^\"]*\"/_zfsfix=\"true\"/g
74 | s/_fsync=\"[^\"]*\"/_fsync=\"true\"/g
75 | s/_futex2=\"[^\"]*\"/_futex2=\"true\"/g
76 | s/_futex_waitv=\"[^\"]*\"/_futex_waitv=\"true\"/g
77 | s/_winesync=\"[^\"]*\"/_winesync=\"false\"/g
78 | s/_waydroid=\"[^\"]*\"/_waydroid=\"true\"/g
79 | s/_processor_opt=\"[^\"]*\"/_processor_opt=\"${_MARCH}\"/g
80 | s/_cacule_rdb=\"[^\"]*\"/_cacule_rdb=\"true\"/g
81 | s/_smt_nice=\"[^\"]*\"/_smt_nice=\"true\"/g
82 | s/_random_trust_cpu=\"[^\"]*\"/_random_trust_cpu=\"true\"/g
83 | s/_runqueue_sharing=\"[^\"]*\"/_runqueue_sharing=\"${_RQ}\"/g
84 | s/_timer_freq=\"[^\"]*\"/_timer_freq=\"${_TIMER_FREQ}\"/g
85 | s/_community_patches=\"[^\"]*\"/_community_patches=\"${_patches[*]}\"/g
86 | s/_user_patches=\"[^\"]*\"/_user_patches=\"false\"/g
87 | s/_custom_pkgbase=\"[^\"]*\"/_custom_pkgbase=\"${_PKGNAME}\"/g
88 | s/_misc_adds=\"[^\"]*\"/_misc_adds=\"true\"/g
89 | " customization.cfg
90 |
91 | echo '_nofallback="true"' >>customization.cfg
92 |
93 | if [[ "$_LTS" == '1' ]]; then
94 | echo 'linux-lts-tkg' >PKGBASE
95 | else
96 | echo 'linux-tkg' >PKGBASE
97 | fi
98 | echo "${_PKGNAME##linux*-tkg-}" >PKGVAR
99 |
100 | return 0
101 | }
102 |
103 | function tkg-kernels-variations() {
104 | set -euo pipefail
105 |
106 | local _LINUX_LTS _LINUX_STABLE _LINUX_MARCH _VAR_SCHED _VAR_SCHED
107 |
108 | _LINUX_LTS='6.6'
109 | _LINUX_STABLE='6.8'
110 |
111 | _LINUX_SCHED=(
112 | 'bmq 1'
113 | 'cfs 0'
114 | 'eevdf 1'
115 | 'pds 0'
116 | 'tt 1'
117 | )
118 |
119 | readonly _LINUX_MARCH=(
120 | 'generic_v3'
121 | 'generic'
122 | )
123 |
124 | # stable
125 | for _VAR_MARCH in "${_LINUX_MARCH[@]}"; do
126 | for _VAR_SCHED in "${_LINUX_SCHED[@]}"; do
127 | echo "$_LINUX_STABLE" "$_VAR_SCHED" "$_VAR_MARCH"
128 | done
129 | done
130 |
131 | # Let's try this baby
132 | echo "$_LINUX_STABLE" 'cfs 0' 'generic_v3_lto'
133 |
134 | # lts
135 | for _VAR_SCHED in "${_LINUX_SCHED[@]}" 'pds 0'; do
136 | echo "$_LINUX_LTS" "$_VAR_SCHED" 'lts'
137 | done
138 |
139 | return 0
140 | }
141 |
142 | function routine-tkg-kernels() {
143 | set -euo pipefail
144 | clean-xdg
145 | interfere-sync
146 | push-routine-dir 'tkg.kernels' || return 12
147 |
148 | git clone 'https://github.com/Frogging-Family/linux-tkg.git' 'linux-tkg'
149 |
150 | local _VARIATIONS _VARIATION _i _DEST
151 |
152 | mapfile -t _VARIATIONS < <(tkg-kernels-variations)
153 |
154 | _i=0
155 | for _VARIATION in "${_VARIATIONS[@]}"; do
156 | _i=$((_i + 1))
157 | _DEST="linux-tkg.$(printf '%04d' $_i)"
158 |
159 | mkdir "$_DEST"
160 | cp -rT 'linux-tkg/' "$_DEST/"
161 |
162 | pushd "$_DEST"
163 | # shellcheck disable=SC2086
164 | tkg-kernel-variate $_VARIATION
165 | popd
166 | done
167 |
168 | rm -rf --one-file-system 'linux-tkg' || true
169 |
170 | (makepwd) || true
171 | clean-logs
172 | popd #routine-dir
173 | return 0
174 | }
175 |
--------------------------------------------------------------------------------
/src/lib/routines.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | function routine() {
4 | set -euo pipefail
5 |
6 | # good time to maybe clean the pkgcache
7 | (clean-pkgcache -q) || true
8 |
9 | local _CMD
10 |
11 | _CMD="${1:-}"
12 |
13 | CAUR_IN_ROUTINE=1
14 | export CAUR_IN_ROUTINE
15 |
16 | case "${_CMD}" in
17 | 'garuda')
18 | load-config 'routines/garuda'
19 | routine-garuda
20 | ;;
21 | 'tkg-kernels')
22 | load-config 'routines/tkg-kernels'
23 | routine-tkg-kernels
24 | ;;
25 | 'tkg-wine')
26 | load-config 'routines/tkg-wine'
27 | routine-tkg-wine
28 | ;;
29 | 'clean-archive')
30 | clean-archive
31 | ;;
32 | *)
33 | generic-routine "${_CMD}"
34 | ;;
35 | esac
36 |
37 | echo 'Finished routine.'
38 |
39 | return 0
40 | }
41 |
42 | function parse-package-list() {
43 | set -euo pipefail
44 |
45 | if [[ ! -f "${1:-}" ]]; then
46 | echo 'Unrecognized routine'
47 | return 22
48 | fi
49 |
50 | sed -E 's/#.*//;/^\s*$/d;s/^\s+//;s/\s+$//' "$1"
51 | }
52 |
53 | function generic-routine() {
54 | set -euo pipefail
55 |
56 | if [[ -z "${1:-}" ]]; then
57 | echo 'Invalid routine'
58 | return 13
59 | fi
60 |
61 | local _ROUTINE _LIST _DIR _URL _PACKAGES _ROUTINE_PACKAGES _EXISTING_PACKAGES_LIST _PACKAGES_NOT_IN_REPO _PACKAGES_IN_REPO
62 | _ROUTINE="$1"
63 |
64 | clean-xdg
65 |
66 | (package-lists-sync)
67 |
68 | _LIST="${CAUR_PACKAGE_LISTS}/${CAUR_CLUSTER_NAME}/${_ROUTINE}.txt"
69 |
70 | if [[ ! -f "${_LIST}" ]]; then
71 | echo 'Unrecognized routine'
72 | return 22
73 | fi
74 |
75 | (interfere-sync)
76 | (repoctl-sync-db)
77 |
78 | load-config "routines/$1"
79 |
80 | push-routine-dir "${_ROUTINE}" || return 12
81 |
82 | # non-VCS packages from AUR (download if updated)
83 | _ROUTINE_PACKAGES="$(parse-package-list "${_LIST}" | sed -E '/:/d;/-(git|svn|bzr|hg|nightly)$/d')"
84 | _EXISTING_PACKAGES_LIST="$(repoctl list)"
85 |
86 | _PACKAGES_NOT_IN_REPO=$(comm -13 <(tr " " "\n" <<<"$_EXISTING_PACKAGES_LIST" | sort -u) <(tr " " "\n" <<<"$_ROUTINE_PACKAGES" | sort -u))
87 | _PACKAGES_IN_REPO=$(comm -12 <(tr " " "\n" <<<"$_EXISTING_PACKAGES_LIST" | sort -u) <(tr " " "\n" <<<"$_ROUTINE_PACKAGES" | sort -u))
88 |
89 | echo "$_PACKAGES_IN_REPO" \
90 | | xargs --no-run-if-empty -L 200 repoctl down -u 2>&1 \
91 | | tee -a _repoctl_down.log \
92 | || true
93 |
94 | echo "$_PACKAGES_NOT_IN_REPO" \
95 | | xargs --no-run-if-empty -L 200 repoctl down 2>&1 \
96 | | tee -a _repoctl_down.log \
97 | || true
98 |
99 | # VCS packages from AUR (always download)
100 | parse-package-list "${_LIST}" \
101 | | sed -E '/:/d' \
102 | | sed -En '/-(git|svn|bzr|hg|nightly)$/p' \
103 | | xargs --no-run-if-empty -L 200 repoctl down 2>&1 \
104 | | tee -a _repoctl_down.log \
105 | || true
106 |
107 | # PKGBUILDs hosted on git repos (always download)
108 | parse-package-list "${_LIST}" \
109 | | sed -En '/:/p' \
110 | | while IFS=':' read -r _DIR _URL; do
111 | git clone --depth 1 "${_URL}" "${_DIR}" \
112 | | tee -a _repoctl_down.log \
113 | || true
114 | done
115 |
116 | (pkgrel-incrementer-start)
117 |
118 | # put in background and wait, otherwise trap does not work
119 | _PACKAGES=()
120 | mapfile -t _PACKAGES < <(
121 | parse-package-list "${_LIST}" \
122 | | sed -E 's/\:(.*)//'
123 | )
124 | makepwd "${_PACKAGES[@]}" &
125 | sane-wait "$!" || true
126 |
127 | (pkgrel-incrementer-stop)
128 |
129 | cleanpwd
130 | popd #routine dir
131 |
132 | # good time to do some cleanup
133 | (clean-post-routine) || true
134 |
135 | return 0
136 | }
137 |
138 | function push-routine-dir() {
139 | set -euo pipefail
140 |
141 | if [ -z "${1:-}" ]; then
142 | echo 'Invalid routine'
143 | return 13
144 | fi
145 |
146 | local _DIR
147 |
148 | if [[ "${CAUR_STAMPROUTINES:-1}" == '1' ]]; then
149 | _DIR="${CAUR_ROUTINES}/$1.$(date '+%Y%m%d%H%M%S')"
150 | else
151 | _DIR="${CAUR_ROUTINES}/$1"
152 | fi
153 |
154 | if [[ -d "$_DIR" ]]; then
155 | pushd "$_DIR"
156 | echo 'Cleaning pre-existent routine directory.'
157 | cleanpwd
158 | else
159 | echo 'Creating new routine directory.'
160 | install -o"$(whoami)" -dDm755 "$_DIR"
161 | pushd "$_DIR"
162 | fi
163 |
164 | # shellcheck disable=SC2064
165 | trap "freeze-notify '$1' '${SLURM_NODELIST:-}'" SIGUSR1
166 |
167 | return 0
168 | }
169 |
170 | function freeze-notify() {
171 | local _PREPARED_REMAINING _TOUCHED_REMAINING
172 | _PREPARED_REMAINING="$(find . -mindepth 2 -maxdepth 2 -name PKGTAG | wc -l)"
173 | [[ ${_PREPARED_REMAINING} -lt 1 ]] && return 0
174 | _TOUCHED_REMAINING="$(find . -mindepth 2 -maxdepth 2 -name building.result | wc -l)"
175 | send-log "Hey onyii-san, wast ${1:-} buiwd on ${CAUR_CLUSTER_NAME}'s ${2:-} stawted lwng time ago (${CAUR_TELEGRAM_TAG}), with ${_PREPARED_REMAINING} packages remaining to build (${_TOUCHED_REMAINING} failed/building)."
176 | }
177 |
--------------------------------------------------------------------------------
/src/lib/sync.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | function interfere-sync() {
4 | set -euo pipefail
5 |
6 | echo 'Syncing interfere...'
7 | pushd "${CAUR_INTERFERE}"
8 | git fetch || true
9 | git reset --hard '@{u}' || true
10 | popd #CAUR_INTERFERE
11 |
12 | return 0
13 | }
14 |
15 | function interfere-push-bumps() {
16 | set -euo pipefail
17 |
18 | echo 'Push interfere...'
19 | pushd "${CAUR_INTERFERE}"
20 | GIT_AUTHOR_NAME="${CAUR_MAINTAINER}@$CAUR_DEPLOY_LABEL" git commit -m 'Update PKGREL_BUMPS' PKGREL_BUMPS \
21 | && git push || return 1
22 | popd #CAUR_INTERFERE
23 |
24 | return 0
25 | }
26 |
27 | function package-lists-sync() {
28 | set -euo pipefail
29 |
30 | echo 'Syncing packages...'
31 | pushd "${CAUR_PACKAGE_LISTS}"
32 | git pull --ff-only || true
33 | popd #CAUR_PACKAGE_LISTS
34 |
35 | return 0
36 | }
37 |
38 | function repoctl-sync-db() {
39 | set -euo pipefail
40 |
41 | [[ -z "${CAUR_REPOCTL_DB_URL:-}" ]] && return 0
42 | [[ -z "${CAUR_REPOCTL_DB_FILE:-}" ]] && return 0
43 |
44 | echo 'Syncing database...'
45 |
46 | install -o"$(whoami)" -dDm755 "${HOME}/.config/repoctl"
47 | [[ -z "${REPOCTL_CONFIG:-}" ]] && REPOCTL_CONFIG="${HOME}/.config/repoctl/config.toml"
48 |
49 | if [[ -e "${REPOCTL_CONFIG}" ]]; then
50 | if [[ "$(wc -l <"$REPOCTL_CONFIG")" -gt 2 ]]; then
51 | echo "sanity check: we are not going to overwrite existing repoctl config"
52 | return 31
53 | fi
54 | fi
55 |
56 | install -o"$(whoami)" -dDm755 "$(dirname "$CAUR_REPOCTL_DB_FILE")"
57 | curl -sLo "${CAUR_REPOCTL_DB_FILE}" "${CAUR_REPOCTL_DB_URL}"
58 |
59 | stee "${REPOCTL_CONFIG}" </dev/null || true
108 |
109 | return 0
110 | }
111 |
112 | function send-log() {
113 | [[ "$CAUR_SILENT" == '1' ]] && return 0
114 |
115 | telegram-send --config "$CAUR_TELEGRAM_LOG" --silent "$@" &>/dev/null || true
116 |
117 | return 0
118 | }
119 |
120 | function sort-logs() (
121 | set -euo pipefail
122 |
123 | if [[ "$CAUR_TYPE" != 'primary' ]]; then
124 | echo 'Only primary node can do this action.'
125 | return 19
126 | fi
127 |
128 | # We don't want to have already fixed logs in there
129 | if [[ -d "$CAUR_DEPLOY_LOGS_FILTERED" ]]; then
130 | rm -r "$CAUR_DEPLOY_LOGS_FILTERED"
131 | fi
132 | mkdir -p "${CAUR_DEPLOY_LOGS_FILTERED}"/{partly-built,source-changed,misc,checksums,build-failed,dep-not-in-repo,dep-runtime,space-missing}
133 |
134 | # Find all candidate files, excluding successful packages
135 | mapfile -t candidates < <(find "${CAUR_DEPLOY_LOGS}" -maxdepth 1 -type f -exec grep -LFe "The package group has already been built." -e "A package has already been built." -e "Finished making:" {} \;)
136 |
137 | function symlink-logs() {
138 | set -euo pipefail
139 | local DESTINATION
140 | DESTINATION="${CAUR_DEPLOY_LOGS_FILTERED}/${3}/"
141 | grep -qF "$2" "$1" && ln -s "$(realpath --relative-to="${DESTINATION}" "${1}")" "${DESTINATION}"
142 | }
143 |
144 | for candidate in "${candidates[@]}"; do
145 | symlink-logs "$candidate" "Part of the package group has already been built." "partly-built" \
146 | || symlink-logs "$candidate" "is not a clone of" "source-changed" \
147 | || symlink-logs "$candidate" "One or more files did not pass the validity check!" "checksums" \
148 | || symlink-logs "$candidate" "error: target not found:" "dep-not-in-repo" \
149 | || symlink-logs "$candidate" "not found, tried pkgconfig" "dep-runtime" \
150 | || symlink-logs "$candidate" "No space left on device" "space-missing" \
151 | || symlink-logs "$candidate" "build stopped: subcommand failed." "build-failed" \
152 | || symlink-logs "$candidate" "" "misc"
153 | done
154 | )
155 |
156 | function find-discarded() {
157 | set -euo pipefail
158 |
159 | local _CURRENT_PACKAGES _INTENDED_PACKAGES _EXTRA_PACKAGES
160 |
161 | if [[ "$CAUR_TYPE" != 'primary' ]]; then
162 | echo 'Only primary node can do this action.'
163 | return 19
164 | fi
165 |
166 | _CURRENT_PACKAGES="$(tar -xaf "${CAUR_DEPLOY_PKGS}/${CAUR_DB_NAME}.db.${CAUR_DB_EXT}" --wildcards --no-anchored 'desc' -O | awk 'f{if (!a[$0]++) {print} ;f=0} /%BASE%/{f=1}')"
167 | _INTENDED_PACKAGES="$(find "${CAUR_PACKAGE_LISTS}" -name '*.txt' | while read -r _LIST; do parse-package-list "$_LIST"; done | awk -F ':' '{print $1}')"
168 | _EXTRA_PACKAGES="$(comm -13 <(tr " " "\n" <<<"$_INTENDED_PACKAGES" | sort -u) <(tr " " "\n" <<<"$_CURRENT_PACKAGES" | sort -u))"
169 |
170 | if [[ -z "${_EXTRA_PACKAGES}" ]]; then
171 | echo "No discarded packages were found!"
172 | else
173 | echo "[!] Discarded packages in repo:"
174 | echo "${_EXTRA_PACKAGES}"
175 |
176 | echo "[!] Total: $(echo -n "${_EXTRA_PACKAGES}" | wc -l)"
177 | fi
178 | }
179 |
--------------------------------------------------------------------------------
/wrappers/README.md:
--------------------------------------------------------------------------------
1 | # Wrappers for non-Arch distros
2 |
3 | The tools inside this directory run from the [toolbox-deps](https://github.com/chaotic-aur/toolbox-deps) container using Singularity.
4 |
--------------------------------------------------------------------------------
/wrappers/git:
--------------------------------------------------------------------------------
1 | repoctl
--------------------------------------------------------------------------------
/wrappers/gpg:
--------------------------------------------------------------------------------
1 | repoctl
--------------------------------------------------------------------------------
/wrappers/pacman:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # wrapper with --fakeroot
3 | if [[ -z "${CAUR_PACMAN_SYNC}" ]]; then
4 | CAUR_PACMAN_SYNC="${HOME}/chaotic/pacman-sync"
5 | fi
6 | install -o"$(whoami)" -dDm755 "${CAUR_PACMAN_SYNC}"
7 |
8 | exec singularity --silent exec --fakeroot \
9 | -B "${CAUR_PACMAN_SYNC}":/var/lib/pacman/sync \
10 | docker://quay.io/chaotic/toolbox-deps \
11 | "$(basename "$0")" "$@"
12 |
--------------------------------------------------------------------------------
/wrappers/repoctl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # wrapper without --fakeroot
3 | if [[ -z "${CAUR_PACMAN_SYNC}" ]]; then
4 | CAUR_PACMAN_SYNC="${HOME}/chaotic/pacman-sync"
5 | fi
6 | install -o"$(whoami)" -dDm755 "${CAUR_PACMAN_SYNC}"
7 |
8 | exec singularity --silent exec \
9 | -B "${CAUR_PACMAN_SYNC}":/var/lib/pacman/sync \
10 | docker://quay.io/chaotic/toolbox-deps \
11 | "$(basename "$0")" "$@"
12 |
--------------------------------------------------------------------------------
/wrappers/telegram-send:
--------------------------------------------------------------------------------
1 | repoctl
--------------------------------------------------------------------------------
/yarn.lock:
--------------------------------------------------------------------------------
1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2 | # yarn lockfile v1
3 |
4 |
5 | boolean@^3.0.1:
6 | version "3.2.0"
7 | resolved "https://registry.yarnpkg.com/boolean/-/boolean-3.2.0.tgz#9e5294af4e98314494cbb17979fa54ca159f116b"
8 | integrity sha512-d0II/GO9uf9lfUHH2BQsjxzRJZBdsjgsBiW4BvhWk/3qoKwQFjIDVN19PfX8F2D/r9PCMTtLWjYVCFrpeYUzsw==
9 |
10 | define-properties@^1.1.3:
11 | version "1.1.3"
12 | resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1"
13 | integrity sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==
14 | dependencies:
15 | object-keys "^1.0.12"
16 |
17 | detect-node@^2.0.4:
18 | version "2.1.0"
19 | resolved "https://registry.yarnpkg.com/detect-node/-/detect-node-2.1.0.tgz#c9c70775a49c3d03bc2c06d9a73be550f978f8b1"
20 | integrity sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==
21 |
22 | es6-error@^4.1.1:
23 | version "4.1.1"
24 | resolved "https://registry.yarnpkg.com/es6-error/-/es6-error-4.1.1.tgz#9e3af407459deed47e9a91f9b885a84eb05c561d"
25 | integrity sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==
26 |
27 | escape-string-regexp@^4.0.0:
28 | version "4.0.0"
29 | resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34"
30 | integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==
31 |
32 | global-agent@^3.0.0:
33 | version "3.0.0"
34 | resolved "https://registry.yarnpkg.com/global-agent/-/global-agent-3.0.0.tgz#ae7cd31bd3583b93c5a16437a1afe27cc33a1ab6"
35 | integrity sha512-PT6XReJ+D07JvGoxQMkT6qji/jVNfX/h364XHZOWeRzy64sSFr+xJ5OX7LI3b4MPQzdL4H8Y8M0xzPpsVMwA8Q==
36 | dependencies:
37 | boolean "^3.0.1"
38 | es6-error "^4.1.1"
39 | matcher "^3.0.0"
40 | roarr "^2.15.3"
41 | semver "^7.3.2"
42 | serialize-error "^7.0.1"
43 |
44 | globalthis@^1.0.1:
45 | version "1.0.2"
46 | resolved "https://registry.yarnpkg.com/globalthis/-/globalthis-1.0.2.tgz#2a235d34f4d8036219f7e34929b5de9e18166b8b"
47 | integrity sha512-ZQnSFO1la8P7auIOQECnm0sSuoMeaSq0EEdXMBFF2QJO4uNcwbyhSgG3MruWNbFTqCLmxVwGOl7LZ9kASvHdeQ==
48 | dependencies:
49 | define-properties "^1.1.3"
50 |
51 | json-stringify-safe@^5.0.1:
52 | version "5.0.1"
53 | resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb"
54 | integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=
55 |
56 | lru-cache@^6.0.0:
57 | version "6.0.0"
58 | resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94"
59 | integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==
60 | dependencies:
61 | yallist "^4.0.0"
62 |
63 | matcher@^3.0.0:
64 | version "3.0.0"
65 | resolved "https://registry.yarnpkg.com/matcher/-/matcher-3.0.0.tgz#bd9060f4c5b70aa8041ccc6f80368760994f30ca"
66 | integrity sha512-OkeDaAZ/bQCxeFAozM55PKcKU0yJMPGifLwV4Qgjitu+5MoAfSQN4lsLJeXZ1b8w0x+/Emda6MZgXS1jvsapng==
67 | dependencies:
68 | escape-string-regexp "^4.0.0"
69 |
70 | mvdan-sh@^0.5.0:
71 | version "0.5.0"
72 | resolved "https://registry.yarnpkg.com/mvdan-sh/-/mvdan-sh-0.5.0.tgz#fa76f611a103595ad0f04f5d18e582892c46e87c"
73 | integrity sha512-UWbdl4LHd2fUnaEcOUFVWRdWGLkNoV12cKVIPiirYd8qM5VkCoCTXErlDubevrkEG7kGohvjRxAlTQmOqG80tw==
74 |
75 | object-keys@^1.0.12:
76 | version "1.1.1"
77 | resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e"
78 | integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==
79 |
80 | prettier-plugin-sh@^0.6.1:
81 | version "0.6.1"
82 | resolved "https://registry.yarnpkg.com/prettier-plugin-sh/-/prettier-plugin-sh-0.6.1.tgz#094d1d190f0d8a53bfd522a68f17a95ca741047d"
83 | integrity sha512-Weelg53FBb1Z5Q1/GpQIb4s//BdhmPAABjJfe6VTQ3m8upQjM36sVVboNOUVvYn3K+LMwzW4vkxhqLQ+vvfBKQ==
84 | dependencies:
85 | mvdan-sh "^0.5.0"
86 |
87 | prettier@^2.6.2:
88 | version "2.6.2"
89 | resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.6.2.tgz#e26d71a18a74c3d0f0597f55f01fb6c06c206032"
90 | integrity sha512-PkUpF+qoXTqhOeWL9fu7As8LXsIUZ1WYaJiY/a7McAQzxjk82OF0tibkFXVCDImZtWxbvojFjerkiLb0/q8mew==
91 |
92 | roarr@^2.15.3:
93 | version "2.15.4"
94 | resolved "https://registry.yarnpkg.com/roarr/-/roarr-2.15.4.tgz#f5fe795b7b838ccfe35dc608e0282b9eba2e7afd"
95 | integrity sha512-CHhPh+UNHD2GTXNYhPWLnU8ONHdI+5DI+4EYIAOaiD63rHeYlZvyh8P+in5999TTSFgUYuKUAjzRI4mdh/p+2A==
96 | dependencies:
97 | boolean "^3.0.1"
98 | detect-node "^2.0.4"
99 | globalthis "^1.0.1"
100 | json-stringify-safe "^5.0.1"
101 | semver-compare "^1.0.0"
102 | sprintf-js "^1.1.2"
103 |
104 | semver-compare@^1.0.0:
105 | version "1.0.0"
106 | resolved "https://registry.yarnpkg.com/semver-compare/-/semver-compare-1.0.0.tgz#0dee216a1c941ab37e9efb1788f6afc5ff5537fc"
107 | integrity sha1-De4hahyUGrN+nvsXiPavxf9VN/w=
108 |
109 | semver@^7.3.2:
110 | version "7.5.3"
111 | resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.3.tgz#161ce8c2c6b4b3bdca6caadc9fa3317a4c4fe88e"
112 | integrity sha512-QBlUtyVk/5EeHbi7X0fw6liDZc7BBmEaSYn01fMU1OUYbf6GPsbTtd8WmnqbI20SeycoHSeiybkE/q1Q+qlThQ==
113 | dependencies:
114 | lru-cache "^6.0.0"
115 |
116 | serialize-error@^7.0.1:
117 | version "7.0.1"
118 | resolved "https://registry.yarnpkg.com/serialize-error/-/serialize-error-7.0.1.tgz#f1360b0447f61ffb483ec4157c737fab7d778e18"
119 | integrity sha512-8I8TjW5KMOKsZQTvoxjuSIa7foAwPWGOts+6o7sgjz41/qMD9VQHEDxi6PBvK2l0MXUmqZyNpUK+T2tQaaElvw==
120 | dependencies:
121 | type-fest "^0.13.1"
122 |
123 | shellcheck@^1.1.0:
124 | version "1.1.0"
125 | resolved "https://registry.yarnpkg.com/shellcheck/-/shellcheck-1.1.0.tgz#ccf1f1815acef0b337d9f2deeecd62ba509e85e1"
126 | integrity sha512-WtLqgjHg7667gGU+0dPV1EtoQgYL/Zxc4fhRt6Z3kfpASG3J08TBJ990HVIUnN/YWUBKMr3FVbBYlEvPVJ24bA==
127 | dependencies:
128 | global-agent "^3.0.0"
129 |
130 | sprintf-js@^1.1.2:
131 | version "1.1.2"
132 | resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.1.2.tgz#da1765262bf8c0f571749f2ad6c26300207ae673"
133 | integrity sha512-VE0SOVEHCk7Qc8ulkWw3ntAzXuqf7S2lvwQaDLRnUeIEaKNQJzV6BwmLKhOqT61aGhfUMrXeaBk+oDGCzvhcug==
134 |
135 | type-fest@^0.13.1:
136 | version "0.13.1"
137 | resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.13.1.tgz#0172cb5bce80b0bd542ea348db50c7e21834d934"
138 | integrity sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==
139 |
140 | yallist@^4.0.0:
141 | version "4.0.0"
142 | resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72"
143 | integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==
144 |
--------------------------------------------------------------------------------