4
4
# create-encrypted-at-rest-drive.sh
5
5
# ###############################################################################
6
6
# Author: Aaron `Tripp` N. Josserand Austin
7
- # Version: v0.1.7 -alpha - Initial Public Alpha Release
8
- # Date: 14-JAN-2024 T 16:24 Mountain US
7
+ # Version: v0.1.8 -alpha - Initial Public Alpha Release
8
+ # Date: 14-JAN-2024 T 21:23 Mountain US
9
9
# ###############################################################################
10
10
# MIT License
11
11
# ###############################################################################
76
76
# the GitHub repository: https://github.com/anjaustin/encrypted-data-at-rest
77
77
# ###############################################################################
78
78
79
- # ## SCRIPT-LEVEL VARIABLES ###
79
+ # ## VARIABLES ###
80
+ readonly VERSION=" v0.1.8-alpha"
81
+
80
82
# Enable DEBUG mode (set to 1 to enable)
81
83
DEBUG=0
82
84
@@ -360,42 +362,55 @@ update_user_bash() {
360
362
fi
361
363
}
362
364
363
- # Usage information
364
- usage () {
365
- cat << EOF
366
- Usage: $0 [-h|--help]
365
+ # Parse command-line options
366
+ while [[ $# -gt 0 ]]; do
367
+ case " $1 " in
368
+ -h|--help)
369
+ # Display usage information
370
+ cat << EOF
371
+ Usage: [sudo] $0 [-h|--help] [-l|--log-dir LOG_DIR]
367
372
368
373
Create encrypted storage drives at rest using LUKS encryption.
369
374
370
375
Options:
371
- -h, --help Display this help message and exit.
376
+ -h, --help Display this help message and exit.
377
+ -l, --log-dir LOG_DIR Set the log directory. Default is "/var/log/edar_drive_setup".
378
+
379
+ Examples:
380
+ ./create-encrypted-at-rest-drive.sh
381
+ sudo ./create-encrypted-at-rest-drive.sh
382
+ sudo ./create-encrypted-at-rest-drive.sh --log-dir /path/to/custom/logs
372
383
373
384
Requirements:
374
- - This script requires elevated privileges. You may need to run it with 'sudo'.
385
+ - This script selectively requires elevated privileges. You can run it with 'sudo' for your convenience .
375
386
- Dependencies: cryptsetup, lsblk, numfmt.
376
387
377
388
How to Run:
378
389
1. Make the script executable: chmod u+x $0
379
- 2. Run the script with elevated privileges: sudo $0
390
+ 2. Run the script: [sudo] $0
391
+ 3. Run the script with debugging: DEBUG=1 [sudo] $0
380
392
381
393
Feedback:
382
394
Your feedback is valuable. Please report any issues or suggest improvements on
383
395
the GitHub repository: https://github.com/anjaustin/encrypted-data-at-rest
384
396
EOF
385
- }
386
-
387
- # Parse command-line options
388
- while [[ $# -gt 0 ]]; do
389
- case " $1 " in
390
- -h|--help)
391
- usage
392
397
exit 0
393
398
;;
399
+ -l|--log-dir)
400
+ # Set custom log directory
401
+ shift
402
+ LOG_DIR=" $1 "
403
+ ;;
404
+ -v|--version)
405
+ # Display version
406
+ echo " $VERSION "
407
+ ;;
394
408
* )
395
409
echo " Error: Invalid option. Use -h or --help for usage information."
396
410
exit 1
397
411
;;
398
412
esac
413
+ shift
399
414
done
400
415
401
416
# ## START ###
@@ -423,4 +438,4 @@ update_user_bash
423
438
log_message " INFO" " User .bashrc and .bash_logout update function completed."
424
439
425
440
log_message " INFO" " Script ended without errors."
426
- # EOF >>>
441
+ # EOF >>>
0 commit comments