mirror of
https://github.com/mtan93/Installomator.git
synced 2026-04-16 22:05:23 +01:00
does not download swiftui if it is already there
This commit is contained in:
@@ -24,6 +24,7 @@ fakeInstallDelay=5
|
|||||||
items=(
|
items=(
|
||||||
"firefoxpkg|Firefox"
|
"firefoxpkg|Firefox"
|
||||||
"googlechromepkg|Google Chrome"
|
"googlechromepkg|Google Chrome"
|
||||||
|
"microsoftoffice365|Microsoft Office 365"
|
||||||
)
|
)
|
||||||
|
|
||||||
# MARK: Constants
|
# MARK: Constants
|
||||||
@@ -66,9 +67,6 @@ dialogActivate() {
|
|||||||
progressUpdate() {
|
progressUpdate() {
|
||||||
# $1: progress text (optional)
|
# $1: progress text (optional)
|
||||||
local text=$1
|
local text=$1
|
||||||
progressindex=$((progressindex + 1))
|
|
||||||
dialogUpdate "progress: $progressindex"
|
|
||||||
echo $progressindex > $progressIndexPath
|
|
||||||
if [[ -n $text ]]; then
|
if [[ -n $text ]]; then
|
||||||
dialogUpdate "progresstext: $text"
|
dialogUpdate "progresstext: $text"
|
||||||
fi
|
fi
|
||||||
@@ -78,7 +76,6 @@ startItem() {
|
|||||||
local description=$1
|
local description=$1
|
||||||
|
|
||||||
echo "Starting Item: $description"
|
echo "Starting Item: $description"
|
||||||
echo $description > $currentItemPath
|
|
||||||
dialogUpdate "listitem: $description: wait"
|
dialogUpdate "listitem: $description: wait"
|
||||||
progressUpdate $description
|
progressUpdate $description
|
||||||
}
|
}
|
||||||
@@ -88,7 +85,6 @@ completeItem() {
|
|||||||
local itemStatus=$2
|
local itemStatus=$2
|
||||||
|
|
||||||
dialogUpdate "listitem: $description: $itemStatus"
|
dialogUpdate "listitem: $description: $itemStatus"
|
||||||
echo "$description: $itemStatus" >> $completedItemsPath
|
|
||||||
echo "completed item $description: $itemStatus"
|
echo "completed item $description: $itemStatus"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,15 +134,10 @@ cleanupAndExit() {
|
|||||||
rm -rf $tmpDir
|
rm -rf $tmpDir
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# remove dialog command file
|
# # remove dialog command file
|
||||||
if [[ -e $dialog_command_file ]]; then
|
# if [[ -e $dialog_command_file ]]; then
|
||||||
rm $dialog_command_file
|
# rm $dialog_command_file
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
# remove completed Items file
|
|
||||||
if [[ -e $completedItemsPath ]]; then
|
|
||||||
rm $completedItemsPath
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
checkInstallomator() {
|
checkInstallomator() {
|
||||||
@@ -199,6 +190,12 @@ checkInstallomator() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
checkSwiftDialog() {
|
||||||
|
if [[ ! -x $dialog ]]; then
|
||||||
|
installomator swiftdialog "Swift Dialog"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# MARK: sanity checks
|
# MARK: sanity checks
|
||||||
|
|
||||||
@@ -217,7 +214,6 @@ fi
|
|||||||
|
|
||||||
# MARK: Setup
|
# MARK: Setup
|
||||||
|
|
||||||
|
|
||||||
# No sleeping
|
# No sleeping
|
||||||
caffeinate -dimsu & caffeinatePID=$!
|
caffeinate -dimsu & caffeinatePID=$!
|
||||||
|
|
||||||
@@ -227,14 +223,8 @@ trap cleanupAndExit EXIT
|
|||||||
# get a temp
|
# get a temp
|
||||||
tmpDir=$(mktemp -d)
|
tmpDir=$(mktemp -d)
|
||||||
|
|
||||||
completedItemsPath=$tmpDir/completedItems.txt
|
|
||||||
currentItemPath=$tmpDir/currentItem.txt
|
|
||||||
progressIndexPath=$tmpDir/progressIndexPath.txt
|
|
||||||
|
|
||||||
# setup first list
|
# setup first list
|
||||||
itemCount=${#items}
|
itemCount=${#items}
|
||||||
progressCount=$((item + 2))
|
|
||||||
progressindex=0
|
|
||||||
|
|
||||||
listitems=( "--listitem" "Configure Tools" )
|
listitems=( "--listitem" "Configure Tools" )
|
||||||
|
|
||||||
@@ -250,7 +240,7 @@ checkInstallomator
|
|||||||
|
|
||||||
# download and install Swift Dialog
|
# download and install Swift Dialog
|
||||||
echo "installing Swift Dialog"
|
echo "installing Swift Dialog"
|
||||||
installomator swiftdialog
|
checkSwiftDialog
|
||||||
|
|
||||||
# display first screen
|
# display first screen
|
||||||
$dialog --title "Configuring your Mac" \
|
$dialog --title "Configuring your Mac" \
|
||||||
|
|||||||
@@ -117,12 +117,12 @@ printlog(){
|
|||||||
while IFS= read -r logmessage; do
|
while IFS= read -r logmessage; do
|
||||||
if [[ "$(whoami)" == "root" ]]; then
|
if [[ "$(whoami)" == "root" ]]; then
|
||||||
echo "$timestamp" : "${log_priority}${space_char} : $label : ${logmessage}" | tee -a $log_location
|
echo "$timestamp" : "${log_priority}${space_char} : $label : ${logmessage}" | tee -a $log_location
|
||||||
updateDialogProgressText "${logmessage}" "$DIALOGCMDFILE"
|
updateDialogProgressText "${logmessage}"
|
||||||
updateDialogProgress "increment" "$DIALOGCMDFILE"
|
# updateDialogProgress "increment"
|
||||||
else
|
else
|
||||||
echo "$timestamp" : "${log_priority}${space_char} : $label : ${logmessage}"
|
echo "$timestamp" : "${log_priority}${space_char} : $label : ${logmessage}"
|
||||||
updateDialogProgressText "${logmessage}" "$DIALOGCMDFILE"
|
updateDialogProgressText "${logmessage}"
|
||||||
updateDialogProgress "increment" "$DIALOGCMDFILE"
|
# updateDialogProgress "increment"
|
||||||
fi
|
fi
|
||||||
done <<< "$log_message"
|
done <<< "$log_message"
|
||||||
fi
|
fi
|
||||||
@@ -830,7 +830,7 @@ runUpdateTool() {
|
|||||||
finishing() {
|
finishing() {
|
||||||
printlog "Finishing..."
|
printlog "Finishing..."
|
||||||
if [[ $DIALOG_PROGRESS == "main" || $DIALOG_PROGRESS == "list" ]]; then
|
if [[ $DIALOG_PROGRESS == "main" || $DIALOG_PROGRESS == "list" ]]; then
|
||||||
updateDialogProgress "complete" "$DIALOGCMDFILE"
|
updateDialogProgress "complete"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sleep 5 # wait a moment to let spotlight catch up
|
sleep 5 # wait a moment to let spotlight catch up
|
||||||
@@ -911,9 +911,20 @@ readDownloadPipe() {
|
|||||||
local log=${2:-$DIALOG_CMD_FILE}
|
local log=${2:-$DIALOG_CMD_FILE}
|
||||||
# set up read from pipe
|
# set up read from pipe
|
||||||
while IFS= read -k 1 -u 0 char; do
|
while IFS= read -k 1 -u 0 char; do
|
||||||
[[ $char =~ [0-9] ]] && keep=1 ;
|
if [[ $char =~ [0-9] ]]; then
|
||||||
[[ $char == % ]] && updateDialogProgressText "Downloading - $progress%" $log && updateDialogProgress "$progress" $log && progress="" && keep=0 ;
|
keep=1
|
||||||
[[ $keep == 1 ]] && progress="$progress$char" ;
|
fi
|
||||||
|
|
||||||
|
if [[ $char == % ]]; then
|
||||||
|
updateDialogProgressText "Downloading $name - $progress%"
|
||||||
|
updateDialogProgress "$progress"
|
||||||
|
progress=""
|
||||||
|
keep=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $keep == 1 ]]; then
|
||||||
|
progress="$progress$char"
|
||||||
|
fi
|
||||||
done < $pipe
|
done < $pipe
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ else
|
|||||||
initNamedPipe create $pipe
|
initNamedPipe create $pipe
|
||||||
|
|
||||||
# run the pipe read in the background
|
# run the pipe read in the background
|
||||||
readDownloadPipe $pipe "$DIALOGCMDFILE" & downloadPipePID=$!
|
readDownloadPipe $pipe "$DIALOG_CMD_FILE" & downloadPipePID=$!
|
||||||
|
|
||||||
# curl (extract - line in "# MARK: download the archive" of Installomator.sh)
|
# curl (extract - line in "# MARK: download the archive" of Installomator.sh)
|
||||||
curlDownload=$(curl -fL -# --show-error ${curlOptions} "$downloadURL" -o "$archiveName" 2>&1 | tee $pipe)
|
curlDownload=$(curl -fL -# --show-error ${curlOptions} "$downloadURL" -o "$archiveName" 2>&1 | tee $pipe)
|
||||||
|
|||||||
Reference in New Issue
Block a user