Commit Graph

263 Commits

Author SHA1 Message Date
Сашка724ая
dbef490b03
common: fix unshare chroot /dev symlinks
Fixes invalid symlink paths for /dev/fd, /dev/stderr, /dev/stdin, /dev/stdout in arch-chroot when run in unshare mode.

Signed-off-by: Aleksandr Ksenofontov <github@sashok724.net>
2023-09-05 10:26:55 +10:00
Morten Linderud
a5b772db02
genfstab: ensure swap devices adhere to -f
Signed-off-by: Morten Linderud <morten@linderud.pw>
2023-05-26 17:01:25 +02:00
Morten Linderud
8ef909063c
Merge remote-tracking branch 'origin/pull/51'
* origin/pull/51:
  pacstrap: silence "only applied to the deepest dir"
  arch-chroot: split variable declaration and assignment
  Add gitlab-ci based on the mkinitcpio one
  Add .editorconfig, from mkinitcpio
  tests: silence "referenced but not assigned" warnings
  tests: remove non-applicable ${1} handling
  common: split genfstab only helpers
  common: quote all arguments
  common: disable shellcheck SC2059
  common: remove unused msg2()
  common: remove unused is_array()
2023-05-05 22:10:12 +02:00
Emil Velikov
3abde514b4 pacstrap: silence "only applied to the deepest dir"
Shellcheck warns that only the deepest directory created will have the
requested permissions. That's fine - this is exactly what we want.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2023-05-03 13:46:34 +01:00
Emil Velikov
abef18a432 arch-chroot: split variable declaration and assignment
As suggested by shellcheck:

In arch-chroot line 164:
  local src=$(resolve_link /etc/resolv.conf)
        ^-^ SC2155 (warning): Declare and assign separately to avoid masking return values.

In arch-chroot line 165:
  local dest=$(resolve_link "$chrootdir/etc/resolv.conf" "$chrootdir")
        ^--^ SC2155 (warning): Declare and assign separately to avoid masking return values.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2023-05-03 13:46:34 +01:00
Emil Velikov
45a2073e33 Add gitlab-ci based on the mkinitcpio one
The in-tree config was seemingly never tested, since it fails loudly.
Copy/paste the mkinitcpio one and drop the non-applicable bat/coverage
sections.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2023-05-03 13:46:34 +01:00
Emil Velikov
d05e136ac2 Add .editorconfig, from mkinitcpio
Direct copy from mkinitcpio.

Note that the in-tree code-base consistently uses 2 space and redoing
that will be done at misc later point.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2023-05-03 13:46:34 +01:00
Emil Velikov
12733c86cb tests: silence "referenced but not assigned" warnings
The optstring* helpers do the assignment, which isn't particularly easy
for shellcheck to deduce. So silence the warnings.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2023-05-03 13:46:34 +01:00
Emil Velikov
3d05834dba tests: remove non-applicable ${1} handling
The arg was never set. Furthermore as-is shellcheck cannot realistically
evaluate the included source.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2023-05-03 13:46:34 +01:00
Emil Velikov
0c848b83b5 common: split genfstab only helpers
v2: drop warning and msg from fstab-helpers

v3: drop m4 -> sed conversion

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2023-05-03 13:46:15 +01:00
Emil Velikov
9f5888d4f2 common: quote all arguments
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2023-05-01 11:32:26 +01:00
Emil Velikov
b4490d003e common: disable shellcheck SC2059
As the inline comment says, the arguments are the actual modifiers.
Shout out to YHNdnzj for spotting this o/

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2023-05-01 11:32:26 +01:00
Emil Velikov
c239649760 common: remove unused msg2()
The function has been unused ever since it was introduced

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2023-05-01 11:32:26 +01:00
Emil Velikov
77e0895696 common: remove unused is_array()
The function hasn't been in use for a number of years.

Cc: Dave Reisner <dreisner@archlinux.org>
Fixes: b240f6e ("common: declare pseudofs types as hash")
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2023-05-01 11:32:26 +01:00
Morten Linderud
77c3cc7c1b
Merge remote-tracking branch 'origin/pull/50'
* origin/pull/50:
  arch-chroot: add option to preserve the chroot resolv.conf
2023-04-02 01:24:25 +02:00
Emil Velikov
aeaecf5ae5 arch-chroot: add option to preserve the chroot resolv.conf
There is a comprehensive inline comment about why we're touching the
chroot resolv.conf. Although it does not consider the cases where:
 - the link may be broken for specific reasons, and/or
 - working resolver within the chroot is not wanted

v2:
 - flip the condition check

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2023-03-29 21:28:31 +01:00
Morten Linderud
7e4e1c1bbf
Merge remote-tracking branch 'origin/pull/49'
* origin/pull/49:
  pacstrap: error out earlier, on invalid directory
  pacstrap: delay selecting chroot/unshare setup
  pacstrap: stop interleaving functions and sequential code
  pacstrap: move include_m4 after the globals
  genfstab: reshuffle while read loop
  arch-chroot: delay selecting chroot/unshare setup
  arch-chroot: stop interleaving functions and sequential code
  arch-chroot: move include_m4 after the globals
2023-03-29 20:44:23 +02:00
Morten Linderud
0feec4a50a
common: ensure /run is mounted with --make-private
udev doesn't work in the chroot which prevents some tools like lsblk to
retrieve the UUID of devices. This can be a bit problematic so instead
of having /run mounted as a tmpfs, do a bind-mound from the rootfs and
include `--make-private`.

This is similar to the previous implemention.

Fixes https://github.com/archlinux/arch-install-scripts/issues/24
Fixes https://github.com/archlinux/arch-install-scripts/pull/26
2023-03-26 20:03:51 +02:00
Emil Velikov
c72a394de7 pacstrap: error out earlier, on invalid directory
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2023-03-26 19:03:33 +01:00
Emil Velikov
8af3fa3b8e pacstrap: delay selecting chroot/unshare setup
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2023-03-26 19:03:33 +01:00
Emil Velikov
c911fbf92a pacstrap: stop interleaving functions and sequential code
Makes it easier to reason about the code.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2023-03-26 19:03:33 +01:00
Emil Velikov
6c68163d4b pacstrap: move include_m4 after the globals
After the m4 substitution, the globals end up mixed misc functions.
Just keep them at the top for legibility.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2023-03-26 19:03:33 +01:00
Emil Velikov
b07a1578d9 genfstab: reshuffle while read loop
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2023-03-26 19:03:33 +01:00
Emil Velikov
3a8e3de608 arch-chroot: delay selecting chroot/unshare setup
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2023-03-26 19:03:32 +01:00
Emil Velikov
a6765cc5c4 arch-chroot: stop interleaving functions and sequential code
Makes it easier to reason about the code.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2023-03-26 18:52:34 +01:00
Emil Velikov
7101c552a0 arch-chroot: move include_m4 after the globals
After the m4 substitution, the globals end up mixed misc functions.
Just keep them at the top for legibility.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2023-03-26 18:52:34 +01:00
Morten Linderud
f5acbb9058
Merge remote-tracking branch 'origin/pull/48'
* origin/pull/48:
  zsh: pacstrap bring it up-to date
  zsh: genfstab bring it up-to date
  zsh: arch-chroot bring it up-to date
  zsh: simplify arch-chroot and genfstab completion
  zsh: split completion into separate files
  make: move bash/zsh completions to separate directories
2023-03-26 19:41:43 +02:00
Morten Linderud
bc2a9a7cae
Merge remote-tracking branch 'origin/pull/47'
* origin/pull/47:
  make: add shellcheck target
  make: add more PHONY targets
  make: remove dummy uninstall target
2023-03-26 19:40:26 +02:00
Morten Linderud
c465332a17
Merge remote-tracking branch 'origin/pull/44'
* origin/pull/44:
  genfstab: remove atgc mount option
2023-03-26 19:40:09 +02:00
Morten Linderud
be937006c8
Merge remote-tracking branch 'origin/pull/45'
* origin/pull/45:
  ci: update differential-shellcheck
2023-03-26 19:39:46 +02:00
Emil Velikov
20a193d5b1 zsh: pacstrap bring it up-to date
Copy/pasta all the new options that have landed over the years.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2023-03-26 17:13:06 +01:00
Emil Velikov
a9768a0c45 zsh: genfstab bring it up-to date
Add the -f(ilter) and -t(ag) options. The latter being mutually
exclusive with -L/-U.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2023-03-26 17:13:06 +01:00
Emil Velikov
1ad274a58e zsh: arch-chroot bring it up-to date
Add -N (simple flag) -u (user/group), plus new directory and command
handling. The vast chunk of these are borrowed by the chroot completion,
as the inline comment indicates.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2023-03-26 17:13:06 +01:00
Emil Velikov
1f8a62bf0b zsh: simplify arch-chroot and genfstab completion
This will allow us to easily update and keep up-to date these two. The
final pacstrap one is fairly hairy and will be dealt with another time.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2023-03-26 17:13:06 +01:00
Emil Velikov
86088c21b1 zsh: split completion into separate files
The current file is borderline impossible to manage by zsh completion
noobies. Split it up for now, where follow-up commits will simplify
things.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2023-03-26 17:13:06 +01:00
Emil Velikov
6468bafc5e make: move bash/zsh completions to separate directories
Consequently, simplify the install target.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2023-03-26 17:13:06 +01:00
Emil Velikov
4b782e25ef make: add shellcheck target
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2023-03-26 17:08:19 +01:00
Emil Velikov
5520c61fb0 make: add more PHONY targets
The man and check targets were missing from the list

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2023-03-26 17:05:46 +01:00
Emil Velikov
06f697e3ae make: remove dummy uninstall target
The target does nothing, so we might as well remove it.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2023-03-26 17:05:46 +01:00
Mike Yuan
f06deaaf26
ci: update differential-shellcheck
See also: https://github.com/redhat-plumbers-in-action/differential-shellcheck/issues/215
2023-03-26 18:19:37 +08:00
Mike Yuan
ad778b6f74
genfstab: remove atgc mount option
This is not changeable during remount,
so let's not include it automatically.
Users who want this feature should turn
to ArchWiki for help[1].

[1] https://wiki.archlinux.org/title/F2FS#Recommended_mount_options

See also: https://github.com/systemd/systemd/issues/26763
2023-03-12 06:42:45 +08:00
Morten Linderud
560c00c9c2
Merge remote-tracking branch 'origin/pull/37'
* origin/pull/37:
  Add shellcheck GitLab CI
  Add Differential ShellCheck GitHub Workflow
2023-03-02 21:03:24 +01:00
Morten Linderud
2d1d4904b9
Merge commit 'refs/pull/42/head' of github.com:archlinux/arch-install-scripts
* github.com:archlinux/arch-install-scripts:
  common: avoid variable name conflict with genfstab
2023-01-25 13:47:01 +01:00
Mike Yuan
4a83825a9d
common: avoid variable name conflict with genfstab 2023-01-21 22:58:25 +08:00
Mike Yuan
326153e211
Add shellcheck GitLab CI 2022-11-24 03:17:22 +08:00
Mike Yuan
f98c5d8268
Add Differential ShellCheck GitHub Workflow
It would run on pull requests only, so please avoid
pushing to master branch directly.
2022-11-24 02:08:19 +08:00
Morten Linderud
4802e1197e
Merge branch 'pr-36' 2022-11-20 14:59:40 +01:00
Morten Linderud
4457e31ee3
Merge branch 'pr-33' 2022-11-20 14:56:54 +01:00
Morten Linderud
a2ed5bb493
Merge branch 'pr-27' 2022-11-20 14:55:31 +01:00
Mike Yuan
added92801
genfstab: remove subvolid= from btrfs options if subvol= is set
Having only one of subvol= and subvolid= is enough for mounting a btrfs subvolume
And having subvolid= set prevents things like 'snapper rollback' to work, as it
updates the subvolume in-place, leaving subvol= unchanged with a different subvolid.
2022-11-20 18:08:23 +08:00