6 SCRIPT_DIR=`dirname $THIS_SCRIPT`
7 SCRIPT_DIR=`absolute_path $SCRIPT_DIR`
8 TEMP_DIR=/tmp/xwalk_build
9 while [ "$1" != "" ]; do
11 PARAM=`echo ${DASHED_PARAM}|sed 's/--//'`
12 if [ "$PARAM" = "$DASHED_PARAM" ]; then
15 if ! echo $PARAM |grep = ; then
16 PARAM=`echo $PARAM |sed 's/^\(.*\)/\U\1/'`
19 PARAM=`echo $PARAM |sed 's/^\(.*=\)/\U\1/'`
26 if [ "x$HELP" != "x" ]; then
28 echo usage: $THIS_SCRIPT [options] [app_path]
30 echo This script is used to create a standalone installer for Crosswalk applications. It
31 echo depends on checkinstall and Crosswalk to function properly.
32 echo The following options are supported:
34 app_path Path to the Crosswalk application. If not specified, the
35 current directory is used.
36 --xwalk_path=<path> Path to Crosswalk binaries. If not specified, the script
37 will try to find them through PATH, the app path, or
38 the current directory.
39 --app_name=<name> Name of the application. If not specified, the name
40 of the application directory is used.
41 --version=<version> The version of the application, defaults to 1.0.0
42 --app_index=<path> Path of app index file, relative to app_path. If not
43 specified, index.html is used.
44 --app_arguments=<path> Arugments to be passed into Crosswalk executable
45 Example: --app_arguments=--allow-file-access-from-files
46 --out=<path> Path of the output package file, defaults to
48 --publisher=<name> The manufacturer of this application, defaults to "Me"
49 --shadow_install=<yes|no> Enable/disable installing app to a temporary directory
50 for testing purposed. Defaults to yes
51 --help Print this message "
55 if [ "x`which checkinstall`" = "x" ]; then
57 echo "checkinstall is required to create an application package. You can install it by:
58 sudo apt-get install checkinstall"
61 if [ "x$APP_PATH" = "x" ]; then
64 if [ "x$APP_INDEX" = "x" ]; then
67 if [ "x$VERSION" = "x" ]; then
70 if [ "x$XWALK_PATH" = "x" ]; then
71 XWALK_PATH=`which xwalk`
72 if [ "x$XWALK_PATH" != "x" ]; then
73 XWALK_PATH=`dirname $XWALK_PATH`
75 if [ "x$XWALK_PATH" = "x" ]; then
77 if ! test -f "$XWALK_PATH/xwalk"; then
79 if ! test -f "$XWALK_PATH/xwalk"; then
80 echo Please make sure you have installed xwalk and setup the PATH enviroment variable
81 echo on your system properly. Or you can specify the Crosswalk path through --xwalk_path
82 echo command line parameter.
88 if [ "x$APP_NAME" = "x" ]; then
89 APP_NAME=`basename $APP_PATH`
91 if [ "x$PUBLISHER" = "x" ]; then
95 if [ "x$OUT" != "x" ]; then
96 OUT_OPT="--pakdir=$OUT"
99 if [ "x$SHADOW_INSTALL" = "x" ]; then
103 XWALK_PATH=`absolute_path $XWALK_PATH`
104 APP_PATH=`absolute_path $APP_PATH`
105 BUILD_DIR=$TEMP_DIR/`basename $APP_PATH`
106 #export some variables so that Makefile can use them
107 export INSTALL_DIR=/opt/${PUBLISHER}/${APP_NAME}
109 #Prepare for the build dir
111 cp -r $APP_PATH $TEMP_DIR
112 if ! test -f $APP_PATH/Makefile; then
113 cp $SCRIPT_DIR/Makefile.templ $BUILD_DIR/Makefile
115 if ! ls *.desktop > /dev/null 2>&1; then
116 while read line; do eval echo $line; done < $SCRIPT_DIR/app.desktop.templ > $BUILD_DIR/$APP_NAME.desktop
118 cd $XWALK_PATH && cp xwalk xwalk.pak libffmpegsumo.so $BUILD_DIR
121 cd $BUILD_DIR && checkinstall --pkgname=$APP_NAME --pkgversion=$VERSION \
122 --backup=no --install=no --exclude=Makefile --fstrans=$SHADOW_INSTALL $OUT_OPT
123 if [ $? != 0 -a -f $APP_PATH/Makefile ]; then
124 echo "Warning: Packaging failed. Maybe there are some unsupported operations in your app's Makefile? Please try re-run the script with --shadow_install=no using sudo"