File: make_portable_archive.sh

package info (click to toggle)
spring 88.0%2Bdfsg1-1.1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 41,524 kB
  • sloc: cpp: 343,114; ansic: 38,414; python: 12,257; java: 12,203; awk: 5,748; sh: 1,204; xml: 997; perl: 405; objc: 192; makefile: 181; php: 134; sed: 2
file content (53 lines) | stat: -rwxr-xr-x 1,282 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash

if [ $# != 1 ]; then
	echo "Usage: $0 <spring_VERSION.exe>"
	exit
fi

# check req.
`which wine &> /dev/null` || (echo "Error: You need Wine installed!"; exit)
`which 7z &> /dev/null` || (echo "Error: You need 7z installed!"; exit)

# prepare
INSTALLER=$1
VERSION=`basename ${INSTALLER} .exe`
VERSION=${VERSION:7}
echo ${VERSION} detected
TEMPDIR=`mktemp -d`

# create a tempdir
PATHNAME=spring-${VERSION}
INSTPATH=${TEMPDIR}/${PATHNAME}
mkdir -p "${INSTPATH}"

# detect wine `windows` peth of the tempdir
WINEINSTPATH=`winepath -w "${INSTPATH}"`
if [ "${WINEINSTPATH:0:4}" = "\\\\?\\" ]; then
	echo "Error: Couldn't translate tempdir path"
	echo we live secure, do this yourself:
	echo rm -f ${TEMPDIR}
	exit
fi

# make the path passable via linux bash \ -> \\
WINEINSTPATH="${WINEINSTPATH//\\/\\\\}"

# install in tempdir via wine
INSTCOMMAND="wine ${INSTALLER} /S /PORTABLE /NOREGISTRY /NODESKTOPLINK /NOSTARTMENU /D=$WINEINSTPATH"
echo $INSTCOMMAND

if ! sh -c "$INSTCOMMAND" ; then
	echo "Error: Installation failed"
	echo we live secure, do this yourself:
	echo rm -f ${TEMPDIR}
	exit
fi

# compress
7z a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on spring_${VERSION}_portable.7z ${INSTPATH}

# finished
echo we live secure, do this yourself:
echo rm -f ${TEMPDIR}