Implement portage-stable UID/GID Rule and Add Apache/MySQL Entries
Add a new rule for enewgroup and enewuser that if the caller is from
portage-stable, ignore the specified UID and GID.
Added entries for Apache and Mysql Users/Groups.
BUG=chromium:342864
TEST=Successfully able to emerge apache and mariadb and successful
trybot run on chromiumos-sdk.
Change-Id: I48f86959d1e367f69e3da51c70eefb3582056487
Reviewed-on: https://chromium-review.googlesource.com/186036
Reviewed-by: Simran Basi <sbasi@chromium.org>
Commit-Queue: Simran Basi <sbasi@chromium.org>
Tested-by: Simran Basi <sbasi@chromium.org>
diff --git a/eclass/user.eclass b/eclass/user.eclass
index bba3626..c787e55 100644
--- a/eclass/user.eclass
+++ b/eclass/user.eclass
@@ -209,6 +209,13 @@
# Handle uid. Passing no UID is functionally equivalent to passing -1.
local provided_uid=$(_get_value_for_user "${euser}" uid)
local euid=$1; shift
+ if [[ "${PORTAGE_REPO_NAME}" == "portage-stable" ]] ; then
+ # If caller is from portage-stable, ignore specified UID.
+ if [[ ${euid:--1} != "-1" ]] ; then
+ einfo "Ignoring requested UID ${euid} in portage-stable ebuilds."
+ fi
+ euid=''
+ fi
if [[ -z ${euid} ]] ; then
euid=-1
elif [[ ${euid} -lt -1 ]] ; then
@@ -337,6 +344,13 @@
# handle gid
local provided_gid=$(_get_value_for_group "${egroup}" gid)
local egid=$1; shift
+ if [[ "${PORTAGE_REPO_NAME}" == "portage-stable" ]] ; then
+ # If caller is from portage-stable, ignore specified GID.
+ if [[ ${egid:--1} != "-1" ]] ; then
+ einfo "Ignoring requested GID ${egid} in portage-stable ebuilds."
+ fi
+ egid=''
+ fi
if [[ -z ${egid} ]] ; then
# If caller specified nothing and profile has GID, use profile.
# If caller specified nothing and profile has no GID, barf.
diff --git a/profiles/base/accounts/group/apache b/profiles/base/accounts/group/apache
new file mode 100644
index 0000000..e596591
--- /dev/null
+++ b/profiles/base/accounts/group/apache
@@ -0,0 +1,3 @@
+group:apache
+gid:244
+users:apache
diff --git a/profiles/base/accounts/group/mysql b/profiles/base/accounts/group/mysql
new file mode 100644
index 0000000..92d2119
--- /dev/null
+++ b/profiles/base/accounts/group/mysql
@@ -0,0 +1,3 @@
+group:mysql
+gid:245
+users:mysql
diff --git a/profiles/base/accounts/user/apache b/profiles/base/accounts/user/apache
new file mode 100644
index 0000000..4e1bffe
--- /dev/null
+++ b/profiles/base/accounts/user/apache
@@ -0,0 +1,6 @@
+user:apache
+uid:244
+gid:244
+gecos:apache server
+home:/dev/null
+shell:/bin/false
diff --git a/profiles/base/accounts/user/mysql b/profiles/base/accounts/user/mysql
new file mode 100644
index 0000000..95bb1ee
--- /dev/null
+++ b/profiles/base/accounts/user/mysql
@@ -0,0 +1,6 @@
+user:mysql
+uid:245
+gid:245
+gecos:mysql database
+home:/dev/null
+shell:/bin/false