代码拉取完成,页面将自动刷新
#!/bin/bash
# Check architecture and set variables
if [[ ! $check_and_set ]]; then
. 0-check-and-set.sh $1 $2
fi
# Get current UTC time
utc_time=`date -u -d"$(wget -qO- --save-headers http://www.debian.org |\
sed '/^Date: /!d;s///;q')" +%Y%m%dT%H%M%SZ`
rootfs_dir_utc=$rootfs_dir-$utc_time
# Cleanup when interrupt signal is received
trap "umount $build_dir/$rootfs_dir_utc/dev; exit 1" SIGINT
if [[ $arch == $host_arch ]]; then
# Create /dev in rootfs
mkdir -p $build_dir/$rootfs_dir_utc/dev 2>/dev/null
# Mount /dev in rootfs
mount --bind /dev $build_dir/$rootfs_dir_utc/dev
# Create root file system and configure debian packages
multistrap -d $build_dir/$rootfs_dir_utc -a $arch -f $conf_file
if [[ $? != 0 ]]; then
echo "mutltistrap with configuration file $conf_file failed"
umount $build_dir/$rootfs_dir_utc/dev
rm -rf $build_dir/$rootfs_dir_utc
exit 1
fi
else
# Create root file system
multistrap -d $build_dir/$rootfs_dir_utc -a $arch -f $conf_file
if [[ $? != 0 ]]; then
echo "mutltistrap with configuration file $conf_file failed"
rm -rf $build_dir/$rootfs_dir_utc
exit 1
fi
# Set environment variables
export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true
export LC_ALL=C LANGUAGE=C LANG=C
# Copy qemu binary to rootfs
cp $qemu_path $build_dir/$rootfs_dir_utc$qemu_path
# Mount /dev in rootfs
mount --bind /dev $build_dir/$rootfs_dir_utc/dev
# Complete the configure of dash
chroot $build_dir/$rootfs_dir_utc /var/lib/dpkg/info/dash.preinst install
# Configure debian packages
chroot $build_dir/$rootfs_dir_utc dpkg --configure -a
fi
# Empty root password
chroot $build_dir/$rootfs_dir_utc passwd -d root
# Get packages installed
chroot $build_dir/$rootfs_dir_utc dpkg -l | awk '{if (NR>3) {print $2" "$3}}' > $build_dir/$rootfs_dir_utc\-packages
# Kill processes running in rootfs
fuser -sk $build_dir/$rootfs_dir_utc
# Remove qemu binary from rootfs
rm $build_dir/$rootfs_dir_utc$qemu_path 2>/dev/null
# Umount /dev in rootfs
umount $build_dir/$rootfs_dir_utc/dev
# Latest rootfs is the current one
ln -sfn $rootfs_dir_utc $build_dir/$rootfs_dir
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。