Skip to content

Commit 2c3dcf3

Browse files
rqptrq
and
rq
authored
Doas sudo check (#25)
* Use doas to set permissions if sudo does not exist * fix indentation --------- Co-authored-by: rq <ernstvermeulen@proton.me>
1 parent 42fb5e4 commit 2c3dcf3

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

resources/scripts/php.sh

+12-3
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,22 @@ NC='\033[0m'
3131

3232
echo ""
3333

34-
if sudo -n true 2>/dev/null; then
35-
sudo chown -R $USER: .
34+
if command -v doas &>/dev/null; then
35+
SUDO="doas"
36+
elif command -v sudo &>/dev/null; then
37+
SUDO="sudo"
38+
else
39+
echo "Neither sudo nor doas is available. Exiting."
40+
exit 1
41+
fi
42+
43+
if $SUDO -n true 2>/dev/null; then
44+
$SUDO chown -R $USER: .
3645
echo -e "${BOLD}Get started with:${NC} cd {{ name }} && ./vendor/bin/sail up"
3746
else
3847
echo -e "${BOLD}Please provide your password so we can make some final adjustments to your application's permissions.${NC}"
3948
echo ""
40-
sudo chown -R $USER: .
49+
$SUDO chown -R $USER: .
4150
echo ""
4251
echo -e "${BOLD}Thank you! We hope you build something incredible. Dive in with:${NC} cd {{ name }} && ./vendor/bin/sail up"
4352
fi

0 commit comments

Comments
 (0)