usersgroups 1.25 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
#
# 
#
use strict;
use libinstall;
use installvars;

sub Install($$$)
{
    my ($server, $isupdate, $impotent) = @_;

    # Replace if this script does an update for ip/domain.
    return 0
	if ($isupdate);

    Phase "usersgroups", "Creating users and groups", sub {
	Phase "tbadmin", "Creating tbadmin group", sub {
	    if (getgrnam("tbadmin")) {
		PhaseSkip("tbadmin group already exists");
	    }
	    ExecQuietFatal("$PW groupadd tbadmin -g $TBADMINGID");
	};
	Phase "root", "Creating root group", sub {
	    if (getgrnam("root")) {
		PhaseSkip("Group already exists");
	    }
	    ExecQuietFatal("$PW groupadd root -g 103");
	};
	# Added next two cause the mysql package does not do this (port does).
	Phase "mysqlgroup", "Creating mysql group", sub {
	    if (getgrnam("mysql")) {
		PhaseSkip("mysql group already exists");
	    }
	    ExecQuietFatal("$PW groupadd mysql -g 88");
	};
	Phase "mysqluser", "Creating mysql user", sub {
	    if (getpwnam("mysql")) {
		PhaseSkip("mysql user already exists");
	    }
	    ExecQuietFatal("$PW useradd mysql -g 88 -g 88 -h - ".
			   "-d $MYSQLDBDIR -s /sbin/nologin -c 'MySQL Daemon'");
	};
	ExecQuietFatal("$CHOWN mysql:mysql $MYSQLDBDIR")
	    if (-e $MYSQLDBDIR);
    };

    return 0;
}

# Local Variables:
# mode:perl
# End: