mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
Merge pull request #8456 from drinkcat/cicd-utmp
.github/workflows/CICD.yml: Create a fully fake utmp
This commit is contained in:
+14
-10
@@ -718,11 +718,13 @@ jobs:
|
||||
sudo apt-get -y update
|
||||
sudo apt-get -y install libselinux1-dev
|
||||
# pinky is a tool to show logged-in users from utmp, and gecos fields from /etc/passwd.
|
||||
# In GitHub Action *nix VMs, no accounts log in, even the "runner" account that runs the commands. The account also has empty gecos fields.
|
||||
# To work around this for pinky tests, we create a fake login entry for the GH runner account...
|
||||
FAKE_UTMP='[7] [999999] [tty2] [runner] [tty2] [] [0.0.0.0] [2022-02-22T22:22:22,222222+00:00]'
|
||||
# ... by dumping the login records, adding our fake line, then reverse dumping ...
|
||||
(utmpdump /var/run/utmp ; echo $FAKE_UTMP) | sudo utmpdump -r -o /var/run/utmp
|
||||
# In GitHub Action *nix VMs, no accounts log in, even the "runner" account that runs the commands, and "system boot" entry is missing.
|
||||
# The account also has empty gecos fields.
|
||||
# To work around these issues for pinky (and who) tests, we create a fake utmp file with a
|
||||
# system boot entry and a login entry for the GH runner account.
|
||||
FAKE_UTMP_2='[2] [00000] [~~ ] [reboot] [~ ] [6.0.0-test] [0.0.0.0] [2022-02-22T22:11:22,222222+00:00]'
|
||||
FAKE_UTMP_7='[7] [999999] [tty2] [runner] [tty2] [ ] [0.0.0.0] [2022-02-22T22:22:22,222222+00:00]'
|
||||
(echo "$FAKE_UTMP_2" ; echo "$FAKE_UTMP_7") | sudo utmpdump -r -o /var/run/utmp
|
||||
# ... and add a full name to each account with a gecos field but no full name.
|
||||
sudo sed -i 's/:,/:runner name,/' /etc/passwd
|
||||
# We also create a couple optional files pinky looks for
|
||||
@@ -1090,11 +1092,13 @@ jobs:
|
||||
ubuntu-latest)
|
||||
sudo apt-get -y update ; sudo apt-get -y install libselinux1-dev
|
||||
# pinky is a tool to show logged-in users from utmp, and gecos fields from /etc/passwd.
|
||||
# In GitHub Action *nix VMs, no accounts log in, even the "runner" account that runs the commands. The account also has empty gecos fields.
|
||||
# To work around this for pinky tests, we create a fake login entry for the GH runner account...
|
||||
FAKE_UTMP='[7] [999999] [tty2] [runner] [tty2] [] [0.0.0.0] [2022-02-22T22:22:22,222222+00:00]'
|
||||
# ... by dumping the login records, adding our fake line, then reverse dumping ...
|
||||
(utmpdump /var/run/utmp ; echo $FAKE_UTMP) | sudo utmpdump -r -o /var/run/utmp
|
||||
# In GitHub Action *nix VMs, no accounts log in, even the "runner" account that runs the commands, and "system boot" entry is missing.
|
||||
# The account also has empty gecos fields.
|
||||
# To work around these issues for pinky (and who) tests, we create a fake utmp file with a
|
||||
# system boot entry and a login entry for the GH runner account.
|
||||
FAKE_UTMP_2='[2] [00000] [~~ ] [reboot] [~ ] [6.0.0-test] [0.0.0.0] [2022-02-22T22:11:22,222222+00:00]'
|
||||
FAKE_UTMP_7='[7] [999999] [tty2] [runner] [tty2] [ ] [0.0.0.0] [2022-02-22T22:22:22,222222+00:00]'
|
||||
(echo "$FAKE_UTMP_2" ; echo "$FAKE_UTMP_7") | sudo utmpdump -r -o /var/run/utmp
|
||||
# ... and add a full name to each account with a gecos field but no full name.
|
||||
sudo sed -i 's/:,/:runner name,/' /etc/passwd
|
||||
# We also create a couple optional files pinky looks for
|
||||
|
||||
Reference in New Issue
Block a user