Skip to content

Commit

Permalink
fix sudo issue on ubuntu
Browse files Browse the repository at this point in the history
  • Loading branch information
CollieIsCute committed Feb 19, 2025
1 parent 9ad4496 commit bfab774
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions .github/workflows/test-distros.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,30 @@ jobs:
- name: Prepare environment
run: |
if command -v apt-get >/dev/null; then
sudo apt-get update
sudo apt-get install -y sudo git curl
if [ "$(id -u)" = "0" ]; then
apt-get update
apt-get install -y sudo git curl
else
sudo apt-get update
sudo apt-get install -y sudo git curl
fi
if ! command -v chezmoi >/dev/null; then
sh -c "$(curl -fsLS get.chezmoi.io)" -- -b /usr/local/bin
fi
elif command -v pacman >/dev/null; then
if ! command -v sudo > /dev/null; then
if ! command -v sudo >/dev/null; then
pacman -Syu --noconfirm sudo
fi
sudo pacman -Syu --noconfirm git chezmoi
sudo pacman -Syu --noconfirm git chezmoi curl
else
exit 1
fi
sudo useradd -m dev || true
echo "dev ALL=(ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/dev
- name: chezmoi init dotfiles
run: |
sudo -u dev chezmoi init --apply collieiscute -v
if command -v sudo >/dev/null; then
sudo -u dev chezmoi init --apply collieiscute -v
else
su dev -c 'chezmoi init --apply collieiscute -v'
fi

0 comments on commit bfab774

Please sign in to comment.