Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # File: install.sh
- #
- # Starts the install, you must copy your public ssh key to the target host before you run this script.
- #
- echo
- echo "Starting LFS build process."
- echo
- # Set some constants.
- USR=$1 # The build user.
- HOST=$2 # The target host.
- DEVICE=$3 # Device that will be used for the target system.
- SCRIPT=install.sh # Name of this script.
- LOGS=./$HOST-logs # The path to the log files.
- TIME_LOGS=$LOGS/build-time.log # The time logs file.
- echo -e "Executing Script: $SCRIPT, Time: $(date)\n" | tee $INFO_LOGS
- # Save start time for timing the script run time.
- start=`date +%s`
- source ./lfs-functions.sh
- # Remove any previous logs.
- rm -rf $LOGS
- # Create the logging directory and time log file.
- mkdir -p $LOGS && touch $TIME_LOGS
- # Copy source bash scripts to target host.
- echo -e "Copying source files to target host \"$HOST\"\n"
- scp lfs-* root@$HOST:~ &&
- echo -e "\nFiles copied to target host \"$HOST\" successfully.\n"
- # Login to remote host and run distribution prep script.
- echo -e "Logging into target host \"$HOST\" as root user.\n"
- ssh root@$HOST source ~/lfs-fedora.sh $USR $HOST $DEVICE &&
- # The distribution script on remote host has finished,
- # wait for host to come back online .
- wait_for_reboot $HOST &&
- # Login to target host, the login will trigger the stage 1 prep script to execute.
- ssh root@$HOST
- end=`date +%s`
- echo -e "Finished Script: $SCRIPT, Time: $(date)\n" | tee $INFO_LOGS
- echo "S:$start E:$end T:$(format_time $[end-start]) S:$SCRIPT" >> $TIME_LOGS
- echo Build completed.
- exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement