Project

General

Profile

« Previous | Next » 

Revision 81910556

Added by jahoti almost 2 years ago

  • ID 81910556643b5878b001ed443aebf719d5bf99b9
  • Parent fbf0503f

Add build support for update URLs

The 'url' parameter can now be used to provide an update URL

View differences:

build.sh
18 18
    echo "    -C, chromium:      build for Chromium and derivatives"
19 19
    echo "    -M, mozilla:       build for Firefox and derivatives"
20 20
    echo "options:"
21
    echo "    -b, build=[LOC]:   set file/directory to use for building"
21
    echo "    -b, build=[LOC]:   file/directory to use for building"
22 22
    echo "    -h, help:          print usage information and exit"
23
    echo "    -o, output=[LOC]:  set output file/directory"
24
    echo "    -k, key=[LOC]:     select a key to use in building and"
25
    echo "                       signing a CRX"
23
    echo "    -o, output=[LOC]:  output file/directory"
24
    echo "    -k, key=[LOC]:     the key to use in signing a CRX;"
25
    echo "                       builds a CRX instead of a ZIP"
26 26
    echo "    -s, safe:          don't delete existing directories;"
27 27
    echo "                       throw an error instead"
28
    echo "    -u, url=[URL]:     URL to check for updates"
28 29
    echo "    -z, zip:           pack the extension as a file"
29 30
    echo
30 31
    echo "environment variables (optional)"
31
    echo "    HAKETILO_ZIP: command to use for generating ZIP files"
32
    echo "    HAKETILO_CHROMIUM: command to user to invoke Chromium"
32
    echo "    HAKETILO_ZIP:      command to use for generating ZIP files"
33
    echo "    HAKETILO_CHROMIUM: command to use for invoking Chromium"
33 34
    
34 35
    exit $EXIT_STATUS
35 36
}
......
38 39

  
39 40
BROWSER=''
40 41
BUILDDIR=''
42
KEY=''
43
UPDATE_URL=''
41 44
MAKEZIP=0
42 45
FORCE=1
43 46

  
......
53 56
	-o | --output)            OUTPUT="$2"; shift;;
54 57
	output=*)  OUTPUT="$(echo "$1" | cut -c 8-)";;
55 58
	-s | --safe | safe)                  FORCE=0;;
59
	-u | --url)           UPDATE_URL="$2"; shift;;
60
	url=*) UPDATE_URL="$(echo "$1" | cut -c 5-)";;
56 61
	-z | --zip | zip_ext)              MAKEZIP=1;;
57 62
	*) print_usage 2 Unrecognized option "'$1'.";;
58 63
    esac
......
67 72
    elif [ $MAKEZIP = 0 ]; then
68 73
	print_usage 4 The "'key'" option must be used in conjunction with the "'zip'" option.
69 74
    elif [ ! -e "$KEY" ]; then
70
	print_usage 5 The specified key file "'$KEY'" does not exist.
75
	errcho "The specified key file '$KEY' does not exist."
76
	exit 5
71 77
    fi
78
    
72 79
    KEY="$(realpath "$KEY")"
73 80
fi
74 81

  
lib_build.sh
185 185
    done
186 186

  
187 187
    CHROMIUM_KEY=''
188
    CHROMIUM_UPDATE_URL=''
188 189
    GECKO_APPLICATIONS=''
190
    
191
    if [ "x$UPDATE_URL" != x ]; then
192
	UPDATE_URL=",\n    \"update_url\": \"$UPDATE_URL\""
193
    fi
189 194

  
190 195
    if [ "$BROWSER" = "chromium" ]; then
191 196
	CHROMIUM_KEY="$(dd if=/dev/urandom bs=32 count=1 2>/dev/null | base64)"
192 197
	CHROMIUM_KEY=$(echo chromium-key-dummy-file-$CHROMIUM_KEY | tr / -)
193 198
	touch $BUILDDIR/$CHROMIUM_KEY
194 199

  
200
	CHROMIUM_UPDATE_URL="$UPDATE_URL"
201

  
195 202
	CHROMIUM_KEY="\n\
196 203
	// WARNING!!!\n\
197 204
	// EACH USER SHOULD REPLACE DUMMY FILE's VALUE WITH A UNIQUE ONE!!!\n\
......
205 212
    \"applications\": {\n\
206 213
	\"gecko\": {\n\
207 214
	    \"id\": \"{6fe13369-88e9-440f-b837-5012fb3bedec}\",\n\
208
	    \"strict_min_version\": \"60.0\"\n\
215
	    \"strict_min_version\": \"60.0\"$UPDATE_URL\n\
209 216
	}\n\
210 217
    },"
211 218
    fi
......
213 220
    sed "\
214 221
s^_GECKO_APPLICATIONS_^$GECKO_APPLICATIONS^
215 222
s^_CHROMIUM_KEY_^$CHROMIUM_KEY^
223
s^_CHROMIUM_UPDATE_URL_^$CHROMIUM_UPDATE_URL^
216 224
s^_BGSCRIPTS_^$BGSCRIPTS^
217 225
s^_CONTENTSCRIPTS_^$CONTENTSCRIPTS^" \
218 226
	< manifest.json > $BUILDDIR/manifest.json
manifest.json
43 43
    "options_ui": {
44 44
	"page": "html/options.html",
45 45
	"open_in_tab": true
46
    },
46
    }_CHROMIUM_UPDATE_URL_,
47 47
    "web_accessible_resources": [_CHROMIUM_KEY_
48 48
    ],
49 49
    "background": {

Also available in: Unified diff