2014-09-23 61 views
0

我創建了一個簡單的創建混合iso的bash腳本。但是,當我嘗試運行它,我得到的輸出:創建混合iso的bash腳本生成「意外的文件結尾」

hybridiso.sh: line 58: syntax error: unexpected end of file. 

我檢查腳本,並試圖進行更改,但我仍然得到同樣的輸出。腳本有什麼問題?

#!/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 
+0

腳本中的while循環未終止。因此,這個錯誤。在適當的位置使用'done'終止它。 – iqstatic 2014-09-23 10:56:06

+0

$ iqstatic我多麼尷尬。謝謝。 – 2014-09-23 11:03:15

回答

2

您還沒有終止while循環與done任何地方;在適當的位置添加done

相關問題