-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathconfig.sh
More file actions
executable file
·85 lines (74 loc) · 3.22 KB
/
config.sh
File metadata and controls
executable file
·85 lines (74 loc) · 3.22 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/sh
PhpVirtualBoxUrl=https://github.com/phpvirtualbox/phpvirtualbox/archive/develop.zip
PhpVirtualBoxGitRepoUrl=https://github.com/phpvirtualbox/phpvirtualbox.git
PhpVirtualBoxVersion=6.1
PhpVirtualBoxVersionCommitHash=0000000
# If files don't exist they need to be downloaded
PhpVirtualBoxFile=phpVirtualBox.zip
PackageRoot=./package/www
Destination=${PackageRoot}/phpvirtualbox4dsm
DSM_PLAT=bromolow
[ -f ./build.config ] && . ./build.config
WGET=$(which wget)
UNZIP=$(which unzip)
if [ "$WGET" == "" ]; then
WGET=./wget
fi
if [ "$UNZIP" == "" ]; then
UNZIP="./unzip"
fi
function download_phpvbox()
{
if [ ! -f ./${PhpVirtualBoxFile} ]; then
echo "Downloading ${PhpVirtualBoxFile}"
$WGET ${PhpVirtualBoxUrl} -O ${PhpVirtualBoxFile}
rm -rf ${Destination}
PhpVirtualBoxVersionCommitHash=$(git ls-remote ${PhpVirtualBoxGitRepoUrl} HEAD | awk '{ print substr($1,1,7) }')
fi
}
function generate_config()
{
if [ ! -d ${Destination} ]; then
${UNZIP} ${PhpVirtualBoxFile} -d ${PackageRoot}/
VB=$(ls -d ${PackageRoot}/phpvirtualbox-*)
mv ${VB} ${Destination}
echo "Generating config.php.synology"
cp ${Destination}/config.php-example ${PackageRoot}/config.php.synology
sed -i -e "s|^var \$username = 'vbox';|var \$username = '@user@';|g" ${PackageRoot}/config.php.synology
sed -i -e "s|^var \$password = 'pass';|var \$password = '@pass@';|g" ${PackageRoot}/config.php.synology
sed -i -e "s|^var \$location = 'http://127\.0\.0\.1:18083/';|var \$location = '@location@';|g" ${PackageRoot}/config.php.synology
sed -i -e "s|^#var \$noAuth = true;|var \$noAuth = @noAuth@;|g" ${PackageRoot}/config.php.synology
sed -i -e "s|^#var \$enableCustomIcons = true;|var \$enableCustomIcons = @enableCustomIcons@;|g" ${PackageRoot}/config.php.synology
sed -i -e "s|^#var \$enableAdvancedConfig = true;|var \$enableAdvancedConfig = @enableAdvancedConfig@;|g" ${PackageRoot}/config.php.synology
sed -i -e "s|^#var \$startStopConfig = true;|var \$startStopConfig = @startStopConfig@;|g" ${PackageRoot}/config.php.synology
sed -i -e "s|^#var \$enableGuestAdditionsVersionDisplay = true;|var \$enableGuestAdditionsVersionDisplay = true;|g" ${PackageRoot}/config.php.synology
sed -i "/#var \$browserRestrictFolders/a var \$browserRestrictFolders = array('/volume1');" ${PackageRoot}/config.php.synology
# fix for not working file browser
#echo "Patching jqueryFileTree.php"
#sed -i -e "s|^header('Content-type', 'application/json');|header('Content-type: application/json');|g" ${Destination}/endpoints/jqueryFileTree.php
fi
echo "Generating build.config"
echo "PhpVirtualBoxFile=${PhpVirtualBoxFile}" > build.config
echo "PhpVirtualBoxVersionCommitHash=${PhpVirtualBoxVersionCommitHash}" >> build.config
}
function update_info
{
echo "Update version in INFO.sh"
sed -i -e "s|^version=.*|version=\"${PhpVirtualBoxVersion}-${PhpVirtualBoxVersionCommitHash}\"|g" INFO.sh
}
case $1 in
prep)
download_phpvbox
generate_config
update_info
echo "Ready to exec:"
echo " 'sudo ../../pkgscripts-ng/PkgCreate.py --print-log -c -I -S -p ${DSM_PLAT} -v 6.2 -x0 -c phpvirtualbox4dsm'" ;;
clean)
rm $PhpVirtualBoxFile
rm -rf $Destination
rm build.config
;;
*)
echo "Usage: ./config.sh prep|clean";
;;
esac