Добавление документации на русском языке, добавление системных директорий для конфигураций по умолчанию
All checks were successful
Build / Build project (push) Successful in 52s

This commit is contained in:
Alexander Zhirov 2025-05-08 02:36:34 +03:00
parent 7b0903d294
commit 40c3a0c815
Signed by: alexander
GPG key ID: C8D8BE544A27C511
13 changed files with 1164 additions and 4 deletions

View file

@ -0,0 +1,63 @@
diff --git a/usr/initiator.h b/usr/initiator.h
index 97918cb..55bb630 100644
--- a/usr/initiator.h
+++ b/usr/initiator.h
@@ -35,11 +35,13 @@
#include "log.h"
#ifndef ISCSI_CONFIG_ROOT
-#define ISCSI_CONFIG_ROOT "/etc/iscsi/"
+#define ISCSI_CONFIG_ROOT "/etc/iscsi"
#endif
#define CONFIG_FILE ISCSI_CONFIG_ROOT"/iscsid.conf"
+#define CONFIG_FILE_STATELESS "/usr/share/defaults"CONFIG_FILE
#define INITIATOR_NAME_FILE ISCSI_CONFIG_ROOT"/initiatorname.iscsi"
+#define INITIATOR_NAME_FILE_STATELESS "/usr/share/defaults"INITIATOR_NAME_FILE
#define PID_FILE "/run/iscsid.pid"
diff --git a/usr/iscsid.c b/usr/iscsid.c
index c72ed5d..08f4f3b 100644
--- a/usr/iscsid.c
+++ b/usr/iscsid.c
@@ -390,6 +390,12 @@ int main(int argc, char *argv[])
bool pid_file_specified = false;
bool no_pid_file_specified = false;
+ if (access(config_file, R_OK) != 0)
+ config_file = CONFIG_FILE_STATELESS;
+
+ if (access(initiatorname_file, R_OK) != 0)
+ initiatorname_file = INITIATOR_NAME_FILE_STATELESS;
+
while ((ch = getopt_long(argc, argv, "c:i:fd:nu:g:p:vh", long_options,
&longindex)) >= 0) {
switch (ch) {
@@ -552,6 +558,9 @@ int main(int argc, char *argv[])
exit(ISCSI_ERR);
}
+ log_info("iSCSI configuration file: %s", config_file);
+ log_info("iSCSI initiator file: %s", initiatorname_file);
+
memset(&daemon_config, 0, sizeof (daemon_config));
daemon_config.pid_file = pid_file;
daemon_config.config_file = config_file;
diff --git a/usr/iscsistart.c b/usr/iscsistart.c
index df92d24..c6188aa 100644
--- a/usr/iscsistart.c
+++ b/usr/iscsistart.c
@@ -373,7 +373,11 @@ int main(int argc, char *argv[])
int control_fd, mgmt_ipc_fd, err;
pid_t pid;
- strcpy(config_file, CONFIG_FILE);
+ const char *config_file_stateless = CONFIG_FILE;
+ if (access(config_file_stateless, R_OK) != 0)
+ config_file_stateless = CONFIG_FILE_STATELESS;
+
+ strcpy(config_file, config_file_stateless);
idbm_node_setup_defaults(&config_rec);
config_rec.name[0] = '\0';
config_rec.conn[0].address[0] = '\0';

View file

@ -0,0 +1,105 @@
diff --git a/doc/iscsi-gen-initiatorname.8.template b/doc/iscsi-gen-initiatorname.8.template
index 97a6e21..2953c75 100644
--- a/doc/iscsi-gen-initiatorname.8.template
+++ b/doc/iscsi-gen-initiatorname.8.template
@@ -36,10 +36,10 @@ Force overwrite of existing initiator name, if present.
.TP
.BI [-p] \fIIQN-PREFIX\fP
Use \fIIQN-PREFIX\fP as the prefix to the IQN generated,
-instead of the default of \fBiqn.1996-04.de.suse:01\fP.
+instead of the default of \fBiqn.2025-05.local.open-iscsi:solus\fP.
.SH FILES
.TP
-@HOMEDIR@/initiatorname.iscsi
+/usr/share/defaults/etc/iscsi/initiatorname.iscsi or @HOMEDIR@/initiatorname.iscsi
The file containing the initiator name. Do not edit manually.
.SH "SEE ALSO"
.BR iscsi-iname (8)
diff --git a/doc/iscsi-iname.8.template b/doc/iscsi-iname.8.template
index b2d1c79..d1f1017 100644
--- a/doc/iscsi-iname.8.template
+++ b/doc/iscsi-iname.8.template
@@ -14,7 +14,7 @@ generates a unique iSCSI node name on every invocation.
Display help
.TP
.BI [-p=]\fIprefix\fP
-Use the prefix passed in instead of the default "@IQN_PREFIX@"
+Use the prefix passed in instead of the default "iqn.2025-05.local.open-iscsi:solus"
.SH AUTHORS
Open-iSCSI project <http://www.open-iscsi.com/>
diff --git a/doc/iscsiadm.8.template b/doc/iscsiadm.8.template
index 90e1f3f..2118e83 100644
--- a/doc/iscsiadm.8.template
+++ b/doc/iscsiadm.8.template
@@ -185,7 +185,7 @@ while running: the \fBHOMEDIR\fR and the \fBDBROOT\fR. The following
describes them:
.TP
.B Home Directory
-The \fIhome directory\fR for open-iscsi is @HOMEDIR@. This is
+The \fIhome directory\fR for open-iscsi is /usr/share/defaults/etc/iscsi or @HOMEDIR@. This is
where it keeps its configuration file (\fIiscsid.conf\fR) and its
initiator name file (\fIinitiatorname.iscsi\fR).
.TP
@@ -695,10 +695,10 @@ List all sessions in tree format:
\fBsh#\fR iscsiadm \-\-mode session \-\-print
.SH FILES
.TP
-@HOMEDIR@/iscsid.conf
+/usr/share/defaults/etc/iscsi/iscsid.conf or @HOMEDIR@/iscsid.conf
The configuration file read by \fBiscsid\fR and \fBiscsiadm\fR on startup.
.TP
-@HOMEDIR@/initiatorname.iscsi
+/usr/share/defaults/etc/iscsi/initiatorname.iscsi or @HOMEDIR@/initiatorname.iscsi
The file containing the iSCSI InitiatorName and InitiatorAlias read by
\fBiscsid\fR and \fBiscsiadm\fR on startup.
.TP
diff --git a/doc/iscsid.8.template b/doc/iscsid.8.template
index 0d122a0..3debe54 100644
--- a/doc/iscsid.8.template
+++ b/doc/iscsid.8.template
@@ -15,10 +15,14 @@ iSCSI database.
.TP
.BI [-c|--config=]\fIconfig\-file\fP
Read configuration from \fIconfig\-file\fR rather than the default
+\fI/usr/share/defaults/etc/iscsi/iscsid.conf
+or
\fI@HOMEDIR@/iscsid.conf\fR file.
.TP
.BI [-i|--initiatorname=]\fIiname\-file\fP
Read initiator name from \fIiname\-file\fR rather than the default
+\fI/usr/share/defaults/etc/iscsi/initiatorname.iscsi
+or
\fI@HOMEDIR@/initiatorname.iscsi\fR file.
.TP
.BI [-f|--foreground]
@@ -55,14 +59,14 @@ display version and exit.
.SH FILES
.TP
-@HOMEDIR@/iscsid.conf
+/usr/share/defaults/etc/iscsi/iscsid.conf or @HOMEDIR@/iscsid.conf
The configuration file read by
.B iscsid
and
.B iscsiadm
on startup.
.TP
-@HOMEDIR@/initiatorname.iscsi
+/usr/share/defaults/etc/iscsi/initiatorname.iscsi or @HOMEDIR@/initiatorname.iscsi
The file containing the iSCSI initiatorname
and initiatoralias read by
.B iscsid
diff --git a/doc/iscsistart.8.template b/doc/iscsistart.8.template
index 62fae4d..45cd78d 100644
--- a/doc/iscsistart.8.template
+++ b/doc/iscsistart.8.template
@@ -14,6 +14,8 @@ sessions used for iSCSI root boot.
.TP
.BI [-c|--config=]\fIconfig\-file\fP
Read configuration from \fIconfig\-file\fR rather than the default
+\fI/usr/share/defaults/etc/iscsi/iscsid.conf
+or
\fI@HOMEDIR@/iscsid.conf\fR file.
.TP
.BI [-i|--initiatorname=]\fIname\fP