1
0
mirror of https://gitlab.alpinelinux.org/alpine/cloud/tiny-cloud.git synced 2025-12-14 19:02:45 +03:00

180 Commits

Author SHA1 Message Date
Natanael Copa
b03030182f Add cloud provider "alpine" and user-data "alpine-conf" 3.0.0_rc2 2023-05-09 14:15:31 +00:00
Jake Buchholz Göktürk
17d0b3d07b stderr output for set_ssh_keys failure 2023-05-09 04:16:15 +00:00
Jake Buchholz Göktürk
229fc70b42 add STDERR output for problems with set_hostname 2023-05-09 04:13:21 +00:00
Natanael Copa
de66c6049e Handle error when setting ssh key
Avoid create a /.ssh dir if user does not exist.
2023-05-08 22:31:58 +02:00
Natanael Copa
7be3b198fb Avoid set empty hostname
Avaoid situation where we end up with an empty /etc/hostname.
2023-05-08 22:31:58 +02:00
Natanael Copa
468407db05 Add test for empty or no config
for all providers
2023-05-08 22:31:58 +02:00
Natanael Copa
f46b6b24d8 tests: unify fake_metadata_nocloud and fake_userdata_nocloud
Avoid duplication of code.

No changes in behavior
2023-05-08 16:54:52 +02:00
Natanael Copa
0500f71837 Don't print error on missing /proc/mounts
This is useful for testing
2023-05-08 13:48:29 +02:00
Natanael Copa
dd7cb23515 Make it posible to override the init actions
This makes it easier to run parts of the actions when running tests.
2023-05-08 13:45:58 +02:00
Natanael Copa
d1ed0c29e3 Make init__create_default_user return success
We should return success even if /etc/doas.d is missing
fixes https://gitlab.alpinelinux.org/alpine/cloud/tiny-cloud/-/issues/38
2023-05-08 12:19:11 +02:00
Jake Buchholz Göktürk
4ccc16f18f Enable sshd & Source UserData Handler 2023-05-08 04:41:41 +00:00
Jake Buchholz Göktürk
4f9386bb94 Add "create_default_user" Init Action 2023-05-08 02:37:54 +00:00
Jake Buchholz Göktürk
ec139644a1 Set Default interfaces 2023-05-07 23:49:50 +00:00
Natanael Copa
a7600fb5ff Only try to expand root which is ext4
Root filesystem may be tmpfs or something else, in which case we should
not call resize2fs.
2023-05-05 03:41:55 +00:00
Natanael Copa
02c0c31703 tiny-cloud: Print usage on invalid option and add test
Add test that verifies invalid option and `tiny-cloud --help`
2023-05-04 11:50:22 +02:00
Jake Buchholz Göktürk
7ad4565a04 update changelog 3.0.0_rc1 2023-05-02 19:16:17 -07:00
Jake Buchholz Göktürk
58ac2108cd Fixes for tiny-cloud Wrapper
* switch from phase functions to variables containing list of actions
* init actions prefixed with 'init__'
* refine output during init
* add syslog entries
* add --setup for putting init scripts in the right runlevel
2023-05-03 02:11:01 +00:00
Jake Buchholz Göktürk
3894cd9f8d Support "local-hostname" 3.0.0_rc0 2023-04-30 23:23:54 +00:00
Jake Buchholz Göktürk
fb2d658d93 Move cloud libs deeper. 2023-04-30 14:55:51 -07:00
Jake Buchholz Göktürk
81869cefcc Consolidate init functionality in /sbin/tiny-cloud 2023-04-30 03:37:11 +00:00
Jake Buchholz Göktürk
762fe36bb8 Move OpenRC Init Scripts 2023-04-29 14:14:20 -07:00
Jake Buchholz Göktürk
83e8677481 Move Tiny Cloud configs into /etc 2023-04-29 20:54:45 +00:00
Jake Buchholz Göktürk
cdae70909c document the deprecation of ebs-nvme-symlinks 2023-04-29 20:30:43 +00:00
Natanael Copa
43bedda17f Adjust when tiny-cloud-early should start 2023-04-14 21:21:07 +00:00
Natanael Copa
fa01b4ea9a tests: add tests for init-final 2023-04-06 22:27:42 +02:00
Natanael Copa
e51051c7ca tests: refactor fake userdata for nocloud
- move it so it can be shared
- remove mentions of #cloud-config to avoid confusion
2023-04-06 22:07:58 +02:00
Natanael Copa
7ea8f69a06 Fix user-data decompression on all shells
yash[1] and zsh does not handle 8-bit bytes in strings good. Work around it
by using printf ... | cmp ... to compare the header. This should be 100%
posix compatible.

Also fix some of the compression header magic bytes:

- unxz: Use octal aas the string '\3757zXZ\000' was misinterpreted by some
  shells.
- lzma: the third byte represents compression mode[2], and we want
  support all compression modes not only '8', so we only check the first
  three bytes instead of 4.

[1]: Upstream report: https://osdn.net/projects/yash/ticket/47772
[2]: https://github.com/frizb/FirmwareReverseEngineering/blob/master/IdentifyingCompressionAlgorithms.md#lzma
2023-04-06 17:19:40 +02:00
Natanael Copa
bbb0c19ae6 Fix detection of lz4 header magic number 2023-04-06 17:19:40 +02:00
Natanael Copa
ab46d7223f tests: add test for save_userdata
Test that compressed user-data gets properly detected
2023-04-06 17:19:40 +02:00
Natanael Copa
12bc6af2ce Fix quoting when reading subshells
This is needed for yash.
2023-04-06 17:19:40 +02:00
Natanael Copa
a67cbd37b0 Add test for ssh-keys in nocloud yaml 2023-04-06 17:19:40 +02:00
Natanael Copa
0f53f14399 tests: add initial tests for init-main 2023-04-06 17:19:36 +02:00
Jake Buchholz Göktürk
fda9a350a1 imds-net-sync should only work with secondary ipv4s on an interface 2.2.2 2023-03-24 16:41:37 -07:00
Jake Buchholz Göktürk
ed67197e7b restore "source /lib/tiny-cloud/common" in imds-net-sync 2.2.1 2023-03-23 19:14:43 +00:00
Jake Buchholz Göktürk
520b72b8d6 Fix imds-net-sync with multiple interfaces
* all IPv4s of non-eth0 interfaces should be associated with route table
* also add "to" rules for non-eth0 interfaces (symmetry with the "from" rules)
2.2.0
2023-03-23 10:33:52 -07:00
Natanael Copa
33257650c8 Fix function detecion
Different shells has slightly different output of `type`:

    $ yash -c "f(){ :; }; type f"
    f: a function

    $ dash -c "f(){ :; }; type f"
    f is a shell function

    $ zsh -c "f(){ :; }; type f"
    f is a shell function from zsh

Lets only look for the word "function" which seems to be the only common
thing.
2023-03-09 17:18:48 +01:00
Natanael Copa
e9b4350617 Fix source of cloud-specific mdev functions
We need to source it with '.'

fixes commit c335944911d6 (Add kyua testsuite and make code more portable)
2023-03-09 13:01:36 +01:00
Natanael Copa
c055e974f0 init-early: use posix printf instead of echo -n 2023-03-09 11:47:34 +01:00
Natanael Copa
38cbdee6a2 Return failure if any of install_modules fails
Add test to verify that install_modules can be skipped and that
install_modules returns failure if it fails to update mdev.conf.
2023-03-09 11:47:34 +01:00
Natanael Copa
4ba3ce17bc Refactor skip_action
micro optimization. No forks used

readability improved by avoiding regex.
2023-03-09 11:47:34 +01:00
Natanael Copa
091af053c5 Use printf for skip_action
printf is posix compatible and works with all shell. echo -n does not
work with yash and is not posix compatible.

Add test for skipping expand_root
2023-03-09 11:47:34 +01:00
Natanael Copa
a626e694c6 Refactor expand_root
Simplify it a bit.
- use awk /proc/mounts instead of busybox mountpoint
- use sysfs to find partition and volume. This is more robust
- add tests for it
2023-03-09 11:47:34 +01:00
Natanael Copa
d0f352b276 Fix detection of cloud-specific mdev functions 2023-03-09 02:28:04 +00:00
Natanael Copa
b9156a7f43 Add tests for imds aws 2023-03-09 02:22:11 +00:00
Natanael Copa
c335944911 Add kyua testsuite and make code more portable 2023-03-08 03:39:39 +00:00
Jake Buchholz Göktürk
39670c091c Add Missing Trailing Newlines 2022-11-03 20:13:03 +00:00
Valery Ushakov
feada28f10 nvme-ebs-links: quote readlink output, it may be empty 2022-11-03 00:37:16 +00:00
Jake Buchholz Göktürk
4d85faffea Fix user-data Decompression 2.1.2 2022-10-20 23:52:52 +00:00
Jake Buchholz Göktürk
4e37eb815c Minor Improvements & Typo Fixen
* save `user-data` during main `tiny-cloud` init script instead of `tiny-cloud-final`
* allow manual setting of bootstrap state with...
  * `service tiny-cloud complete`
  * `service tiny-cloud incomplete`
* use `${VAR:=default}` idiom instead of `VAR=${VAR:-default}`
* fix inconsequential typo in `imds-net-sync`
2.1.1
2022-10-16 21:48:05 +00:00
Stefan Reimer
1e49b7f212 fix: remove extra ']', removes of /] after first boot. 2022-09-27 15:03:21 +00:00