dialog --title$"Import stream files directory into Icecast"\
--msgbox$"Import success" 6 40
}
function icecast_import_from_usb {
clear
detect_usb_drive
if[!-b$USB_DRIVE];then
dialog --title$"Import stream files from USB drive"--msgbox$'No USB drive found' 6 50
return
fi
backup_mount_drive ${USB_DRIVE}
if[!-d$USB_MOUNT$ICECAST_DIR];then
dialog --title$"Import stream files from USB drive"--msgbox$'No stream files directory found on USB drive' 6 50
backup_unmount_drive ${USB_DRIVE}
fi
cp-ru$USB_MOUNT$ICECAST_DIR/*$ICECAST_DIR
backup_unmount_drive ${USB_DRIVE}
icecast_convert_files $ICECAST_DIR
dialog --title$"Import stream files from USB drive"--msgbox$'Import complete. You may now remove the USB drive' 6 50
}
function icecast_export_to_usb {
clear
detect_usb_drive
if[!-b$USB_DRIVE];then
dialog --title$"Export stream files to USB drive"--msgbox$'No USB drive found' 6 50
return
fi
backup_mount_drive ${USB_DRIVE}
if[!-d$USB_MOUNT$ICECAST_DIR];then
mkdir-p$USB_MOUNT$ICECAST_DIR
fi
cp-ru$ICECAST_DIR/*$USB_MOUNT$ICECAST_DIR
backup_unmount_drive ${USB_DRIVE}
dialog --title$"Export stream files to USB drive"--msgbox$'Export complete. You may now remove the USB drive' 6 50
}
function icecast_format_drive {
detect_usb_drive
data=$(tempfile 2>/dev/null)
trap"rm -f $data" 0 1 2 5 15
dialog --title$"Format USB drive $USB_DRIVE for stream file storage"\
--backtitle$"Freedombone Control Panel"\
--defaultno\
--yesno$"\nPlease confirm that you wish to format drive\n\n${USB_DRIVE}\n\nAll current data on the drive will be lost, and you will be prompted to give a password used to encrypt the drive.\n\nDANGER: If you screw up here and format the wrong drive it's your own fault!" 16 60
sel=$?
case$selin
1)return;;
255)return;;
esac
rm$data
clear
echo''
echo$"Formatting drive $USB_DRIVE. ALL CONTENTS WILL BE LOST."
echo''
${PROJECT_NAME}-format$USB_DRIVE
dialog --title$"Format USB drive $USB_DRIVE for stream file storage"--msgbox$'Format complete. You may now export stream files or remove the USB drive' 6 50