Skip to content

Commit

Permalink
changed installer creation
Browse files Browse the repository at this point in the history
  • Loading branch information
MacThings committed Oct 23, 2023
1 parent f7aeb34 commit 5d26055
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 52 deletions.
12 changes: 8 additions & 4 deletions ANYmacOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
2A14A723230322F80048B14A /* Settings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A14A71D230322F80048B14A /* Settings.swift */; };
2A14A724230322F80048B14A /* Website.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A14A71E230322F80048B14A /* Website.swift */; };
2A14A725230322F80048B14A /* CreateUSBInstaller.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A14A71F230322F80048B14A /* CreateUSBInstaller.swift */; };
2A43E2322AE6D56E00CDCFE0 /* Install-App.zip in Resources */ = {isa = PBXBuildFile; fileRef = 2A43E2312AE6D56E00CDCFE0 /* Install-App.zip */; };
2A605B032664E7590043D793 /* Sparkle in Frameworks */ = {isa = PBXBuildFile; productRef = 2A605B022664E7590043D793 /* Sparkle */; };
2A6FEA57266F9BF000B4B508 /* LetsMoveIt.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A6FEA56266F9BF000B4B508 /* LetsMoveIt.swift */; };
2A7AD8B325659BA1003800A9 /* ShowSetSysSeed.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A7AD8B225659BA1003800A9 /* ShowSetSysSeed.swift */; };
Expand Down Expand Up @@ -83,6 +84,7 @@
2A14A71E230322F80048B14A /* Website.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Website.swift; sourceTree = "<group>"; };
2A14A71F230322F80048B14A /* CreateUSBInstaller.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CreateUSBInstaller.swift; sourceTree = "<group>"; };
2A2879F423094D2F00C29553 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Main.strings; sourceTree = "<group>"; };
2A43E2312AE6D56E00CDCFE0 /* Install-App.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = "Install-App.zip"; sourceTree = "<group>"; };
2A6FEA56266F9BF000B4B508 /* LetsMoveIt.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LetsMoveIt.swift; sourceTree = "<group>"; };
2A7AD8B225659BA1003800A9 /* ShowSetSysSeed.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ShowSetSysSeed.swift; sourceTree = "<group>"; };
2A8EB9902544AD5500F79DED /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Localizable.strings; sourceTree = "<group>"; };
Expand Down Expand Up @@ -146,6 +148,7 @@
2AC6612D239F84AE00E859D7 /* WindowController.swift */,
2A0A7D742347B3070081F997 /* anymacos.html */,
1FA7862423002558002CDB52 /* Assets.xcassets */,
2A43E2312AE6D56E00CDCFE0 /* Install-App.zip */,
1FA7862623002558002CDB52 /* Main.storyboard */,
1FA7862923002558002CDB52 /* Info.plist */,
2A8EB98F2544AD5500F79DED /* Localizable.strings */,
Expand Down Expand Up @@ -257,6 +260,7 @@
buildActionMask = 2147483647;
files = (
1FA7862523002558002CDB52 /* Assets.xcassets in Resources */,
2A43E2322AE6D56E00CDCFE0 /* Install-App.zip in Resources */,
2A8EB9912544AD5500F79DED /* Localizable.strings in Resources */,
1FA7862823002558002CDB52 /* Main.storyboard in Resources */,
);
Expand Down Expand Up @@ -478,15 +482,15 @@
CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 112;
CURRENT_PROJECT_VERSION = 113;
DEVELOPMENT_TEAM = "";
ENABLE_HARDENED_RUNTIME = NO;
INFOPLIST_FILE = ANYmacOS/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MARKETING_VERSION = 1.1.2;
MARKETING_VERSION = 1.1.3;
PRODUCT_BUNDLE_IDENTIFIER = anymacos.slsoft.de;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -502,15 +506,15 @@
CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 112;
CURRENT_PROJECT_VERSION = 113;
DEVELOPMENT_TEAM = "";
ENABLE_HARDENED_RUNTIME = NO;
INFOPLIST_FILE = ANYmacOS/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MARKETING_VERSION = 1.1.2;
MARKETING_VERSION = 1.1.3;
PRODUCT_BUNDLE_IDENTIFIER = anymacos.slsoft.de;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
Binary file not shown.
Binary file added ANYmacOS/Install-App.zip
Binary file not shown.
14 changes: 13 additions & 1 deletion ANYmacOS/anymacos.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
</head>
<body>

<p><span class="header" lang="en">New in 1.1.3</span></p>
<ul>
<span class="newstext">
<li>It is now possible to create an installer application without SIP disabled. This is no longer created directly in "/Applications" but in a sparse image which is created, mounted and filled by ANYmacOS in the download path stored by the user. This has the advantage that you don't have to write to a system protected directory (/Applications) anymore. You end up with a volume named "Installer-App" on your desktop where the installer application is located.</li>
</ul></span>

<p><span class="header" lang="en">New in 1.1.2</span></p>
<ul>
<span class="newstext">
Expand All @@ -48,7 +54,13 @@
<span class="newstext">
<li>Removed: Update channel selection (for downloads) has been removed because Apple's catalogs no longer allow differentiation. You can now always see everything in the OS selection.</li>
</ul></span>


<p><span class="header" lang="en">New in 1.0.9/span></p>
<ul>
<span class="newstext">
<li>Installer Application is now created in an Disk-Image, named Installer-App, which is beside the ANYmacOS Download Folder. That means SIP can be enabled and the installer could be created in Userland which has no restrictions.</li>
</ul></span>

<p><span class="header" lang="en">New in 1.0.8</span></p>
<ul>
<span class="newstext">
Expand Down
137 changes: 90 additions & 47 deletions ANYmacOS/script/script.command
Original file line number Diff line number Diff line change
Expand Up @@ -88,39 +88,53 @@ function _languageselect()

function _check_user()
{




############ Prüft ob der User Adminrechte hat und das Passwort korrekt ist
if [[ "$syslang" = "en" ]]; then
_helpDefaultWrite "Statustext" ""
string="The user you are currently logged in with does not have administrative rights. Please enter a user who has these rights."
else
_helpDefaultWrite "Statustext" ""
string="Der User mit dem Du gerade angemeldet bist hat keine Administrativen Rechte. Bitte gib nun einen User an der diese Rechte hat."
fi
############ Prüft ob der User Adminrechte hat und das Passwort korrekt ist
groups "$user" | grep -q -w admin
if [ $? = 1 ]; then
user=$(osascript -e "display dialog \"Der User mit dem Du gerade angemeldet bist hat keine Administrativen Rechte. Bitte gib nun einen User an der diese Rechte hat.\" default answer \"$user\"" -e 'text returned of result')
user=$(osascript -e "display dialog \"$string\" default answer \"$user\"" -e 'text returned of result')
fi
######
if [[ "$syslang" = "en" ]]; then
string="Please enter your user password."
else
string="Gib hier Dein Benutzer-Passwort ein."
fi
password=$(osascript -e "display dialog \"$string\" default answer \"\" with hidden answer" -e 'text returned of result')
if [[ "$syslang" = "en" ]]; then
string="You have not entered a password! Try again."
else
string="Du hast kein Passwort eingegeben! Versuche es noch einmal."
fi

password=$(osascript -e 'display dialog "Gib hier Dein Benutzer-Passwort ein:" default answer "" with hidden answer' -e 'text returned of result')

if [ ! -n "$password" ]; then
osascript -e 'display dialog "Du hast kein Passwort eingegeben! Versuche es noch einmal." buttons {"OK"}'
osascript -e "display dialog \"$string\" buttons {\"OK\"}"
exit 1
fi
###

######
if [[ "$syslang" = "en" ]]; then
string="The user you are currently logged in with does not have administrative rights. Try again."
else
string="Der User mit dem Du gerade angemeldet bist hat keine Administrativen Rechte. Versuche es noch einmal."
fi
groups "$user" | grep -q -w admin
if [ $? = 1 ]; then
osascript -e 'display dialog "Der User mit dem Du gerade angemeldet bist hat keine Administrativen Rechte. Versuche es noch einmal." buttons {"OK"}'
osascript -e "display dialog \"$string\" buttons {\"OK\"}"
exit 1
fi

######
if [[ "$syslang" = "en" ]]; then
string="The password you entered is not correct. Try again.."
else
string="Das eingegebene Password ist nicht korrekt. Versuche es noch einmal."
fi
echo "$password" | sudo -S dscl /Local/Default -u "$user" >/dev/null 2>&1

if [ $? != 0 ]; then
osascript -e 'display dialog "Das eingegebene Password ist nicht korrekt. Versuche es noch einmal." buttons {"OK"}'
osascript -e "display dialog \"$string\" buttons {\"OK\"}"
exit 1
fi
####################################################################################
Expand Down Expand Up @@ -266,21 +280,28 @@ function _download_macos()
kill_download=$( _helpDefaultRead "KillDL" )
if [[ $kill_download = 1 ]]; then
if [[ "$syslang" = "en" ]]; then
_helpDefaultWrite "Statustext" "Downloading aborted"
else
_helpDefaultWrite "Statustext" "Download abgebrochen"
string="Downloading aborted"
else
string="Download abgebrochen"
fi

_helpDefaultWrite "Statustext" "$string"

exit
fi

checker=$( /usr/bin/curl -k -s -L -I "$line" )
if [[ $checker != *"ength: 0"* ]]; then
line_progress=$( echo "$line" | sed 's/.*\///g' )

if [[ "$syslang" = "en" ]]; then
_helpDefaultWrite "Statustext" "Downloading ..."
else
_helpDefaultWrite "Statustext" "Dateitransfer ..."
string="Downloading ..."
else
string="Dateitransfer ..."
fi

_helpDefaultWrite "Statustext" "$string"

echo "$line_progress" >> "$download_path"/.anymacos_download

dl_size=$( /usr/bin/curl -k -s -L -I "$line" | grep "ength:" | sed 's/.*th://g' | xargs | awk '{ byte =$1 /1024/1024; print byte " MB" }' | awk '{printf "%.0f\n", $1}' )
Expand All @@ -306,29 +327,36 @@ done < ""$temp_path"/files"
_helpDefaultWrite "Stop" "Yes"
if [[ $kill_download = 1 ]]; then
if [[ "$syslang" = "en" ]]; then
_helpDefaultWrite "Statustext" "Downloading aborted"
else
_helpDefaultWrite "Statustext" "Download abgebrochen"
string="Downloading aborted"
else
string="Download abgebrochen"
fi

_helpDefaultWrite "Statustext" "$string"

exit
fi


if [[ "$syslang" = "en" ]]; then
_helpDefaultWrite "Statustext" "Creating Installer-Application ..."
string="Creating Installer-Application ..."
else
_helpDefaultWrite "Statustext" "Erzeuge Installer-Application ..."
string="Erzeuge Installer-Applikation ..."
fi

_helpDefaultWrite "Statustext" "$string"


kill_download=$( _helpDefaultRead "KillDL" )
if [[ $kill_download = 1 ]]; then
_helpDefaultWrite "Stop" "Yes"
if [[ "$syslang" = "en" ]]; then
_helpDefaultWrite "Statustext" "Downloading aborted"
else
_helpDefaultWrite "Statustext" "Download abgebrochen"
string="Downloading aborted"
else
string="Download abgebrochen"
fi

_helpDefaultWrite "Statustext" "$string"

exit
fi

Expand All @@ -355,24 +383,31 @@ done < ""$temp_path"/files"

if [[ "$installok" = "0" ]]; then

echo "$password" | sudo -u "$user" -S mv /Volumes/Install-AppApplications/Install*.app/Contents/SharedSupport /Volumes/Install-App/Applications/Install*/Contents/
echo "$password" | sudo -u "$user" -S rm -r /Volumes/Install-AppApplications
echo "$password" | sudo -u "$user" -S mv /Volumes/Install-App/Applications/Install*.app /Volumes/Install-App/
echo "$password" | sudo -u "$user" -S rm -r /Volumes/Install-App/Library /Volumes/Install-App/Applications
echo "$password" | sudo -u "$user" -S mv /Volumes/Install-AppApplications/Install*.app/Contents/SharedSupport /Volumes/Install-App/Applications/Install*/Contents/
echo "$password" | sudo -u "$user" -S rm -r /Volumes/Install-AppApplications
echo "$password" | sudo -u "$user" -S mv /Volumes/Install-App/Applications/Install*.app /Volumes/Install-App/
echo "$password" | sudo -u "$user" -S rm -r /Volumes/Install-App/Library /Volumes/Install-App/Applications

_helpDefaultWrite "InstallerAppDone" "Yes"
_helpDefaultWrite "InstallerAppDone" "Yes"
if [[ "$syslang" = "en" ]]; then
_helpDefaultWrite "Statustext" "Done"
string="Done"
else
_helpDefaultWrite "Statustext" "Fertig"
string="Fertig"
fi

_helpDefaultWrite "Statustext" "$string"
else
_helpDefaultWrite "InstallerAppDone" "No"


if [[ "$syslang" = "en" ]]; then
_helpDefaultWrite "Statustext" "Creation failed! Please try again."
string="Creation failed! Please try again."
else
_helpDefaultWrite "Statustext" "Erstellung fehlgeschlagen. Bitte versuche es erneut."
string="Erstellung fehlgeschlagen. Bitte versuche es erneut."
fi

_helpDefaultWrite "Statustext" "$string"

fi
exit
}
Expand All @@ -386,10 +421,14 @@ function _remove_downloads()
pkill -f aria2c

if [[ "$syslang" = "en" ]]; then
_helpDefaultWrite "Statustext" "Cleaning Downloadfolder"
string="Cleaning Downloadfolder"
else
_helpDefaultWrite "Statustext" "Bereinige Downloadordner"
string="Bereinige Downloadordner"
fi

_helpDefaultWrite "Statustext" "$string"


while IFS= read -r line
do
rm "$download_path"/"$line" 2> /dev/null
Expand Down Expand Up @@ -417,11 +456,13 @@ function _kill_aria()
# kill -term $KILLPID;
# done
if [[ "$syslang" = "en" ]]; then
_helpDefaultWrite "Statustext" "Done"
string="Done"
else
_helpDefaultWrite "Statustext" "Fertig"
string="Fertig"
fi

_helpDefaultWrite "Statustext" "$string"

bash kill.command &

exit
Expand Down Expand Up @@ -532,10 +573,12 @@ function _start_installer_creation()
fi

if [[ "$syslang" = "en" ]]; then
_helpDefaultWrite "Statustext" "Please enter your Root Password to start the Process."
string="Please enter your Root Password to start the Process."
else
_helpDefaultWrite "Statustext" "Bitte gib Dein Rootpasswort ein um den Prozess zu starten."
string="Bitte gib Dein Rootpasswort ein um den Prozess zu starten."
fi

_helpDefaultWrite "Statustext" "$string"

diskutil eraseVolume JHFS+ "$targetvolumename" "$targetvolume"

Expand Down

0 comments on commit 5d26055

Please sign in to comment.