Skip to content

Commit 00254ff

Browse files
authored
Merge pull request #3 from grahampugh/testauth
Testauth
2 parents 864a96c + a3ee49e commit 00254ff

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

autopkg-setup.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ installCommandLineTools() {
8181
if [[ ${cmd_line_tools} ]]; then
8282
echo "Download found - installing"
8383
softwareupdate -i "$cmd_line_tools" --verbose
84+
# 35:43: syntax error: A identifier can’t go after this “"”. (-2740)
85+
# /usr/bin/osascript -e 'do shell script "softwareupdate -i "'"$cmd_line_tools"'" --verbose" with administrator privileges'
8486
else
8587
echo "Download not found"
8688
fi
@@ -111,7 +113,15 @@ installAutoPkg() {
111113
echo "### Installing AutoPkg..."
112114
echo "ALERT: REQUIRES ADMIN RIGHTS - please enter account password"
113115
echo
114-
sudo installer -pkg "/tmp/autopkg-latest.pkg" -target /
116+
echo "### Prompting for administrator credentials to install AutoPkg..."
117+
if [[ $native_prompt == "yes" ]]; then
118+
# Use native prompt if requested
119+
/usr/bin/osascript -e 'do shell script "installer -pkg /tmp/autopkg-latest.pkg -target /" with administrator privileges'
120+
else
121+
# Use sudo prompt
122+
echo "Please enter your administrator password to install AutoPkg."
123+
sudo installer -pkg /tmp/autopkg-latest.pkg -target /
124+
fi
115125

116126
autopkg_version=$(${AUTOPKG} version)
117127

@@ -251,6 +261,8 @@ do
251261
case "$1" in
252262
-f|--force) force_autopkg_update="yes"
253263
;;
264+
--prompt) native_prompt="yes"
265+
;;
254266
-b|--beta)
255267
force_autopkg_update="yes"
256268
use_beta="yes"

0 commit comments

Comments
 (0)