-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDeep_Freeze_APFS_addVolume_thawed.sh
More file actions
65 lines (48 loc) · 1.74 KB
/
Deep_Freeze_APFS_addVolume_thawed.sh
File metadata and controls
65 lines (48 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/sh
# Jamf JSS Parameters 1 through 3 are predefined as mount point, computer name, and username
pathToScript=$0
mountPoint=$1
computerName=$2
userName=$3
shift 3
# Shift off the $1 $2 $3 parameters passed by the JSS so that parameter 4 is now $1
####################################################################################################
#
# Accepts 2 parameters:
# VolumeName dfPassword
#
#
#
####################################################################################################
#
####################################################################################################
#
#
# DEFINE VARIABLES & READ IN PARAMETERS
#
####################################################################################################
# HARDCODED VALUES SET HERE
dfPassword=""
# CHECK TO SEE IF A VALUE WAS PASSED IN PARAMETER 2 AND, IF SO, ASSIGN TO "DFPASSWORD"
if [ "$2" != "" ] && [ "$dfPassword" == "" ];then
dfPassword=$2
fi
####################################################################################################
#
# SCRIPT CONTENTS - DO NOT MODIFY BELOW THIS LINE
#
####################################################################################################
VolumeName="${1}"
bootDiskdev=$(diskutil info / | awk '/Part of Whole/ {print $4}')
if [ ! -e /Volumes/"$VolumeName" ]
then
echo "Adding APFS volume $VolumeName..."
/usr/sbin/diskutil APFS addVolume $bootDiskdev APFS "$VolumeName"
else
echo "/Volumes/$VolumeName aready exists, thus not creating the APFS volume."
fi
# ignore permisssions
/usr/sbin/diskutil disableOwnership "/Volumes/$VolumeName"
echo "Setting $VolumeName volume state to Thawed..."
DFXPSWD="$dfPassword" /usr/local/bin/deepfreeze thaw --volume "$VolumeName" --env
exit 0