首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >创建混合iso的Bash脚本生成“意外的文件结束”

创建混合iso的Bash脚本生成“意外的文件结束”
EN

Stack Overflow用户
提问于 2014-09-23 10:49:42
回答 1查看 378关注 0票数 0

我创建了一个简单的bash脚本来创建一个混合的iso。但是当我尝试运行它时,我得到了输出:

代码语言:javascript
复制
hybridiso.sh: line 58: syntax error: unexpected end of file.

我已经检查了脚本并尝试对其进行更改,但仍然得到了相同的输出。剧本怎么了?

代码语言:javascript
复制
#!/bin/bash

##Sanity Cheks##
if [ "$(whoami)" != root ]; then
    echo "You must be root to execute this script."
fi

if [ ! -x /usr/bin/xorriso ]; then
    echo "xorriso is not installed. Run 'apt-get install xorriso' to install it."
exit 1
fi

if [ ! -x /usr/bin/live-build ]; then
    echo "live-build is not installed. Run 'apt-get install live-build' to install it."
exit 1
fi

if [ ! -x /usr/bin/syslinux ]; then
    echo "syslinux is not insatlled. Run 'apt-get install syslinux' to install it."
exit 1
fi

if [ ! -x /usr/bin/mksquashfs ]; then
    echo "squashfs-tools is not installed. Run 'apt-get install squashfs-tools' to install it."
exit 1
fi
###############

mkdir $PWD/hybridiso
cd hybridiso
mkdir -p binary/live && mkdir -p binary/isolinux
read -e -p "Enter local file path for linux kernel " kernel
read -e -p "Enter local file path for initrd " initrd
cp $kernel binary/live/ && cp $initrd binary/live/
#mksquashfs chroot binary/live/filesystem.squashfs -comp xz -e boot
cp /usr/lib/syslinux/isolinux.bin binary/isolinux/
cp /usr/lib/syslinux/menu.c32 binary/isolinux/
while true; do
read -p "Do you have an isolinux.cfg? " resp
if [ $resp -eq no ]; then
    echo "You need to create a valid isolinux.cfg file!"
    echo "Creating example file $PWD/isolinux.cfg.example"
    echo -e "ui menu.c32\nprompt 0\nmenu title Boot Menu\ntimeout 300\n\n\nlabel live-amd64\n       menu label ^Live (amd64)\n       menu default\n       linux /live/linux\n        append initrd=/live/initrd.gz boot=live persistence quiet\n\n\nlabel live-amd64-failsafe\n        menu label ^Live (amd64 failsafe)\nlinux /live/linux\nappend initrd=/live/initrd.gz boot=live persistence config memtest noapic noapm nodma nomce nolapic nomodest nosmp nosplash vga=normal\n\n\nendtext" >> isolinux.cfg.example
exit 1
elif [ $resp -eq yes ]; then
    break
else
    "Put only in yes or no"
fi

read -e -p "Enter local file path for isolinux.cfg" isolinux
cp $isolinux binary/isolinux/

xorriso -as mkisofs -r -J -joliet-long -l -cache-inodes -isohybrid-mbr /usr/lib/syslinux/isohdpfx.bin -partition_offset 16 -A "Debian Live" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o kiosk.iso binary

echo "Script is succesfull!"
exit 0
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-09-23 10:53:48

您还没有使用while anywhere终止done循环;在适当的位置添加done

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25993190

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档