Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Kickstart scripts for adding specified user during installation as well as check-up if the user was successfully added to the system, including password, /home/<user> directory and specified group. Signed-off-by: Karel Valek <kvalek@redhat.com>
- Loading branch information
Karel Valek
committed
Jul 8, 2015
1 parent
4a4bea4
commit 232240e
Showing
2 changed files
with
108 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# Set basic URL | ||
url --url="http://dl.fedoraproject.org/pub/fedora/linux/development/$releasever/$basearch/os/" | ||
|
||
# perform install | ||
install | ||
|
||
# Set network - automatical DHCP | ||
network --bootproto=dhcp | ||
|
||
bootloader --timeout=1 | ||
zerombr | ||
|
||
# Remove whole disk info and recreate it. | ||
clearpart --all | ||
autopart --type=lvm | ||
|
||
# Set locales and Keyboard. | ||
keyboard us | ||
lang en | ||
timezone America/New_York | ||
|
||
# set users. Root first, others next | ||
rootpw qweqwe | ||
|
||
## TEST CREATE USER | ||
# First, we need to create a group where we can assign user.. | ||
group --name=kosygroup --gid=5001 | ||
|
||
# ..then create the user and assign him/her to group we created before. | ||
user --name=kosieh --gecos="Kosieh Barter" --homedir=/home/kbarter --password="$6$QsJCB9E6geIjWNvn$UZLEtnHYgKmFgrPo0fY1qNBc/aRi9b01f19w9mpdFm9.MPblckUuFYvpRLSzeYeR/6lO/2uY4WtjhbryC0k2L/" --iscrypted --shell=/bin/bash --uid=4001 --gid=5001 | ||
|
||
# After all, shut down the machine. | ||
shutdown | ||
|
||
%packages | ||
%end | ||
|
||
%post | ||
## TEST CREATE USER CHECK | ||
# First, check if the group is properly set up. | ||
cat /etc/group | grep 5001 | ||
if [[ $? -ne 0 ]]; then | ||
echo "FAILED: Group failed to create." >> /root/RESULT | ||
fi | ||
# If it succeeds, lets go to higher level. Check, if the user is present.. | ||
cat /etc/passwd | grep kosieh | ||
if [[ $? -ne 0 ]]; then | ||
echo "FAILED: User is not present in system." >> /root/RESULT | ||
fi | ||
# ..if successfull, let's check if the user has his / her real name... | ||
cat /etc/passwd | grep kosieh | grep "Kosieh Barter" | ||
if [[ $? -ne 0 ]]; then | ||
echo "FAILED: User is present, but not all details: REAL NAME (GEDOS)" >> /root/RESULT | ||
fi | ||
# ...and if so, let's presume that all GEDOS data should be in "OK" state. Next step is to check bash... | ||
cat /etc/passwd | grep kosieh | grep "/bin/bash" | ||
if [[ $? -ne 0 ]]; then | ||
echo "FAILED: User is present, but /bin/bash is not set (EXPERIMENTAL!)" >> /root/RESULT | ||
fi | ||
# ...that will also confirm that the user should have his/her password (already in crypted version, EXPERIMENTAL!!)... | ||
cat /etc/shadow | grep kosieh | grep "$6$QsJCB9E6geIjWNvn$UZLEtnHYgKmFgrPo0fY1qNBc/aRi9b01f19w9mpdFm9.MPblckUuFYvpRLSzeYeR/6lO/2uY4WtjhbryC0k2L/" | ||
if [[ $? -ne 0 ]]; then | ||
echo "FAILED: User is present, passwords DO NOT match" >> /root/RESULT | ||
fi | ||
# ...and the best for last, does the user BELONG to the group stated in kickstart script? | ||
cat /etc/passwd | grep kosieh | grep 5001 | ||
if [[ $? -ne 0 ]]; then | ||
echo "FAILED: User is present, group assignment failed" >> /root/RESULT | ||
fi | ||
# ..And I forgot! What about the home directory? Let's fix this by a simple test. | ||
ls /home/ | grep kbarter | ||
if [[ $? -ne 0 ]]; then | ||
echo "FAILED: Home directory not found" >> /root/RESULT | ||
fi | ||
# If everything succeeds, give the tester permission to go and grab a cookie. | ||
if [[ ! -e /root/RESULT ]]; then | ||
echo SUCCESS > /root/RESULT | ||
fi | ||
%end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# | ||
# Copyright (C) 2015 Red Hat, Inc. | ||
# | ||
# This copyrighted material is made available to anyone wishing to use, | ||
# modify, copy, or redistribute it subject to the terms and conditions of | ||
# the GNU General Public License v.2, or (at your option) any later version. | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY expressed or implied, including the implied warranties of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | ||
# Public License for more details. You should have received a copy of the | ||
# GNU General Public License along with this program; if not, write to the | ||
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
# 02110-1301, USA. Any Red Hat trademarks that are incorporated in the | ||
# source code or documentation are not subject to the GNU General Public | ||
# License and may only be used or replicated with the express permission of | ||
# Red Hat, Inc. | ||
# | ||
# Red Hat Author(s): Chris Lumens <clumens@redhat.com> | ||
|
||
. ${KSTESTDIR}/functions.sh |