aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristos.K <freedomrfox@gmail.com>2017-08-22 13:48:56 +0300
committerChristos.K <freedomrfox@gmail.com>2017-08-22 13:48:56 +0300
commitd288be448905bf2b8e6d88b12d668c7e411540e8 (patch)
tree6e81be4f11a1ca99e71ef759c0e850ad8922e9c9
parentPreliminary functions (diff)
downloadGSE-d288be448905bf2b8e6d88b12d668c7e411540e8.tar.gz
GSE-d288be448905bf2b8e6d88b12d668c7e411540e8.tar.bz2
GSE-d288be448905bf2b8e6d88b12d668c7e411540e8.zip
Newsystem functions
-rw-r--r--config.d/controller/modules/functions/ct_newsys.sh58
1 files changed, 58 insertions, 0 deletions
diff --git a/config.d/controller/modules/functions/ct_newsys.sh b/config.d/controller/modules/functions/ct_newsys.sh
new file mode 100644
index 0000000..ee44d97
--- /dev/null
+++ b/config.d/controller/modules/functions/ct_newsys.sh
@@ -0,0 +1,58 @@
+#!/bin/bash
+
+_bsu_dfs() {
+ #/DEV/SDX
+ SYSDEV="$(blkid | grep "SYSFS" | awk -F ':' '{ print $1 }')"
+ BACKUPDEV="$(blkid | grep "BACKUPFS" | awk -F ':' '{ print $1 }')"
+ BOOTDEV="$(blkid | grep "BOOTFS" | awk -F ':' '{ print $1 }')"
+ USERDATADEV="$(blkid | grep "USERDATAFS" | awk -F ':' '{ print $1 }')"
+
+ export SYSDEV
+ export BACKUPDEV
+ export USERDATADEV
+ export BOOTDEV
+
+ # EXPORT SYSTEM'S FS
+ SYSFS="$(blkid | grep "LABEL=\"SYSFS\"" | awk -F ' ' '{print $4}' | awk -F '=' '{print $2}' | sed 's/\"//g')"
+ export SYS
+
+ # EXPORT BACKUP's FS
+ BACKUPFS="$(blkid | grep "LABEL=\"BACKUPFS\"" | awk -F ' ' '{print $4}' | awk -F '=' '{print $2}' | sed 's/\"//g')"
+ export BACKUPFS
+}
+
+_remake() {
+ if eval "mkfs.$1" "$2" "$3" "$4"; then
+ return 0
+ else
+ return 1
+ fi
+}
+
+_remake_dev() {
+ if _unmount "$1"; then
+ if [[ "${SYSFS}" == 'btrfs' ]]; then
+ wipefs "$2"
+ if _remake "${SYSFS}" "-f -L" "SYSFS" "$2"; then
+ echo "File system created"
+ _ctflag_remake=0
+ else
+ echo "Failed creating new filesystem"
+ _ctflag_remake=1
+ fi
+ else
+ wipefs "$2"
+ if _remake "${SYSFS}" "-F -L" "SYSFS" "$2"; then
+ echo "File system created"
+ _ctflag_remake=0
+ else
+ echo "Failed creating new filesystem"
+ _ctflag_remake=1
+ fi
+ fi
+ else
+ echo "Failed unmounting /mnt/workdir"
+ _ctflag_remake=1
+ fi
+ export _ctflag_remake
+} \ No newline at end of file