Suppress macOS permission fallback code
This commit is contained in:
parent
d12de839b1
commit
52be2d6762
8 changed files with 43 additions and 28 deletions
|
@ -56,17 +56,14 @@ if [ -d /Applications ] && [ -d /Library ] && [ -z "$NO_RESTART" ]; then
|
||||||
if ! cat "$HOME/.zshrc" | grep '# TEMPORARY FOR INSTALL DOCTOR MACOS' > /dev/null; then
|
if ! cat "$HOME/.zshrc" | grep '# TEMPORARY FOR INSTALL DOCTOR MACOS' > /dev/null; then
|
||||||
echo 'bash <(curl -sSL https://install.doctor/start) # TEMPORARY FOR INSTALL DOCTOR MACOS' >> "$HOME/.zshrc"
|
echo 'bash <(curl -sSL https://install.doctor/start) # TEMPORARY FOR INSTALL DOCTOR MACOS' >> "$HOME/.zshrc"
|
||||||
fi
|
fi
|
||||||
# TODO - Section below attempts to add timeout to macOS softwareupdate command but is failing to prompt for password (which is required even with /etc/sudoers set up
|
if command -v gtimeout > /dev/null; then
|
||||||
# if command -v gtimeout > /dev/null; then
|
logg info 'Ensuring system software is upgraded (timing out after 50 minutes if system upgrade fails)'
|
||||||
# logg info 'Ensuring system software is upgraded (timing out after 50 minutes if system upgrade fails)'
|
sudo gtimeout 3000 softwareupdate -i -a -R || logg warn 'The system update command timed out after 50 minutes'
|
||||||
# gtimeout 3000 sudo softwareupdate -i -a -R || logg warn 'The system update command timed out after 50 minutes'
|
else
|
||||||
# else
|
# If gtimeout is unavailable, then attempt system upgrade without a timeout (which usually works on fresh systems)
|
||||||
# # If gtimeout is unavailable, then attempt system upgrade without a timeout (which usually works on fresh systems)
|
logg info 'Applying OS upgrades (if available)'
|
||||||
# logg info 'Applying OS upgrades (if available)'
|
sudo softwareupdate -i -a -R || logg error 'Failed to perform a system update via sudo softwareupdate -i -a -R'
|
||||||
# sudo softwareupdate -i -a -R || logg error 'Failed to perform a system update via sudo softwareupdate -i -a -R'
|
fi
|
||||||
# fi
|
|
||||||
logg info 'Applying OS upgrades (if available)'
|
|
||||||
sudo softwareupdate -i -a -R || logg error 'Failed to perform a system update via sudo softwareupdate -i -a -R'
|
|
||||||
logg info 'If system updates were downloaded / installed, a reboot might be required.'
|
logg info 'If system updates were downloaded / installed, a reboot might be required.'
|
||||||
if command -v gsed > /dev/null; then
|
if command -v gsed > /dev/null; then
|
||||||
sudo gsed -i '/# TEMPORARY FOR INSTALL DOCTOR MACOS/d' "$HOME/.zshrc" || logg warn "Failed to remove kickstart script from .zshrc"
|
sudo gsed -i '/# TEMPORARY FOR INSTALL DOCTOR MACOS/d' "$HOME/.zshrc" || logg warn "Failed to remove kickstart script from .zshrc"
|
||||||
|
|
|
@ -43,7 +43,7 @@ if command -v privoxy > /dev/null; then
|
||||||
if command -v add-user > /dev/null; then
|
if command -v add-user > /dev/null; then
|
||||||
sudo add-user privoxy
|
sudo add-user privoxy
|
||||||
fi
|
fi
|
||||||
sudo chown privoxy:privoxy "$PRIVOXY_CONFIG" || sudo chown privoxy:$(id -g -n) "$PRIVOXY_CONFIG"
|
sudo chown privoxy:privoxy "$PRIVOXY_CONFIG" 2> /dev/null || sudo chown privoxy:$(id -g -n) "$PRIVOXY_CONFIG"
|
||||||
|
|
||||||
# @description Restart Privoxy after configuration is applied
|
# @description Restart Privoxy after configuration is applied
|
||||||
if [ -d /Applications ] && [ -d /System ]; then
|
if [ -d /Applications ] && [ -d /System ]; then
|
||||||
|
|
|
@ -22,7 +22,7 @@ if [ -d /Applications ] && [ -d /System ]; then
|
||||||
brew install defaultbrowser
|
brew install defaultbrowser
|
||||||
fi
|
fi
|
||||||
logg info "Setting default browser to {{ .user.defaultBrowserDarwin }}"
|
logg info "Setting default browser to {{ .user.defaultBrowserDarwin }}"
|
||||||
defaultbrowser "{{ .user.defaultBrowserDarwin }}"
|
osascript "$HOME/Library/Scripts/default-browser.scpt" "{{ .user.defaultBrowserDarwin }}"
|
||||||
else
|
else
|
||||||
logg info 'Setting default browser for text/html to {{ .user.defaultBrowser }}'
|
logg info 'Setting default browser for text/html to {{ .user.defaultBrowser }}'
|
||||||
xdg-mime default {{ .user.defaultBrowser }}.desktop text/html
|
xdg-mime default {{ .user.defaultBrowser }}.desktop text/html
|
||||||
|
|
|
@ -85,12 +85,12 @@ EOT
|
||||||
if command -v add-user > /dev/null; then
|
if command -v add-user > /dev/null; then
|
||||||
sudo add-user rclone
|
sudo add-user rclone
|
||||||
fi
|
fi
|
||||||
sudo chown -Rf rclone:rclone /var/cache/rclone || sudo chown -Rf rclone:$(id -g -n) /var/cache/rclone
|
sudo chown -Rf rclone:rclone /var/cache/rclone 2> /dev/null || sudo chown -Rf rclone:$(id -g -n) /var/cache/rclone
|
||||||
|
|
||||||
logg info 'Ensuring /var/log/rclone exists'
|
logg info 'Ensuring /var/log/rclone exists'
|
||||||
sudo mkdir -p /var/log/rclone
|
sudo mkdir -p /var/log/rclone
|
||||||
sudo chmod 770 /var/log/rclone
|
sudo chmod 770 /var/log/rclone
|
||||||
sudo chown -Rf rclone:rclone /var/log/rclone || sudo chown -Rf rclone:$(id -g -n) /var/log/rclone
|
sudo chown -Rf rclone:rclone /var/log/rclone 2> /dev/null || sudo chown -Rf rclone:$(id -g -n) /var/log/rclone
|
||||||
|
|
||||||
logg info 'Adding ~/.local/bin/rclone-mount to /usr/local/bin'
|
logg info 'Adding ~/.local/bin/rclone-mount to /usr/local/bin'
|
||||||
sudo cp -f "$HOME/.local/bin/rclone-mount" /usr/local/bin/rclone-mount
|
sudo cp -f "$HOME/.local/bin/rclone-mount" /usr/local/bin/rclone-mount
|
||||||
|
@ -117,7 +117,7 @@ EOT
|
||||||
logg info "Ensuring /mnt/$SERVICE_ID is created with proper permissions"
|
logg info "Ensuring /mnt/$SERVICE_ID is created with proper permissions"
|
||||||
sudo mkdir -p "/mnt/$SERVICE_ID"
|
sudo mkdir -p "/mnt/$SERVICE_ID"
|
||||||
sudo chmod 770 "/mnt/$SERVICE_ID"
|
sudo chmod 770 "/mnt/$SERVICE_ID"
|
||||||
sudo chown -Rf rclone:rclone "/mnt/$SERVICE_ID" || sudo chown -Rf rclone:$(id -g -n) "/mnt/$SERVICE_ID"
|
sudo chown -Rf rclone:rclone "/mnt/$SERVICE_ID" 2> /dev/null || sudo chown -Rf rclone:$(id -g -n) "/mnt/$SERVICE_ID"
|
||||||
|
|
||||||
### Enable / restart the service
|
### Enable / restart the service
|
||||||
logg info "Enabling / restarting the $SERVICE_ID S3 service"
|
logg info "Enabling / restarting the $SERVICE_ID S3 service"
|
||||||
|
|
|
@ -76,17 +76,17 @@ if command -v smbd > /dev/null; then
|
||||||
logg info "Ensuring $PRIVATE_SHARE is created"
|
logg info "Ensuring $PRIVATE_SHARE is created"
|
||||||
sudo mkdir -p "$PRIVATE_SHARE"
|
sudo mkdir -p "$PRIVATE_SHARE"
|
||||||
sudo chmod 770 "$PRIVATE_SHARE"
|
sudo chmod 770 "$PRIVATE_SHARE"
|
||||||
sudo chown -Rf rclone:rclone "$PRIVATE_SHARE" || sudo chown -Rf rclone:$(id -g -n) "$PRIVATE_SHARE"
|
sudo chown -Rf rclone:rclone "$PRIVATE_SHARE" 2> /dev/null || sudo chown -Rf rclone:$(id -g -n) "$PRIVATE_SHARE"
|
||||||
|
|
||||||
logg info "Ensuring $PUBLIC_SHARE is created"
|
logg info "Ensuring $PUBLIC_SHARE is created"
|
||||||
sudo mkdir -p "$PUBLIC_SHARE"
|
sudo mkdir -p "$PUBLIC_SHARE"
|
||||||
sudo chmod 775 "$PUBLIC_SHARE"
|
sudo chmod 775 "$PUBLIC_SHARE"
|
||||||
sudo chown -Rf rclone:rclone "$PUBLIC_SHARE" || sudo chown -Rf rclone:$(id -g -n) "$PUBLIC_SHARE"
|
sudo chown -Rf rclone:rclone "$PUBLIC_SHARE" 2> /dev/null || sudo chown -Rf rclone:$(id -g -n) "$PUBLIC_SHARE"
|
||||||
|
|
||||||
logg info "Ensuring $HOME/Public is created"
|
logg info "Ensuring $HOME/Public is created"
|
||||||
mkdir -p "$HOME/Public"
|
mkdir -p "$HOME/Public"
|
||||||
chmod 775 "$HOME/Public"
|
chmod 775 "$HOME/Public"
|
||||||
chown -Rf {{ .user.username }}:{{ .user.username }} "$HOME/Public" || chown -Rf {{ .user.username }}:$(id -g -n) "$HOME/Public"
|
chown -Rf {{ .user.username }}:{{ .user.username }} "$HOME/Public" 2> /dev/null || chown -Rf {{ .user.username }}:$(id -g -n) "$HOME/Public"
|
||||||
|
|
||||||
sudo sharing -a "$PRIVATE_SHARE" -S "Private (System)" -n "Private (System)" -g 000 -s 001 -E 1 -R 1 && logg success "Configured $PRIVATE_SHARE as a private Samba share" || logg info 'sharing command failed - it is likely that the share was already set up'
|
sudo sharing -a "$PRIVATE_SHARE" -S "Private (System)" -n "Private (System)" -g 000 -s 001 -E 1 -R 1 && logg success "Configured $PRIVATE_SHARE as a private Samba share" || logg info 'sharing command failed - it is likely that the share was already set up'
|
||||||
sudo sharing -a "$PUBLIC_SHARE" -S "Public (System)" -n "Public (System)" -g 001 -s 001 -E 1 -R 0 && logg success "Configured $PUBLIC_SHARE as a public Samba share" || logg info 'sharing command failed - it is likely that the share was already set up'
|
sudo sharing -a "$PUBLIC_SHARE" -S "Public (System)" -n "Public (System)" -g 001 -s 001 -E 1 -R 0 && logg success "Configured $PUBLIC_SHARE as a public Samba share" || logg info 'sharing command failed - it is likely that the share was already set up'
|
||||||
|
@ -97,17 +97,17 @@ if command -v smbd > /dev/null; then
|
||||||
logg info "Ensuring $PRIVATE_SHARE is created"
|
logg info "Ensuring $PRIVATE_SHARE is created"
|
||||||
sudo mkdir -p "$PRIVATE_SHARE"
|
sudo mkdir -p "$PRIVATE_SHARE"
|
||||||
sudo chmod 770 "$PRIVATE_SHARE"
|
sudo chmod 770 "$PRIVATE_SHARE"
|
||||||
sudo chown -Rf rclone:rclone "$PRIVATE_SHARE" || sudo chown -Rf rclone:$(id -g -n) "$PRIVATE_SHARE"
|
sudo chown -Rf rclone:rclone "$PRIVATE_SHARE"
|
||||||
|
|
||||||
logg info "Ensuring $PUBLIC_SHARE is created"
|
logg info "Ensuring $PUBLIC_SHARE is created"
|
||||||
sudo mkdir -p "$PUBLIC_SHARE"
|
sudo mkdir -p "$PUBLIC_SHARE"
|
||||||
sudo chmod 775 "$PUBLIC_SHARE"
|
sudo chmod 775 "$PUBLIC_SHARE"
|
||||||
sudo chown -Rf rclone:rclone "$PUBLIC_SHARE" || sudo chown -Rf rclone:$(id -g -n) "$PUBLIC_SHARE"
|
sudo chown -Rf rclone:rclone "$PUBLIC_SHARE"
|
||||||
|
|
||||||
logg info "Ensuring $HOME/Public is created"
|
logg info "Ensuring $HOME/Public is created"
|
||||||
mkdir -p "$HOME/Public"
|
mkdir -p "$HOME/Public"
|
||||||
chmod 775 "$HOME/Public"
|
chmod 775 "$HOME/Public"
|
||||||
chown -Rf {{ .user.username }}:rclone "$HOME/Public" || chown -Rf {{ .user.username }}:$(id -g -n) "$HOME/Public"
|
chown -Rf {{ .user.username }}:rclone "$HOME/Public"
|
||||||
|
|
||||||
logg info "Copying Samba server configuration to /etc/samba/smb.conf"
|
logg info "Copying Samba server configuration to /etc/samba/smb.conf"
|
||||||
sudo cp -f "${XDG_CONFIG_HOME:-$HOME/.config}/samba/config" "/etc/samba/smb.conf"
|
sudo cp -f "${XDG_CONFIG_HOME:-$HOME/.config}/samba/config" "/etc/samba/smb.conf"
|
||||||
|
|
|
@ -17,13 +17,13 @@ ensureNetdataOwnership() {
|
||||||
### Ensure /usr/local/var/lib/netdata/cloud.d is owned by user
|
### Ensure /usr/local/var/lib/netdata/cloud.d is owned by user
|
||||||
if [ -d /usr/local/var/lib/netdata ]; then
|
if [ -d /usr/local/var/lib/netdata ]; then
|
||||||
logg info 'Ensuring permissions are correct on /usr/local/var/lib/netdata'
|
logg info 'Ensuring permissions are correct on /usr/local/var/lib/netdata'
|
||||||
sudo chown -Rf netdata:netdata /usr/local/var/lib/netdata || sudo chown -Rf netdata:$(id -g -n) /usr/local/var/lib/netdata
|
sudo chown -Rf netdata:netdata /usr/local/var/lib/netdata 2> /dev/null || sudo chown -Rf netdata:$(id -g -n) /usr/local/var/lib/netdata
|
||||||
elif [ -d /var/lib/netdata ]; then
|
elif [ -d /var/lib/netdata ]; then
|
||||||
logg info 'Ensuring permissions are correct on /var/lib/netdata'
|
logg info 'Ensuring permissions are correct on /var/lib/netdata'
|
||||||
sudo chown -Rf netdata:netdata /var/lib/netdata || sudo chown -Rf netdata:$(id -g -n) /var/lib/netdata
|
sudo chown -Rf netdata:netdata /var/lib/netdata 2> /dev/null || sudo chown -Rf netdata:$(id -g -n) /var/lib/netdata
|
||||||
elif [ -d "$HOMEBREW_PREFIX/var/lib/netdata" ]; then
|
elif [ -d "${HOMEBREW_PREFIX:-/opt/homebrew}/var/lib/netdata" ]; then
|
||||||
logg info "Ensuring permissions are correct on $HOMEBREW_PREFIX/var/lib/netdata"
|
logg info "Ensuring permissions are correct on ${HOMEBREW_PREFIX:-/opt/homebrew}/var/lib/netdata"
|
||||||
sudo chown -Rf netdata:netdata "$HOMEBREW_PREFIX/var/lib/netdata" || sudo chown -Rf netdata:$(id -g -n) "$HOMEBREW_PREFIX/var/lib/netdata"
|
sudo chown -Rf netdata:netdata "${HOMEBREW_PREFIX:-/opt/homebrew}/var/lib/netdata" 2> /dev/null || sudo chown -Rf netdata:$(id -g -n) "${HOMEBREW_PREFIX:-/opt/homebrew}/var/lib/netdata"
|
||||||
else
|
else
|
||||||
logg warn 'No /var/lib/netdata folder found'
|
logg warn 'No /var/lib/netdata folder found'
|
||||||
fi
|
fi
|
||||||
|
|
14
home/Library/Scripts/default-browser.scpt
Normal file
14
home/Library/Scripts/default-browser.scpt
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
on run argv
|
||||||
|
do shell script "defaultbrowser " & item 1 of argv
|
||||||
|
try
|
||||||
|
tell application "System Events"
|
||||||
|
tell application process "CoreServicesUIAgent"
|
||||||
|
tell window 1
|
||||||
|
tell (first button whose name starts with "use")
|
||||||
|
perform action "AXPress"
|
||||||
|
end tell
|
||||||
|
end tell
|
||||||
|
end tell
|
||||||
|
end tell
|
||||||
|
end try
|
||||||
|
end run
|
|
@ -44,7 +44,11 @@ for FOLDER in "$CACHE_FOLDER" "$CONFIG_FOLDER" "$LOG_FOLDER" "$MOUNT_PATH"; do
|
||||||
if [ ! -d "$FOLDER" ]; then
|
if [ ! -d "$FOLDER" ]; then
|
||||||
sudo mkdir -p "$FOLDER" || echo "ERROR: Need permissions for $FOLDER"
|
sudo mkdir -p "$FOLDER" || echo "ERROR: Need permissions for $FOLDER"
|
||||||
sudo chmod 755 "$FOLDER"
|
sudo chmod 755 "$FOLDER"
|
||||||
sudo chown -Rf rclone:rclone "$FOLDER" || sudo chown -Rf rclone:$(id -g -n) "$FOLDER"
|
if command -v own > /dev/null; then
|
||||||
|
sudo own "$FOLDER"
|
||||||
|
else
|
||||||
|
sudo chown -Rf rclone:rclone "$FOLDER" 2> /dev/null || sudo chown -Rf rclone:$(id -g -n) "$FOLDER"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue