-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
phnz
committed
Sep 25, 2015
0 parents
commit 5c4718e
Showing
67 changed files
with
3,339 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDisplayName</key> | ||
<string>VPN.ht (Development)</string> | ||
<key>CFBundleExecutable</key> | ||
<string>Atom</string> | ||
<key>CFBundleIconFile</key> | ||
<string>atom.icns</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>ht.vpn.development</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>VPN.ht (Development)</string> | ||
<key>CFBundlePackageType</key> | ||
<string>APPL</string> | ||
<key>CFBundleVersion</key> | ||
<string>0.0</string> | ||
<key>LSMinimumSystemVersion</key> | ||
<string>10.8.0</string> | ||
<key>NSMainNibFile</key> | ||
<string>MainMenu</string> | ||
<key>NSPrincipalClass</key> | ||
<string>AtomApplication</string> | ||
<key>NSSupportsAutomaticGraphicsSwitching</key> | ||
<true/> | ||
<key>CFBundleURLTypes</key> | ||
<array> | ||
<dict> | ||
<key>CFBundleURLSchemes</key> | ||
<array> | ||
<string>vpnht</string> | ||
</array> | ||
<key>CFBundleURLName</key> | ||
<string>OpenVPN App Protocol</string> | ||
</dict> | ||
</array> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# KEEP PRIVATE ! | ||
|
||
All utilities used to build the final desktop APP | ||
|
||
### includes | ||
|
||
* PKG Builder for Mac OSX | ||
* NSIS Scripts and all required plugins for building the installer |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
#!/bin/bash | ||
CURRENTDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) | ||
ROOTDIR="${CURRENTDIR}/../../" | ||
BUILD_DIR="${ROOTDIR}/dist/VPN.ht-darwin-x64/" | ||
BASE_DIR="${ROOTDIR}/dist" | ||
PKG_DIR="${ROOTDIR}/util/mac/pkg" | ||
VERSION="0.0.1" | ||
IDENTIFIER="ht.vpn.desktop" | ||
APPNAME="VPN.ht" | ||
|
||
rm -rf "$BASE_DIR/darwin" | ||
mkdir -p "$BASE_DIR/darwin/flat/Resources/en.lproj" | ||
mkdir -p "$BASE_DIR/darwin/flat/base.pkg" | ||
mkdir -p "$BASE_DIR/darwin/scripts" | ||
mkdir -p "$BASE_DIR/darwin/root/Applications" | ||
cp -R $BUILD_DIR/VPN.ht.app $BASE_DIR/darwin/root/Applications | ||
cp -R $PKG_DIR/* $BASE_DIR/darwin/scripts | ||
NUM_FILES=$(find ${BASE_DIR}/darwin/root | wc -l) | ||
INSTALL_KB_SIZE=$(du -k -s ${BASE_DIR}/darwin/root | awk '{print $1}') | ||
|
||
cat <<EOF > ${BASE_DIR}/darwin/flat/base.pkg/PackageInfo | ||
<?xml version="1.0" encoding="utf-8" standalone="no"?> | ||
<pkg-info overwrite-permissions="true" relocatable="false" identifier="${IDENTIFIER}" postinstall-action="none" version="${VERSION}" format-version="2" generator-version="InstallCmds-502 (14C109)" auth="root" preserve-xattr="true"> | ||
<payload numberOfFiles="${NUM_FILES}" installKBytes="${INSTALL_KB_SIZE}"/> | ||
<bundle path="./VPN.ht.app" id="${IDENTIFIER}" CFBundleShortVersionString="${VERSION}" CFBundleVersion="0"/> | ||
<bundle-version> | ||
<bundle id="${IDENTIFIER}"/> | ||
</bundle-version> | ||
<upgrade-bundle> | ||
<bundle id="${IDENTIFIER}"/> | ||
</upgrade-bundle> | ||
<update-bundle/> | ||
<atomic-update-bundle/> | ||
<strict-identifier> | ||
<bundle id="${IDENTIFIER}"/> | ||
</strict-identifier> | ||
<relocate> | ||
<bundle id="${IDENTIFIER}"/> | ||
</relocate> | ||
<scripts> | ||
<preinstall file="./preinstall"/> | ||
<postinstall file="./postinstall"/> | ||
</scripts> | ||
</pkg-info> | ||
EOF | ||
|
||
cat <<EOF > ${BASE_DIR}/darwin/flat/Distribution | ||
<?xml version="1.0" encoding="utf-8" standalone="no"?> | ||
<installer-gui-script minSpecVersion="2"> | ||
<pkg-ref id="${IDENTIFIER}"> | ||
<bundle-version> | ||
<bundle CFBundleShortVersionString="${VERSION}" CFBundleVersion="0" id="${IDENTIFIER}" path="VPN.ht.app"/> | ||
</bundle-version> | ||
<must-close> | ||
<app id="${IDENTIFIER}"/> | ||
</must-close> | ||
</pkg-ref> | ||
<product id="${IDENTIFIER}" version="${VERSION}"/> | ||
<title>VPN.ht</title> | ||
<options customize="never" require-scripts="false" hostArchitectures="i386"/> | ||
<volume-check> | ||
<allowed-os-versions> | ||
<os-version min="10.7"/> | ||
</allowed-os-versions> | ||
</volume-check> | ||
<choices-outline> | ||
<line choice="default"> | ||
<line choice="${IDENTIFIER}"/> | ||
</line> | ||
</choices-outline> | ||
<choice id="default" title="VPN.ht" versStr="${VERSION}"/> | ||
<choice id="${IDENTIFIER}" title="VPN.ht" visible="false"> | ||
<pkg-ref id="${IDENTIFIER}.base.pkg"/> | ||
</choice> | ||
<pkg-ref id="${IDENTIFIER}.base.pkg" version="${VERSION}" onConclusion="none" installKBytes="${INSTALL_KB_SIZE}">#base.pkg</pkg-ref> | ||
</installer-gui-script> | ||
EOF | ||
|
||
PKG_LOCATION="${ROOTDIR}/dist/${APPNAME}-${VERSION}.pkg" | ||
|
||
( cd ${BASE_DIR}/darwin/root && find . | cpio -o --format odc --owner 0:80 | gzip -c ) > ${BASE_DIR}/darwin/flat/base.pkg/Payload | ||
( cd ${BASE_DIR}/darwin/scripts && find . | cpio -o --format odc --owner 0:80 | gzip -c ) > ${BASE_DIR}/darwin/flat/base.pkg/Scripts | ||
mkbom ${BASE_DIR}/darwin/root ${BASE_DIR}/darwin/flat/base.pkg/Bom | ||
( cd ${BASE_DIR}/darwin/flat/ && xar --compression none -cf "${PKG_LOCATION}" * ) | ||
echo "osx package has been built: ${PKG_LOCATION}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
#!/bin/sh | ||
#touch ~/from-pkg-installer | ||
|
||
LOGFILE=~/Library/Logs/VPN.ht/installer.log | ||
PATH_DIR_VPNHT_APP='/Applications/VPN.ht.app' | ||
|
||
source ./shared/common | ||
|
||
#################################################################### | ||
# Log function adapters specific to this script: | ||
#################################################################### | ||
|
||
function log_text | ||
{ | ||
log_text_base "$1" "$LOGFILE" | ||
} | ||
|
||
function log_command | ||
{ | ||
command_output=$($1) | ||
log_command_base "$command_output" "$LOGFILE" | ||
} | ||
|
||
function permissions_set_vpnclients | ||
{ | ||
log_text "Setting permissions on VpnClient binaries..." | ||
current_directory_print | ||
|
||
DIR_VPN_CLIENTS='/Applications/VPN.ht.app/Contents/Resources/bin' | ||
|
||
if [ ! -d "$DIR_VPN_CLIENTS" ]; then | ||
log_text "Directory \"$DIR_VPN_CLIENTS\" does not exist" | ||
exit 1 | ||
fi | ||
|
||
cd "$DIR_VPN_CLIENTS" | ||
log_text "Current directory: " | ||
log_command "pwd" | ||
|
||
log_text "ls -la before changing permissions: " | ||
log_command "ls -la" | ||
bin_path=. | ||
|
||
openvpn_module_name="openvpn" | ||
|
||
full_openvpn_module_path="$bin_path/$openvpn_module_name" | ||
|
||
log_text "openvpn path is \"$full_openvpn_module_path\"" | ||
|
||
if [ -f "$full_openvpn_module_path" ]; then | ||
log_text "openvpn details: " | ||
log_command "ls -la $full_openvpn_module_path" | ||
log_text "Setting root:admin as openvpn owner..." | ||
sudo chown root:admin "$full_openvpn_module_path" | ||
log_text "Setting execute permissions for openvpn..." | ||
sudo chmod a+x "$full_openvpn_module_path" | ||
log_text "Setting setuid on openvpn..." | ||
sudo chmod u+s "$full_openvpn_module_path" | ||
log_text "openvpn details: " | ||
log_command "ls -la $full_openvpn_module_path" | ||
else | ||
log_text "WARNING: File not found: \"$full_openvpn_module_path\"" | ||
return 1 | ||
fi | ||
|
||
} | ||
|
||
function permissions_set_applications | ||
{ | ||
|
||
log_text "Setting permissions on helper application binaries..." | ||
current_directory_print | ||
|
||
DIR_APPLICATIONS='/Applications/VPN.ht.app/Contents/Frameworks/' | ||
|
||
if [ ! -d "$DIR_APPLICATIONS" ]; then | ||
log_text "Directory \"$DIR_APPLICATIONS\" does not exist" | ||
exit 1 | ||
fi | ||
|
||
cd "$DIR_APPLICATIONS" | ||
log_text "Current directory: " | ||
log_command "pwd" | ||
|
||
log_text "ls -la before changing permissions: " | ||
log_command "ls -la" | ||
bin_path=. | ||
|
||
VPNHTHELPER_NAME="VPN.ht Helper.app" | ||
|
||
PATH_VPNHTHELPER="$bin_path/$VPNHTHELPER_NAME" | ||
|
||
if [ -d "$PATH_VPNHTHELPER" ]; then | ||
VPNHTHELPER_NAME="VPN.ht\ Helper.app" | ||
PATH_VPNHTHELPER="$bin_path/$VPNHTHELPER_NAME" | ||
log_text "VPN.ht Helper.APP details: " | ||
log_command "ls -la $PATH_VPNHTHELPER" | ||
log_text "Setting root:admin as VPNHTHelper.APP owner..." | ||
sudo chown -R root:admin "$PATH_VPNHTHELPER" | ||
log_text "Setting execute permissions for VPNHTHelper.APP..." | ||
sudo chmod -R a+x "$PATH_VPNHTHELPER" | ||
log_text "Setting setuid on VPNHTHelper.APP..." | ||
sudo chmod -R u+s "$PATH_VPNHTHELPER" | ||
log_text "VPNHTHelper.APP details: " | ||
log_command "ls -la $PATH_VPNHTHELPER" | ||
else | ||
log_text "WARNING: Directory not found: \"$PATH_VPNHTHELPER\"" | ||
exit 2 | ||
fi | ||
} | ||
|
||
function permissions_set_scripts | ||
{ | ||
log_text "Setting permissions on up/down script..." | ||
current_directory_print | ||
|
||
SCRIPTS_PATH='/Applications/VPN.ht.app/Contents/Resources/bin/' | ||
|
||
if [ ! -d "$SCRIPTS_PATH" ]; then | ||
log_text "Directory \"$SCRIPTS_PATH\" does not exist" | ||
exit 1 | ||
fi | ||
|
||
cd "$SCRIPTS_PATH" | ||
|
||
log_text "Current directory: " | ||
log_command "pwd" | ||
|
||
log_text "ls -la before changing permissions: " | ||
log_command "ls -la script.*" | ||
|
||
SCRIPTS_NAME="script.*" | ||
|
||
log_text "\"$SCRIPTS_NAME\" details: " | ||
log_command "ls -la $SCRIPTS_NAME" | ||
|
||
log_text "Setting root:admin as owner..." | ||
sudo chown -R root:admin $SCRIPTS_NAME | ||
|
||
log_text "Setting execute permissions..." | ||
sudo chmod -R a+x $SCRIPTS_NAME | ||
|
||
log_text "Setting setuid on up down scripts..." | ||
sudo chmod -R u+s $SCRIPTS_NAME | ||
|
||
log_text "\"$SCRIPTS_NAME\" details: " | ||
log_command "ls -la $SCRIPTS_NAME" | ||
|
||
} | ||
|
||
#################################################################### | ||
# Main script body: | ||
#################################################################### | ||
|
||
log_text "===================" | ||
log_text "=== postinstall ===" | ||
log_text "===================" | ||
|
||
log_text "Setting wheel group on VPN.ht whole application..." | ||
sudo chown -R root:wheel "$PATH_DIR_VPNHT_APP" | ||
|
||
permissions_set_vpnclients | ||
permissions_set_applications | ||
permissions_set_scripts | ||
|
||
log_text "Installation completed successfully..." | ||
|
||
exit 0 |
Oops, something went wrong.