Skip to content

Commit

Permalink
Merge branch 'main' into docs-v4.61.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rachaelshaw committed Nov 11, 2024
2 parents 02e8c4e + 59c85b6 commit c6f57b5
Show file tree
Hide file tree
Showing 24 changed files with 125 additions and 83 deletions.
4 changes: 2 additions & 2 deletions orbit/TUF.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ Following are the currently deployed versions of fleetd components on the `stabl

| Component\OS | macOS | Linux | Windows | Linux (arm64) |
|--------------|--------------|--------|---------|---------------|
| orbit | 1.34.0 | 1.34.0 | 1.34.0 | 1.34.0 |
| desktop | 1.34.0 | 1.34.0 | 1.34.0 | 1.34.0 |
| orbit | 1.35.0 | 1.35.0 | 1.35.0 | 1.35.0 |
| desktop | 1.35.0 | 1.35.0 | 1.35.0 | 1.35.0 |
| osqueryd | 5.14.1 | 5.14.1 | 5.14.1 | 5.14.1 |
| nudge | 1.1.10.81462 | - | - | - |
| swiftDialog | 2.1.0 | - | - | - |
Expand Down
3 changes: 3 additions & 0 deletions server/mdm/maintainedapps/scripts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ func TestScriptGeneration(t *testing.T) {
err = json.Unmarshal(caskJSON, &cask)
require.NoError(t, err)

cask.PreUninstallScripts = app.PreUninstallScripts
cask.PostUninstallScripts = app.PostUninstallScripts

t.Run(app.Identifier, func(t *testing.T) {
installScript, err := installScriptForApp(app, &cask)
require.NoError(t, err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ trash() {
local logged_in_user="$1"
local target_file="$2"
local timestamp="$(date +%Y-%m-%d-%s)"
local rand="$(jot -r 1 0 99999)"

# replace ~ with /Users/$logged_in_user
if [[ "$target_file" == ~* ]]; then
Expand All @@ -20,7 +21,7 @@ trash() {

if [[ -e "$target_file" ]]; then
echo "removing $target_file."
mv -f "$target_file" "$trash/${file_name}_${timestamp}"
mv -f "$target_file" "$trash/${file_name}_${timestamp}_${rand}"
else
echo "$target_file doesn't exist."
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ remove_launchctl_service() {
local booleans=("true" "false")
local plist_status
local paths
local sudo
local should_sudo

echo "Removing launchctl service ${service}"

for sudo in "${booleans[@]}"; do
for should_sudo in "${booleans[@]}"; do
plist_status=$(launchctl list "${service}" 2>/dev/null)

if [[ $plist_status == \{* ]]; then
if [[ $sudo == "true" ]]; then
if [[ $should_sudo == "true" ]]; then
sudo launchctl remove "${service}"
else
launchctl remove "${service}"
Expand All @@ -69,15 +69,15 @@ remove_launchctl_service() {
)

# if not using sudo, prepend the home directory to the paths
if [[ $sudo == "false" ]]; then
if [[ $should_sudo == "false" ]]; then
for i in "${!paths[@]}"; do
paths[i]="${HOME}${paths[i]}"
done
fi

for path in "${paths[@]}"; do
if [[ -e "$path" ]]; then
if [[ $sudo == "true" ]]; then
if [[ $should_sudo == "true" ]]; then
sudo rm -f -- "$path"
else
rm -f -- "$path"
Expand All @@ -91,6 +91,7 @@ trash() {
local logged_in_user="$1"
local target_file="$2"
local timestamp="$(date +%Y-%m-%d-%s)"
local rand="$(jot -r 1 0 99999)"

# replace ~ with /Users/$logged_in_user
if [[ "$target_file" == ~* ]]; then
Expand All @@ -102,7 +103,7 @@ trash() {

if [[ -e "$target_file" ]]; then
echo "removing $target_file."
mv -f "$target_file" "$trash/${file_name}_${timestamp}"
mv -f "$target_file" "$trash/${file_name}_${timestamp}_${rand}"
else
echo "$target_file doesn't exist."
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ remove_launchctl_service() {
local booleans=("true" "false")
local plist_status
local paths
local sudo
local should_sudo

echo "Removing launchctl service ${service}"

for sudo in "${booleans[@]}"; do
for should_sudo in "${booleans[@]}"; do
plist_status=$(launchctl list "${service}" 2>/dev/null)

if [[ $plist_status == \{* ]]; then
if [[ $sudo == "true" ]]; then
if [[ $should_sudo == "true" ]]; then
sudo launchctl remove "${service}"
else
launchctl remove "${service}"
Expand All @@ -69,15 +69,15 @@ remove_launchctl_service() {
)

# if not using sudo, prepend the home directory to the paths
if [[ $sudo == "false" ]]; then
if [[ $should_sudo == "false" ]]; then
for i in "${!paths[@]}"; do
paths[i]="${HOME}${paths[i]}"
done
fi

for path in "${paths[@]}"; do
if [[ -e "$path" ]]; then
if [[ $sudo == "true" ]]; then
if [[ $should_sudo == "true" ]]; then
sudo rm -f -- "$path"
else
rm -f -- "$path"
Expand All @@ -91,6 +91,7 @@ trash() {
local logged_in_user="$1"
local target_file="$2"
local timestamp="$(date +%Y-%m-%d-%s)"
local rand="$(jot -r 1 0 99999)"

# replace ~ with /Users/$logged_in_user
if [[ "$target_file" == ~* ]]; then
Expand All @@ -102,20 +103,26 @@ trash() {

if [[ -e "$target_file" ]]; then
echo "removing $target_file."
mv -f "$target_file" "$trash/${file_name}_${timestamp}"
mv -f "$target_file" "$trash/${file_name}_${timestamp}_${rand}"
else
echo "$target_file doesn't exist."
fi
}

(cd /Users/$LOGGED_IN_USER; sudo -u $LOGGED_IN_USER fileproviderctl domain remove -A com.box.desktop.boxfileprovider)
(cd /Users/$LOGGED_IN_USER; sudo -u $LOGGED_IN_USER /Applications/Box.app/Contents/MacOS/fpe/streem --remove-fpe-domain-and-archive-unsynced-content Box)
(cd /Users/$LOGGED_IN_USER; sudo -u $LOGGED_IN_USER /Applications/Box.app/Contents/MacOS/fpe/streem --remove-fpe-domain-and-preserve-unsynced-content Box)
(cd /Users/$LOGGED_IN_USER; defaults delete com.box.desktop)
echo "${LOGGED_IN_USER} ALL = (root) NOPASSWD: /Library/Application\ Support/Box/uninstall_box_drive_r" >> /etc/sudoers.d/box_uninstall
remove_launchctl_service 'com.box.desktop.helper'
quit_application 'com.box.Box-Local-Com-Server'
quit_application 'com.box.desktop'
quit_application 'com.box.desktop.findersyncext'
quit_application 'com.box.desktop.helper'
quit_application 'com.box.desktop.ui'
sudo -u "$LOGGED_IN_USER" '/Library/Application Support/Box/uninstall_box_drive'
(cd /Users/$LOGGED_IN_USER && sudo -u "$LOGGED_IN_USER" '/Library/Application Support/Box/uninstall_box_drive')
sudo pkgutil --forget 'com.box.desktop.installer.*'
rm /etc/sudoers.d/box_uninstall
trash $LOGGED_IN_USER '~/.Box_*'
trash $LOGGED_IN_USER '~/Library/Application Support/Box/Box'
trash $LOGGED_IN_USER '~/Library/Application Support/FileProvider/com.box.desktop.boxfileprovider'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ trash() {
local logged_in_user="$1"
local target_file="$2"
local timestamp="$(date +%Y-%m-%d-%s)"
local rand="$(jot -r 1 0 99999)"

# replace ~ with /Users/$logged_in_user
if [[ "$target_file" == ~* ]]; then
Expand All @@ -20,7 +21,7 @@ trash() {

if [[ -e "$target_file" ]]; then
echo "removing $target_file."
mv -f "$target_file" "$trash/${file_name}_${timestamp}"
mv -f "$target_file" "$trash/${file_name}_${timestamp}_${rand}"
else
echo "$target_file doesn't exist."
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ remove_launchctl_service() {
local booleans=("true" "false")
local plist_status
local paths
local sudo
local should_sudo

echo "Removing launchctl service ${service}"

for sudo in "${booleans[@]}"; do
for should_sudo in "${booleans[@]}"; do
plist_status=$(launchctl list "${service}" 2>/dev/null)

if [[ $plist_status == \{* ]]; then
if [[ $sudo == "true" ]]; then
if [[ $should_sudo == "true" ]]; then
sudo launchctl remove "${service}"
else
launchctl remove "${service}"
Expand All @@ -69,15 +69,15 @@ remove_launchctl_service() {
)

# if not using sudo, prepend the home directory to the paths
if [[ $sudo == "false" ]]; then
if [[ $should_sudo == "false" ]]; then
for i in "${!paths[@]}"; do
paths[i]="${HOME}${paths[i]}"
done
fi

for path in "${paths[@]}"; do
if [[ -e "$path" ]]; then
if [[ $sudo == "true" ]]; then
if [[ $should_sudo == "true" ]]; then
sudo rm -f -- "$path"
else
rm -f -- "$path"
Expand All @@ -91,6 +91,7 @@ trash() {
local logged_in_user="$1"
local target_file="$2"
local timestamp="$(date +%Y-%m-%d-%s)"
local rand="$(jot -r 1 0 99999)"

# replace ~ with /Users/$logged_in_user
if [[ "$target_file" == ~* ]]; then
Expand All @@ -102,7 +103,7 @@ trash() {

if [[ -e "$target_file" ]]; then
echo "removing $target_file."
mv -f "$target_file" "$trash/${file_name}_${timestamp}"
mv -f "$target_file" "$trash/${file_name}_${timestamp}_${rand}"
else
echo "$target_file doesn't exist."
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ remove_launchctl_service() {
local booleans=("true" "false")
local plist_status
local paths
local sudo
local should_sudo

echo "Removing launchctl service ${service}"

for sudo in "${booleans[@]}"; do
for should_sudo in "${booleans[@]}"; do
plist_status=$(launchctl list "${service}" 2>/dev/null)

if [[ $plist_status == \{* ]]; then
if [[ $sudo == "true" ]]; then
if [[ $should_sudo == "true" ]]; then
sudo launchctl remove "${service}"
else
launchctl remove "${service}"
Expand All @@ -70,15 +70,15 @@ remove_launchctl_service() {
)

# if not using sudo, prepend the home directory to the paths
if [[ $sudo == "false" ]]; then
if [[ $should_sudo == "false" ]]; then
for i in "${!paths[@]}"; do
paths[i]="${HOME}${paths[i]}"
done
fi

for path in "${paths[@]}"; do
if [[ -e "$path" ]]; then
if [[ $sudo == "true" ]]; then
if [[ $should_sudo == "true" ]]; then
sudo rm -f -- "$path"
else
rm -f -- "$path"
Expand All @@ -92,6 +92,7 @@ trash() {
local logged_in_user="$1"
local target_file="$2"
local timestamp="$(date +%Y-%m-%d-%s)"
local rand="$(jot -r 1 0 99999)"

# replace ~ with /Users/$logged_in_user
if [[ "$target_file" == ~* ]]; then
Expand All @@ -103,7 +104,7 @@ trash() {

if [[ -e "$target_file" ]]; then
echo "removing $target_file."
mv -f "$target_file" "$trash/${file_name}_${timestamp}"
mv -f "$target_file" "$trash/${file_name}_${timestamp}_${rand}"
else
echo "$target_file doesn't exist."
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ trash() {
local logged_in_user="$1"
local target_file="$2"
local timestamp="$(date +%Y-%m-%d-%s)"
local rand="$(jot -r 1 0 99999)"

# replace ~ with /Users/$logged_in_user
if [[ "$target_file" == ~* ]]; then
Expand All @@ -20,7 +21,7 @@ trash() {

if [[ -e "$target_file" ]]; then
echo "removing $target_file."
mv -f "$target_file" "$trash/${file_name}_${timestamp}"
mv -f "$target_file" "$trash/${file_name}_${timestamp}_${rand}"
else
echo "$target_file doesn't exist."
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ trash() {
local logged_in_user="$1"
local target_file="$2"
local timestamp="$(date +%Y-%m-%d-%s)"
local rand="$(jot -r 1 0 99999)"

# replace ~ with /Users/$logged_in_user
if [[ "$target_file" == ~* ]]; then
Expand All @@ -58,7 +59,7 @@ trash() {

if [[ -e "$target_file" ]]; then
echo "removing $target_file."
mv -f "$target_file" "$trash/${file_name}_${timestamp}"
mv -f "$target_file" "$trash/${file_name}_${timestamp}_${rand}"
else
echo "$target_file doesn't exist."
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ remove_launchctl_service() {
local booleans=("true" "false")
local plist_status
local paths
local sudo
local should_sudo

echo "Removing launchctl service ${service}"

for sudo in "${booleans[@]}"; do
for should_sudo in "${booleans[@]}"; do
plist_status=$(launchctl list "${service}" 2>/dev/null)

if [[ $plist_status == \{* ]]; then
if [[ $sudo == "true" ]]; then
if [[ $should_sudo == "true" ]]; then
sudo launchctl remove "${service}"
else
launchctl remove "${service}"
Expand All @@ -32,15 +32,15 @@ remove_launchctl_service() {
)

# if not using sudo, prepend the home directory to the paths
if [[ $sudo == "false" ]]; then
if [[ $should_sudo == "false" ]]; then
for i in "${!paths[@]}"; do
paths[i]="${HOME}${paths[i]}"
done
fi

for path in "${paths[@]}"; do
if [[ -e "$path" ]]; then
if [[ $sudo == "true" ]]; then
if [[ $should_sudo == "true" ]]; then
sudo rm -f -- "$path"
else
rm -f -- "$path"
Expand All @@ -54,6 +54,7 @@ trash() {
local logged_in_user="$1"
local target_file="$2"
local timestamp="$(date +%Y-%m-%d-%s)"
local rand="$(jot -r 1 0 99999)"

# replace ~ with /Users/$logged_in_user
if [[ "$target_file" == ~* ]]; then
Expand All @@ -65,7 +66,7 @@ trash() {

if [[ -e "$target_file" ]]; then
echo "removing $target_file."
mv -f "$target_file" "$trash/${file_name}_${timestamp}"
mv -f "$target_file" "$trash/${file_name}_${timestamp}_${rand}"
else
echo "$target_file doesn't exist."
fi
Expand Down
Loading

0 comments on commit c6f57b5

Please sign in to comment.