+do_filesys(before, beforec, after, afterc)
+char **before;
+int beforec;
+char **after;
+int afterc;
+{
+ char cmd[1024];
+ int acreate, atype, btype;
+
+ if (afterc < FS_CREATE) {
+ atype = acreate = 0;
+ } else {
+ atype = !strcmp(after[FS_TYPE], "AFS");
+ acreate = atoi(after[FS_CREATE]);
+ }
+
+ if (beforec < FS_CREATE) {
+ if (acreate == 0 || atype == 0) return;
+
+ /* new locker creation */
+ sprintf(cmd, "%s/perl -I%s %s/afs_create.pl %s %s %s %s %s %s",
+ BIN_DIR, BIN_DIR, BIN_DIR,
+ after[FS_NAME], after[FS_L_TYPE], after[FS_MACHINE],
+ after[FS_PACK], after[FS_OWNER], after[FS_OWNERS]);
+ run_cmd(cmd);
+ return;
+ }
+
+ btype = !strcmp(before[FS_TYPE], "AFS");
+ if (afterc < FS_CREATE) {
+ if (btype)
+ critical_alert("incremental",
+ "Cannot delete AFS filesystem %s: Operation not supported",
+ before[FS_NAME]);
+ return;
+ }
+
+ if (!acreate)
+ return;
+
+ /* Are we dealing with AFS lockers (could be type ERR lockers) */
+ if (!atype && !btype)
+ if (strcmp(before[FS_TYPE], "ERR") || strcmp(after[FS_TYPE], "ERR"))
+ return;
+
+ /* By now, we know we are simply changing AFS filesystem attributes.
+ * Operations supported:
+ * Name change: rename/remount
+ * Path change: remount
+ * Type change: ERR<-->AFS
+ */
+
+#if 0
+ if (strcmp(before[FS_OWNER], after[FS_OWNER]) ||
+ strcmp(before[FS_OWNERS], after[FS_OWNERS]))
+ {
+ critical_alert("incremental",
+ "Cannot change ownership of filesystem %s: Operation not yet supported",
+ after[FS_NAME]);
+ }
+#endif
+
+ sprintf(cmd, "%s/perl -I%s %s/afs_rename.pl %s %s %s %s %s %s %s %s %s %s",
+ BIN_DIR, BIN_DIR, BIN_DIR,
+ before[FS_NAME], before[FS_MACHINE], before[FS_TYPE],
+ before[FS_L_TYPE], before[FS_PACK],
+ after[FS_NAME], after[FS_MACHINE], after[FS_TYPE],
+ after[FS_L_TYPE], after[FS_PACK]);
+ run_cmd(cmd);
+}
+
+
+do_quota(before, beforec, after, afterc)
+char **before;
+int beforec;
+char **after;
+int afterc;
+{
+ char cmd[1024];
+
+ if (afterc < Q_DIRECTORY || strcmp("ANY", after[Q_TYPE]) ||
+ strncmp("/afs/", after[Q_DIRECTORY], 5))
+ return;
+
+ sprintf(cmd, "%s/perl -I%s %s/afs_quota.pl %s %s",
+ BIN_DIR, BIN_DIR, BIN_DIR,
+ after[Q_DIRECTORY], after[Q_QUOTA]);
+ run_cmd(cmd);
+ return;
+}
+
+
+run_cmd(cmd)
+char *cmd;
+{
+ int success=0, tries=0;
+
+ check_afs();
+
+ while (success == 0 && tries < 2) {
+ if (tries++)
+ sleep(90);
+ com_err(whoami, 0, "Executing command: %s", cmd);
+ if (system(cmd) == 0)
+ success++;
+ }
+ if (!success)
+ critical_alert("incremental", "failed command: %s", cmd);
+}
+
+
+add_user_lists(ac, av, user)
+ int ac;
+ char *av[];
+ char *user;
+{
+ if (atoi(av[5]))
+ edit_group(1, av[0], "USER", user);
+}
+
+