#!/tools/bin/sh # The first argument to the setup script is the working directory. cd ${1} # Reading system configuration informations, functions and package versions. source ../sysinfos source ../functions source ../packages-list export LFS_PKG_DIR="$(dirname $(dirname $(pwd)))/packages/stage2" export LFS_LOG_DIR=/var/log/hvlinux-install/stage2 export LFS_LOG_FILE=${LFS_LOG_DIR}/install.log export LFS_TMP="/tmp" init_log_file run_cmd_log "Changing ownership of /tools files to root" chown -R 0:0 /tools && run_script_log "Creating basic directory structure" makedir && # The first mode change ensures that not just everybody can enter the /root # directory -- the same as a normal user would do with his or her home # directory. The second mode change makes sure that any user can write to the # /tmp and /var/tmp directories, but cannot remove other users' files from them. # The latter is prohibited by the so-called "sticky bit" -- the highest bit in # the 1777 bit mask. run_cmd_log "Setting permissions for /root" chmod 0750 /root && run_cmd_log "Setting permissions for /tmp and /var/tmp" \ chmod 1777 /tmp /var/tmp && # To remove the warning message: # "warning: can't open /etc/fstab: No such file or directory" touch /etc/fstab && # We must use the -n option. If not, a regular "/etc/mtab" file will be created, # and the mtab link we try to create later will not work. action_checkbox "Mounting the /proc filesystem" mount -n proc /proc -t proc && action_checkbox "Mounting the /dev/pts filesystem" \ mount -n -t devpts -o gid=4,mode=620 none /dev/pts && run_script_log "Creating essential symlinks" symlinks && run_script_log "Creating default groups" create-groups && run_script_log "Creating default users" create-users && run_script_log "Creating default configuration files" create-config-files && touch /var/run/utmp && touch /var/log/{btmp,lastlog,wtmp} && chgrp utmp /var/run/utmp /var/log/lastlog /var/log/btmp && chmod 664 /var/run/utmp /var/log/lastlog && chmod 600 /var/log/btmp && # Executing the install-1 script ./install-1 last_error=$? umount /dev/pts umount proc if [ $? != 0 -o ${last_error} != 0 ]; then exit 1 fi exit 0