This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
lsts_glued/utils/mknfs.bash

38 lines
962 B
Bash
Raw Normal View History

2013-07-13 17:19:22 +01:00
#! /bin/bash
#############################################################################
# $Id:: Helps deploying an archive to a folder in an easy way. $:#
#############################################################################
# Check shell type.
if [ -z "$BASH_VERSION" ]; then
echo "ERROR: you must use bash to run this script."
exit 1
fi
if [ $# -ne 1 ]; then
echo "Usage: $0 <config>"
exit 1
fi
if ! [ -f "$1" ]; then
echo "ERROR: configuration file '$1' does not exist."
exit 1
fi
source "$1"
# Creating a new folder:
target="${cfg_dir_base}/nfs/${cfg_hostname}"
sudo rm -rf ${target}
mkdir -p ${target}
# Copy the content of the file to our NFS folder:
sudo tar -pxf ${cfg_rootfs_tar} -C ${target}
# We want our resolve file and host file:
sudo rm "${target}/etc/resolv.conf"
sudo cp "/etc/resolv.conf" "${target}/etc/resolv.conf"
sudo rm "${target}/etc/hosts"
sudo cp "/etc/hosts" "${target}/etc/hosts"