mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2025-12-20 06:29:50 +00:00
[ubuntu] fix user on rust and brew scripts (#1907)
* fix user on rust and brew scripts * set user on a factory stage * get last user from /etc/passwd Co-authored-by: Leonid Lapshin <originalnoe-nazvanie@yandex.ru>
This commit is contained in:
@@ -2,10 +2,13 @@
|
|||||||
|
|
||||||
# Fix permissions for Homebrew
|
# Fix permissions for Homebrew
|
||||||
# https://github.com/actions/virtual-environments/issues/1568
|
# https://github.com/actions/virtual-environments/issues/1568
|
||||||
|
|
||||||
brew_folder="/home/linuxbrew/"
|
brew_folder="/home/linuxbrew/"
|
||||||
|
homebrew_user=$(cut -d: -f1 /etc/passwd | tail -1)
|
||||||
|
|
||||||
if [ -d "$brew_folder" ]; then
|
if [ -d "$brew_folder" ]; then
|
||||||
brew_folder_owner=$(ls -ld $brew_folder | awk '{print $3}')
|
brew_folder_owner=$(ls -ld $brew_folder | awk '{print $3}')
|
||||||
if [ "$USER" != "$brew_folder_owner" ]; then
|
if [ "$homebrew_user" != "$brew_folder_owner" ]; then
|
||||||
chown "$USER":docker -R $brew_folder
|
chown "$homebrew_user":docker -R $brew_folder
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -2,10 +2,13 @@
|
|||||||
|
|
||||||
# Fix permissions for the Rust folder
|
# Fix permissions for the Rust folder
|
||||||
# https://github.com/actions/virtual-environments/issues/572
|
# https://github.com/actions/virtual-environments/issues/572
|
||||||
|
|
||||||
rust_folder="/usr/share/rust"
|
rust_folder="/usr/share/rust"
|
||||||
|
rust_user=$(cut -d: -f1 /etc/passwd | tail -1)
|
||||||
|
|
||||||
if [ -d "$rust_folder" ]; then
|
if [ -d "$rust_folder" ]; then
|
||||||
rust_folder_owner=$(ls -ld $rust_folder | awk '{print $3}')
|
rust_folder_owner=$(ls -ld $rust_folder | awk '{print $3}')
|
||||||
if [ "$USER" != "$rust_folder_owner" ]; then
|
if [ "$rust_user" != "$rust_folder_owner" ]; then
|
||||||
chown "$USER":docker -R $rust_folder
|
chown "$rust_user":docker -R $rust_folder
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user