2012-07-21 67 views
-3

我有一個.bat文件,我用它來創建.apk文件在我的窗口中... 現在我需要能夠在Ubuntu中創建.apk文件,但我不知道如何將我的bat文件轉換爲批處理文件以便能夠在ubuntu上運行它!在Linux上的蝙蝠等效

下面是可以在windows上正常工作的bat文件...請問我能提供一些關於如何在Ubuntu上運行它的提示嗎?

@echo off 
set PAUSE_ERRORS=0 
:user_configuration 

:: Path to Flex SDK 
set FLEX_SDK=C:\sdk\flex_sdk_4.5.1.21328 

:: Path to Android SDK 
set ANDROID_SDK=C:\sdk\android 

:validation 
if not exist "%FLEX_SDK%\bin" goto flexsdk 
if not exist "%ANDROID_SDK%\platform-tools" goto androidsdk 
goto succeed 

:validation 
if not exist "%FLEX_SDK%\bin" goto flexsdk 
if not exist "%ANDROID_SDK%\platform-tools" goto androidsdk 
goto succeed 

:flexsdk 
echo. 
echo ERROR: incorrect path to Flex SDK 
echo. 
if %PAUSE_ERRORS%==1 pause 
exit 

:androidsdk 
echo. 
echo ERROR: incorrect path to Android SDK in 'bat\SetupSDK.bat' 
echo. 

if %PAUSE_ERRORS%==1 pause 
exit 

:succeed 
set PATH=%PATH%;%FLEX_SDK%\bin 
set PATH=%PATH%;%ANDROID_SDK%\platform-tools 

:: Android packaging 
set AND_CERT_NAME="PeymanApp" 
set AND_CERT_PASS=fd 
set AND_CERT_FILE=cert\SampleApp.p12 
set AND_ICONS=icons/android 

set AND_SIGNING_OPTIONS=-storetype pkcs12 -keystore "%AND_CERT_FILE%" -storepass  %AND_CERT_PASS% 

:: Application descriptor 
set APP_XML=application.xml 

:: Files to package 
set APP_DIR=bin 
set FILE_OR_DIR=-C %APP_DIR% . 

:: Your application ID (must match <id> of Application descriptor) 
set APP_ID=air.com.doitflash.SampleApp 

:: Output packages 
set DIST_PATH=dist 
set DIST_NAME=PeymanApp 

:validation 
%SystemRoot%\System32\find /C "<id>%APP_ID%</id>" "%APP_XML%" > NUL 
if errorlevel 1 goto badid 
goto end_validation 

:badid 
echo. 
echo ERROR: Application ID (APP_ID) does NOT match Application descriptor '%APP_XML%'  (id) 

echo. 

:end_validation 

set TARGET= 
set PLATFORM=android 

::call bat\Packager.bat 
if "%PLATFORM%"=="android" goto android-config 

:android-config 
set CERT_FILE=%AND_CERT_FILE% 
set SIGNING_OPTIONS=%AND_SIGNING_OPTIONS% 
set ICONS=%AND_ICONS% 
set DIST_EXT=apk 
set TYPE=apk 
goto start 

:start 
if not exist "%CERT_FILE%" goto certificate 
:: Output file 
set FILE_OR_DIR=%FILE_OR_DIR% -C "%ICONS%" . 
if not exist "%DIST_PATH%" md "%DIST_PATH%" 
set OUTPUT=%DIST_PATH%\%DIST_NAME%%TARGET%.%DIST_EXT% 
:: Package 

echo true 
echo. 
call adt -package -target %TYPE%%TARGET% %OPTIONS% %SIGNING_OPTIONS% "%OUTPUT%"  "%APP_XML%" %FILE_OR_DIR% -extdir lib/ 
echo. 
if errorlevel 1 goto failed 
goto end 

:certificate 
echo Certificate not found: %CERT_FILE% 
echo. 

if %PAUSE_ERRORS%==1 pause 
exit 

:failed 
echo APK setup creation FAILED. 

if %PAUSE_ERRORS%==1 pause 
exit 

:end 
+2

Hello Peyman,Stack Overflow並不是將代碼從一種語言翻譯成另一種語言的正確方式。嘗試把它自己轉換成一個shell腳本(這裏有大量的書籍/教程)。如果您遇到特定問題,請在此處發帖。 – Mat 2012-07-21 08:00:22

回答