1
0
Fork 0

Fix username and password; delete root password

This commit is contained in:
Braiden Vasco 2017-07-01 02:09:28 +00:00
parent 1a0a789ed8
commit 0d70551190
5 changed files with 21 additions and 7 deletions

View file

@ -133,6 +133,16 @@ if [ -z "${HOSTNAME}" ]; then
exit 1
fi
if [ -z "${USERNAME}" ]; then
echo "USERNAME not set" 1>&2
exit 1
fi
if [ -z "${PASSWORD}" ]; then
echo "PASSWORD not set" 1>&2
exit 1
fi
export IMG_DATE=${IMG_DATE:-"$(date +%Y-%m-%d)"}
export BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
@ -144,6 +154,8 @@ export LOG_FILE="${WORK_DIR}/build.log"
export CLEAN
export IMG_NAME
export HOSTNAME
export USERNAME
export PASSWORD
export APT_PROXY
export STAGE

2
config
View file

@ -1,2 +1,4 @@
IMG_NAME='BarnacleOS'
HOSTNAME='barnacleos'
USERNAME='user'
PASSWORD='password'

View file

@ -7,8 +7,8 @@ on_chroot << EOF
hardlink -t /usr/share/doc
EOF
if [ -d ${ROOTFS_DIR}/home/pi/.config ]; then
chmod 700 ${ROOTFS_DIR}/home/pi/.config
if [ -d ${ROOTFS_DIR}/home/$USERNAME/.config ]; then
chmod 700 ${ROOTFS_DIR}/home/$USERNAME/.config
fi
rm -f ${ROOTFS_DIR}/etc/apt/apt.conf.d/51cache

View file

@ -6,11 +6,11 @@ install -m 744 files/policy-rc.d ${ROOTFS_DIR}/usr/sbin/policy-rc.d #TODO: Neces
install -v -m 644 files/fstab ${ROOTFS_DIR}/etc/fstab
on_chroot << EOF
if ! id -u pi >/dev/null 2>&1; then
adduser --disabled-password --gecos "" pi
if ! id -u $USERNAME >/dev/null 2>&1; then
adduser --disabled-password --gecos "" $USERNAME
fi
echo "pi:raspberry" | chpasswd
echo "root:root" | chpasswd
echo "$USERNAME:$PASSWORD" | chpasswd
passwd -d root
EOF

View file

@ -24,7 +24,7 @@ for GRP in input spi i2c gpio; do
groupadd -f -r $GRP
done
for GRP in adm dialout cdrom audio users sudo video games plugdev input gpio spi i2c netdev; do
adduser pi $GRP
adduser $USERNAME $GRP
done
EOF