From ceece6a1b0e309ef32a8b8bcb0ce4a72b2d13e26 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 25 Feb 2013 15:56:15 +0100 Subject: delete random functions in random files --- remote/tools/base/base.build | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/remote/tools/base/base.build b/remote/tools/base/base.build index 8a327f83..ef2d2d27 100644 --- a/remote/tools/base/base.build +++ b/remote/tools/base/base.build @@ -57,32 +57,6 @@ build() { fi } -clean_users_and_groups() { - # Pass the root directory of the "system" you want to clean, eg '/' for your real machine (probably a bad idea) - [ $# -ne 1 ] && perror "Missing param to clean_users_and_groups" - local SYSBASE=$1 - local PASSWD=${SYSBASE}/etc/passwd - local GROUP=${SYSBASE}/etc/group - local SHADOW=${SYSBASE}/etc/shadow - # remove local users from group file (TODO: currently assumes users have ids 1000-1999) - local LOCALUSERS=$(grep -E '^[^:]+:x?:1[0-9]{3}:' "${PASSWD}" | awk -F ':' '{print $1}') - for USER in $LOCALUSERS; do - sed -r -i "s/([:,])${USER}/\1/g" "${GROUP}" - done - # fix syntax: remove trailing ',' in group file - sed -r -i 's/,+$//g' "${GROUP}" - sed -r -i 's/,+/,/g' "${GROUP}" - sed -i 's/:,/:/g' "${GROUP}" - # remove all non-system groups (also assumes users have 1000-1999, so nogroup will be kept) - grep -v -E '^[^:]+:x?:1[0-9]{3}:' "${GROUP}" > "${GROUP}.tmp" - mv "${GROUP}.tmp" "${GROUP}" - # same for users... - grep -v -E '^[^:]+:x?:1[0-9]{3}:' "${PASSWD}" > "${PASSWD}.tmp" - mv "${PASSWD}.tmp" "${PASSWD}" - # generate fresh shadow file - awk -F ':' '{print $1":*:15555:0:99999:7:::"}' "${PASSWD}" > "${SHADOW}" -} - post_copy() { # make basic directory structure -- cgit v1.2.3-55-g7522