Skip to content

fix sudo issue on ubuntu #16

fix sudo issue on ubuntu

fix sudo issue on ubuntu #16

Workflow file for this run

name: Test Dotfiles on Different OS
on:
push:
branches: [ main ]
pull_request:
concurrency:
group: dotfiles-tests-${{ github.ref }}
cancel-in-progress: true
jobs:
dotfiles-test:
name: ${{ matrix.container }}-test
runs-on: ubuntu-latest
continue-on-error: true
strategy:
matrix:
container: ["manjarolinux/base:latest", "archlinux:latest", "ubuntu:latest", "ubuntu:20.04", "ubuntu:22.04"]
container:
image: ${{ matrix.container }}
env:
USER: dev
HOME: /home/dev
CHEZMOI_VERBOSE: 1
steps:
- name: Prepare environment
run: |
if command -v apt-get >/dev/null; then
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
pacman -Syu --noconfirm sudo
fi
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: |
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