Delete user before deleting group
This commit is contained in:
parent
8ec873f009
commit
57ba7611bd
@ -1,14 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
if [ -n "$(getent group "$WWW_DATA_GID")" ]
|
|
||||||
then
|
|
||||||
GROUPNAME=$(getent passwd "$WWW_DATA_GID" | cut -d: -f1)
|
|
||||||
echo "Deleting group $GROUPNAME which already uses GID $WWW_DATA_GID"
|
|
||||||
groupdel "$GROUPNAME"
|
|
||||||
else
|
|
||||||
echo "GID $WWW_DATA_GID not in use"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$(getent passwd "$WWW_DATA_UID")" ]
|
if [ -n "$(getent passwd "$WWW_DATA_UID")" ]
|
||||||
then
|
then
|
||||||
USERNAME=$(getent passwd "$WWW_DATA_UID" | cut -d: -f1)
|
USERNAME=$(getent passwd "$WWW_DATA_UID" | cut -d: -f1)
|
||||||
@ -18,6 +9,15 @@ else
|
|||||||
echo "UID $WWW_DATA_UID not in use"
|
echo "UID $WWW_DATA_UID not in use"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -n "$(getent group "$WWW_DATA_GID")" ]
|
||||||
|
then
|
||||||
|
GROUPNAME=$(getent passwd "$WWW_DATA_GID" | cut -d: -f1)
|
||||||
|
echo "Deleting group $GROUPNAME which already uses GID $WWW_DATA_GID"
|
||||||
|
groupdel "$GROUPNAME"
|
||||||
|
else
|
||||||
|
echo "GID $WWW_DATA_GID not in use"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -n "$(getent group www-data)" ]
|
if [ -n "$(getent group www-data)" ]
|
||||||
then
|
then
|
||||||
echo "Modifying existing www-data group, setting GID to $WWW_DATA_GID"
|
echo "Modifying existing www-data group, setting GID to $WWW_DATA_GID"
|
||||||
|
|||||||
@ -1,15 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
if [ -n "$(getent group "$WWW_DATA_GID")" ]
|
|
||||||
then
|
|
||||||
GROUPNAME=$(getent passwd "$WWW_DATA_GID" | cut -d: -f1)
|
|
||||||
echo "Deleting group $GROUPNAME which already uses GID $WWW_DATA_GID"
|
|
||||||
groupdel "$GROUPNAME"
|
|
||||||
else
|
|
||||||
echo "GID $WWW_DATA_GID not in use"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$(getent passwd "$WWW_DATA_UID")" ]
|
if [ -n "$(getent passwd "$WWW_DATA_UID")" ]
|
||||||
then
|
then
|
||||||
USERNAME=$(getent passwd "$WWW_DATA_UID" | cut -d: -f1)
|
USERNAME=$(getent passwd "$WWW_DATA_UID" | cut -d: -f1)
|
||||||
@ -19,6 +10,15 @@ else
|
|||||||
echo "UID $WWW_DATA_UID not in use"
|
echo "UID $WWW_DATA_UID not in use"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -n "$(getent group "$WWW_DATA_GID")" ]
|
||||||
|
then
|
||||||
|
GROUPNAME=$(getent passwd "$WWW_DATA_GID" | cut -d: -f1)
|
||||||
|
echo "Deleting group $GROUPNAME which already uses GID $WWW_DATA_GID"
|
||||||
|
groupdel "$GROUPNAME"
|
||||||
|
else
|
||||||
|
echo "GID $WWW_DATA_GID not in use"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -n "$(getent group www-data)" ]
|
if [ -n "$(getent group www-data)" ]
|
||||||
then
|
then
|
||||||
echo "Modifying existing www-data group, setting GID to $WWW_DATA_GID"
|
echo "Modifying existing www-data group, setting GID to $WWW_DATA_GID"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user