|
|
| version 1.23, 2025/04/02 02:16:27 | version 1.25, 2025/04/02 04:50:49 |
|---|---|
| Line 24 | Line 24 |
| * along with FreeM. If not, see <https://www.gnu.org/licenses/>. | * along with FreeM. If not, see <https://www.gnu.org/licenses/>. |
| * | * |
| * $Log$ | * $Log$ |
| * Revision 1.25 2025/04/02 04:50:49 snw | |
| * Allow vendor routines to be upgraded | |
| * | |
| * Revision 1.24 2025/04/02 03:02:42 snw | |
| * Stop requiring users to pass -e to fmadm when -u or -g are passed | |
| * | |
| * Revision 1.23 2025/04/02 02:16:27 snw | * Revision 1.23 2025/04/02 02:16:27 snw |
| * Add fmadm status environment command and move journals to a better location | * Add fmadm status environment command and move journals to a better location |
| * | * |
| Line 230 int main (int argc, char **argv) | Line 236 int main (int argc, char **argv) |
| env_user[k++] = argv[i][j]; | env_user[k++] = argv[i][j]; |
| } | } |
| fma_explicit_environment = TRUE; | |
| base_arg++; | base_arg++; |
| break; | break; |
| Line 248 int main (int argc, char **argv) | Line 253 int main (int argc, char **argv) |
| env_group[k++] = argv[i][j]; | env_group[k++] = argv[i][j]; |
| } | } |
| fma_explicit_environment = TRUE; | |
| base_arg++; | base_arg++; |
| break; | break; |
| Line 298 int main (int argc, char **argv) | Line 302 int main (int argc, char **argv) |
| } | } |
| } | } |
| } | } |
| if (obj != OBJ_DAEMON) { | if (obj != OBJ_DAEMON) { |
| if (strlen (env_user) == 0) { | if (strlen (env_user) == 0) { |
| snprintf (env_user, 6, "freem"); | snprintf (env_user, 6, "freem"); |
| Line 419 int main (int argc, char **argv) | Line 423 int main (int argc, char **argv) |
| else return fmadm_usage(); | else return fmadm_usage(); |
| if (strncmp (obj_str, "lock", STRLEN - 1) == 0) obj = OBJ_LOCK; | if (strncmp (obj_str, "lock", STRLEN - 1) == 0) obj = OBJ_LOCK; |
| else if (strncmp (obj_str, "zallocate", STRLEN - 1) == 0) obj = OBJ_ZALLOC; | |
| else if (strncmp (obj_str, "journal", STRLEN - 1) == 0) obj = OBJ_JOURNAL; | else if (strncmp (obj_str, "journal", STRLEN - 1) == 0) obj = OBJ_JOURNAL; |
| else if (strncmp (obj_str, "namespace", STRLEN - 1) == 0) obj = OBJ_NAMESPACE; | else if (strncmp (obj_str, "namespace", STRLEN - 1) == 0) obj = OBJ_NAMESPACE; |
| else if (strncmp (obj_str, "global", STRLEN - 1) == 0) obj = OBJ_GLOBAL; | else if (strncmp (obj_str, "global", STRLEN - 1) == 0) obj = OBJ_GLOBAL; |
| Line 677 int fm_shell (void) | Line 680 int fm_shell (void) |
| strcpy (obj_str, args[0]); | strcpy (obj_str, args[0]); |
| if (strncmp (obj_str, "lock", STRLEN - 1) == 0) obj = OBJ_LOCK; | if (strncmp (obj_str, "lock", STRLEN - 1) == 0) obj = OBJ_LOCK; |
| else if (strncmp (obj_str, "zallocate", STRLEN - 1) == 0) obj = OBJ_ZALLOC; | |
| else if (strncmp (obj_str, "journal", STRLEN - 1) == 0) obj = OBJ_JOURNAL; | else if (strncmp (obj_str, "journal", STRLEN - 1) == 0) obj = OBJ_JOURNAL; |
| else if (strncmp (obj_str, "namespace", STRLEN - 1) == 0) obj = OBJ_NAMESPACE; | else if (strncmp (obj_str, "namespace", STRLEN - 1) == 0) obj = OBJ_NAMESPACE; |
| else if (strncmp (obj_str, "global", STRLEN - 1) == 0) obj = OBJ_GLOBAL; | else if (strncmp (obj_str, "global", STRLEN - 1) == 0) obj = OBJ_GLOBAL; |
| Line 881 int fmadm_usage (void) | Line 883 int fmadm_usage (void) |
| fprintf (stdout, " stop, restart\n\n"); | fprintf (stdout, " stop, restart\n\n"); |
| fprintf (stdout, " <object> can be one of:\n"); | fprintf (stdout, " <object> can be one of:\n"); |
| fprintf (stdout, " lock, zallocate, journal, namespace, global, routine, job,\n"); | fprintf (stdout, " lock, journal, namespace, global, routine, job,\n"); |
| fprintf (stdout, " environment\n\n"); | fprintf (stdout, " environment\n\n"); |
| fprintf (stdout, " Not all actions are valid for all objects. Please see the FreeM manual\n"); | fprintf (stdout, " Not all actions are valid for all objects. Please see the FreeM manual\n"); |
| Line 1338 void fm_configure (void) | Line 1340 void fm_configure (void) |
| char usrrtn[4096]; | char usrrtn[4096]; |
| char usrgbl[4096]; | char usrgbl[4096]; |
| char locktab[4096]; | |
| char zalloctab[4096]; | |
| char jnldir[4096]; | char jnldir[4096]; |
| char jnlfile[4096]; | char jnlfile[4096]; |
| char jnlmode[4]; | char jnlmode[4]; |
| Line 1367 void fm_configure (void) | Line 1367 void fm_configure (void) |
| char *groupname = env_group; | char *groupname = env_group; |
| #if !defined(__OS2__) | #if !defined(__OS2__) |
| if (geteuid () != 0) { | |
| fprintf (stderr, "fmadm: not superuser\n"); | |
| exit (1); | |
| } | |
| struct group *d_grp; | struct group *d_grp; |
| struct passwd *d_user; | struct passwd *d_user; |
| gid_t d_gid; | gid_t d_gid; |
| Line 1391 void fm_configure (void) | Line 1396 void fm_configure (void) |
| snprintf (sysgbl, 4095, "%s/freem/%s/SYSTEM/globals", LOCALSTATEDIR, fma_environment); | snprintf (sysgbl, 4095, "%s/freem/%s/SYSTEM/globals", LOCALSTATEDIR, fma_environment); |
| snprintf (usrrtn, 4095, "%s/freem/%s/USER/routines", LOCALSTATEDIR, fma_environment); | snprintf (usrrtn, 4095, "%s/freem/%s/USER/routines", LOCALSTATEDIR, fma_environment); |
| snprintf (usrgbl, 4095, "%s/freem/%s/USER/globals", LOCALSTATEDIR, fma_environment); | snprintf (usrgbl, 4095, "%s/freem/%s/USER/globals", LOCALSTATEDIR, fma_environment); |
| snprintf (locktab, 4095, "/tmp/locktab"); | |
| snprintf (zalloctab, 4095, "/tmp/zalloctab"); | |
| snprintf (jnldir, 4095, "%s/freem/%s/journals", LOCALSTATEDIR, fma_environment); | snprintf (jnldir, 4095, "%s/freem/%s/journals", LOCALSTATEDIR, fma_environment); |
| snprintf (jnlfile, 4095, "%s/freem_journal_%s.dat", jnldir, fma_environment); | snprintf (jnlfile, 4095, "%s/freem_journal_%s.dat", jnldir, fma_environment); |
| snprintf (jnlmode, 3, "on"); | snprintf (jnlmode, 3, "on"); |
| Line 1520 void fm_configure (void) | Line 1523 void fm_configure (void) |
| mkdir (buf, 0775); | mkdir (buf, 0775); |
| set_permissions (buf, username, groupname, 0775); | set_permissions (buf, username, groupname, 0775); |
| fprintf (stderr, "fmadm: copying routines from '%s' to '%s'...\n", src_dir, dest_dir); | fprintf (stderr, "fmadm: copying vendor routines from '%s' to '%s'...\n", src_dir, dest_dir); |
| if ((dir = opendir (src_dir)) == NULL) { | if ((dir = opendir (src_dir)) == NULL) { |
| fprintf (stderr, "\nfmadm: could not open source directory %s\n", src_dir); | fprintf (stderr, "\nfmadm: could not open source directory %s\n", src_dir); |
| Line 1531 void fm_configure (void) | Line 1534 void fm_configure (void) |
| char infile[4096]; | char infile[4096]; |
| char outfile[4096]; | char outfile[4096]; |
| if ((strcmp (ent->d_name, ".") != 0) && (strcmp (ent->d_name, "..") != 0)) { | if ((strcmp (ent->d_name, ".") != 0) && (strcmp (ent->d_name, "..") != 0)) { |
| fprintf (stderr, "\t%s\n", ent->d_name); | |
| snprintf (infile, 4095, "%s/%s", src_dir, ent->d_name); | snprintf (infile, 4095, "%s/%s", src_dir, ent->d_name); |
| snprintf (outfile, 4095, "%s/%s", dest_dir, ent->d_name); | snprintf (outfile, 4095, "%s/%s", dest_dir, ent->d_name); |
| if (stat (outfile, &etcstat) == 0) { | |
| unlink (outfile); | |
| fprintf (stderr, "\tupgrade -> %s\n", ent->d_name); | |
| } | |
| else { | |
| fprintf (stderr, "\tnew -> %s\n", ent->d_name); | |
| } | |
| #if !defined(__OS2__) | #if !defined(__OS2__) |
| if (cp (outfile, infile) != 0) { | if (cp (outfile, infile) != 0) { |
| fprintf (stderr, "fmadm: failure copying %s to %s\n", infile, outfile); | fprintf (stderr, "fmadm: failure copying %s to %s\n", infile, outfile); |