Jump to content
wolfmannight

Create legit copy of macOS from apple catalog

10 posts in this topic

Recommended Posts

Posted (edited)

If you are in 10.14.0 you will not longer able to download legit copy of macOS from Apple store.

It's download and install as system update.

 

Here is script to generate >5GB installer and also create bootable USB media.

I'm sharing code of script and if you wanna get executable download from attachment.

 

If you can more optimise the code you are welcomed.

 

You also can also download macOS 10.15 when it will be available.

 

after downloading attachment in terminal type:

chmod a+x /path/to/downloaded/file

1.png.814d9f516d98015f5c7e1d453f2a0a0e.png

 

#!/bin/bash

# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The {censored} You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://www.wtfpl.net/ for more details. */

# One more contribution to open source world.

# Note: try to reduce lines and add more features
#       you will be add in contribute area.


# Global functions
print() { printf -- "$1\n"; }
log() { printf -- "\033[37m LOG: $1 \033[0m\n"; }
success() { printf -- "\033[32m SUCCESS: $1 \033[0m\n"; }
warning() { printf -- "\033[33m WARNING: $1 \033[0m\n"; }
error() { printf -- "\033[31m ERROR: $1 \033[0m\n"; }
heading() { printf -- "   \033[1;30;42m $1 \033[0m\n\n"; }
newUiPage() {
  clear
  echo "---------------------------------------------------"
  echo "-       macOS Legit Copy Downloader v1.0.1        -"
  echo "-                By Hanger1 (H1)                  -"
  echo "---------------------------------------------------"
  echo " Contributor: ricoc90"
  echo " "
  echo " "
}


# Global Variables
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
tmpDir="$DIR"
srcDir="$DIR/macOSsrc"

# Prgram functions
downloadAndParseCatalog(){

    # Download catalog file from apple server
    #-------------------------------
    print "\nLoading macOS catalog from swscan.apple.com..."
    if ! curl --fail -s -f -o "$tmpDir/catalog.gz" "$1"; then error "Failed to download catalog" && exit; fi
    gunzip -k "$tmpDir/catalog.gz"
    rm "$tmpDir/catalog.gz"


    # Parse catalog file into arrays
    #-------------------------------
    versionsArray=($(getListOfVersions))

    appleDiagnosticsArray=($(findLinkInCatalog AppleDiagnostics.dmg "$tmpDir/catalog"))
    appleDiagnosticsChunklistArray=($(findLinkInCatalog AppleDiagnostics.chunklist "$tmpDir/catalog"))
    baseSystemArray=($(findLinkInCatalog BaseSystem.dmg "$tmpDir/catalog"))
    baseSystemChunklistArray=($(findLinkInCatalog BaseSystem.chunklist "$tmpDir/catalog"))
    installInfoArray=($(findLinkInCatalog InstallInfo.plist "$tmpDir/catalog"))
    installESDArray=($(findLinkInCatalog InstallESDDmg.pkg "$tmpDir/catalog"))

    rm "$tmpDir/catalog"

}

findLinkInCatalog(){
    array=($(awk '/'$1'</{print $1}' "$2"))
    let index=0
    for element in "${array[@]}"; do
        array[$index]="${element:8:${#element}-17}"
        let index=index+1
    done
    echo ${array[@]}
}

getListOfVersions(){
    versionInfoArray=($(findLinkInCatalog InstallInfo.plist "$tmpDir/catalog"))
    let index=0
    for element in "${versionInfoArray[@]}"; do
        infoline=$(curl -s -f $element | tail -5)
        versionInfo[$index]="$(echo $infoline | awk -v FS="(string>|</string)" '{print $2}')"
        let index++
    done
    echo ${versionInfo[@]}
}




checkOSAvaibility() {
    if curl --output /dev/null --silent --head --fail "https://swscan.apple.com/content/catalogs/others/index-$1seed-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog.gz"; then echo "$1"; else echo "10.14"; fi
}





downloadOS(){
    # Print User Interface
    newUiPage
    LATEST_VERSION=$(checkOSAvaibility "10.15")

    # User input for selecting release type
    PS3=""$'\n(You can also able to download macOS 10.15 when it will available)\n\n'"Which release you want? "
    select RELEASETYPE in "Developer Release" "Beta Release" "Public Release"; do
        case $RELEASETYPE in
            Developer* ) CATALOGTYPE="-${LATEST_VERSION}seed"; break;;
            Beta* ) CATALOGTYPE="-${LATEST_VERSION}beta"; break;;
            Public* ) break;;
        esac
    done


    downloadAndParseCatalog "https://swscan.apple.com/content/catalogs/others/index${CATALOGTYPE}-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog.gz"


    newUiPage
    # User input for selecting macOS versions
    PS3=""$'\n'"Select macOS version : "
    select MACVERSION in "${versionsArray[@]}"; do
        if [[ $REPLY -le ${#versionsArray[@]} && $REPLY -gt 0 ]]
            then

                # Dont break sequence (It's sequenced with $fileNames[@])
                links=(${appleDiagnosticsArray[$[$REPLY - 1]]} ${appleDiagnosticsChunklistArray[$[$REPLY - 1]]} ${baseSystemArray[$[$REPLY - 1]]} ${baseSystemChunklistArray[$[$REPLY - 1]]} ${installInfoArray[$[$REPLY - 1]]} ${installESDArray[$[$REPLY - 1]]})
                fileNames=("AppleDiagnostics.dmg" "AppleDiagnostics.chunklist" "BaseSystem.dmg" "BaseSystem.chunklist" "InstallInfo.plist" "InstallESDDmg.pkg")
                
                # Ask user to download macOS or only print links
                while true; do read -p ""$'\n'"You wanna download macOS ? [y/n] " yn
                    print ""
                    if [[ $yn == y ]]; then

                            # make source directory
                            if [ ! -d "$srcDir" ]; then mkdir "$srcDir"; fi

                            # Download files into $srcDir from $links[@]
                            for i in {0..5}; do
                                curl -f -o "$srcDir/${fileNames[$i]}" "${links[$i]}"
                            done && break;

                        elif [[ $yn == n ]]; then
                            for link in "${links[@]}"; do print $link; done && break; #&& exit;
                    fi
                done

                break
            else error "Invalid choice."
        fi
    done
}



createinstallmedia(){
    #---------------------------------------------------------------------------
    #  Create Install Media
    #---------------------------------------------------------------------------

    # Taking ownership of downloaded files
    #-------------------------------------------------
    chmod a+x "$srcDir/BaseSystem.dmg"
    chmod a+x "$srcDir/BaseSystem.chunklist"
    chmod a+x "$srcDir/InstallInfo.plist"
    chmod a+x "$srcDir/InstallESDDmg.pkg"
    chmod a+x "$srcDir/AppleDiagnostics.dmg"
    chmod a+x "$srcDir/AppleDiagnostics.chunklist"


    # Mount 'BaseSystem.dmg'
    #-------------------------
    $(hdiutil attach "$srcDir/BaseSystem.dmg" 2>&1 >/dev/null)

    print "\n\nMake sure \"macOS Base System\" volume is mounted\n"
    read -p "Press enter to continue..."


    # Pull 'Install macOS XXXX.app' from 'BaseSystem.dmg'
    #-----------------------------------------------------
    FOLDERS=(/Volumes/*)
    for folder in "${FOLDERS[@]}"; do
        [[ -d "$folder" && "$folder" =~ "macOS Base System" ]] && basePath="$folder"
    done
    
 

    for file in "$basePath/"*; do # Find XXXX.app in mounted volume
        if [[ $file == *.app ]]; then
            let index=${#name_array[@]}
            name_array[$index]="${file##*/}"
        fi
    done
    installAppName=${name_array[0]}



    newUiPage
    print "Copying $installAppName to out folder..."
    cp -R "/Volumes/macOS Base System/$installAppName" "$DIR/"


    # UnMount 'BaseSystem.dmg'
    #-------------------------
    $(hdiutil detach /Volumes/macOS\ Base\ System 2>&1 >/dev/null)

    print "Copying Files to SharedSupport folder...\n"

    # Create SharedSupport folder inside 'Install macOS XXXX.app/Contents'
    #----------------------------------------------------------------------
    SharedSupportDir="$DIR/${installAppName}/Contents/SharedSupport"
    if [ ! -d "$SharedSupportDir" ]; then mkdir "$SharedSupportDir"; fi


    # Copy All contents of src folder to 'Install macOS XXXX.app/Contents/SharedSupport'
    #----------------------------------------------------------------------
    # cp -R $srcDir/* $DIR/Install\ macOS\ Mojave\ Beta.app/Contents/SharedSupport

    cp -R "$srcDir/BaseSystem.dmg" "$SharedSupportDir"
    cp -R "$srcDir/BaseSystem.chunklist" "$SharedSupportDir"
    cp -R "$srcDir/InstallInfo.plist" "$SharedSupportDir"
    cp -R "$srcDir/AppleDiagnostics.dmg" "$SharedSupportDir"
    cp -R "$srcDir/AppleDiagnostics.chunklist" "$SharedSupportDir"

    # This file will be copied with InstallESD.dmg name
    cp -R "$srcDir/InstallESDDmg.pkg" "$SharedSupportDir/InstallESD.dmg"


    # Replace <string>InstallESDDmg.pkg</string> to <string>InstallESD.dmg</string> in 'src/InstallInfo.plist'
    #----------------------------------------------------------------------------------------------------------
    sed -i "" 's/<string>InstallESDDmg.pkg<\/string>/<string>InstallESD.dmg<\/string>/g' "$SharedSupportDir/InstallInfo.plist"



    # Remove these lines from 'src/InstallInfo.plist'
    #------------------------------------------------
    #		<key>chunklistURL</key>
    #		<string>InstallESDDmg.chunklist</string>
    #		<key>chunklistid</key>
    #		<string>com.apple.chunklist.InstallESDDmg</string>
    sed -i "" '30,33d' "$SharedSupportDir/InstallInfo.plist"


    # Replace <string>com.apple.pkg.InstallESDDmg</string> to <string>com.apple.dmg.InstallESD</string> in 'src/InstallInfo.plist'
    #----------------------------------------------------------------------------------------------------------
    sed -i "" 's/<string>com.apple.pkg.InstallESDDmg<\/string>/<string>com.apple.dmg.InstallESD<\/string>/g' "$SharedSupportDir/InstallInfo.plist"


    # Replace InstallESDDmg.pkg to InstallESD.dmg in 'src/InstallInfo.plist'
    #----------------------------------------------------------------------------------------------------------
    sed -i "" 's/InstallESDDmg.pkg/InstallESD.dmg/g' "$SharedSupportDir/InstallInfo.plist"


    # newUiPage

    DEVICES=($(ls /Volumes))

    read -p 'Enter name of USB media : ' INSTALLER_DEVICE



    # Creates a bootable installer for macOS on selected media
    # As discribed in https://support.apple.com/en-us/HT201372
    print ""
    sudo "$DIR/$installAppName/Contents/Resources/createinstallmedia" --volume /Volumes/$INSTALLER_DEVICE


    read -p 'You wanna delete downloaded files ? (y/n) : ' ANSWER
    if [ $ANSWER == y ]; then rm -R "$srcDir"; fi
}







newUiPage
# User input for selecting release type
PS3=""$'\n'"What you want to do? "
select RELEASETYPE in "Download macOS" "Make bootable Media"; do
    case $RELEASETYPE in
        Download* ) downloadOS; break;;
        Make* ) createinstallmedia; break;;
    esac
done


exit

 

 

Attachment 

manOSDownloader_rc

Edited by wolfmannight
Added new screenshot

Share this post


Link to post
Share on other sites
Advertisement
Posted (edited)
10 hours ago, arsradu said:

Nice! Indeed a lot better, from a download stand point. One thing missing: choice. :D Can we make it so you can choose which build you want to download? Like: show you available options, then you can choose which one you want and download everything for that specific build.

 

@crazybirdy's installScript_1014fullapp (inside MBR-Manual-Method-20190326.dmg downloadable here) already can do all this.

 

You can choose which catalog file to use (Regular, Public Beta or Developer Beta), and it provides the available full installer builds & their download links ...

 

從 swscan.apple.com 下載完整安裝app.    Download the full installer app from swscan.apple.com.


1.選用 正式版 下載渠道。
1.Use CatalogURL for Regular Software Updates
  https://swscan.apple.com/content/catalogs/others/index-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog.gz

2.選用 公開測試版 下載渠道。
2.Use CatalogURL for Public Beta Program Members
  https://swscan.apple.com/content/catalogs/others/index-10.14beta-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog.gz

3.選用 開發者測試版 下載渠道。
3.Use CatalogURL for Developer Beta Program Members
  https://swscan.apple.com/content/catalogs/others/index-10.14seed-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog.gz

請選擇 要下載的 版本  Select the CatalogURL ( 1 / 2 / 3 ) : 3

選用版本  The selected CatalogURL:  開發者測試版 下載渠道 Developer Beta Updates
  https://swscan.apple.com/content/catalogs/others/index-10.14seed-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog.gz


正在搜尋更新,請耐心等候! Searching for updates from catalogs of swscan.apple.com. Be patient!

http://swcdn.apple.com/content/downloads/12/40/091-95155/piv8296jbzadg8qb5m3gatbllz60d2flsw/BaseSystem.dmg
http://swcdn.apple.com/content/downloads/21/07/041-59913/m210y0lkn7bsiqsi98vfuyk08x2z4to1qk/BaseSystem.dmg
http://swcdn.apple.com/content/downloads/34/47/041-03369/rsbnsn82mun7a480ipgu4r7inb0307i5sq/BaseSystem.dmg
http://swcdn.apple.com/content/downloads/37/33/041-40587/7nzzwfbvvpmccfh0bvgcatbsxb2eng0hyz/BaseSystem.dmg
http://swcdn.apple.com/content/downloads/44/42/041-47723/gt7p2zncc41nrdr8ahp0c4udjrf01r43kn/BaseSystem.dmg

最新版本 The latest version: 10.14.5.18F132 macOS Mojave

可選擇下載的版本 Available version to downlaod:

[ 0 ] 2019-01-08 18:00:07 .. 091-95155 .. 10.13.6.17G66 macOS High Sierra
[ 1 ] 2019-05-13 16:58:21 .. 041-59913 .. 10.14.5.18F132 macOS Mojave
[ 2 ] 2018-09-12 18:58:56 .. 041-03369 .. 10.14.0.18A384a macOS Mojave Beta
[ 3 ] 2019-02-20 17:59:53 .. 041-40587 .. 10.14.4.18E194e macOS Mojave Beta
[ 4 ] 2019-03-25 22:57:46 .. 041-47723 .. 10.14.4.18E2034 macOS Mojave

選擇要下載的版本 Select one version to downlaod: 1

Credit to @crazybirdy and @Pike R. Alpha's original scripts :).

 

PS:  The latest available full installer is the release 10.14.5_18F132 (your links in the above post are actually for 10.14.0_18A384a beta).  The 10.14.6 beta is only available as an update at the moment - use Update-installScript_1014 for this.

 

installScript_1014fullapp.zip

Update-installScript.zip

Edited by fusion71au
extra info

Share this post


Link to post
Share on other sites
On 5/19/2019 at 3:27 AM, fusion71au said:

 

@crazybirdy's installScript_1014fullapp (inside MBR-Manual-Method-20190326.dmg downloadable here) already can do all this.

 

You can choose which catalog file to use (Regular, Public Beta or Developer Beta), and it provides the available full installer builds & their download links ...

 


從 swscan.apple.com 下載完整安裝app.    Download the full installer app from swscan.apple.com.


1.選用 正式版 下載渠道。
1.Use CatalogURL for Regular Software Updates
  https://swscan.apple.com/content/catalogs/others/index-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog.gz

2.選用 公開測試版 下載渠道。
2.Use CatalogURL for Public Beta Program Members
  https://swscan.apple.com/content/catalogs/others/index-10.14beta-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog.gz

3.選用 開發者測試版 下載渠道。
3.Use CatalogURL for Developer Beta Program Members
  https://swscan.apple.com/content/catalogs/others/index-10.14seed-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog.gz

請選擇 要下載的 版本  Select the CatalogURL ( 1 / 2 / 3 ) : 3

選用版本  The selected CatalogURL:  開發者測試版 下載渠道 Developer Beta Updates
  https://swscan.apple.com/content/catalogs/others/index-10.14seed-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog.gz


正在搜尋更新,請耐心等候! Searching for updates from catalogs of swscan.apple.com. Be patient!

http://swcdn.apple.com/content/downloads/12/40/091-95155/piv8296jbzadg8qb5m3gatbllz60d2flsw/BaseSystem.dmg
http://swcdn.apple.com/content/downloads/21/07/041-59913/m210y0lkn7bsiqsi98vfuyk08x2z4to1qk/BaseSystem.dmg
http://swcdn.apple.com/content/downloads/34/47/041-03369/rsbnsn82mun7a480ipgu4r7inb0307i5sq/BaseSystem.dmg
http://swcdn.apple.com/content/downloads/37/33/041-40587/7nzzwfbvvpmccfh0bvgcatbsxb2eng0hyz/BaseSystem.dmg
http://swcdn.apple.com/content/downloads/44/42/041-47723/gt7p2zncc41nrdr8ahp0c4udjrf01r43kn/BaseSystem.dmg

最新版本 The latest version: 10.14.5.18F132 macOS Mojave

可選擇下載的版本 Available version to downlaod:

[ 0 ] 2019-01-08 18:00:07 .. 091-95155 .. 10.13.6.17G66 macOS High Sierra
[ 1 ] 2019-05-13 16:58:21 .. 041-59913 .. 10.14.5.18F132 macOS Mojave
[ 2 ] 2018-09-12 18:58:56 .. 041-03369 .. 10.14.0.18A384a macOS Mojave Beta
[ 3 ] 2019-02-20 17:59:53 .. 041-40587 .. 10.14.4.18E194e macOS Mojave Beta
[ 4 ] 2019-03-25 22:57:46 .. 041-47723 .. 10.14.4.18E2034 macOS Mojave

選擇要下載的版本 Select one version to downlaod: 1

Credit to @crazybirdy and @Pike R. Alpha's original scripts :).

 

PS:  The latest available full installer is the release 10.14.5_18F132 (your links in the above post are actually for 10.14.0_18A384a beta).  The 10.14.6 beta is only available as an update at the moment - use Update-installScript_1014 for this.

 

installScript_1014fullapp.zip

Update-installScript.zip

 

Using it isn't complicated ? It's also provide MBR customisations.

Its good but if you really wanna just create simple app, then it require lot to learn process.

Mine is simple and just download OS as it was in before 10.14 (one click download)

 

Script contains really really small code lines...

 

Well thanks for your scratch guides, I really love those guides.

 

thanks,

 

Share this post


Link to post
Share on other sites
Posted (edited)
On 5/19/2019 at 2:10 AM, chris1111 said:

Main script


#!/bin/bash
# Vars
apptitle="makeLegitApp"
version="1.1"
# Set Icon directory and file 
iconfile="/System/Library/CoreServices/Installer.app/Contents/Resources/Installer.icns"
current_date_time="`date "+%Y-%m-%d %H:%M:%S"`";
echo $current_date_time;
echo "Starting makeLegitApp"

# Select
response=$(osascript -e 'tell app "System Events" to display dialog "Welcome makeLegitApp
Select a choice to create your 
Install macOS Mojave.app" buttons {"Cancel","Beta","Release"} default button 3 with title "'"$apptitle"' '"$version"'" with icon POSIX file "'"$iconfile"'"  ')

action=$(echo $response | cut -d ':' -f2)

# Exit if Canceled
if [ "$action" == "Cancel" ] ; then
  osascript -e 'display notification "Program closing" with title "'"$apptitle"'" subtitle "User cancelled"'
  echo "User cancelled"
  exit 0
fi


### USER: Select Beta
if [ "$action" == "Beta" ] ; then
  osascript -e 'display notification "Program makeLegitApp" with title "'"$apptitle"'" subtitle "User  Select Beta"'
  Sleep 1
  # Remove BUILD if exist

if [ "/Private/tmp/src" ]; then
	rm -rf "/Private/tmp/src"
fi

if [ "/Private/tmp/Install macOS Mojave Beta.app" ]; then
	rm -rf "/Private/tmp/Install macOS Mojave Beta.app"
fi

if [ "/Private/tmp/Install macOS Mojave.app" ]; then
	rm -rf "/Private/tmp/Install macOS Mojave.app"
fi

if [ "/$HOME/Desktop/makeLegitApp" ]; then
	rm -rf "/$HOME/Desktop/makeLegitApp"
fi

osascript <<EOF
tell application "makeLegitApp.app"
   activate
end tell
EOF

# Root location of file
#--------------------------
srcDir="/Private/tmp/src"

# Create Source folder
#----------------------
mkdir -p /Private/tmp/src 
echo "PROGRESS:0"
echo "Build Install macOS Mojave Beta.app"
sleep 1

printf "${RED}Script created by Hanger1${NC}\n"
printf "${GREEN}Script adapt and modify by chris1111${NC}\n"
printf "${GREEN}Spacial thanks to @fusion71au from insanelymac for guide.${NC}\n\n"
printf "Download following files from Orignal Apple server\n\n"
printf "1) BaseSystem.dmg\n"
printf "2) BaseSystem.chunklist\n"
printf "3) InstallInfo.plist\n"
printf "4) InstallESDDmg.pkg\n"
printf "5) AppleDiagnostics.dmg\n"
printf "6) AppleDiagnostics.chunklist\n\n"
printf "${BLUE}Catalog link: https://swscan.apple.com/content/catalogs/others/index-10.14seed-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog.gz${NC}\n"
printf "\n\nPut Above files into \"src\" folder\n\n\n"
Sleep 3
echo "PROGRESS:10"
sleep 1
echo "PROGRESS:20"
sleep 1
echo " "
sleep 1
echo "PROGRESS:30"
sleep 1
echo "
Build Start " 
Sleep 3 
echo "DETAILS:SHOW"
Sleep 2


# Check for Source files exist or not.
#----------------------------------------
if [ ! -f $srcDir/BaseSystem.dmg ]; then                    # Check for BaseSystem.dmg
    echo "Downloading: BaseSystem.dmg ➣ Wait!"
Sleep 2
echo "DETAILS:HIDE"
sleep 1
    curl -L "http://swcdn.apple.com/content/downloads/34/47/041-03369/rsbnsn82mun7a480ipgu4r7inb0307i5sq/BaseSystem.dmg" -o "/Private/tmp/src/BaseSystem.dmg" 
    echo "Download: Complete ➣ Done!"
fi

echo "PROGRESS:40"
sleep 1
echo "DETAILS:SHOW"
Sleep 2

if [ ! -f $srcDir/BaseSystem.chunklist ]; then                    # Check for BaseSystem.chunklist
    echo "Downloading: BaseSystem.chunklist ➣ Wait!"
Sleep 2
echo "DETAILS:HIDE"
sleep 1
    curl -L "http://swcdn.apple.com/content/downloads/34/47/041-03369/rsbnsn82mun7a480ipgu4r7inb0307i5sq/BaseSystem.chunklist" -o "/Private/tmp/src/BaseSystem.chunklist"
    echo "Download: Complete ➣ Done!"
fi

echo "DETAILS:HIDE"
sleep 1
echo "PROGRESS:50"
sleep 1
echo "DETAILS:SHOW"
Sleep 2

if [ ! -f $srcDir/InstallInfo.plist ]; then                    # Check for InstallInfo.plist
    echo "Downloading: InstallInfo.plist ➣ Wait!"
Sleep 2
echo "DETAILS:HIDE"
sleep 1
    curl -L "http://swcdn.apple.com/content/downloads/34/47/041-03369/rsbnsn82mun7a480ipgu4r7inb0307i5sq/InstallInfo.plist" -o "/Private/tmp/src/InstallInfo.plist"
    echo "Download: Complete ➣ Done!"
fi

echo "DETAILS:HIDE"
sleep 1
echo "PROGRESS:60"
sleep 1
echo "DETAILS:SHOW"
Sleep 2

if [ ! -f $srcDir/InstallESDDmg.pkg ]; then                    # Check for InstallESDDmg.pkg
    echo "Downloading: InstallESDDmg.pkg ➣ Wait!"
Sleep 2
echo "DETAILS:HIDE"
sleep 1
    curl -L "http://swcdn.apple.com/content/downloads/34/47/041-03369/rsbnsn82mun7a480ipgu4r7inb0307i5sq/InstallESDDmg.pkg" -o "/Private/tmp/src/InstallESDDmg.pkg"
    echo "Download: Complete ➣ Done!"
fi

echo "DETAILS:HIDE"
sleep 1
echo "PROGRESS:70"
sleep 1
echo "DETAILS:SHOW"
Sleep 2

if [ ! -f $srcDir/AppleDiagnostics.dmg ]; then                    # Check for AppleDiagnostics.dmg
    echo "Downloading: AppleDiagnostics.dmg ➣ Wait!"
Sleep 2
echo "DETAILS:HIDE"
sleep 1
    curl -L "http://swcdn.apple.com/content/downloads/34/47/041-03369/rsbnsn82mun7a480ipgu4r7inb0307i5sq/AppleDiagnostics.dmg" -o "/Private/tmp/src/AppleDiagnostics.dmg"
    echo "Download: Complete ➣ Done!"
fi

echo "DETAILS:HIDE"
sleep 1
echo "PROGRESS:80"
sleep 1
echo "DETAILS:SHOW"
Sleep 2


if [ ! -f $srcDir/AppleDiagnostics.chunklist ]; then                    # Check for AppleDiagnostics.chunklist
    echo "Downloading: AppleDiagnostics.chunklist ➣ Wait!"
Sleep 2
echo "DETAILS:HIDE"
sleep 1
    curl -L "http://swcdn.apple.com/content/downloads/34/47/041-03369/rsbnsn82mun7a480ipgu4r7inb0307i5sq/AppleDiagnostics.chunklist" -o "/Private/tmp/src/AppleDiagnostics.chunklist"
    echo "Download: Complete ➣ Done!"
fi

echo "DETAILS:HIDE"
sleep 1
echo "PROGRESS:90"
sleep 1
echo "DETAILS:SHOW"
Sleep 2


# Taking ownership of downloaded files
#-------------------------------------------------
chmod a+x /Private/tmp/src/BaseSystem.dmg
chmod a+x /Private/tmp/src/BaseSystem.chunklist
chmod a+x /Private/tmp/src/InstallInfo.plist
chmod a+x /Private/tmp/src/InstallESDDmg.pkg
chmod a+x /Private/tmp/src/AppleDiagnostics.dmg
chmod a+x /Private/tmp/src/AppleDiagnostics.chunklist


# Mount 'BaseSystem.dmg'
#-------------------------
$(hdiutil attach /Private/tmp/src/BaseSystem.dmg -noverify -nobrowse 2>&1 >/dev/null)



echo "Make sure \"macOS Base System\" volume is mounted"
Sleep 3


# Pull 'Install macOS XXXX.app' from 'BaseSystem.dmg'
#-----------------------------------------------------
findApp(){
    for file in "/Volumes/OS X Base System"/*; do # Find XXXX.app in mounted volume
        if [[ $file == *.app ]]; then
            let index=${#name_array[@]}
            name_array[$index]="${file##*/}"
        fi
    done
    echo ${name_array[0]}
}

installAppName=$(findApp)

printf "\n\nCopying $installAppName to out folder...\n"
cp -R "/Volumes/OS X Base System/$installAppName" /Private/tmp


# UnMount 'BaseSystem.dmg'
#-------------------------
$(hdiutil detach /Volumes/OS\ X\ Base\ System 2>&1 >/dev/null)


printf "Copying Files to SharedSupport folder... Wait!\n"
sleep 3
echo "DETAILS:HIDE"
sleep 1

# Create SharedSupport folder inside 'Install macOS XXXX.app/Contents'
#----------------------------------------------------------------------
SharedSupportDir="/Private/tmp/$installAppName/Contents/SharedSupport"
if [ ! -d "$SharedSupportDir" ]; then mkdir "$SharedSupportDir"; fi


# Copy All contents of src folder to 'Install macOS XXXX.app/Contents/SharedSupport'
#----------------------------------------------------------------------
# cp -R /Private/tmp/src/* /Private/tmp/Install\ macOS\ Mojave\ Beta.app/Contents/SharedSupport

cp -R "/Private/tmp/src/BaseSystem.dmg" "$SharedSupportDir"
cp -R "/Private/tmp/src/BaseSystem.chunklist" "$SharedSupportDir"
cp -R "/Private/tmp/src/InstallInfo.plist" "$SharedSupportDir"
cp -R "/Private/tmp/src/InstallESDDmg.pkg" "$SharedSupportDir/InstallESD.dmg"
cp -R "/Private/tmp/src/AppleDiagnostics.dmg" "$SharedSupportDir"
cp -R "/Private/tmp/src/AppleDiagnostics.chunklist" "$SharedSupportDir"


# Replace <string>InstallESDDmg.pkg</string> to <string>InstallESD.dmg</string> in 'src/InstallInfo.plist'
#----------------------------------------------------------------------------------------------------------
sed -i "" 's/<string>InstallESDDmg.pkg<\/string>/<string>InstallESD.dmg<\/string>/g' "$SharedSupportDir/InstallInfo.plist"



# Remove these lines from 'src/InstallInfo.plist'
#------------------------------------------------
#		<key>chunklistURL</key>
#		<string>InstallESDDmg.chunklist</string>
#		<key>chunklistid</key>
#		<string>com.apple.chunklist.InstallESDDmg</string>
sed -i "" '30,33d' "$SharedSupportDir/InstallInfo.plist"


# Replace <string>com.apple.pkg.InstallESDDmg</string> to <string>com.apple.dmg.InstallESD</string> in 'src/InstallInfo.plist'
#----------------------------------------------------------------------------------------------------------
sed -i "" 's/<string>com.apple.pkg.InstallESDDmg<\/string>/<string>com.apple.dmg.InstallESD<\/string>/g' "$SharedSupportDir/InstallInfo.plist"


# Replace InstallESDDmg.pkg to InstallESD.dmg in 'src/InstallInfo.plist'
#----------------------------------------------------------------------------------------------------------
sed -i "" 's/InstallESDDmg.pkg/InstallESD.dmg/g' "$SharedSupportDir/InstallInfo.plist"

echo "PROGRESS:95"
sleep 1
echo "DETAILS:SHOW"
Sleep 2
mkdir -p /$HOME/Desktop/makeLegitApp
Sleep 1
mv /Private/tmp/"Install macOS Mojave Beta.app" $HOME/Desktop/makeLegitApp/"Install macOS Mojave Beta.app"
echo $current_date_time; 
sleep 1
Open /$HOME/Desktop/makeLegitApp
sleep 2
osascript <<EOF
tell application "makeLegitApp.app"
   activate
end tell
EOF
echo "DETAILS:HIDE"
sleep 1
echo "Build Install macOS Mojave Beta.app ➣ Done"
echo "PROGRESS:100"
fi

### USER: Select Release
if [ "$action" == "Release" ] ; then
  osascript -e 'display notification "Program makeLegitApp" with title "'"$apptitle"'" subtitle "User  Select Release"'
  Sleep 1
  # Remove BUILD if exist

if [ "/Private/tmp/src" ]; then
	rm -rf "/Private/tmp/src"
fi

if [ "/Private/tmp/Install macOS Mojave.app" ]; then
	rm -rf "/Private/tmp/Install macOS Mojave.app"
fi

if [ "/Private/tmp/Install macOS Mojave Beta.app" ]; then
	rm -rf "/Private/tmp/Install macOS Mojave Beta.app"
fi

if [ "/$HOME/Desktop/makeLegitApp" ]; then
	rm -rf "/$HOME/Desktop/makeLegitApp"
fi

osascript <<EOF
tell application "makeLegitApp.app"
   activate
end tell
EOF


# Root location of file
#--------------------------
srcDir="/Private/tmp/src"

# Create Source folder
#----------------------
mkdir -p /Private/tmp/src 
echo "PROGRESS:0"
echo "Build Install macOS Mojave.app"
sleep 1

printf "${RED}Script created by Hanger1${NC}\n"
printf "${GREEN}Script adapt and modify by chris1111${NC}\n"
printf "${GREEN}Spacial thanks to @fusion71au from insanelymac for guide.${NC}\n\n"
printf "Download following files from Orignal Apple server\n\n"
printf "1) BaseSystem.dmg\n"
printf "2) BaseSystem.chunklist\n"
printf "3) InstallInfo.plist\n"
printf "4) InstallESDDmg.pkg\n"
printf "5) AppleDiagnostics.dmg\n"
printf "6) AppleDiagnostics.chunklist\n\n"
printf "${BLUE}Catalog link: https://swscan.apple.com/content/catalogs/others/index-10.14seed-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog.gz${NC}\n"
printf "\n\nPut Above files into \"src\" folder\n\n\n"
Sleep 3
echo "PROGRESS:10"
sleep 1
echo "PROGRESS:20"
sleep 1
echo " "
sleep 1
echo "PROGRESS:30"
sleep 1
echo "
Build Start " 
Sleep 3 
echo "DETAILS:SHOW"
Sleep 2


# Check for Source files exist or not.
#----------------------------------------
if [ ! -f $srcDir/BaseSystem.dmg ]; then                    # Check for BaseSystem.dmg
    echo "Downloading: BaseSystem.dmg ➣ Wait!"
Sleep 2
echo "DETAILS:HIDE"
sleep 1
    curl -L "http://swcdn.apple.com/content/downloads/21/07/041-59913/m210y0lkn7bsiqsi98vfuyk08x2z4to1qk/BaseSystem.dmg" -o "/Private/tmp/src/BaseSystem.dmg" 
    echo "Download: Complete ➣ Done!"
fi

echo "PROGRESS:40"
sleep 1
echo "DETAILS:SHOW"
Sleep 2

if [ ! -f $srcDir/BaseSystem.chunklist ]; then                    # Check for BaseSystem.chunklist
    echo "Downloading: BaseSystem.chunklist ➣ Wait!"
Sleep 2
echo "DETAILS:HIDE"
sleep 1
    curl -L "http://swcdn.apple.com/content/downloads/21/07/041-59913/m210y0lkn7bsiqsi98vfuyk08x2z4to1qk/BaseSystem.chunklist" -o "/Private/tmp/src/BaseSystem.chunklist"
    echo "Download: Complete ➣ Done!"
fi

echo "DETAILS:HIDE"
sleep 1
echo "PROGRESS:50"
sleep 1
echo "DETAILS:SHOW"
Sleep 2

if [ ! -f $srcDir/InstallInfo.plist ]; then                    # Check for InstallInfo.plist
    echo "Downloading: InstallInfo.plist ➣ Wait!"
Sleep 2
echo "DETAILS:HIDE"
sleep 1
    curl -L "http://swcdn.apple.com/content/downloads/21/07/041-59913/m210y0lkn7bsiqsi98vfuyk08x2z4to1qk/InstallInfo.plist" -o "/Private/tmp/src/InstallInfo.plist"
    echo "Download: Complete ➣ Done!"
fi

echo "DETAILS:HIDE"
sleep 1
echo "PROGRESS:60"
sleep 1
echo "DETAILS:SHOW"
Sleep 2

if [ ! -f $srcDir/InstallESDDmg.pkg ]; then                    # Check for InstallESDDmg.pkg
    echo "Downloading: InstallESDDmg.pkg ➣ Wait!"
Sleep 2
echo "DETAILS:HIDE"
sleep 1
    curl -L "http://swcdn.apple.com/content/downloads/21/07/041-59913/m210y0lkn7bsiqsi98vfuyk08x2z4to1qk/InstallESDDmg.pkg" -o "/Private/tmp/src/InstallESDDmg.pkg"
    echo "Download: Complete ➣ Done!"
fi

echo "DETAILS:HIDE"
sleep 1
echo "PROGRESS:70"
sleep 1
echo "DETAILS:SHOW"
Sleep 2

if [ ! -f $srcDir/AppleDiagnostics.dmg ]; then                    # Check for AppleDiagnostics.dmg
    echo "Downloading: AppleDiagnostics.dmg ➣ Wait!"
Sleep 2
echo "DETAILS:HIDE"
sleep 1
    curl -L "http://swcdn.apple.com/content/downloads/21/07/041-59913/m210y0lkn7bsiqsi98vfuyk08x2z4to1qk/AppleDiagnostics.dmg" -o "/Private/tmp/src/AppleDiagnostics.dmg"
    echo "Download: Complete ➣ Done!"
fi

echo "DETAILS:HIDE"
sleep 1
echo "PROGRESS:80"
sleep 1
echo "DETAILS:SHOW"
Sleep 2


if [ ! -f $srcDir/AppleDiagnostics.chunklist ]; then                    # Check for AppleDiagnostics.chunklist
    echo "Downloading: AppleDiagnostics.chunklist ➣ Wait!"
Sleep 2
echo "DETAILS:HIDE"
sleep 1
    curl -L "http://swcdn.apple.com/content/downloads/21/07/041-59913/m210y0lkn7bsiqsi98vfuyk08x2z4to1qk/AppleDiagnostics.chunklist" -o "/Private/tmp/src/AppleDiagnostics.chunklist"
    echo "Download: Complete ➣ Done!"
fi

echo "DETAILS:HIDE"
sleep 1
echo "PROGRESS:90"
sleep 1
echo "DETAILS:SHOW"
Sleep 2


# Taking ownership of downloaded files
#-------------------------------------------------
chmod a+x /Private/tmp/src/BaseSystem.dmg
chmod a+x /Private/tmp/src/BaseSystem.chunklist
chmod a+x /Private/tmp/src/InstallInfo.plist
chmod a+x /Private/tmp/src/InstallESDDmg.pkg
chmod a+x /Private/tmp/src/AppleDiagnostics.dmg
chmod a+x /Private/tmp/src/AppleDiagnostics.chunklist


# Mount 'BaseSystem.dmg'
#-------------------------
$(hdiutil attach /Private/tmp/src/BaseSystem.dmg -noverify -nobrowse 2>&1 >/dev/null)



echo "Make sure \"macOS Base System\" volume is mounted"
Sleep 3


# Pull 'Install macOS XXXX.app' from 'BaseSystem.dmg'
#-----------------------------------------------------
findApp(){
    for file in "/Volumes/macOS Base System"/*; do # Find XXXX.app in mounted volume
        if [[ $file == *.app ]]; then
            let index=${#name_array[@]}
            name_array[$index]="${file##*/}"
        fi
    done
    echo ${name_array[0]}
}

installAppName=$(findApp)

printf "\n\nCopying $installAppName to out folder...\n"
cp -R "/Volumes/macOS Base System/$installAppName" /Private/tmp


# UnMount 'BaseSystem.dmg'
#-------------------------
$(hdiutil detach /Volumes/macOS\ Base\ System 2>&1 >/dev/null)


printf "Copying Files to SharedSupport folder... Wait!\n"
sleep 3
echo "DETAILS:HIDE"
sleep 1

# Create SharedSupport folder inside 'Install macOS XXXX.app/Contents'
#----------------------------------------------------------------------
SharedSupportDir="/Private/tmp/$installAppName/Contents/SharedSupport"
if [ ! -d "$SharedSupportDir" ]; then mkdir "$SharedSupportDir"; fi


# Copy All contents of src folder to 'Install macOS XXXX.app/Contents/SharedSupport'
#----------------------------------------------------------------------
# cp -R /Private/tmp/src/* /Private/tmp/Install\ macOS\ Mojave\ Beta.app/Contents/SharedSupport

cp -R "/Private/tmp/src/BaseSystem.dmg" "$SharedSupportDir"
cp -R "/Private/tmp/src/BaseSystem.chunklist" "$SharedSupportDir"
cp -R "/Private/tmp/src/InstallInfo.plist" "$SharedSupportDir"
cp -R "/Private/tmp/src/InstallESDDmg.pkg" "$SharedSupportDir/InstallESD.dmg"
cp -R "/Private/tmp/src/AppleDiagnostics.dmg" "$SharedSupportDir"
cp -R "/Private/tmp/src/AppleDiagnostics.chunklist" "$SharedSupportDir"


# Replace <string>InstallESDDmg.pkg</string> to <string>InstallESD.dmg</string> in 'src/InstallInfo.plist'
#----------------------------------------------------------------------------------------------------------
sed -i "" 's/<string>InstallESDDmg.pkg<\/string>/<string>InstallESD.dmg<\/string>/g' "$SharedSupportDir/InstallInfo.plist"



# Remove these lines from 'src/InstallInfo.plist'
#------------------------------------------------
#		<key>chunklistURL</key>
#		<string>InstallESDDmg.chunklist</string>
#		<key>chunklistid</key>
#		<string>com.apple.chunklist.InstallESDDmg</string>
sed -i "" '30,33d' "$SharedSupportDir/InstallInfo.plist"


# Replace <string>com.apple.pkg.InstallESDDmg</string> to <string>com.apple.dmg.InstallESD</string> in 'src/InstallInfo.plist'
#----------------------------------------------------------------------------------------------------------
sed -i "" 's/<string>com.apple.pkg.InstallESDDmg<\/string>/<string>com.apple.dmg.InstallESD<\/string>/g' "$SharedSupportDir/InstallInfo.plist"


# Replace InstallESDDmg.pkg to InstallESD.dmg in 'src/InstallInfo.plist'
#----------------------------------------------------------------------------------------------------------
sed -i "" 's/InstallESDDmg.pkg/InstallESD.dmg/g' "$SharedSupportDir/InstallInfo.plist"

echo "PROGRESS:95"
sleep 1
echo "DETAILS:SHOW"
Sleep 2
mkdir -p /$HOME/Desktop/makeLegitApp
Sleep 1
mv /Private/tmp/"Install macOS Mojave.app" $HOME/Desktop/makeLegitApp/"Install macOS Mojave.app" 
echo $current_date_time; 
sleep 1
Open /$HOME/Desktop/makeLegitApp
sleep 2
osascript <<EOF
tell application "makeLegitApp.app"
   activate
end tell
EOF
echo "DETAILS:HIDE"
sleep 1
echo "Build Install macOS Mojave.app ➣ Done"
echo "PROGRESS:100"
fi

 

 

There's no need to duplicate your script for the "Beta" and "Release" statement.

#!/bin/bash
# Vars
apptitle="makeLegitApp"
version="1.1"
# Set Icon directory and file 
iconfile="/System/Library/CoreServices/Installer.app/Contents/Resources/Installer.icns"
current_date_time="`date "+%Y-%m-%d %H:%M:%S"`";
echo $current_date_time;
echo "Starting makeLegitApp"

# Select
response=$(osascript -e 'tell app "System Events" to display dialog "Welcome makeLegitApp
Select a choice to create your 
Install macOS Mojave.app" buttons {"Cancel","Beta","Release"} default button 3 with title "'"$apptitle"' '"$version"'" with icon POSIX file "'"$iconfile"'"  ')

action=$(echo $response | cut -d ':' -f2)

# Exit if Canceled
if [ "$action" == "Cancel" ] ; then
  osascript -e 'display notification "Program closing" with title "'"$apptitle"'" subtitle "User cancelled"'
  echo "User cancelled"
  exit 0
fi

# Conditions based on user's selection
if [ "$action" == "Beta" ] ; then
    APPNAME="Install macOS Mojave Beta"
    MOUNTPOINT="/Volumes/OS X Base System"
    URL_PATH="34/47/041-03369/rsbnsn82mun7a480ipgu4r7inb0307i5sq"
else 
    # We can only assume that the user selected "Release" ...
    APPNAME="Install macOS Mojave"
    MOUNTPOINT="/Volumes/macOS Base System"
    URL_PATH="21/07/041-59913/m210y0lkn7bsiqsi98vfuyk08x2z4to1qk"
fi

osascript -e 'display notification "Program makeLegitApp" with title "'"$apptitle"'" subtitle "User Selected '"$action"'"'
Sleep 1
  
# Remove BUILD if exist

if [ "/Private/tmp/src" ]; then
	rm -rf "/Private/tmp/src"
fi

if [ "/Private/tmp/Install macOS Mojave Beta.app" ]; then
	rm -rf "/Private/tmp/Install macOS Mojave Beta.app"
fi

if [ "/Private/tmp/Install macOS Mojave.app" ]; then
	rm -rf "/Private/tmp/Install macOS Mojave.app"
fi

if [ "/$HOME/Desktop/makeLegitApp" ]; then
	rm -rf "/$HOME/Desktop/makeLegitApp"
fi

osascript <<EOF
tell application "makeLegitApp.app"
   activate
end tell
EOF

# Root location of file
#--------------------------
srcDir="/Private/tmp/src"

# Create Source folder
#----------------------
mkdir -p /Private/tmp/src 
echo "PROGRESS:0"
echo "Build Install ${APPNAME}.app"
sleep 1

printf "${RED}Script created by Hanger1${NC}\n"
printf "${GREEN}Script adapt and modify by chris1111${NC}\n"
printf "${GREEN}Spacial thanks to @fusion71au from insanelymac for guide.${NC}\n\n"
printf "Download following files from Orignal Apple server\n\n"
printf "1) BaseSystem.dmg\n"
printf "2) BaseSystem.chunklist\n"
printf "3) InstallInfo.plist\n"
printf "4) InstallESDDmg.pkg\n"
printf "5) AppleDiagnostics.dmg\n"
printf "6) AppleDiagnostics.chunklist\n\n"
printf "${BLUE}Catalog link: https://swscan.apple.com/content/catalogs/others/index-10.14seed-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog.gz${NC}\n"
printf "\n\nPut Above files into \"src\" folder\n\n\n"
Sleep 3
echo "PROGRESS:10"
sleep 1
echo "PROGRESS:20"
sleep 1
echo " "
sleep 1
echo "PROGRESS:30"
sleep 1
echo "
Build Start " 
Sleep 3 
echo "DETAILS:SHOW"
Sleep 2


# Check for Source files exist or not.
#----------------------------------------
if [ ! -f $srcDir/BaseSystem.dmg ]; then                    # Check for BaseSystem.dmg
    echo "Downloading: BaseSystem.dmg ➣ Wait!"
Sleep 2
echo "DETAILS:HIDE"
sleep 1
    curl -L "http://swcdn.apple.com/content/downloads/${URL_PATH}/BaseSystem.dmg" -o "/Private/tmp/src/BaseSystem.dmg" 
    echo "Download: Complete ➣ Done!"
fi

echo "PROGRESS:40"
sleep 1
echo "DETAILS:SHOW"
Sleep 2

if [ ! -f $srcDir/BaseSystem.chunklist ]; then                    # Check for BaseSystem.chunklist
    echo "Downloading: BaseSystem.chunklist ➣ Wait!"
Sleep 2
echo "DETAILS:HIDE"
sleep 1
    curl -L "http://swcdn.apple.com/content/downloads/${URL_PATH}/BaseSystem.chunklist" -o "/Private/tmp/src/BaseSystem.chunklist"
    echo "Download: Complete ➣ Done!"
fi

echo "DETAILS:HIDE"
sleep 1
echo "PROGRESS:50"
sleep 1
echo "DETAILS:SHOW"
Sleep 2

if [ ! -f $srcDir/InstallInfo.plist ]; then                    # Check for InstallInfo.plist
    echo "Downloading: InstallInfo.plist ➣ Wait!"
Sleep 2
echo "DETAILS:HIDE"
sleep 1
    curl -L "http://swcdn.apple.com/content/downloads/${URL_PATH}/InstallInfo.plist" -o "/Private/tmp/src/InstallInfo.plist"
    echo "Download: Complete ➣ Done!"
fi

echo "DETAILS:HIDE"
sleep 1
echo "PROGRESS:60"
sleep 1
echo "DETAILS:SHOW"
Sleep 2

if [ ! -f $srcDir/InstallESDDmg.pkg ]; then                    # Check for InstallESDDmg.pkg
    echo "Downloading: InstallESDDmg.pkg ➣ Wait!"
Sleep 2
echo "DETAILS:HIDE"
sleep 1
    curl -L "http://swcdn.apple.com/content/downloads/${URL_PATH}/InstallESDDmg.pkg" -o "/Private/tmp/src/InstallESDDmg.pkg"
    echo "Download: Complete ➣ Done!"
fi

echo "DETAILS:HIDE"
sleep 1
echo "PROGRESS:70"
sleep 1
echo "DETAILS:SHOW"
Sleep 2

if [ ! -f $srcDir/AppleDiagnostics.dmg ]; then                    # Check for AppleDiagnostics.dmg
    echo "Downloading: AppleDiagnostics.dmg ➣ Wait!"
Sleep 2
echo "DETAILS:HIDE"
sleep 1
    curl -L "http://swcdn.apple.com/content/downloads/${URL_PATH}/AppleDiagnostics.dmg" -o "/Private/tmp/src/AppleDiagnostics.dmg"
    echo "Download: Complete ➣ Done!"
fi

echo "DETAILS:HIDE"
sleep 1
echo "PROGRESS:80"
sleep 1
echo "DETAILS:SHOW"
Sleep 2


if [ ! -f $srcDir/AppleDiagnostics.chunklist ]; then                    # Check for AppleDiagnostics.chunklist
    echo "Downloading: AppleDiagnostics.chunklist ➣ Wait!"
Sleep 2
echo "DETAILS:HIDE"
sleep 1
    curl -L "http://swcdn.apple.com/content/downloads/${URL_PATH}/AppleDiagnostics.chunklist" -o "/Private/tmp/src/AppleDiagnostics.chunklist"
    echo "Download: Complete ➣ Done!"
fi

echo "DETAILS:HIDE"
sleep 1
echo "PROGRESS:90"
sleep 1
echo "DETAILS:SHOW"
Sleep 2


# Taking ownership of downloaded files
#-------------------------------------------------
chmod a+x /Private/tmp/src/BaseSystem.dmg
chmod a+x /Private/tmp/src/BaseSystem.chunklist
chmod a+x /Private/tmp/src/InstallInfo.plist
chmod a+x /Private/tmp/src/InstallESDDmg.pkg
chmod a+x /Private/tmp/src/AppleDiagnostics.dmg
chmod a+x /Private/tmp/src/AppleDiagnostics.chunklist


# Mount 'BaseSystem.dmg'
#-------------------------
$(hdiutil attach /Private/tmp/src/BaseSystem.dmg -noverify -nobrowse 2>&1 >/dev/null)



echo "Make sure \"macOS Base System\" volume is mounted"
Sleep 3


# Pull 'Install macOS XXXX.app' from 'BaseSystem.dmg'
#-----------------------------------------------------
findApp(){
    for file in "${MOUNTPOINT}"/*; do # Find XXXX.app in mounted volume
        if [[ $file == *.app ]]; then
            let index=${#name_array[@]}
            name_array[$index]="${file##*/}"
        fi
    done
    echo ${name_array[0]}
}

installAppName=$(findApp)

printf "\n\nCopying $installAppName to out folder...\n"
cp -R "${MOUNTPOINT}/$installAppName" /Private/tmp


# UnMount 'BaseSystem.dmg'
#-------------------------
$(hdiutil detach "${MOUNTPOINT}" 2>&1 >/dev/null)


printf "Copying Files to SharedSupport folder... Wait!\n"
sleep 3
echo "DETAILS:HIDE"
sleep 1

# Create SharedSupport folder inside 'Install macOS XXXX.app/Contents'
#----------------------------------------------------------------------
SharedSupportDir="/Private/tmp/$installAppName/Contents/SharedSupport"
if [ ! -d "$SharedSupportDir" ]; then mkdir "$SharedSupportDir"; fi


# Copy All contents of src folder to 'Install macOS XXXX.app/Contents/SharedSupport'
#----------------------------------------------------------------------
# cp -R /Private/tmp/src/* /Private/tmp/Install\ macOS\ Mojave\ Beta.app/Contents/SharedSupport

cp -R "/Private/tmp/src/BaseSystem.dmg" "$SharedSupportDir"
cp -R "/Private/tmp/src/BaseSystem.chunklist" "$SharedSupportDir"
cp -R "/Private/tmp/src/InstallInfo.plist" "$SharedSupportDir"
cp -R "/Private/tmp/src/InstallESDDmg.pkg" "$SharedSupportDir/InstallESD.dmg"
cp -R "/Private/tmp/src/AppleDiagnostics.dmg" "$SharedSupportDir"
cp -R "/Private/tmp/src/AppleDiagnostics.chunklist" "$SharedSupportDir"


# Replace <string>InstallESDDmg.pkg</string> to <string>InstallESD.dmg</string> in 'src/InstallInfo.plist'
#----------------------------------------------------------------------------------------------------------
sed -i "" 's/<string>InstallESDDmg.pkg<\/string>/<string>InstallESD.dmg<\/string>/g' "$SharedSupportDir/InstallInfo.plist"



# Remove these lines from 'src/InstallInfo.plist'
#------------------------------------------------
#		<key>chunklistURL</key>
#		<string>InstallESDDmg.chunklist</string>
#		<key>chunklistid</key>
#		<string>com.apple.chunklist.InstallESDDmg</string>
sed -i "" '30,33d' "$SharedSupportDir/InstallInfo.plist"


# Replace <string>com.apple.pkg.InstallESDDmg</string> to <string>com.apple.dmg.InstallESD</string> in 'src/InstallInfo.plist'
#----------------------------------------------------------------------------------------------------------
sed -i "" 's/<string>com.apple.pkg.InstallESDDmg<\/string>/<string>com.apple.dmg.InstallESD<\/string>/g' "$SharedSupportDir/InstallInfo.plist"


# Replace InstallESDDmg.pkg to InstallESD.dmg in 'src/InstallInfo.plist'
#----------------------------------------------------------------------------------------------------------
sed -i "" 's/InstallESDDmg.pkg/InstallESD.dmg/g' "$SharedSupportDir/InstallInfo.plist"

echo "PROGRESS:95"
sleep 1
echo "DETAILS:SHOW"
Sleep 2
mkdir -p /$HOME/Desktop/makeLegitApp
Sleep 1
mv /Private/tmp/"${APPNAME}.app" $HOME/Desktop/makeLegitApp/"${APPNAME}.app"
echo $current_date_time; 
sleep 1
Open /$HOME/Desktop/makeLegitApp
sleep 2
osascript <<EOF
tell application "makeLegitApp.app"
   activate
end tell
EOF
echo "DETAILS:HIDE"
sleep 1
echo "Build ${APPNAME}.app ➣ Done"
echo "PROGRESS:100"

 

Edited by ricoc90

Share this post


Link to post
Share on other sites
Posted (edited)

I see first post EDIT and the new script is much more better then the one I modify 

 

 

Edited by chris1111
My previous content deleted

Share this post


Link to post
Share on other sites
On 5/17/2019 at 5:54 AM, wolfmannight said:

Here is script to generate >5GB installer and also create bootable USB media.

This works great! Thanks so much.

 

 

Share this post


Link to post
Share on other sites
On 5/17/2019 at 2:54 PM, wolfmannight said:

If you are in 10.14.0 you will not longer able to download legit copy of macOS from Apple store.

It's download and install as system update.

 

Here is script to generate >5GB installer and also create bootable USB media.

I'm sharing code of script and if you wanna get executable download from attachment.

 

 

Attachment 

manOSDownloader_rc

 

 

BIG THANKS for this. It works. It shows multiple versions and also different release levels...

I could easily download the 10.14.5 and 10.14.6 which both I was after!

Thanks wolfmannight !

 

(For anyone new around here, it's easy, just download, chmod to the file, and then execute it from Finder, works perfectly).

 

Share this post


Link to post
Share on other sites

Hello Guys,

 I'm a definite newbie to all of this but was overjoyed when I found out that my MacBook Pro mid 2009 could still live on for a few more years thanks to Dosdude1 and the patcher tool I downloaded , I'm just now trying to get out of a scrape because stupidly I have gone and put myself on the Catalina beta testing program and im sure it doesn't come as a surprise, but my  machine is REALLY struggling! So I have decided to go back to Mojave and probably stay there and retire the poor dear.. Thing is I'm stuck and I can't get back into the DeLorean and get back to the Mojave as the patcher tool is being thwarted by all sorts of strange things being fired at it from the OS. All of sudden there will be alerts (whilst the melding of the patcher and the OS was nearly complete!) that the USB drive disc was "not ejected properly" my hands not even near it. Then other alerts on subsequent attempts that the drive could not be used because it was formatted as APFS, it wasn't and still isn't, as I've triple checked it and its definitely macOS extended (journaled), and then the final straw today when I used a new memory stick and attempted the fusion, at the very end the alerts were now that it couldn't read the group information on the source files and had ejected the disk! 

All I want to do is get back to a safe place and open Final Cut X which I haven't been able to do in Catalina as it throws up every time you show it a rainbow clapperboard and crashes FCP mercilessly along with VLC and iMovie and a host of other linked applications.

So I spotted you guys and wondered if you might be able to help me back to FCPXLAND  as I have a horrible feeling I'm not in Kansas anymore,

Cheers Everyone

Sam (from the UK) 

Share this post


Link to post
Share on other sites

Topic is a bit misleading.

Any "copy" is illegal, only "original" is legal tender.

Hackintosh is illegal, no matter which way you look at it.

We all break the law.

See you in Alcatraz

Share this post


Link to post
Share on other sites
On 10/10/2019 at 8:00 AM, STLVNUB said:

Topic is a bit misleading.

Any "copy" is illegal, only "original" is legal tender.

Hackintosh is illegal, no matter which way you look at it.

We all break the law.

See you in Alcatraz

Remember that Breaking License =/= Breaking Law (not in every country).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×