Fix username and password; delete root password
This commit is contained in:
parent
1a0a789ed8
commit
0d70551190
5 changed files with 21 additions and 7 deletions
12
build.sh
12
build.sh
|
@ -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
2
config
|
@ -1,2 +1,4 @@
|
|||
IMG_NAME='BarnacleOS'
|
||||
HOSTNAME='barnacleos'
|
||||
USERNAME='user'
|
||||
PASSWORD='password'
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Reference in a new issue