Browse Source

Added usage and help functions

Matteo Zeccoli Marazzini 5 years ago
parent
commit
2042f99c9d
2 changed files with 26 additions and 1 deletions
  1. 19 0
      helpfile
  2. 7 1
      parse-arguments.sh

+ 19 - 0
helpfile

@@ -0,0 +1,19 @@
+newdisk automator
+This program can be used in two mode: automatic and manual.
+
+Automatic:
+newdisk-automator [-f] device
+device is partitioned according to the following scheme:
+	- calcolo: 100GB
+	- swap: ram size + 1GB
+	- free space: 10% of the total
+	- condor: 40% of remaining space
+	- tempdir: 60% of remaining space
+If the size of the disk is less than 102GB + ram size, this mode cannot be used.
+If the size of the disk is greater than the minimum size, but still less than (100GB + ram size) * 2, to use this mode the -f option must be passed.
+Be careful: in the automatic mode, calcolo and swap size are fixed, and forcing it with -f could result in having very small tempdir and condor partitions. 
+
+Manual:
+newdisk-automator device temp condor swap vm
+The partitions are assigned the size passed on the command line, which is assumed to be in GB.
+If the total passed with the command line is greater than the size of the disk, the program stops.

+ 7 - 1
parse-arguments.sh

@@ -4,7 +4,7 @@ parse_arguments()
 	while getopts ":fh" o; do
 		case $o in
 		f) FORCE=1;;
-		h) help && exit 0;;
+		h) cat ${DIR}/helpfile && exit 0;;
 		\?) usage && exit;;
 		esac
 	done
@@ -53,3 +53,9 @@ manual()
 		fatal ${MANUALSIZE_E} "can't use this sizes: ${DEVICE} has only $(bytes_to_gibibytes ${DEVICE_SIZE})G"
 	fi
 }
+
+usage()
+{
+	echo "Usage: ${PROGRAM_NAME} [-f] device | device temp condor swap vm"
+	echo "Try -h for help"
+}