[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 7c5835f 2/2: Abstract the normal user's defau
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 7c5835f 2/2: Abstract the normal user's default group |
Date: |
Wed, 9 Oct 2019 11:17:26 -0400 (EDT) |
branch: master
commit 7c5835fb57cc9e15cbf978fa852deb08388782a1
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Abstract the normal user's default group
---
install_centos.sh | 8 ++++----
install_redhat.sh | 2 +-
lmi_setup_11.sh | 2 +-
lmi_setup_21.sh | 17 +++++++++--------
lmi_setup_inc.sh | 3 ++-
5 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/install_centos.sh b/install_centos.sh
index 680cc9c..05967c5 100755
--- a/install_centos.sh
+++ b/install_centos.sh
@@ -38,7 +38,7 @@ cat >/etc/schroot/chroot.d/centos7lmi.conf <<EOF
description=centos-7.7
directory=/srv/chroot/centos7lmi
users="${NORMAL_USER}"
-groups="${NORMAL_USER}"
+groups="${NORMAL_GROUP}"
root-groups=root
type=plain
EOF
@@ -67,9 +67,9 @@ chmod 666 /dev/null
chmod 666 /dev/ptmx
[ -d /dev/pts ] || mkdir /dev/pts
-getent group "${NORMAL_USER}" || groupadd --gid="${NORMAL_USER_GID}"
"${NORMAL_USER}"
+getent group "${NORMAL_GROUP}" || groupadd --gid="${NORMAL_GROUP_GID}"
"${NORMAL_GROUP}"
getent passwd "${NORMAL_USER}" || useradd \
- --gid="${NORMAL_USER_GID}" \
+ --gid="${NORMAL_GROUP_GID}" \
--uid="${NORMAL_USER_UID}" \
--create-home \
--shell=/bin/zsh \
@@ -128,7 +128,7 @@ aliases=lmi
description=debian ${CODENAME} cross build ${CHRTVER}
directory=/srv/chroot/${CHRTNAME}
users="${NORMAL_USER}"
-groups="${NORMAL_USER}"
+groups="${NORMAL_GROUP}"
root-groups=root
type=plain
EOF
diff --git a/install_redhat.sh b/install_redhat.sh
index 089abf8..20fb6a0 100755
--- a/install_redhat.sh
+++ b/install_redhat.sh
@@ -73,7 +73,7 @@ aliases=lmi
description=debian ${CODENAME} cross build ${CHRTVER}
directory=/srv/chroot/${CHRTNAME}
users="${NORMAL_USER}"
-groups="${NORMAL_USER}"
+groups="${NORMAL_GROUP}"
root-groups=root
type=plain
EOF
diff --git a/lmi_setup_11.sh b/lmi_setup_11.sh
index 61b1ef4..108f70d 100755
--- a/lmi_setup_11.sh
+++ b/lmi_setup_11.sh
@@ -42,7 +42,7 @@ aliases=lmi
description=debian ${CODENAME} cross build ${CHRTVER}
directory=/srv/chroot/${CHRTNAME}
users="${NORMAL_USER}"
-groups="${NORMAL_USER}"
+groups="${NORMAL_GROUP}"
root-groups=root
type=plain
EOF
diff --git a/lmi_setup_21.sh b/lmi_setup_21.sh
index 88424e2..c49e7e1 100755
--- a/lmi_setup_21.sh
+++ b/lmi_setup_21.sh
@@ -37,9 +37,9 @@ assert_chrooted
# chage -d 0 "${NORMAL_USER}"
# may seem like a good idea, but invoking schroot with that userid
# doesn't prompt for a password change.
-groupadd --gid="${NORMAL_USER_GID}" "${NORMAL_USER}"
+groupadd --gid="${NORMAL_GROUP_GID}" "${NORMAL_GROUP}"
useradd \
- --gid="${NORMAL_USER_GID}" \
+ --gid="${NORMAL_GROUP_GID}" \
--uid="${NORMAL_USER_UID}" \
--create-home \
--shell=/bin/zsh \
@@ -49,17 +49,18 @@ useradd \
usermod -aG sudo "${NORMAL_USER}"
# Add an 'lmi' group, which may be useful in a multi-user chroot.
-groupadd --gid=1001 lmi
-usermod -aG lmi "${NORMAL_USER}"
+getent group 1001 || groupadd --gid=1001 lmi || echo "Oops."
+usermod -aG lmi "${NORMAL_USER}" || echo "Oops."
+# Here, the 'lmi' group should probably be the owner, eventually.
mkdir -p /opt/lmi
-chown "${NORMAL_USER}":lmi /opt/lmi
+chown "${NORMAL_USER}":"${NORMAL_USER}" /opt/lmi
mkdir -p /etc/opt/lmi
-chown "${NORMAL_USER}":lmi /etc/opt/lmi
+chown "${NORMAL_USER}":"${NORMAL_USER}" /etc/opt/lmi
mkdir -p /var/opt/lmi
-chown "${NORMAL_USER}":lmi /var/opt/lmi
+chown "${NORMAL_USER}":"${NORMAL_USER}" /var/opt/lmi
mkdir -p /cache_for_lmi
-chown "${NORMAL_USER}":lmi /cache_for_lmi
+chown "${NORMAL_USER}":"${NORMAL_USER}" /cache_for_lmi
chsh -s /bin/zsh "${NORMAL_USER}"
diff --git a/lmi_setup_inc.sh b/lmi_setup_inc.sh
index aabb508..b8c19e5 100755
--- a/lmi_setup_inc.sh
+++ b/lmi_setup_inc.sh
@@ -35,7 +35,8 @@ CHRTVER=1
CHRTNAME=lmi_${CODENAME}_${CHRTVER}
NORMAL_USER=greg
NORMAL_USER_UID=1000
-NORMAL_USER_GID=1000
+NORMAL_GROUP=1000
+NORMAL_GROUP_GID=1000
GIT_URL_BASE=https://git.savannah.nongnu.org/cgit/lmi.git/plain
# For a server that, bizarrely, blocks gnu.org but allows github.com:
# GIT_URL_BASE=https://github.com/vadz/lmi/raw/master