Skip to content

Commit

Permalink
Enable unattended setup
Browse files Browse the repository at this point in the history
  • Loading branch information
almirsarajcic committed Sep 20, 2024
1 parent 01fc1ba commit d2060f4
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/github_workflows.ex
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,17 @@ defmodule GithubWorkflows do
]
]
) ++
if(os == "Linux",
do: [],
else: [
[
name: "Disable password prompt for macOS",
if: "steps.result_cache.outputs.cache-hit != 'true'",
run:
~S<sudo sed -i "" "s/%admin ALL = (ALL) ALL/%admin ALL = (ALL) NOPASSWD: ALL/g" /etc/sudoers>
]
]
) ++
[
[
name: "Install expect tool",
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,9 @@ jobs:
with:
key: ${{ runner.os }}-bash-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/static/macOS.sh') }}
path: priv/static/macOS.sh
- name: Disable password prompt for macOS
if: steps.result_cache.outputs.cache-hit != 'true'
run: 'sudo sed -i "" "s/%admin ALL = (ALL) ALL/%admin ALL = (ALL) NOPASSWD: ALL/g" /etc/sudoers'
- name: Install expect tool
if: steps.result_cache.outputs.cache-hit != 'true'
run: brew install expect
Expand Down Expand Up @@ -391,6 +394,9 @@ jobs:
- name: Install shell
if: steps.result_cache.outputs.cache-hit != 'true'
run: brew install zsh
- name: Disable password prompt for macOS
if: steps.result_cache.outputs.cache-hit != 'true'
run: 'sudo sed -i "" "s/%admin ALL = (ALL) ALL/%admin ALL = (ALL) NOPASSWD: ALL/g" /etc/sudoers'
- name: Install expect tool
if: steps.result_cache.outputs.cache-hit != 'true'
run: brew install expect
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,9 @@ jobs:
with:
key: ${{ runner.os }}-bash-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/static/macOS.sh') }}
path: priv/static/macOS.sh
- name: Disable password prompt for macOS
if: steps.result_cache.outputs.cache-hit != 'true'
run: 'sudo sed -i "" "s/%admin ALL = (ALL) ALL/%admin ALL = (ALL) NOPASSWD: ALL/g" /etc/sudoers'
- name: Install expect tool
if: steps.result_cache.outputs.cache-hit != 'true'
run: brew install expect
Expand Down Expand Up @@ -395,6 +398,9 @@ jobs:
- name: Install shell
if: steps.result_cache.outputs.cache-hit != 'true'
run: brew install zsh
- name: Disable password prompt for macOS
if: steps.result_cache.outputs.cache-hit != 'true'
run: 'sudo sed -i "" "s/%admin ALL = (ALL) ALL/%admin ALL = (ALL) NOPASSWD: ALL/g" /etc/sudoers'
- name: Install expect tool
if: steps.result_cache.outputs.cache-hit != 'true'
run: brew install expect
Expand Down
10 changes: 10 additions & 0 deletions priv/static/Linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,16 @@ maybe_install() {
add_env() {
printf "\n"

# Ask for sudo password upfront
sudo -v

# Keep sudo alive
while true; do
sudo -n true
sleep 60
kill -0 "$$" || exit
done 2>/dev/null &

printf "${white}\n"
sleep 1.5
maybe_install "mise"
Expand Down
10 changes: 10 additions & 0 deletions priv/static/macOS.sh
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,16 @@ maybe_install() {
add_env() {
printf "\n"

# Ask for sudo password upfront
sudo -v

# Keep sudo alive
while true; do
sudo -n true
sleep 60
kill -0 "$$" || exit
done 2>/dev/null &

printf "${white}\n"
sleep 1.5
maybe_install "Xcode Command Line Tools"
Expand Down

0 comments on commit d2060f4

Please sign in to comment.