Skip to content

Commit

Permalink
better handling of loginwindow reload
Browse files Browse the repository at this point in the history
  • Loading branch information
Clkw0rk committed Nov 7, 2023
1 parent 201aa0b commit 472754d
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions build_resources/Packages/XCreds/scripts/postinstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@ fi

if [ ! -e "${rights_backup_path}" ]; then
security authorizationdb read system.login.console > "${rights_backup_path}"

fi

if [ -e "${plugin_path}" ]; then

if [ -e "${target_volume}"/Library/Security/SecurityAgentPlugins/XCredsLoginPlugin.bundle ]; then
rm -rf "${target_volume}"/Library/Security/SecurityAgentPlugins/XCredsLoginPlugin.bundle
fi
Expand All @@ -34,8 +32,26 @@ fi

if [ -e ${xcreds_login_script} ]; then
"${xcreds_login_script}" -i

else
echo "could not find xcreds_login_script tool"
exit -1
fi

if /usr/bin/pgrep -q "Setup Assistant"; then
# loginwindow hasn't been displayed yet - exit successfully
/usr/bin/logger "XCreds: authroization mechanic setup complete"
exit 0
fi

while [[ ! -f "/var/db/.AppleSetupDone" ]]; do
sleep 1
/usr/bin/logger "Waiting for Setup Assistant to complete"
done

# if Finder is not loaded, reload the loginwindow
if /usr/bin/pgrep -q "Finder"; then
exit 0
else
/usr/bin/logger "XCreds: Reload loginwindow"
/usr/bin/killall -9 loginwindow
fi

0 comments on commit 472754d

Please sign in to comment.