split platform
This commit is contained in:
parent
e21158443e
commit
ca62bd051f
3 changed files with 43 additions and 27 deletions
54
ctl
54
ctl
|
@ -33,15 +33,25 @@ if [ ! -e "$PID" ]; then
|
|||
PID="$DATA/$NAME.pid"
|
||||
fi
|
||||
|
||||
PLATFORM_PYTHON=3.4
|
||||
SHARED_PYTHON=3.4
|
||||
if [ -e "$BASE/local_platform" ]; then
|
||||
export PLATFORM_ENV="$BASE/local_platform"
|
||||
else
|
||||
if [ $SYSTEM == "Linux" ]; then
|
||||
export PLATFORM_ENV="$BASE/platform/${SYSTEM}_${PLATFORM}"
|
||||
if [ $PLATFORM == "x86_64" ]; then
|
||||
ARCH=64
|
||||
else
|
||||
export PLATFORM_ENV="$BASE/platform/$SYSTEM"
|
||||
ARCH=32
|
||||
fi
|
||||
PLATFORM="linux$ARCH"
|
||||
fi
|
||||
if [ $SYSTEM == "Darwin" ]; then
|
||||
PLATFORM="darwin64"
|
||||
PLATFORM_PY=3.5
|
||||
fi
|
||||
fi
|
||||
export PLATFORM_ENV="$BASE/platform_${PLATFORM}"
|
||||
PATH="$PLATFORM_ENV/bin:$PATH"
|
||||
|
||||
SHARED_ENV="$BASE/platform/Shared"
|
||||
|
@ -56,7 +66,9 @@ if [ $SYSTEM == "Darwin" ]; then
|
|||
export SSL_CERT_DIR="$SHARED_ENV/etc/openssl/certs"
|
||||
fi
|
||||
|
||||
PYTHONPATH="$PLATFORM_ENV/lib/python3.4/site-packages:$SHARED_ENV/lib/python3.4/site-packages:$BASE/$NAME"
|
||||
PYTHONPATH="${PLATFORM_ENV}/lib/python${PLATFORM_PYTHON}/site-packages"
|
||||
PYTHONPATH="${PYTHONPATH}:${SHARED_ENV}/lib/python${SHARED_PYTHON}/site-packages"
|
||||
PYTHONPATH="${PYTHONPATH}:${BASE}/${NAME}"
|
||||
export PYTHONPATH
|
||||
|
||||
oxCACHE="$DATA/ox"
|
||||
|
@ -68,25 +80,7 @@ hash -r 2>/dev/null
|
|||
# allow more open files
|
||||
ulimit -S -n 2048
|
||||
|
||||
function remove_autostart {
|
||||
if [ $SYSTEM == "Darwin" ]; then
|
||||
launchd_name="com.openmedialibrary.loginscript"
|
||||
launchd_plist="$HOME/Library/LaunchAgents/${launchd_name}.plist"
|
||||
if [ -e "$launchd_plist" ]; then
|
||||
launchctl stop "$launchd_name"
|
||||
launchctl unload "$launchd_plist"
|
||||
rm "$launchd_plist"
|
||||
fi
|
||||
fi
|
||||
if [ $SYSTEM == "Linux" ]; then
|
||||
if [ -e "$HOME/.config/autostart/openmedialibrary.desktop" ]; then
|
||||
rm "$HOME/.config/autostart/openmedialibrary.desktop"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "$1" == "start" ]; then
|
||||
remove_autostart
|
||||
cd "$BASE/$NAME"
|
||||
if [ -e "$PID" ]; then
|
||||
if ps -p `cat "$PID"` > /dev/null; then
|
||||
|
@ -110,7 +104,6 @@ if [ "$1" == "debug" ]; then
|
|||
exit $?
|
||||
fi
|
||||
if [ "$1" == "stop" ]; then
|
||||
remove_autostart
|
||||
if [ -e "$PID" ]; then
|
||||
_PID=`cat "$PID"`
|
||||
kill $_PID
|
||||
|
@ -147,7 +140,7 @@ if [ "$1" == "open" ]; then
|
|||
if ps -p `cat "$PID"` > /dev/null; then
|
||||
xdg-open "file://${BASE}/openmedialibrary/static/html/load.html"
|
||||
else
|
||||
python3 "$NAME/oml/gtkstatus.py" $@
|
||||
python3 "${NAME}/oml/gtkstatus.py" $@
|
||||
exit $?
|
||||
fi
|
||||
else
|
||||
|
@ -162,11 +155,26 @@ if [ "$1" == "ui" ]; then
|
|||
python3 "$NAME/oml/ui.py" $@
|
||||
exit $?
|
||||
fi
|
||||
if [ "$1" == "init" ]; then
|
||||
if [ ! -e "${BASE}/platform" ]; then
|
||||
git clone https://git.0x2620.org/openmedialibrary_platform.git "${BASE}/platform"
|
||||
fi
|
||||
if [ ! -e "${PLATFORM_ENV}" ]; then
|
||||
git clone https://git.0x2620.org/openmedialibrary_platform_${PLATFORM}.git "${PLATFORM_ENV}"
|
||||
fi
|
||||
exit
|
||||
fi
|
||||
if [ "$1" == "update" ]; then
|
||||
cd "$BASE/$NAME"
|
||||
if [ -d "$BASE/$NAME/.git" ]; then
|
||||
OLD=`"$0" version`
|
||||
cd "$BASE/platform"
|
||||
echo Update shared platform...
|
||||
git pull
|
||||
if [ ! -e "${PLATFORM_ENV}" ]; then
|
||||
git clone https://git.0x2620.org/openmedialibrary_platform_${PLATFORM}.git "${PLATFORM_ENV}"
|
||||
fi
|
||||
cd "${PLATFORM_ENV}"
|
||||
echo Update platform...
|
||||
git pull
|
||||
echo Update $NAME...
|
||||
|
|
|
@ -209,6 +209,12 @@ def command_release(*args):
|
|||
return h.hexdigest()
|
||||
|
||||
MODULES = ['platform', 'openmedialibrary', 'oxjs', 'reader']
|
||||
PLATFORM_MODULES = {
|
||||
'platform_linux32': 'linux32',
|
||||
'platform_linux64': 'linux64',
|
||||
'platform_darwin64': 'darwin64',
|
||||
}
|
||||
MODULES += list(PLATFORM_MODULES)
|
||||
VERSIONS = {module:version(module) for module in MODULES}
|
||||
|
||||
EXCLUDE=[
|
||||
|
@ -236,6 +242,8 @@ def command_release(*args):
|
|||
'version': VERSIONS[module],
|
||||
'sha1': sha1sum(join('updates', '%s-%s.tar.bz2' % (module, VERSIONS[module])))
|
||||
} for module in MODULES}
|
||||
for module in PLATFORM_MODULES:
|
||||
release['modules'][module]['platform'] = PLATFORM_MODULES[module]
|
||||
if sign(release):
|
||||
with open('updates/%s.json' % release_name, 'w') as fd:
|
||||
json.dump(release, fd, indent=2, sort_keys=True)
|
||||
|
|
|
@ -234,7 +234,7 @@ def get_app_version(app):
|
|||
def upgrade_app():
|
||||
if sys.platform == 'darwin':
|
||||
base = os.path.dirname(settings.base_dir)
|
||||
bundled_app = os.path.join(base, 'platform/Darwin/Applications/Open Media Library.app')
|
||||
bundled_app = os.path.join(base, 'platform_darwin64/Applications/Open Media Library.app')
|
||||
app = '/Applications/Open Media Library.app'
|
||||
version = get_app_version(app)
|
||||
current_version = get_app_version(bundled_app)
|
||||
|
|
Loading…
Reference in a new issue