@@ -46,15 +46,15 @@ function wait_for_device() {
4646
4747 for i in {1..5}; do
4848 if [ -e " /dev/disk/by-uuid/$l_device_uuid " ]; then
49- return $SUCCESS
49+ return " $SUCCESS "
5050 else
5151 echo " Waiting for device $l_device_uuid ... ${i} s"
5252 sleep 1
5353 fi
5454 done
5555
5656 echo " ERROR: Device \" $l_device_uuid \" is not available."
57- return $FAILURE
57+ return " $FAILURE "
5858}
5959
6060# -----------------------------------------------------------------------------
@@ -66,11 +66,11 @@ function verify_lvm() {
6666 local l_lvm_group=$2
6767
6868 if lvdisplay " $l_lvm_group /$l_lvm_name " > /dev/null 2>&1 ; then
69- return $SUCCESS
69+ return " $SUCCESS "
7070 fi
7171
7272 echo " ERROR: Logical volume \" $l_lvm_name \" is not available."
73- return $FAILURE
73+ return " $FAILURE "
7474}
7575
7676function lvm_is_active() {
@@ -79,9 +79,9 @@ function lvm_is_active() {
7979
8080 # Use lvs to check if volume is active (more reliable than parsing lvdisplay)
8181 if lvs --noheadings -o lv_active " $l_lvm_group /$l_lvm_name " 2> /dev/null | grep -q " active" ; then
82- return $SUCCESS
82+ return " $SUCCESS "
8383 else
84- return $FAILURE
84+ return " $FAILURE "
8585 fi
8686}
8787
@@ -90,7 +90,7 @@ function activate_lvm() {
9090 local l_lvm_group=$2
9191
9292 if [ " $l_lvm_name " == " none" ] || [ " $l_lvm_group " == " none" ]; then
93- return $SUCCESS
93+ return " $SUCCESS "
9494 fi
9595
9696 verify_lvm " $l_lvm_name " " $l_lvm_group "
@@ -100,7 +100,7 @@ function activate_lvm() {
100100 echo " Activating $l_lvm_name ..."
101101 if ! lvchange -ay " $l_lvm_group /$l_lvm_name " ; then
102102 echo " ERROR: Failed to activate LVM logical volume \" $l_lvm_group /$l_lvm_name \" "
103- return $FAILURE
103+ return " $FAILURE "
104104 fi
105105 echo -e " Done\n"
106106 fi
@@ -111,7 +111,7 @@ function deactivate_lvm() {
111111 local l_lvm_group=$2
112112
113113 if [ " $l_lvm_name " == " none" ] || [ " $l_lvm_group " == " none" ]; then
114- return $SUCCESS
114+ return " $SUCCESS "
115115 fi
116116
117117 verify_lvm " $l_lvm_name " " $l_lvm_group "
@@ -120,7 +120,7 @@ function deactivate_lvm() {
120120 echo " Deactivating $l_lvm_name ..."
121121 if ! lvchange -an " $l_lvm_group /$l_lvm_name " ; then
122122 echo " WARNING: Failed to deactivate LVM logical volume \" $l_lvm_group /$l_lvm_name \" "
123- return $FAILURE
123+ return " $FAILURE "
124124 fi
125125 echo -e " Done\n"
126126 else
@@ -140,13 +140,13 @@ function unlock_device() {
140140
141141 if [ " $l_device_uuid " == " none" ] || [ " $l_mapper " == " none" ]; then
142142 echo -e " Device not configured (device_uuid=\" $l_device_uuid \" ; mapper=\" $l_mapper \" ). Skipping.\n"
143- return $SUCCESS
143+ return " $SUCCESS "
144144 fi
145145
146146 # Check if already unlocked
147147 if cryptsetup status " $l_mapper " > /dev/null 2>&1 ; then
148148 echo -e " Partition \" $l_mapper \" unlocked. Skipping.\n"
149- return $SUCCESS
149+ return " $SUCCESS "
150150 fi
151151
152152 echo " Unlocking $l_mapper ($l_encryption_type )..."
@@ -160,30 +160,30 @@ function unlock_device() {
160160 if [ " $l_key_file " != " none" ] && [ -f " $l_key_file " ]; then
161161 if ! cryptsetup open --type bitlk " $l_device_path " " $l_mapper " --key-file=" $l_key_file " ; then
162162 echo " ERROR: Failed to unlock BitLocker device \" $l_device_uuid \" as \" $l_mapper \" using key file"
163- return $FAILURE
163+ return " $FAILURE "
164164 fi
165165 else
166166 if ! cryptsetup open --type bitlk " $l_device_path " " $l_mapper " ; then
167167 echo " ERROR: Failed to unlock BitLocker device \" $l_device_uuid \" as \" $l_mapper \" with interactive password"
168- return $FAILURE
168+ return " $FAILURE "
169169 fi
170170 fi
171171 elif [ " $l_encryption_type " == " luks" ]; then
172172 # LUKS support
173173 if [ " $l_key_file " != " none" ] && [ -f " $l_key_file " ]; then
174174 if ! cryptsetup open --type luks " $l_device_path " " $l_mapper " --key-file=" $l_key_file " ; then
175175 echo " ERROR: Failed to unlock LUKS device \" $l_device_uuid \" as \" $l_mapper \" using key file"
176- return $FAILURE
176+ return " $FAILURE "
177177 fi
178178 else
179179 if ! cryptsetup open --type luks " $l_device_path " " $l_mapper " ; then
180180 echo " ERROR: Failed to unlock LUKS device \" $l_device_uuid \" as \" $l_mapper \" with interactive password"
181- return $FAILURE
181+ return " $FAILURE "
182182 fi
183183 fi
184184 else
185185 echo " ERROR: Unsupported encryption type \" $l_encryption_type \" for device \" $l_mapper \" "
186- return $FAILURE
186+ return " $FAILURE "
187187 fi
188188
189189 echo -e " Done\n"
@@ -194,14 +194,14 @@ function lock_device() {
194194 local l_encryption_type=${2:- luks}
195195
196196 if [ " $l_mapper " == " none" ]; then
197- return $SUCCESS
197+ return " $SUCCESS "
198198 fi
199199
200200 if cryptsetup status " $l_mapper " > /dev/null 2>&1 ; then
201201 echo " Locking $l_mapper ($l_encryption_type )..."
202202 if ! cryptsetup close " $l_mapper " ; then
203203 echo " WARNING: Failed to lock device \" $l_mapper \" "
204- return $FAILURE
204+ return " $FAILURE "
205205 fi
206206 echo -e " Done\n"
207207 else
@@ -220,22 +220,22 @@ function mount_device() {
220220
221221 if [ " $l_mapper " == " none" ] || [ " $l_mount " == " none" ]; then
222222 echo -e " Mount not configured (mapper=\" $l_mapper \" ; mount_point=\" $l_mount \" ). Skipping.\n"
223- return $SUCCESS
223+ return " $SUCCESS "
224224 elif mountpoint -q " /mnt/$l_mount " ; then
225225 echo -e " Mountpoint \" $l_mount \" mounted. Skipping.\n"
226226 else
227227 # Check if mapper device exists before attempting mount
228228 if [ ! -e " /dev/mapper/$l_mapper " ]; then
229229 echo -e " Mapper device \" /dev/mapper/$l_mapper \" does not exist. Skipping mount.\n"
230- return $SUCCESS
230+ return " $SUCCESS "
231231 fi
232232
233233 echo " Mounting $l_mount ..."
234234 mkdir -p " /mnt/$l_mount "
235235
236236 if ! mount -o " $l_mount_options " " /dev/mapper/$l_mapper " " /mnt/$l_mount " ; then
237237 echo " ERROR: Failed to mount \" /dev/mapper/$l_mapper \" to \" /mnt/$l_mount \" "
238- return $FAILURE
238+ return " $FAILURE "
239239 fi
240240 echo -e " Done\n"
241241 fi
@@ -245,14 +245,14 @@ function unmount_device() {
245245 local l_mount=$1
246246
247247 if [ " $l_mount " == " none" ]; then
248- return $SUCCESS
248+ return " $SUCCESS "
249249 fi
250250
251251 if mountpoint -q " /mnt/$l_mount " ; then
252252 echo " Unmounting $l_mount ..."
253253 if ! umount " /mnt/$l_mount " ; then
254254 echo " WARNING: Failed to unmount \" /mnt/$l_mount \" "
255- return $FAILURE
255+ return " $FAILURE "
256256 else
257257 echo -e " Done\n"
258258 fi
@@ -271,7 +271,7 @@ function mount_network_path() {
271271 local l_additional_options=$7
272272
273273 if [ " $l_protocol " == " none" ]; then
274- return $SUCCESS
274+ return " $SUCCESS "
275275 fi
276276
277277 if mountpoint -q " /mnt/$l_mount_path " ; then
@@ -283,9 +283,9 @@ function mount_network_path() {
283283 # Build mount options from username/groupname
284284 local l_mount_options
285285 l_mount_options=$( build_mount_options " $l_owner_user " " $l_owner_group " " $l_additional_options " )
286- if [ $? -ne $SUCCESS ]; then
286+ if [ $? -ne " $SUCCESS " ]; then
287287 echo " $l_mount_options " # Print error message
288- return $FAILURE
288+ return " $FAILURE "
289289 fi
290290
291291 # Prepend credentials if provided
@@ -295,7 +295,7 @@ function mount_network_path() {
295295
296296 if ! mount -t " $l_protocol " -o " $l_mount_options " " $l_network_path " " /mnt/$l_mount_path " ; then
297297 echo " ERROR: Failed to mount network path \" $l_network_path \" to \" /mnt/$l_mount_path \" "
298- return $FAILURE
298+ return " $FAILURE "
299299 fi
300300 echo -e " Done\n"
301301 fi
0 commit comments