10 script_path=$(readlink -f ${0%/*})
12 mirror="http://ftp.jaist.ac.jp/pub/Linux/ubuntu/"
15 # Show an INFO message
19 echo "[LUBS Core] INFO: ${_msg}"
22 # Show an ERROR message then exit with status
23 # _msg_error <message> <exit code>
27 echo "[LUBS Core] ERROR: ${_msg}" >&2
28 if [[ ! ${_error} = 0 ]]; then
34 # Helper function to run make_*() only one time.
36 if [[ ! -e "${work_dir}/build.${1}" ]]; then
38 touch "${work_dir}/build.${1}"
44 "${script_path}/lubs-chroot" "${work_dir}/airootfs" ${@}
48 run_cmd apt-get --yes install ${@}
55 if [[ ${EUID} -ne 0 ]]; then
56 _msg_error "This script must be run as root." 1
59 [[ ! -d "${work_dir}" ]] && mkdir -p "${work_dir}"
62 for mount in $(mount | awk '{print $3}' | grep $(realpath ${work_dir})); do
63 _msg_info "Unmounting ${mount}"
71 _msg_info "Installing Ubuntu to '${work_dir}/airootfs/'..."
72 mkdir -p ${work_dir}/airootfs
73 debootstrap --arch=${arch} --include=linux-image-generic --verbose --merged-usr "${codename}" "${work_dir}/airootfs" ${mirror}
74 echo 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${PATH}' >> "${work_dir}/airootfs/etc/bash.bashrc"
75 run_cmd apt-get update
76 # run_cmd apt-get upgrade
77 _msg_info "${codename} installed successfully!"
81 cp ${script_path}/source.list.d/${codename}/* ${work_dir}/airootfs/etc/apt
85 run_cmd apt-get update
86 installpkglist=($(grep -h -v ^'#' ${script_path}/packages.x86_64))
87 run_cmd apt-get --yes install ${installpkglist[@]}
92 run_once make_sourcelist
93 # run_once make_packages