Browse Source

create new version zramraid

root 5 years ago
parent
commit
e8c63fa4bd

readme.md → README.md


+ 2 - 2
zramraid.deb/etc/default/zramraid

@@ -1,5 +1,5 @@
1
 ## service start
1
 ## service start
2
-# mode - startup parameter zraid system in manual or automatic mode, examples: mode="auto" or mode="manual"
3
-# if "manual" zraid does not start automatically at startup, dafult - "manual" 
2
+# mode - startup parameter zramraid system in manual or automatic mode, examples: mode="auto" or mode="manual"
3
+# if "manual" zramraid does not start automatically at startup, dafult - "manual" 
4
 #
4
 #
5
 mode="manual";
5
 mode="manual";

+ 46 - 46
zramraid.deb/etc/zramraid/messages.dat

@@ -1,14 +1,14 @@
1
 {
1
 {
2
 "ru_RU.UTF-8":{
2
 "ru_RU.UTF-8":{
3
 	    "msg":[  
3
 	    "msg":[  
4
-	    "Система zraid не запущена!",
5
-	    "Нет параметров для zraid-maker!",
6
-	    "Полный запуск системы zraid: zraid-maker --on",
7
-	    "Полная остановка системы zraid: zraid-maker --off",
8
-	    "Состояние системы zraid: zraid-maker --status",
9
-	    "Проверка конфигрурации системы zraid: zraid-maker --test",
4
+	    "Система zramraid не запущена!",
5
+	    "Нет параметров для zramraid-maker!",
6
+	    "Полный запуск системы zramraid: zramraid-maker --on",
7
+	    "Полная остановка системы zramraid: zramraid-maker --off",
8
+	    "Состояние системы zramraid: zramraid-maker --status",
9
+	    "Проверка конфигрурации системы zramraid: zramraid-maker --test",
10
 	    "В системе отсутствует пакет jq!",
10
 	    "В системе отсутствует пакет jq!",
11
-	    "Отсутствует файл конфигурации zraid.conf!",
11
+	    "Отсутствует файл конфигурации zramraid.conf!",
12
 	    "В системе отсутствует пакет mdadm!",
12
 	    "В системе отсутствует пакет mdadm!",
13
 	    "В конфигурации нет указанных md устройств!",
13
 	    "В конфигурации нет указанных md устройств!",
14
 	    "Неверный параметр в конфигурации!",
14
 	    "Неверный параметр в конфигурации!",
@@ -17,10 +17,10 @@
17
 	    "Не найден файл!",
17
 	    "Не найден файл!",
18
 	    "Общий обьем образов превышает установленный лимит памяти!",
18
 	    "Общий обьем образов превышает установленный лимит памяти!",
19
 	    "Это устройство занято системой",
19
 	    "Это устройство занято системой",
20
-	    "Старт системы zraid...",
21
-	    "Стоп системы zraid...",
22
-	    "zraid - включен и активированы устройства:",
23
-	    "zraid - отключен",
20
+	    "Старт системы zramraid...",
21
+	    "Стоп системы zramraid...",
22
+	    "zramraid - включен и активированы устройства:",
23
+	    "zramraid - отключен",
24
 	    "Лимит памяти:",
24
 	    "Лимит памяти:",
25
 	    "Ошибка устройства md:",
25
 	    "Ошибка устройства md:",
26
 	    "Ошибка образа:",
26
 	    "Ошибка образа:",
@@ -32,42 +32,42 @@
32
 	    "Извините, старая версия ядра, рекомендуется 3.14.x и выше!",
32
 	    "Извините, старая версия ядра, рекомендуется 3.14.x и выше!",
33
 	    "Ошибочное значение",
33
 	    "Ошибочное значение",
34
 	    "Допускается только",
34
 	    "Допускается только",
35
-	    "Помомощь: zraid-maker --help",
35
+	    "Помомощь: zramraid-maker --help",
36
 	    "Памяти всего:",
36
 	    "Памяти всего:",
37
 	    "Памяти свободно:",
37
 	    "Памяти свободно:",
38
-	    "Нет параметров для zraid-config!",
39
-	    "Создание пустого zraid.conf: zraid-config --config-default",
40
-	    "Добавление устройства MD: zraid-config --add md[x]:image - пример: md1:/home/zraid/disk1.img",
41
-	    "Удаление устройства MD: zraid-config --del md[x] - пример: md1",
42
-	    "Получение списка MD: zraid-config --list",
43
-	    "Параметр ограничения использования памяти: zraid-config --limit-mem [x] - пример: 90% or 1024Kb",
44
-	    "Параметр описание носителя: zraid-config --info-md md[x] - пример: md1",
45
-	    "Помощь: zraid-config --help",
38
+	    "Нет параметров для zramraid-config!",
39
+	    "Создание пустого zramraid.conf: zramraid-config --config-default",
40
+	    "Добавление устройства MD: zramraid-config --add md[x]:image - пример: md1:/home/zramraid/disk1.img",
41
+	    "Удаление устройства MD: zramraid-config --del md[x] - пример: md1",
42
+	    "Получение списка MD: zramraid-config --list",
43
+	    "Параметр ограничения использования памяти: zramraid-config --limit-mem [x] - пример: 90% or 1024Kb",
44
+	    "Параметр описание носителя: zramraid-config --info-md md[x] - пример: md1",
45
+	    "Помощь: zramraid-config --help",
46
 	    "Операция не выполнена",
46
 	    "Операция не выполнена",
47
 	    "Выполнено - успешно.",
47
 	    "Выполнено - успешно.",
48
 	    "Не найдено:",
48
 	    "Не найдено:",
49
 	    "Введите описаниe для устройства MD и нажмите Enter:",
49
 	    "Введите описаниe для устройства MD и нажмите Enter:",
50
 	    "Описание образов в конфигурации не найдено",
50
 	    "Описание образов в конфигурации не найдено",
51
 	    "Доступно только с привилегиями root!",
51
 	    "Доступно только с привилегиями root!",
52
-	    "Версия zraid:",
52
+	    "Версия zramraid:",
53
 	    "Извините, старая версия ядра, рекомендуется 4.2.x и выше для этого параметра!",
53
 	    "Извините, старая версия ядра, рекомендуется 4.2.x и выше для этого параметра!",
54
 	    "- устройство уже работает...",
54
 	    "- устройство уже работает...",
55
 	    "версия ядра не позволяет выборочное управление носителями, только полная остановка и запуск, рекомендуется 4.2.x и выше.",
55
 	    "версия ядра не позволяет выборочное управление носителями, только полная остановка и запуск, рекомендуется 4.2.x и выше.",
56
-	    "Индивидуальный запуск носителя zraid: zraid-maker --on md[x] - пример:md1",
57
-	    "Индивидульная остановка носителя zraid: zraid-maker --off md[x] - пример:md1"
56
+	    "Индивидуальный запуск носителя zramraid: zramraid-maker --on md[x] - пример:md1",
57
+	    "Индивидульная остановка носителя zramraid: zramraid-maker --off md[x] - пример:md1"
58
 	    ]
58
 	    ]
59
 
59
 
60
     },
60
     },
61
 "C.UTF-8":{
61
 "C.UTF-8":{
62
 	    "msg":[
62
 	    "msg":[
63
-	    "Not start zraid system!",
64
-	    "No input parameters for zraid-maker",
65
-	    "Full start arrays zraid: zraid-maker --on",
66
-	    "Full stop array zraid: zraid-maker --off",
67
-	    "State arrays zraid: zraid-maker --status",
68
-	    "Check config zraid arrays: zraid-maker --test",
63
+	    "Not start zramraid system!",
64
+	    "No input parameters for zramraid-maker",
65
+	    "Full start arrays zramraid: zramraid-maker --on",
66
+	    "Full stop array zramraid: zramraid-maker --off",
67
+	    "State arrays zramraid: zramraid-maker --status",
68
+	    "Check config zramraid arrays: zramraid-maker --test",
69
 	    "Not found in the system package jq!",
69
 	    "Not found in the system package jq!",
70
-	    "Not found configuration file zraid.conf",
70
+	    "Not found configuration file zramraid.conf",
71
 	    "Not found in the system package mdadm!",
71
 	    "Not found in the system package mdadm!",
72
 	    "No specified md devices!",
72
 	    "No specified md devices!",
73
 	    "The parameter is incorrect!",
73
 	    "The parameter is incorrect!",
@@ -76,10 +76,10 @@
76
 	    "Not found file!",
76
 	    "Not found file!",
77
 	    "The total images exceeds the limit of available memory!",
77
 	    "The total images exceeds the limit of available memory!",
78
 	    "This device busy a system!",
78
 	    "This device busy a system!",
79
-	    "zraid start...",
80
-	    "zraid stop...",
81
-	    "zraid - on & enable devices:",
82
-	    "zraid - off",
79
+	    "zramraid start...",
80
+	    "zramraid stop...",
81
+	    "zramraid - on & enable devices:",
82
+	    "zramraid - off",
83
 	    "limit mem:",
83
 	    "limit mem:",
84
 	    "error: md",
84
 	    "error: md",
85
 	    "error: image ",
85
 	    "error: image ",
@@ -91,29 +91,29 @@
91
 	    "I'm sorry the old kernel version! recommended 3.14 or higher",
91
 	    "I'm sorry the old kernel version! recommended 3.14 or higher",
92
 	    "Error value",
92
 	    "Error value",
93
 	    "Allowed only",
93
 	    "Allowed only",
94
-	    "help: zraid-maker --help",
94
+	    "help: zramraid-maker --help",
95
 	    "Memory total:",
95
 	    "Memory total:",
96
 	    "Memory free:",
96
 	    "Memory free:",
97
-	    "No input parameters for zraid-config!",
98
-	    "Create empty zraid.conf: zraid-config --config-default",
99
-	    "Add device MD in config: zraid-config --add md[x]:image - example: md1:/home/zraid/disk1.img",
100
-	    "Delete device MD in config: zraid-config --del md[x] - example: md1",
101
-	    "Listing devices MD in config: zraid-config --list",
102
-	    "The memory limit usage: zraid-config --limit-mem [x] - example: 90% or 1024Kb",
103
-	    "The set info for md device: zraid-config --info-md md[x] - example: md1",
104
-	    "Help: zraid-config --help",
97
+	    "No input parameters for zramraid-config!",
98
+	    "Create empty zramraid.conf: zramraid-config --config-default",
99
+	    "Add device MD in config: zramraid-config --add md[x]:image - example: md1:/home/zramraid/disk1.img",
100
+	    "Delete device MD in config: zramraid-config --del md[x] - example: md1",
101
+	    "Listing devices MD in config: zramraid-config --list",
102
+	    "The memory limit usage: zramraid-config --limit-mem [x] - example: 90% or 1024Kb",
103
+	    "The set info for md device: zramraid-config --info-md md[x] - example: md1",
104
+	    "Help: zramraid-config --help",
105
 	    "Operation not succeded",
105
 	    "Operation not succeded",
106
 	    "Operation succeded",
106
 	    "Operation succeded",
107
 	    "Not found:",
107
 	    "Not found:",
108
 	    "Enter the data for device MD description and press Enter:",
108
 	    "Enter the data for device MD description and press Enter:",
109
 	    "description of the images in the configuration are not found",
109
 	    "description of the images in the configuration are not found",
110
 	    "It is only available with root privileges",
110
 	    "It is only available with root privileges",
111
-	    "version zraid:",
111
+	    "version zramraid:",
112
 	    "I'm sorry the old kernel version! recommended 4.2 or higher for this option",
112
 	    "I'm sorry the old kernel version! recommended 4.2 or higher for this option",
113
 	    "-device is already working",
113
 	    "-device is already working",
114
 	    "kernel version does not allow selective media management, only a complete stop and start, recommended 4.2 or higher for this option",
114
 	    "kernel version does not allow selective media management, only a complete stop and start, recommended 4.2 or higher for this option",
115
-	    "Selective startup zraid device: raid-maker --on md[x] - example: md1",
116
-	    "Selective stop zraid device: raid-maker --off md[x] - example: md1"
115
+	    "Selective startup zramraid device: zramraid-maker --on md[x] - example: md1",
116
+	    "Selective stop zramraid device: zramraid-maker --off md[x] - example: md1"
117
 	    ]
117
 	    ]
118
     }
118
     }
119
 }
119
 }

+ 11 - 11
zramraid.deb/etc/zramraid/zramraid-config

@@ -1,13 +1,13 @@
1
 #!/bin/bash
1
 #!/bin/bash
2
-## zraid-config
2
+## zramraid-config
3
 ## (c) author's idea and realization: Kleemov A. & Koshuba V.
3
 ## (c) author's idea and realization: Kleemov A. & Koshuba V.
4
 ## script author: Koshuba V - stvixfree@gmail.com
4
 ## script author: Koshuba V - stvixfree@gmail.com
5
 ## all parameters
5
 ## all parameters
6
 ##settime=$(date +%s%3N);
6
 ##settime=$(date +%s%3N);
7
 option=$1;
7
 option=$1;
8
 params=$2;
8
 params=$2;
9
-PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/etc/zraid";
10
-version="10.03.18";
9
+export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/etc/zramraid";
10
+version="25.06.18";
11
 ## msg [53]
11
 ## msg [53]
12
 set_msg=( '"0" "0"' '"1" "0"' '"2" "0"' '"3" "0"' '"4" "0"' '"5" "0"' '"6" "1"' '"7" "1"' '"8" "1"' 
12
 set_msg=( '"0" "0"' '"1" "0"' '"2" "0"' '"3" "0"' '"4" "0"' '"5" "0"' '"6" "1"' '"7" "1"' '"8" "1"' 
13
 	'"9" "1"' '"10" "1"' '"11" "1"' '"12" "1"'  '"13" "1"' '"14" "1"' '"15" "1"' '"16" "0"' 
13
 	'"9" "1"' '"10" "1"' '"11" "1"' '"12" "1"'  '"13" "1"' '"14" "1"' '"15" "1"' '"16" "0"' 
@@ -26,10 +26,10 @@ free_mem=$(cat /proc/meminfo |awk '/^MemAvailable:/{print $2}');
26
 limit_mem=0;
26
 limit_mem=0;
27
 info_limit_mem=0;
27
 info_limit_mem=0;
28
 total_size_images=0;
28
 total_size_images=0;
29
-zpath="/etc/zraid";
30
-zconfig="zraid.conf";
31
-zmsg="/etc/zraid/messages.dat";
32
-log="/var/log/zraid.log";
29
+zpath="/etc/zramraid";
30
+zconfig="zramraid.conf";
31
+zmsg="/etc/zramraid/messages.dat";
32
+log="/var/log/zramraid.log";
33
 reports=();
33
 reports=();
34
 id_zmd=();
34
 id_zmd=();
35
 image_zmd=();
35
 image_zmd=();
@@ -121,7 +121,7 @@ value_in="";
121
 function writeToLog() {
121
 function writeToLog() {
122
 for ((rpt_index=0; rpt_index != ${#reports[@]}; rpt_index++))
122
 for ((rpt_index=0; rpt_index != ${#reports[@]}; rpt_index++))
123
 do
123
 do
124
-    echo  "$rdate zraid message: ${reports[$rpt_index]}">>$log;
124
+    echo  "$rdate zramraid message: ${reports[$rpt_index]}">>$log;
125
 done
125
 done
126
 }
126
 }
127
 
127
 
@@ -243,7 +243,7 @@ if [[ ! $(cat $zmsg|grep "$lang"|wc -m) == 0 ]]
243
 
243
 
244
 ##--@F step operation
244
 ##--@F step operation
245
 function readConf() {
245
 function readConf() {
246
-# test enable file zraid.conf
246
+# test enable file zramraid.conf
247
 if [ ! -f $zpath/$zconfig ]
247
 if [ ! -f $zpath/$zconfig ]
248
     then
248
     then
249
     reports=();
249
     reports=();
@@ -500,7 +500,7 @@ if [ ! -f $zpath/$zconfig ]
500
     then
500
     then
501
         confNew;
501
         confNew;
502
     else
502
     else
503
-        cp $zpath/$zconfig $zpath/$(date +%H_%M)"-zraid.old">/dev/null;
503
+        cp $zpath/$zconfig $zpath/$(date +%H_%M)"-zramraid.old">/dev/null;
504
         confNew;
504
         confNew;
505
 fi
505
 fi
506
 }
506
 }
@@ -645,7 +645,7 @@ done
645
 
645
 
646
 }
646
 }
647
 
647
 
648
-##- Begin ZRAID
648
+##- Begin zramraid
649
 case "$option" in
649
 case "$option" in
650
 
650
 
651
 ## create default config +
651
 ## create default config +

+ 12 - 12
zramraid.deb/etc/zramraid/zramraid-maker

@@ -1,11 +1,11 @@
1
 #!/bin/bash
1
 #!/bin/bash
2
-## zraid-maker
2
+## zramraid-maker
3
 ## (c) author's idea and realization: Kleemov A. & Koshuba V.
3
 ## (c) author's idea and realization: Kleemov A. & Koshuba V.
4
 ## script author: Koshuba V - stvixfree@gmail.com
4
 ## script author: Koshuba V - stvixfree@gmail.com
5
 ## all parameters
5
 ## all parameters
6
 option=$1;
6
 option=$1;
7
 params=$2;
7
 params=$2;
8
-PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/etc/zraid";
8
+PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/etc/zramraid";
9
 version="10.03.18";
9
 version="10.03.18";
10
 ## msg [53]
10
 ## msg [53]
11
 set_msg=( '"0" "1"' '"1" "1"' '"2" "1"' '"3" "1"' '"4" "1"' '"5" "1"' '"6" "1"' '"7" "1"' '"8" "1"' 
11
 set_msg=( '"0" "1"' '"1" "1"' '"2" "1"' '"3" "1"' '"4" "1"' '"5" "1"' '"6" "1"' '"7" "1"' '"8" "1"' 
@@ -27,10 +27,10 @@ total_mem=$(cat /proc/meminfo |awk '/^MemTotal:/{print $2}');
27
 free_mem=$(cat /proc/meminfo |awk '/^MemAvailable:/{print $2}');
27
 free_mem=$(cat /proc/meminfo |awk '/^MemAvailable:/{print $2}');
28
 limit_mem=0;
28
 limit_mem=0;
29
 info_limit_mem=0;
29
 info_limit_mem=0;
30
-zpath="/etc/zraid";
31
-zconfig="/etc/zraid/zraid.conf";
32
-zmsg="/etc/zraid/messages.dat";
33
-log="/var/log/zraid.log";
30
+zpath="/etc/zramraid";
31
+zconfig="/etc/zramraid/zramraid.conf";
32
+zmsg="/etc/zramraid/messages.dat";
33
+log="/var/log/zramraid.log";
34
 ##
34
 ##
35
 reports=();
35
 reports=();
36
 id_zmd=();
36
 id_zmd=();
@@ -126,7 +126,7 @@ value_in="";
126
 function writeToLog() {
126
 function writeToLog() {
127
 for ((rpt_index=0; rpt_index != ${#reports[@]}; rpt_index++))
127
 for ((rpt_index=0; rpt_index != ${#reports[@]}; rpt_index++))
128
 do
128
 do
129
-    echo  "$rdate zraid message: ${reports[$rpt_index]}">>$log;
129
+    echo  "$rdate zramraid message: ${reports[$rpt_index]}">>$log;
130
 done
130
 done
131
 }
131
 }
132
 
132
 
@@ -317,7 +317,7 @@ eXlogic;
317
 
317
 
318
 ##--@F step operation
318
 ##--@F step operation
319
 function confRead() {
319
 function confRead() {
320
-# test enable file zraid.conf
320
+# test enable file zramraid.conf
321
 if [ ! -f $zconfig ]
321
 if [ ! -f $zconfig ]
322
     then
322
     then
323
     reports=();
323
     reports=();
@@ -870,10 +870,10 @@ done
870
 }
870
 }
871
 
871
 
872
 
872
 
873
-##- Begin ZRAID
873
+##- Begin zramraid
874
 case "$option" in
874
 case "$option" in
875
 
875
 
876
-## on zraid
876
+## on zramraid
877
 "--on" | "--on" )
877
 "--on" | "--on" )
878
 if [ ! "$params" ]
878
 if [ ! "$params" ]
879
     then
879
     then
@@ -886,7 +886,7 @@ fi
886
 exit 0;
886
 exit 0;
887
 ;; 
887
 ;; 
888
 
888
 
889
-## off zraid
889
+## off zramraid
890
 "--off" | "--off" )
890
 "--off" | "--off" )
891
 if [ ! "$params" ]
891
 if [ ! "$params" ]
892
     then
892
     then
@@ -899,7 +899,7 @@ fi
899
 exit 0;
899
 exit 0;
900
 ;;
900
 ;;
901
 
901
 
902
-## status zraid
902
+## status zramraid
903
 "--status" | "--status" )
903
 "--status" | "--status" )
904
 test_status=1;
904
 test_status=1;
905
 execute_func=( ${operation_status[@]} );
905
 execute_func=( ${operation_status[@]} );