![William Li](/assets/img/avatar_default.png)
If not, the dotnet new will run as root and the cache folders will be in root ownership How to get current user https://apple.stackexchange.com/questions/144159/how-can-i-determine-the-invoking-user-in-an-apple-installer-postinstall-script
18 lines
522 B
Bash
Executable file
18 lines
522 B
Bash
Executable file
#!/bin/sh
|
|
#
|
|
# Copyright (c) .NET Foundation and contributors. All rights reserved.
|
|
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
#
|
|
|
|
PACKAGE=$1
|
|
INSTALL_DESTINATION=$2
|
|
|
|
|
|
# A temporary fix for the permissions issue(s)
|
|
chmod -R 755 $INSTALL_DESTINATION
|
|
|
|
# Run 'dotnet new' as user to trigger the first time experience to initialize the cache
|
|
INSTALLER_USER=$(stat -f '%Su' $HOME)
|
|
su - $INSTALLER_USER -c "$INSTALL_DESTINATION/dotnet new > /dev/null 2>&1 || true"
|
|
|
|
exit 0
|