lfs-buildscripts/CH9Config/01-USBFlash.sh
2024-10-10 14:50:01 -07:00

45 lines
872 B
Bash

#!/bin/bash
# Do not try to bring up the network when booted from a thumb drive
systemctl disable systemd-networkd-wait-online
# hostname
echo "lfsusb" > /etc/hostname
# LFS user
groupadd lfs
useradd -d /home/lfs -s /bin/bash -g lfs -m -k /dev/null lfs
# fix permissions
chown -R lfs:lfs /home/lfs
# login scripts
cat > /home/lfs/.bash_profile << "EOF"
exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash
EOF
chown lfs:lfs /home/lfs/.bash_profile
cat > /home/lfs/.bashrc << "EOF"
set +h
umask 022
LFS=/mnt/newlfs
LC_ALL=POSIX
LFS_TGT=x86_64-lfs-linux-gnu
PATH=/usr/bin
if [ ! -L /bin ]; then PATH=/bin:$PATH; fi
PATH=$LFS/tools/bin:$PATH
CONFIG_SITE=$LFS/usr/share/config.site
export LFS LC_ALL LFS_TGT PATH CONFIG_SITE
# below is conservative but safe
export MAKEFLAGS=-j8
EOF
echo "Please set the password for the lfs user:"
echo " passwd lfs"
echo