|
|
| version 1.27, 2025/04/02 15:36:25 | version 1.28, 2025/04/02 19:59:38 |
|---|---|
| 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.28 2025/04/02 19:59:38 snw | |
| * Automatically modify env.conf from fmadm reconfigure | |
| * | |
| * Revision 1.27 2025/04/02 15:36:25 snw | * Revision 1.27 2025/04/02 15:36:25 snw |
| * Do extensive result checking for environment stop/start/restart in fmadm | * Do extensive result checking for environment stop/start/restart in fmadm |
| * | * |
| Line 1482 void fm_configure (void) | Line 1485 void fm_configure (void) |
| char *username = env_user; | char *username = env_user; |
| char *groupname = env_group; | char *groupname = env_group; |
| #if !defined(__OS2__) | #if !defined(__OS2__) |
| if (geteuid () != 0) { | if (geteuid () != 0) { |
| fprintf (stderr, "fmadm: not superuser\n"); | fprintf (stderr, "fmadm: not superuser\n"); |
| Line 1679 void fm_configure (void) | Line 1682 void fm_configure (void) |
| } | } |
| fp = fopen (env_config_file, "a+"); | if (fm_validate_environment (fma_environment) == FALSE) { |
| fp = fopen (env_config_file, "a+"); | |
| fprintf (stderr, "Creating %s... ", env_config_file); | |
| fprintf (stderr, "Creating %s... ", env_config_file); | |
| snprintf (buf, 4095, "[%s]", fma_environment); | |
| fm_write (fp, buf); | snprintf (buf, 4095, "[%s]", fma_environment); |
| fm_write (fp, buf); | |
| snprintf (buf, 4095, "user=%s", env_user); | |
| fm_write (fp, buf); | snprintf (buf, 4095, "user=%s", env_user); |
| fm_write (fp, buf); | |
| snprintf (buf, 4095, "group=%s", env_group); | |
| fm_write (fp, buf); | snprintf (buf, 4095, "group=%s", env_group); |
| fm_write (fp, buf); | |
| snprintf (buf, 4095, "enabled=true"); | |
| fm_write (fp, buf); | |
| snprintf (buf, 4095, "env_path=%s/freem/%s", LOCALSTATEDIR, fma_environment); | |
| fm_write (fp, buf); | |
| fclose (fp); | |
| fprintf (stderr, "[OK]\n"); | |
| } | |
| else { | |
| char modtmp[255]; | |
| fprintf (stderr, "Updating %s: \n", env_config_file); | |
| read_profile_string (env_config_file, fma_environment, "user", modtmp); | |
| if (strcmp (env_user, modtmp) != 0) { | |
| modify_profile_string (env_config_file, fma_environment, "user", env_user); | |
| fprintf (stderr, "\tuser: %s -> %s\n", modtmp, env_user); | |
| } | |
| snprintf (buf, 4095, "enabled=true"); | read_profile_string (env_config_file, fma_environment, "group", modtmp); |
| fm_write (fp, buf); | if (strcmp (env_group, modtmp) != 0) { |
| modify_profile_string (env_config_file, fma_environment, "group", env_group); | |
| snprintf (buf, 4095, "env_path=%s/freem/%s", LOCALSTATEDIR, fma_environment); | fprintf (stderr, "\tgroup: %s -> %s\n", modtmp, env_group); |
| fm_write (fp, buf); | } |
| } | |
| fclose (fp); | |
| fprintf (stderr, "[OK]\n"); | |
| fp = fopen (config_file, "a+"); | fp = fopen (config_file, "a+"); |