Skip to content

Commit

Permalink
fix: use sudo only when it is nesessarily
Browse files Browse the repository at this point in the history
  • Loading branch information
bonyuta0204 committed Oct 24, 2023
1 parent 4aad710 commit 701b9a3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,7 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2

- name: Run the installer (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: sudo ./install.sh

- name: Run the installer (macOS)
if: matrix.os == 'macos-latest'
- name: Run the installer
run: ./install.sh

- name: Run test script
Expand Down
12 changes: 4 additions & 8 deletions installers/apt/essentials.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
#!/bin/bash
set -ex
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
set -eu

# Set environment variables to non-interactive (this prevents some prompts)
export DEBIAN_FRONTEND=non-interactive

apt-install(){
apt-get -y install $@
sudo apt-get -y install $@
}

apt-add-repo(){
apt-add-repository -y $@
sudo apt-add-repository -y $@
}
apt-get update
sudo apt-get update
## apt-add-repo is included in software-properties-common
apt-install software-properties-common

Expand Down

0 comments on commit 701b9a3

Please sign in to comment.