ディスクAにWinPEと同様のLinux生放送環境を作成し、、、rootfs.tar.gz
を含むbzImage
UディスクBをBurning.sh
PCに挿入し、ディスクAを利用して生放送環境に入りました。ところで今はBurning.sh
ライブ環境で実行できないことを発見し、エラーは次のとおりです。
bash: ./Burning.sh: cannot execute: required file not found.
コンテンツBurning.sh
#!/usr/bin/bash
######################################################################
# Author: madship_xk
######################################################################
current_path=$(pwd)
#clear
# First, Fdisk
echo "**1************************************************************************"
echo "**2************************************************************************"
foo(){
#clear
echo "**3************************************************************************"
echo "**4************************************************************************"
###获取第二个磁盘的信息###
#fdisk -l | grep Disk | awk '{FS=" "} {print $2}' | sed 's/:/ /g' > ./tmp.txt
ls /dev/sda > ./tmp.txt
hdstr=`awk 'NR==1 {print}' ./tmp.txt`
echo "hdstr="${hdstr}
rm ./tmp.txt
echo "**5************************************************************************"
echo "********** 1st Command: FDISK ***********"
echo "********** Plese Follow the Introduction! ***********"
echo "**6************************************************************************"
fdisk ${hdstr} <<EOT 1>/dev/null 2>/dev/null || exit 1
d
1
d
2
d
3
d
4
d
n
p
1
+2G
n
p
2
w
EOT
echo "**7************************************************************************"
echo "********** 2nd Command: PARTX ***********"
echo "********** Please Follow the Introduction! ***********"
echo "**8************************************************************************"
partx ${hdstr} 1>/dev/null
#sleep 1
###判断mmcblk0###
#if [[ ${hdstr} = '/dev/mmcblk0' ]] ; then
# echo "emmc exists..."
# hdstr=`printf "%sp" ${hdstr}`
# b_mmcFlag="1"
#else
# echo "ssd exists..."
# b_mmcFlag="0"
#fi
#echo ${hdstr}
sleep 1
#clear
echo "**9************************************************************************"
echo "********** 3rd Command: FORMAT SDB1 ***********"
echo "********** Please Follow the Introduction! ***********"
echo "**10************************************************************************"
hdstr1=`printf "%s1" ${hdstr}`
echo ${hdstr1}
sleep 5
mkfs.ext4 ${hdstr1} 1>/dev/null
sleep 1
#clear
echo "**11************************************************************************"
echo "********** 4th Command: FORMAT SDB2 ***********"
echo "********** Please Follow the Introduction! ***********"
echo "**12************************************************************************"
hdstr2=`printf "%s2" ${hdstr}`
echo ${hdstr2}
sleep 5
mkfs.ext4 ${hdstr2} 1>/dev/null
sleep 1
#clear
echo " "
echo "**13************************************************************************"
echo "********** 6th Command: MIRROR IMAGE FOR SDB1 ***********"
echo "********** Please Follow the Introduction! ***********"
echo "**14************************************************************************"
mkdir /mnt/boot
mount ${hdastr1} /mnt/boot 1>/dev/null
sleep 5
grub-install --root-directory=/mnt /dev/sda --force
cat > /mnt/boot/grub/grub.cfg <<EOF 1>/dev/null || exit 1
#Begin cfg
set default=0
set timeout=5
set root=(hd0,1)
menuentry "GNU/Linux, Test-6.4.0-rt" {
linux /bzImage rw root=/dev/sda2
}
EOF
cp "${current_path}/bzImage" /mnt/boot
umount /mnt/boot
sleep 1
#clear
echo "**15************************************************************************"
echo "********** 7th Command: MIRROR IMAGE FOR SDB2 ***********"
echo "********** Please Follow the Introduction! ***********"
echo "**16************************************************************************"
sleep 2
mount ${hdstr2} /mnt
cp "${current_path}/rootfs.tar.gz" /mnt
cd /mnt
tar -vxf rootfs.tar.gz
rm rootfs.tar.gz
cd ~
umount /mnt
sync
#clear
echo "**17************************************************************************"
echo "********** 7th Command: MIRROR IMAGE FOR SDB2 ***********"
echo "********** Please Follow the Introduction! ***********"
echo "**18************************************************************************"
}
jumpa(){
echo "Please input \"BURN\" to go to start point"
read INP
#echo $INP
if [[ $INP = 'BURN' ]] ; then
echo "Going to Start POINT......"
sleep 2
echo
foo
else
echo
jumpa
fi
}
jumpa
答え1
以下を実行して問題を解決しました。dos2unix Burning.sh