mirror of
https://gitee.com/gfdgd-xi/deep-wine-runner
synced 2025-01-12 17:48:27 +08:00
添加helper脚本
This commit is contained in:
parent
05549090fe
commit
88bec61044
15
helper/README.txt
Normal file
15
helper/README.txt
Normal file
@ -0,0 +1,15 @@
|
||||
#autostart
|
||||
|
||||
#autostart在系统启动时自启动,根据配置“autostart”文件策略预启动容器,不需要用户手动启动
|
||||
|
||||
1.默认不会预启动任何容器
|
||||
|
||||
2.如果需要启动所有已运行过的容器,请将文件"autostart" 改名 "autostart.all" 示例如下:
|
||||
sudo mv /opt/deepinwine/tools/autostart /opt/deepinwine/tools/autostart.all
|
||||
|
||||
3.如果需要启动用户自己关注的应用,那么将容器名称按行写入"autostart",格式如下:
|
||||
com.qq.weixin.work.deepin
|
||||
com.qq.im.deepin
|
||||
com.meituxiuxiu.deepin
|
||||
|
||||
4.兼容原来的kill.sh逻辑
|
74
helper/SetDpi.sh
Executable file
74
helper/SetDpi.sh
Executable file
@ -0,0 +1,74 @@
|
||||
#!/bin/bash
|
||||
|
||||
BASE_DIR="$HOME/.deepinwine/Deepin-QQ"
|
||||
WINE_CMD="deepin-wine"
|
||||
PUBLIC_DIR="/var/public"
|
||||
|
||||
SHELL_DIR="/opt/deepinwine/tools"
|
||||
|
||||
if [ $SPECIFY_SHELL_DIR ]; then
|
||||
SHELL_DIR=$SPECIFY_SHELL_DIR
|
||||
fi
|
||||
|
||||
_SetRegistryValue()
|
||||
{
|
||||
env WINEPREFIX="$BASE_DIR" $WINE_CMD reg ADD "$1" /v "$2" /t $3 /d "$4" /f
|
||||
}
|
||||
|
||||
_SetOverride()
|
||||
{
|
||||
_SetRegistryValue 'HKCU\Software\Wine\DllOverrides' "$2" REG_SZ "$1"
|
||||
}
|
||||
|
||||
UsePublicDir()
|
||||
{
|
||||
if [ -z "$USE_PUBLIC_DIR" ]; then
|
||||
echo "Don't use public dir"
|
||||
return 1
|
||||
fi
|
||||
if [ ! -d "$PUBLIC_DIR" ];then
|
||||
echo "Not found $PUBLIC_DIR"
|
||||
return 1
|
||||
fi
|
||||
if [ ! -r "$PUBLIC_DIR" ];then
|
||||
echo "Can't read for $PUBLIC_DIR"
|
||||
return 1
|
||||
fi
|
||||
if [ ! -w "$PUBLIC_DIR" ];then
|
||||
echo "Can't write for $PUBLIC_DIR"
|
||||
return 1
|
||||
fi
|
||||
if [ ! -x "$PUBLIC_DIR" ];then
|
||||
echo "Can't excute for $PUBLIC_DIR"
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
if [ -z "$1" ] || [ -z "$2" ]; then
|
||||
echo "Please input two args, first is dpi, second is bottle name"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if (("$1" < 96)) || (($1 > 400)) ; then
|
||||
echo "Invaild dpi vaule, min 96 max 400"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
BASE_DIR="$HOME/.deepinwine/$2"
|
||||
|
||||
if UsePublicDir; then
|
||||
BASE_DIR="$PUBLIC_DIR/$2"
|
||||
fi
|
||||
|
||||
if [ ! -d "$BASE_DIR" ]; then
|
||||
echo "Invaild bottle name, $2 is not exist"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
$SHELL_DIR/kill.sh $2
|
||||
|
||||
_SetRegistryValue 'HKCU\Control Panel\Desktop' LogPixels REG_DWORD $1
|
||||
|
||||
exit 0
|
59
helper/add_hotkeys
Executable file
59
helper/add_hotkeys
Executable file
@ -0,0 +1,59 @@
|
||||
#!/usr/bin/env python3
|
||||
# vim: set ts=4 sw=4 fileencoding=utf-8:
|
||||
# Luomio <nohappiness@gmail.com>
|
||||
# Filename: dde-first-run.py
|
||||
# Create Date: 27-03, 13
|
||||
|
||||
from os import path, rename, remove
|
||||
import locale
|
||||
import subprocess
|
||||
import os
|
||||
import shutil
|
||||
import json
|
||||
import math
|
||||
import dbus
|
||||
|
||||
_action = "/opt/deepinwine/tools/sendkeys.sh"
|
||||
|
||||
def system_screenshot_isA():
|
||||
bus = dbus.SessionBus()
|
||||
keybinding = bus.get_object("com.deepin.daemon.Keybinding", "/com/deepin/daemon/Keybinding")
|
||||
keybinding_iface = dbus.Interface(keybinding, dbus_interface='com.deepin.daemon.Keybinding')
|
||||
|
||||
obj = json.loads(keybinding_iface.List())
|
||||
for i in range(len(obj)):
|
||||
if obj[i]['Id'] == "screenshot":
|
||||
if '<Control><Alt>A' in obj[i]['Accels']:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
def add_qq_shortcut(_name, _key, _short_cut):
|
||||
if path.exists(_action):
|
||||
bus = dbus.SessionBus()
|
||||
keybinding = bus.get_object("com.deepin.daemon.Keybinding", "/com/deepin/daemon/Keybinding")
|
||||
keybinding_iface = dbus.Interface(keybinding, dbus_interface='com.deepin.daemon.Keybinding')
|
||||
|
||||
obj = json.loads(keybinding_iface.List())
|
||||
for i in range(len(obj)):
|
||||
if obj[i]['Name'] == _name:
|
||||
keybinding_iface.Delete(obj[i]['Id'], obj[i]['Type'])
|
||||
|
||||
_, ok = keybinding_iface.Add(_name, _action+_key, _short_cut)
|
||||
if ok == False:
|
||||
return False
|
||||
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
_action = os.path.realpath(os.path.dirname(sys.argv[0]))
|
||||
_action = os.path.join(_action, "sendkeys.sh")
|
||||
|
||||
if len(sys.argv) < 4:
|
||||
add_qq_shortcut(u"提取QQ消息", " z", "<Control><Alt>Z")
|
||||
if system_screenshot_isA():
|
||||
add_qq_shortcut(u"QQ截图", " a", "<Control><Alt>S")
|
||||
else:
|
||||
add_qq_shortcut(u"QQ截图", " a", "<Control><Alt>A")
|
||||
sys.exit(0)
|
||||
|
||||
add_qq_shortcut(str(sys.argv[1]), sys.argv[2], sys.argv[3])
|
0
helper/autostart
Normal file
0
helper/autostart
Normal file
57
helper/autostart_all.sh
Executable file
57
helper/autostart_all.sh
Executable file
@ -0,0 +1,57 @@
|
||||
#!/bin/bash
|
||||
|
||||
get_value()
|
||||
{
|
||||
cat $1 | grep -m 1 ${2}= | awk -F = '{print $NF}' | awk -F \" '{print $2}'
|
||||
}
|
||||
|
||||
init_bottle()
|
||||
{
|
||||
RUN_FILE=$1
|
||||
|
||||
if [ ! -f "$RUN_FILE" ];then
|
||||
echo "$RUN_FILE 未安装"
|
||||
return
|
||||
fi
|
||||
|
||||
DEB_PACKAGE_NAME="$(get_value $RUN_FILE DEB_PACKAGE_NAME)"
|
||||
BOTTLENAME="$(get_value $RUN_FILE BOTTLENAME)"
|
||||
APPRUN_CMD="$(get_value $RUN_FILE APPRUN_CMD)"
|
||||
BOTTLEPATH="$HOME/.deepinwine/$BOTTLENAME"
|
||||
|
||||
if [ $2 ]&&[ $2 == "-c" ];then
|
||||
$RUN_FILE -c
|
||||
fi
|
||||
|
||||
# KILL="/opt/deepinwine/tools/kill.bak"
|
||||
# if [ -f $KILL ];then
|
||||
# $KILL "$BOTTLENAME"
|
||||
# fi
|
||||
|
||||
if [ -d "$BOTTLEPATH" ];then
|
||||
APPRUN_CMD=${APPRUN_CMD/\$HOME/$HOME}
|
||||
|
||||
if [ ! -f "$APPRUN_CMD" ];then
|
||||
export WINEDLLPATH=/opt/$APPRUN_CMD/lib:/opt/$APPRUN_CMD/lib64
|
||||
fi
|
||||
|
||||
ARCHIVE_FILE_DIR="/opt/apps/$DEB_PACKAGE_NAME/files"
|
||||
export WINEPREDLL="$ARCHIVE_FILE_DIR/dlls"
|
||||
|
||||
WINEPREFIX="$BOTTLEPATH" $APPRUN_CMD /opt/deepinwine/tools/startbottle.exe &
|
||||
fi
|
||||
}
|
||||
|
||||
AUTOSTART="/opt/deepinwine/tools/autostart"
|
||||
if [ -f "$AUTOSTART.all" ];then
|
||||
find /opt/apps -name run.sh | while read package;do
|
||||
init_bottle $package "$@"
|
||||
done
|
||||
elif [ -f $AUTOSTART ];then
|
||||
debs=`cat $AUTOSTART`
|
||||
for deb in $debs
|
||||
do
|
||||
debname=`echo $deb | sed -e 's/\s//g'`
|
||||
init_bottle "/opt/apps/$debname/files/run.sh" "$@"
|
||||
done
|
||||
fi
|
58
helper/autostart_wine.sh
Executable file
58
helper/autostart_wine.sh
Executable file
@ -0,0 +1,58 @@
|
||||
#!/bin/bash
|
||||
|
||||
DEB_PACKAGE_NAME="com.qq.im.deepin"
|
||||
|
||||
get_value()
|
||||
{
|
||||
cat $1 | grep -m 1 ${2}= | awk -F = '{print $NF}' | awk -F \" '{print $2}'
|
||||
}
|
||||
|
||||
if [ -n "$1" ];then
|
||||
DEB_PACKAGE_NAME="$1"
|
||||
fi
|
||||
|
||||
RUN_FILE="/opt/apps/$DEB_PACKAGE_NAME/files/run.sh"
|
||||
|
||||
if [ ! -f "$RUN_FILE" ];then
|
||||
echo "$DEB_PACKAGE_NAME 未安装"
|
||||
exit
|
||||
fi
|
||||
|
||||
BOTTLENAME="$(get_value $RUN_FILE BOTTLENAME)"
|
||||
APPRUN_CMD="$(get_value $RUN_FILE APPRUN_CMD)"
|
||||
BOTTLEPATH="$HOME/.deepinwine/$BOTTLENAME"
|
||||
|
||||
bottle_started()
|
||||
{
|
||||
ps -ef | grep startbottle.exe | while read startb;do
|
||||
starts=(${startb// / })
|
||||
envfile=/proc/${starts[1]}/environ
|
||||
if [ -f $envfile ];then
|
||||
grep -c $BOTTLENAME /proc/${starts[1]}/environ > /dev/null
|
||||
if [ $? -eq 0 ];then
|
||||
echo ${starts[1]}
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
if [ "$(bottle_started)" ];then
|
||||
exit
|
||||
fi
|
||||
|
||||
$RUN_FILE -c
|
||||
|
||||
if [ -d "$BOTTLEPATH" ];then
|
||||
APPRUN_CMD=${APPRUN_CMD/\$HOME/$HOME}
|
||||
|
||||
if [ ! -f "$APPRUN_CMD" ];then
|
||||
export WINEDLLPATH=/opt/$APPRUN_CMD/lib:/opt/$APPRUN_CMD/lib64
|
||||
fi
|
||||
|
||||
ARCHIVE_FILE_DIR="/opt/apps/$DEB_PACKAGE_NAME/files"
|
||||
export WINEPREDLL="$ARCHIVE_FILE_DIR/dlls"
|
||||
|
||||
WINEPREFIX="$BOTTLEPATH" $APPRUN_CMD /opt/deepinwine/tools/startbottle.exe &
|
||||
fi
|
||||
|
1
helper/box86-activex
Symbolic link
1
helper/box86-activex
Symbolic link
@ -0,0 +1 @@
|
||||
../../deepin-box86/stable/box86
|
BIN
helper/deepin-wine-banner
Executable file
BIN
helper/deepin-wine-banner
Executable file
Binary file not shown.
22
helper/get_tray_window
Executable file
22
helper/get_tray_window
Executable file
@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env python3
|
||||
# vim: set ts=4 sw=4 fileencoding=utf-8:
|
||||
# Luomio <nohappiness@gmail.com>
|
||||
# Filename: dde-first-run.py
|
||||
# Create Date: 27-03, 13
|
||||
|
||||
import dbus
|
||||
|
||||
def get_tray_window():
|
||||
bus = dbus.SessionBus()
|
||||
traymanager = bus.get_object("com.deepin.dde.TrayManager", "/com/deepin/dde/TrayManager")
|
||||
|
||||
traymanager_iface = dbus.Interface(traymanager, dbus_interface='org.freedesktop.DBus.Properties')
|
||||
windows = traymanager_iface.Get("com.deepin.dde.TrayManager","TrayIcons")
|
||||
str="window_id:"
|
||||
for i in range(len(windows)):
|
||||
str += '{:#x} '.format(windows[i])
|
||||
|
||||
print(str)
|
||||
|
||||
if __name__ == "__main__":
|
||||
get_tray_window()
|
291
helper/kill.sh
Executable file
291
helper/kill.sh
Executable file
@ -0,0 +1,291 @@
|
||||
#!/bin/bash
|
||||
|
||||
APP_NAME="QQ"
|
||||
LOG_FILE=$0
|
||||
SHELL_DIR=${0%/*}
|
||||
if [ $SPECIFY_SHELL_DIR ]; then
|
||||
SHELL_DIR=$SPECIFY_SHELL_DIR
|
||||
fi
|
||||
|
||||
PUBLIC_DIR="/var/public"
|
||||
|
||||
UsePublicDir()
|
||||
{
|
||||
if [ -z "$USE_PUBLIC_DIR" ]; then
|
||||
echo "Don't use public dir"
|
||||
return 1
|
||||
fi
|
||||
if [ ! -d "$PUBLIC_DIR" ];then
|
||||
echo "Not found $PUBLIC_DIR"
|
||||
return 1
|
||||
fi
|
||||
if [ ! -r "$PUBLIC_DIR" ];then
|
||||
echo "Can't read for $PUBLIC_DIR"
|
||||
return 1
|
||||
fi
|
||||
if [ ! -w "$PUBLIC_DIR" ];then
|
||||
echo "Can't write for $PUBLIC_DIR"
|
||||
return 1
|
||||
fi
|
||||
if [ ! -x "$PUBLIC_DIR" ];then
|
||||
echo "Can't excute for $PUBLIC_DIR"
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
WINE_BOTTLE="$HOME/.deepinwine"
|
||||
|
||||
if UsePublicDir;then
|
||||
WINE_BOTTLE="$PUBLIC_DIR"
|
||||
fi
|
||||
|
||||
get_wine_by_pid()
|
||||
{
|
||||
wine_path=$(cat /proc/$1/maps | grep -E "\/wine$|\/wine64$|\/wine |\/wine64 " | head -1 | awk '{print $6}')
|
||||
if [ -z "$wine_path" ];then
|
||||
cat /proc/$1/cmdline| xargs -0 -L1 -I{} echo {} | grep -E "\/wine$|\/wine64$|\/wine |\/wine64 " | head -1
|
||||
else
|
||||
echo $wine_path
|
||||
fi
|
||||
}
|
||||
|
||||
is_wine_process()
|
||||
{
|
||||
wine_module=$(get_wine_by_pid $1)
|
||||
if [ -z "$wine_module" ];then
|
||||
wine_module=$(cat /proc/$1/maps | grep -E "\/wineserver$" | head -1)
|
||||
fi
|
||||
echo $wine_module
|
||||
}
|
||||
|
||||
set_emu_by_pid()
|
||||
{
|
||||
emu_cmd=$(xargs -0 printf '%s\n' < /proc/$1/environ | grep ^EMU_CMD=)
|
||||
emu_args=$(xargs -0 printf '%s\n' < /proc/$1/environ | grep ^EMU_ARGS=)
|
||||
if [ -n "$emu_cmd" ];then
|
||||
export "$emu_cmd"
|
||||
fi
|
||||
if [ -n "$emu_args" ];then
|
||||
export "$emu_args"
|
||||
fi
|
||||
debug_log_to_file "$1 EMU_CMD: $EMU_CMD, EMU_ARGS: $EMU_ARGS"
|
||||
}
|
||||
|
||||
get_prefix_by_pid()
|
||||
{
|
||||
WINE_PREFIX=$(xargs -0 printf '%s\n' < /proc/$1/environ | grep WINEPREFIX)
|
||||
WINE_PREFIX=${WINE_PREFIX##*=}
|
||||
if [ -z "$WINE_PREFIX" ] && [ -n "$(is_wine_process $1)" ]; then
|
||||
#不指定容器的情况用默认容器目录
|
||||
WINE_PREFIX="$HOME/.wine"
|
||||
fi
|
||||
if [ -n "$WINE_PREFIX" ];then
|
||||
WINE_PREFIX=$(realpath $WINE_PREFIX)
|
||||
echo $WINE_PREFIX
|
||||
fi
|
||||
}
|
||||
|
||||
get_wineserver_pid()
|
||||
{
|
||||
if [ -z "$1" ];then
|
||||
return
|
||||
fi
|
||||
targ_prefix=$(realpath $1)
|
||||
for server_pid in $(ps -ef | grep wineserver | awk '{print $2}') ;do
|
||||
server_prefix=$(get_prefix_by_pid $server_pid)
|
||||
debug_log_to_file "get server pid $server_pid, prefix: $server_prefix"
|
||||
|
||||
if [ "$targ_prefix" = "$server_prefix" ];then
|
||||
echo $server_pid
|
||||
return
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
init_log_file()
|
||||
{
|
||||
if [ -d "$DEBUG_LOG" ];then
|
||||
LOG_DIR=$(realpath $DEBUG_LOG)
|
||||
if [ -d "$LOG_DIR" ];then
|
||||
LOG_FILE="${LOG_DIR}/${LOG_FILE##*/}.log"
|
||||
echo "" > "$LOG_FILE"
|
||||
debug_log "LOG_FILE=$LOG_FILE"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
debug_log_to_file()
|
||||
{
|
||||
if [ -d "$DEBUG_LOG" ];then
|
||||
strDate=$(date)
|
||||
echo -e "${strDate}:${1}" >> "$LOG_FILE"
|
||||
fi
|
||||
}
|
||||
|
||||
debug_log()
|
||||
{
|
||||
strDate=$(date)
|
||||
echo "${strDate}:${1}"
|
||||
}
|
||||
|
||||
init_log_file
|
||||
|
||||
get_bottle_path_by_process_id()
|
||||
{
|
||||
PID_LIST="$1"
|
||||
PREFIX_LIST=""
|
||||
|
||||
for pid_var in $PID_LIST ; do
|
||||
WINE_PREFIX=$(get_prefix_by_pid $pid_var)
|
||||
#去掉重复项
|
||||
for bottle_path in $(echo -e $PREFIX_LIST) ; do
|
||||
if [[ $bottle_path == "$WINE_PREFIX" ]]; then
|
||||
WINE_PREFIX=""
|
||||
fi
|
||||
done
|
||||
if [ -d "$WINE_PREFIX" ]; then
|
||||
debug_log_to_file "found $pid_var : $WINE_PREFIX"
|
||||
PREFIX_LIST+="\n$WINE_PREFIX"
|
||||
fi
|
||||
done
|
||||
echo -e $PREFIX_LIST
|
||||
}
|
||||
|
||||
get_pid_by_process_name()
|
||||
{
|
||||
PID_LIST=""
|
||||
for pid_var in $(ps -ef | grep -E -i "$1" | grep -v grep | awk '{print $2}');do
|
||||
#通过判断是否加载wine来判断是不是wine进程
|
||||
if [ -n "$(is_wine_process $pid_var)" ];then
|
||||
PID_LIST+=" $pid_var"
|
||||
fi
|
||||
done
|
||||
echo "$PID_LIST"
|
||||
}
|
||||
|
||||
get_bottle_path_by_process_name()
|
||||
{
|
||||
PID_LIST=$(get_pid_by_process_name $1)
|
||||
debug_log_to_file "get pid list: $PID_LIST"
|
||||
get_bottle_path_by_process_id "$PID_LIST"
|
||||
}
|
||||
|
||||
get_bottle_path()
|
||||
{
|
||||
if [ -z "$1" ];then
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ -f "$1/user.reg" ]; then
|
||||
realpath "$1"
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ -f "$WINE_BOTTLE/$1/user.reg" ]; then
|
||||
realpath "$WINE_BOTTLE/$1"
|
||||
return 0
|
||||
fi
|
||||
get_bottle_path_by_process_name "$1"
|
||||
}
|
||||
|
||||
get_wineserver_path_by_pid()
|
||||
{
|
||||
server_info=$(ps -ef | grep -E "${1}.*wineserver" | grep -v grep)
|
||||
debug_log_to_file "get server info $server_info"
|
||||
WINESERVER=$(echo $server_info | awk '{print $NF}')
|
||||
if [ ! -f "$WINESERVER" ];then
|
||||
WINESERVER=$(echo $server_info | awk '{print $(NF-1)}')
|
||||
WINESERVER=${WINESERVER%*.real}
|
||||
fi
|
||||
debug_log_to_file "get server $WINESERVER"
|
||||
}
|
||||
|
||||
kill_app()
|
||||
{
|
||||
debug_log "try to kill $1"
|
||||
for bottle_path in $(get_bottle_path $1); do
|
||||
if [ -n "$bottle_path" ];then
|
||||
server_pid=$(get_wineserver_pid "$bottle_path")
|
||||
if [ -z "$server_pid" ];then
|
||||
continue
|
||||
fi
|
||||
set_emu_by_pid $server_pid
|
||||
|
||||
get_wineserver_path_by_pid $server_pid
|
||||
if [ -f "$WINESERVER" ];then
|
||||
debug_log "kill $bottle_path by $WINESERVER"
|
||||
# 兼容arm版本,通过模拟器运行
|
||||
env WINEPREFIX="$bottle_path" $EMU_CMD $EMU_ARGS "$WINESERVER" -k
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
#Kill defunct process
|
||||
ps -ef | grep -E "$USER.*exe.*<defunct>"
|
||||
ps -ef | grep -E "$USER.*exe.*<defunct>" | grep -v grep | awk '{print $2}' | xargs -i kill -9 {}
|
||||
}
|
||||
|
||||
get_tray_window()
|
||||
{
|
||||
$SHELL_DIR/get_tray_window | awk -F: '{print $2}'
|
||||
}
|
||||
|
||||
get_stacking_window()
|
||||
{
|
||||
xprop -root _NET_CLIENT_LIST_STACKING | awk -F# '{print $2}' | sed -e 's/, / /g'
|
||||
}
|
||||
|
||||
get_window_pid()
|
||||
{
|
||||
for winid in $(echo "$1" | sed -e 's/ /\n/g') ;
|
||||
do
|
||||
xprop -id $winid _NET_WM_PID | awk -F= '{print $2}'
|
||||
done
|
||||
}
|
||||
|
||||
get_window_bottle()
|
||||
{
|
||||
debug_log_to_file "get_window_bottle $1"
|
||||
PID_LIST=$(get_window_pid "$1")
|
||||
debug_log_to_file "get_window_bottle pid list: $PID_LIST"
|
||||
get_bottle_path_by_process_id "$PID_LIST"
|
||||
}
|
||||
|
||||
get_active_bottles()
|
||||
{
|
||||
TRAYWINDOWS=$(get_tray_window)
|
||||
STACKINGWINDOWS=$(get_stacking_window)
|
||||
debug_log_to_file "tray window id: $TRAYWINDOWS"
|
||||
debug_log_to_file "stacking window id: $STACKINGWINDOWS"
|
||||
PID_LIST="$TRAYWINDOWS $STACKINGWINDOWS"
|
||||
get_window_bottle "$PID_LIST"
|
||||
}
|
||||
|
||||
kill_exit_block_app()
|
||||
{
|
||||
TAGBOTTLE=$(get_bottle_path $1)
|
||||
debug_log "tag bottle: $TAGBOTTLE"
|
||||
ACTIVEBOTTLES=$(get_active_bottles)
|
||||
debug_log "active bottles: $ACTIVEBOTTLES"
|
||||
|
||||
if [[ "$ACTIVEBOTTLES" != *"$TAGBOTTLE"* ]]; then
|
||||
kill_app "$TAGBOTTLE"
|
||||
fi
|
||||
}
|
||||
|
||||
#get_active_bottles
|
||||
#exit
|
||||
|
||||
debug_log "kill $1 $2"
|
||||
|
||||
if [ -n "$1" ]; then
|
||||
APP_NAME="$1"
|
||||
fi
|
||||
|
||||
if [ "$2" = "block" ]; then
|
||||
kill_exit_block_app $APP_NAME $3
|
||||
else
|
||||
kill_app $APP_NAME
|
||||
fi
|
44
helper/log.sh
Executable file
44
helper/log.sh
Executable file
@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
|
||||
BOTTLE_NAME="Deepin-QQ"
|
||||
DEBUG_MSG="+pid,+tid,+timestamp"
|
||||
SHELL_DIR=$(dirname $0)
|
||||
SHELL_DIR=$(realpath "$SHELL_DIR")
|
||||
if [ $SPECIFY_SHELL_DIR ]; then
|
||||
SHELL_DIR=$SPECIFY_SHELL_DIR
|
||||
fi
|
||||
|
||||
if [ -n "$1" ]; then
|
||||
BOTTLE_NAME="$1"
|
||||
fi
|
||||
|
||||
if [ -n "$2" ]; then
|
||||
DEBUG_MSG="$2"
|
||||
fi
|
||||
|
||||
RUN_CMD="/opt/deepinwine/apps/${BOTTLE_NAME}/run.sh"
|
||||
|
||||
if [ ! -f "$RUN_CMD" ]; then
|
||||
RUN_CMD="/opt/apps/$BOTTLE_NAME/files/run.sh"
|
||||
if [ ! -f "$RUN_CMD" ]; then
|
||||
echo "Invaild bottle name, $BOTTLE_NAME is not exist"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
mkdir $HOME/log &> /dev/null
|
||||
|
||||
export DEBUG_LOG="$HOME/log"
|
||||
|
||||
dpkg -l | grep "Deepin Wine" > $HOME/log/${BOTTLE_NAME}.log
|
||||
dpkg -l | grep deepin-wine >> $HOME/log/${BOTTLE_NAME}.log
|
||||
ps -ef | grep -i c: >> $HOME/log/${BOTTLE_NAME}.log
|
||||
|
||||
$SHELL_DIR/kill.sh ${BOTTLE_NAME}
|
||||
|
||||
if [ -z "$3" ]; then
|
||||
WINEDEBUG=${DEBUG_MSG} $RUN_CMD &>> $HOME/log/${BOTTLE_NAME}.log &
|
||||
else
|
||||
WINEDEBUG=${DEBUG_MSG} $RUN_CMD -u "$3" &>> $HOME/log/${BOTTLE_NAME}.log &
|
||||
fi
|
||||
dde-file-manager $HOME/log &> /dev/null &
|
51
helper/map_device.sh
Executable file
51
helper/map_device.sh
Executable file
@ -0,0 +1,51 @@
|
||||
#!/bin/bash
|
||||
|
||||
#$1 link path
|
||||
#$2 real path
|
||||
Update_link()
|
||||
{
|
||||
if [ -f "$1" ];then
|
||||
echo "$1 is a file"
|
||||
rm "$1"
|
||||
fi
|
||||
|
||||
if [ -L "$1" ];then
|
||||
real_path=$(realpath $1)
|
||||
echo "${1} is a symlink, $real_path"
|
||||
if [ "$2" = "$real_path" ];then
|
||||
echo "not need create"
|
||||
return
|
||||
fi
|
||||
rm "$1"
|
||||
fi
|
||||
|
||||
link_dir=$(dirname "$1")
|
||||
mkdir -p "$link_dir"
|
||||
echo "link $1 to $2"
|
||||
ln -s "$2" "$1"
|
||||
}
|
||||
|
||||
map_lp()
|
||||
{
|
||||
ls /dev/lp* |\
|
||||
while read line; do
|
||||
Update_link "${HOME}/.deepinwine/lp0" "$line"
|
||||
return
|
||||
done
|
||||
}
|
||||
|
||||
map_serial()
|
||||
{
|
||||
i=0
|
||||
COMS=("COM1" "COM2" "COM3" "COM4")
|
||||
dmesg | grep -E "0000:01.*tty" | awk '{print $4}'|\
|
||||
while read line;do
|
||||
ttypath=$(echo "/dev/$line")
|
||||
compath=$(echo "${HOME}/.deepinwine/${COMS[i]}")
|
||||
let "i++"
|
||||
Update_link "$compath" "$ttypath"
|
||||
done
|
||||
}
|
||||
|
||||
map_lp
|
||||
map_serial
|
40
helper/register_font.sh
Executable file
40
helper/register_font.sh
Executable file
@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
|
||||
APPS="Deepin-QQ Deepin-QQLigth"
|
||||
WINE_CMD="deepin-wine5-stable"
|
||||
RE_TAG="Source Han Sans SC Regular"
|
||||
WINE_PREFIX=""
|
||||
|
||||
_SetRegistryValue()
|
||||
{
|
||||
env WINEPREFIX="$WINE_PREFIX" $WINE_CMD reg ADD "$1" /v "$2" /t $3 /d "$4"
|
||||
}
|
||||
|
||||
_DeleteRegistryValue()
|
||||
{
|
||||
env WINEPREFIX="$WINE_PREFIX" $WINE_CMD reg DELETE "$1" /v "$2"
|
||||
}
|
||||
|
||||
_SetFontReplacements()
|
||||
{
|
||||
echo "$1 -> $2"
|
||||
# _DeleteRegistryValue 'HKCU\Software\Wine\\Fonts\Replacements' "$1"
|
||||
_SetRegistryValue 'HKCU\Software\Wine\\Fonts\Replacements' "$1" REG_SZ "$2"
|
||||
}
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "No font name"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -n "$2" ]; then
|
||||
RE_TAG="$2"
|
||||
fi
|
||||
|
||||
for name in ${APPS}; do
|
||||
WINE_PREFIX="$HOME/.deepinwine/$name"
|
||||
echo $WINE_PREFIX
|
||||
if [ -d "$WINE_PREFIX" ]; then
|
||||
_SetFontReplacements "$1" "$RE_TAG"
|
||||
fi
|
||||
done
|
787
helper/run.sh
Executable file
787
helper/run.sh
Executable file
@ -0,0 +1,787 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (C) 2016 Deepin, Inc.
|
||||
#
|
||||
# Author: Li LongYu <lilongyu@linuxdeepin.com>
|
||||
# Peng Hao <penghao@linuxdeepin.com>
|
||||
|
||||
WINEPREFIX="$HOME/.deepinwine/@public_bottle_name@"
|
||||
APPDIR="/opt/deepinwine/apps/@public_bottle_name@"
|
||||
APPVER="@deb_version_string@"
|
||||
APPTAR="files.7z"
|
||||
BOTTLENAME=""
|
||||
WINE_CMD="deepin-wine"
|
||||
CREATE_BOTTLE=""
|
||||
LOG_FILE=$0
|
||||
|
||||
init_log_file()
|
||||
{
|
||||
if [ ! -d "$DEBUG_LOG" ];then
|
||||
return
|
||||
fi
|
||||
|
||||
LOG_DIR=$(realpath $DEBUG_LOG)
|
||||
if [ -d "$LOG_DIR" ];then
|
||||
LOG_FILE="${LOG_DIR}/${LOG_FILE##*/}.log"
|
||||
echo "" > "$LOG_FILE"
|
||||
debug_log "LOG_FILE=$LOG_FILE"
|
||||
fi
|
||||
}
|
||||
|
||||
debug_log_to_file()
|
||||
{
|
||||
if [ -d "$DEBUG_LOG" ];then
|
||||
strDate=$(date)
|
||||
echo -e "${strDate}:${1}" >> "$LOG_FILE"
|
||||
fi
|
||||
}
|
||||
|
||||
debug_log()
|
||||
{
|
||||
strDate=$(date)
|
||||
echo "${strDate}:${1}"
|
||||
}
|
||||
|
||||
init_log_file
|
||||
|
||||
_SetRegistryValue()
|
||||
{
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD reg ADD "$1" /v "$2" /t $3 /d "$4" /f
|
||||
}
|
||||
|
||||
_DeleteRegistry()
|
||||
{
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD reg DELETE "$1" /f &> /dev/null
|
||||
}
|
||||
|
||||
_SetOverride()
|
||||
{
|
||||
_SetRegistryValue 'HKCU\Software\Wine\DllOverrides' "$2" REG_SZ "$1"
|
||||
}
|
||||
|
||||
_DisableAliUpdate()
|
||||
{
|
||||
if [ -f "${WINEPREFIX}/.disable" ];then
|
||||
return
|
||||
fi
|
||||
debug_log "Disable AliUpdate"
|
||||
touch ${WINEPREFIX}/.disable
|
||||
|
||||
/opt/deepinwine/tools/kill.sh AliWorkbench block
|
||||
VERSIONS=$(ls ${WINEPREFIX}'/drive_c/Program Files/AliWorkbench' | grep -E '*.*.*N')
|
||||
VERSIONS=$(echo $VERSIONS | awk '{print $2}')
|
||||
debug_log $VERSIONS
|
||||
|
||||
if [ -n "$VERSIONS" ];then
|
||||
debug_log "Remove bottle"
|
||||
rm -rf "$WINEPREFIX"
|
||||
/opt/deepinwine/apps/Deepin-QianNiu/run.sh -c
|
||||
fi
|
||||
|
||||
_SetOverride "" "AliUpdate"
|
||||
}
|
||||
|
||||
HelpApp()
|
||||
{
|
||||
echo " Extra Commands:"
|
||||
echo " -r/--reset Reset app to fix errors"
|
||||
echo " -e/--remove Remove deployed app files"
|
||||
echo " -h/--help Show program help info"
|
||||
}
|
||||
FixLink()
|
||||
{
|
||||
if [ -d ${WINEPREFIX} ]; then
|
||||
CUR_DIR=$PWD
|
||||
cd "${WINEPREFIX}/dosdevices"
|
||||
rm c: z:
|
||||
ln -s -f ../drive_c c:
|
||||
ln -s -f / z:
|
||||
cd $CUR_DIR
|
||||
ls -l "${WINEPREFIX}/dosdevices"
|
||||
fi
|
||||
}
|
||||
urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; }
|
||||
|
||||
uridecode()
|
||||
{
|
||||
local path=$(urldecode "$1")
|
||||
path=${path/file:\/\//}
|
||||
echo $path
|
||||
}
|
||||
|
||||
get_bottle_path_by_process_id()
|
||||
{
|
||||
PID_LIST="$1"
|
||||
PREFIX_LIST=""
|
||||
|
||||
for pid_var in $PID_LIST ; do
|
||||
WINE_PREFIX=$(xargs -0 printf '%s\n' < /proc/$pid_var/environ | grep WINEPREFIX)
|
||||
WINE_PREFIX=${WINE_PREFIX##*=}
|
||||
for path in $(echo -e $PREFIX_LIST) ; do
|
||||
if [[ $path == "$WINE_PREFIX" ]]; then
|
||||
WINE_PREFIX=""
|
||||
fi
|
||||
done
|
||||
if [ -d "$WINE_PREFIX" ]; then
|
||||
debug_log_to_file "found $pid_var : $WINE_PREFIX"
|
||||
PREFIX_LIST+="\n$WINE_PREFIX"
|
||||
fi
|
||||
done
|
||||
echo -e $PREFIX_LIST | grep $HOME
|
||||
}
|
||||
|
||||
get_bottle_path_by_process_name()
|
||||
{
|
||||
PID_LIST=$(ps -ef | grep -E -i "c:.*${1}" | grep -v grep | awk '{print $2}')
|
||||
debug_log_to_file "get pid list: $PID_LIST"
|
||||
get_bottle_path_by_process_id "$PID_LIST"
|
||||
}
|
||||
|
||||
CallYMDY()
|
||||
{
|
||||
SERVER_BOTTLE=$(get_bottle_path_by_process_name sqlservr.exe | grep $WINEPREFIX)
|
||||
if [ -z "$SERVER_BOTTLE" ]; then
|
||||
debug_log "Starting SQL Server ..."
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "c:\\Program Files\\Microsoft SQL Server\\MSSQL\\Binn\\sqlservr.exe" -s MSSQLSERVER &
|
||||
else
|
||||
debug_log "SQL Server is running in $SERVER_BOTTLE"
|
||||
fi
|
||||
|
||||
if [ "autostart" == "$1" ]; then
|
||||
debug_log "Auto start SQL Server"
|
||||
elif [ "tongji" == "$1" ]; then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "c:\\Program Files\\旗帜软件\\党内信息管理系统(统计版)\\CReport.exe" &
|
||||
elif [ "createdb" == "$1" ]; then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "c:\\Program Files\\旗帜软件\\党内信息管理系统(统计版)\\数据库安装\\SetupDb.exe" &
|
||||
elif [ "servermanger" == "$1" ]; then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "c:\\Program Files\\Microsoft SQL Server\\80\\Tools\\Binn\\sqlmangr.exe" /n &
|
||||
else
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "c:\\Program Files\\旗帜软件\\党内信息管理系统(统计版)\\QZCPMIS.exe" &
|
||||
fi
|
||||
}
|
||||
CallYMGWY()
|
||||
{
|
||||
if [ "autostart" == "$1" ]; then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD uninstaller --list
|
||||
elif [ "tongji" == "$1" ]; then
|
||||
firefox "http://127.0.0.1:64022/hzbtj" &
|
||||
else
|
||||
firefox "http://127.0.0.1:64022/hzb" &
|
||||
fi
|
||||
}
|
||||
CallATM()
|
||||
{
|
||||
if [ "autostart" == "$1" ]; then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD /opt/deepinwine/tools/startbottle.exe &
|
||||
else
|
||||
if [ ! -f "$WINEPREFIX/drive_c/Program Files/TradeManager/AliIM.exe" ]; then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "c:\\deepin\\AliIM2015_ATM.exe"
|
||||
fi
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "c:\\Program Files\\TradeManager\\AliIM.exe" &
|
||||
fi
|
||||
}
|
||||
CallMaxthon2()
|
||||
{
|
||||
if [ "autostart" == "$1" ]; then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD /opt/deepinwine/tools/startbottle.exe &
|
||||
else
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "c:\\Program Files\\Maxthon2\\Maxthon.exe" &
|
||||
fi
|
||||
}
|
||||
CallQIANNIU()
|
||||
{
|
||||
if [ "autostart" == "$1" ]; then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD /opt/deepinwine/tools/startbottle.exe &
|
||||
else
|
||||
_DisableAliUpdate
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "c:\\Program Files\\AliWorkbench\\AliWorkbench.exe" &
|
||||
fi
|
||||
}
|
||||
CallYMPOPS()
|
||||
{
|
||||
if [ "autostart" == "$1" ]; then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD /opt/deepinwine/tools/startbottle.exe &
|
||||
else
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "c:\\Program Files\\全国持久性有机污染物统计年报信息管理系统(2017)\\POPs.exe" &
|
||||
fi
|
||||
}
|
||||
CallYMRLZY()
|
||||
{
|
||||
if [ "autostart" == "$1" ]; then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD /opt/deepinwine/tools/startbottle.exe &
|
||||
else
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "c:\\Program Files\\人力资源社会保障统计报表系统SMIS2012\\bin\\Omni.exe" &
|
||||
fi
|
||||
}
|
||||
CallYMDATJ()
|
||||
{
|
||||
if [ "autostart" == "$1" ]; then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD /opt/deepinwine/tools/startbottle.exe &
|
||||
else
|
||||
if [ ! -f "$WINEPREFIX/drive_c/Program Files/JoinCheer/全国档案事业统计年报信息管理系统/ReportE.exe" ]; then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "c:\\deepin\\install\\setup.exe"
|
||||
fi
|
||||
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "c:\\Program Files\\JoinCheer\\全国档案事业统计年报信息管理系统\\ReportE.exe" &
|
||||
fi
|
||||
}
|
||||
CallYMWZXX()
|
||||
{
|
||||
if [ "autostart" == "$1" ]; then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD /opt/deepinwine/tools/startbottle.exe &
|
||||
else
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "c:\\Program Files\\全国政府网站信息报送客户端\\UFReader.exe" &
|
||||
fi
|
||||
}
|
||||
CallRTX2015()
|
||||
{
|
||||
if [ "autostart" == "$1" ]; then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD /opt/deepinwine/tools/startbottle.exe &
|
||||
else
|
||||
cd "$WINEPREFIX/drive_c/Program Files/Tencent/RTXC"
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "c:\\Program Files\\Tencent\\RTXC\\RTX.exe" &
|
||||
fi
|
||||
}
|
||||
CallYMRDWS()
|
||||
{
|
||||
if [ "autostart" == "$1" ]; then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD /opt/deepinwine/tools/startbottle.exe &
|
||||
else
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "c:\\Program Files\\饮用水水源环境基础信息采集系统\\RDWS.exe" &
|
||||
fi
|
||||
}
|
||||
CallQQGame()
|
||||
{
|
||||
debug_log "run $1"
|
||||
/opt/deepinwine/tools/kill.sh QQMicroGameBox block
|
||||
env WINEPREFIX="$WINEPREFIX" /opt/deepinwine/tools/QQGameRunner $1 &
|
||||
}
|
||||
CallWXWork()
|
||||
{
|
||||
if [ "autostart" == "$1" ]; then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD /opt/deepinwine/tools/startbottle.exe &
|
||||
else
|
||||
/opt/deepinwine/tools/kill.sh WXWork.exe block
|
||||
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "c:\\Program Files\\WXWork\\WXWork.exe" &
|
||||
fi
|
||||
}
|
||||
CallRTX2009()
|
||||
{
|
||||
if [ "autostart" == "$1" ]; then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD /opt/deepinwine/tools/startbottle.exe &
|
||||
else
|
||||
cd "$WINEPREFIX/drive_c/Program Files/Tencent/RTXC"
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "c:\\Program Files\\Tencent\\RTXC\\RTX.exe" &
|
||||
fi
|
||||
}
|
||||
CallIrfanView()
|
||||
{
|
||||
if [ "autostart" == "$1" ]; then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD /opt/deepinwine/tools/startbottle.exe &
|
||||
else
|
||||
OPEN_FILE=$(uridecode $1)
|
||||
if [ -f "$OPEN_FILE" ]; then
|
||||
OPEN_FILE=$(realpath "$OPEN_FILE")
|
||||
OPEN_FILE="z:$OPEN_FILE"
|
||||
debug_log "fond file $OPEN_FILE"
|
||||
OPEN_FILE=$(echo $OPEN_FILE | sed -e 's/\//\\\\/g')
|
||||
fi
|
||||
|
||||
echo "file path: $OPEN_FILE"
|
||||
if [ -n "$OPEN_FILE" ]; then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "c:\\Program Files\\IrfanView\\i_view32.exe" "$OPEN_FILE" &
|
||||
else
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "c:\\Program Files\\IrfanView\\i_view32.exe" &
|
||||
fi
|
||||
fi
|
||||
}
|
||||
CallQQ()
|
||||
{
|
||||
if [ ! -f "$WINEPREFIX/../.QQ_run" ]; then
|
||||
debug_log "first run time"
|
||||
/opt/deepinwine/tools/add_hotkeys
|
||||
/opt/deepinwine/tools/fontconfig
|
||||
touch "$WINEPREFIX/../.QQ_run"
|
||||
fi
|
||||
|
||||
if [ "autostart" == "$1" ]; then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD /opt/deepinwine/tools/startbottle.exe &
|
||||
else
|
||||
#Support use native file dialog
|
||||
export ATTACH_FILE_DIALOG=1
|
||||
|
||||
#Auto kill block process
|
||||
/opt/deepinwine/tools/kill.sh QQ.exe block
|
||||
|
||||
debug_log "start running..."
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "c:\\Program Files\\Tencent\\QQ\\Bin\\QQ.exe" &
|
||||
fi
|
||||
}
|
||||
CallTIM()
|
||||
{
|
||||
if [ ! -f "$WINEPREFIX/../.QQ_run" ]; then
|
||||
debug_log "first run time"
|
||||
/opt/deepinwine/tools/add_hotkeys
|
||||
/opt/deepinwine/tools/fontconfig
|
||||
# If the bottle not exists, run reg may cost lots of times
|
||||
# So create the bottle befor run reg
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD uninstaller --list
|
||||
touch $WINEPREFIX/../.QQ_run
|
||||
fi
|
||||
|
||||
if [ "autostart" == "$1" ]; then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD /opt/deepinwine/tools/startbottle.exe &
|
||||
else
|
||||
#Auto kill block process
|
||||
/opt/deepinwine/tools/kill.sh TIM.exe block
|
||||
|
||||
#Support use native file dialog
|
||||
export ATTACH_FILE_DIALOG=1
|
||||
|
||||
debug_log "start running..."
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "c:\\Program Files\\Tencent\\TIM\\Bin\\TIM.exe" &
|
||||
|
||||
#disable Tencent MiniBrowser
|
||||
_DeleteRegistry "HKCU\\Software\\Tencent\\MiniBrowser"
|
||||
fi
|
||||
}
|
||||
fun1(){
|
||||
xwininfo -root -children | grep -E -i "WeChat.exe.*Wine.*60x60"
|
||||
}
|
||||
CallWeChat()
|
||||
{
|
||||
if [ "autostart" == "$1" ]; then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD /opt/deepinwine/tools/startbottle.exe &
|
||||
else
|
||||
debug_log "Disable auto update"
|
||||
_DeleteRegistry "HKCU\\Software\\Tencent\\WeChat" "UpdateFailCnt"
|
||||
_DeleteRegistry "HKCU\\Software\\Tencent\\WeChat" "NeedUpdateType"
|
||||
rm "${WINEPREFIX}/drive_c/users/${USER}/Application Data/Tencent/WeChat/All Users/config/configEx.ini"
|
||||
|
||||
export DISABLE_RENDER_CLIPBOARD=1
|
||||
export ATTACH_FILE_DIALOG=1
|
||||
debug_log "start running..."
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "c:\\Program Files\\Tencent\\WeChat\\WeChat.exe" &
|
||||
fi
|
||||
}
|
||||
CallFoobar2000()
|
||||
{
|
||||
if [ "autostart" == "$1" ]; then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD /opt/deepinwine/tools/startbottle.exe &
|
||||
else
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "c:\\Program Files\\foobar2000\\foobar2000.exe" &
|
||||
fi
|
||||
}
|
||||
Call7zip()
|
||||
{
|
||||
if [ "autostart" == "$1" ]; then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD /opt/deepinwine/tools/startbottle.exe &
|
||||
else
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "c:\\Program Files\\7-Zip\\7zFM.exe" &
|
||||
fi
|
||||
}
|
||||
Callgtjafuyi()
|
||||
{
|
||||
if [ "autostart" == "$1" ]; then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD /opt/deepinwine/tools/startbottle.exe &
|
||||
else
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "c:\\GTJA\\RichEZ\\TdxW.exe" &
|
||||
fi
|
||||
}
|
||||
CallAAAlog()
|
||||
{
|
||||
if [ "autostart" == "$1" ]; then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD /opt/deepinwine/tools/startbottle.exe &
|
||||
else
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "c:\\Program Files\\AAALOGO\\alogo.exe" &
|
||||
fi
|
||||
}
|
||||
CallWinRAR()
|
||||
{
|
||||
if [ "autostart" == "$1" ]; then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD /opt/deepinwine/tools/startbottle.exe &
|
||||
else
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "c:\\Program Files\\WinRAR\\WinRAR.exe" &
|
||||
fi
|
||||
}
|
||||
Call360Zip()
|
||||
{
|
||||
if [ "autostart" == "$1" ]; then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD /opt/deepinwine/tools/startbottle.exe &
|
||||
else
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "c:\\Program Files\\360\\360zip\\360zip.exe" &
|
||||
fi
|
||||
}
|
||||
CallJCJCJSC()
|
||||
{
|
||||
if [ "autostart" == "$1" ]; then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD /opt/deepinwine/tools/startbottle.exe &
|
||||
else
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "c:\\金长江网上交易\\金长江网上交易财智版\\tdxw.exe" &
|
||||
fi
|
||||
}
|
||||
CallQQEIM()
|
||||
{
|
||||
if [ "autostart" == "$1" ]; then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD /opt/deepinwine/tools/startbottle.exe &
|
||||
else
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "c:\\Program Files\\Tencent\\QQEIM\\Bin\\QQEIM.exe" &
|
||||
fi
|
||||
}
|
||||
CallMTXX()
|
||||
{
|
||||
if [ "autostart" == "$1" ]; then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD /opt/deepinwine/tools/startbottle.exe &
|
||||
else
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "c:\\Program Files\\Meitu\\XiuXiu\\XiuXiu.exe " &
|
||||
fi
|
||||
}
|
||||
CallDecryptDoc()
|
||||
{
|
||||
if [ "autostart" == "$1" ]; then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD /opt/deepinwine/tools/startbottle.exe &
|
||||
else
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "c:\\DecryptDoc.exe " &
|
||||
fi
|
||||
}
|
||||
CallYNote()
|
||||
{
|
||||
if [ "autostart" == "$1" ]; then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD /opt/deepinwine/tools/startbottle.exe &
|
||||
else
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "c:\\Program Files\\Youdao\\YoudaoNote\\YoudaoNote.exe " &
|
||||
fi
|
||||
}
|
||||
CallQQCRM()
|
||||
{
|
||||
if [ "autostart" == "$1" ]; then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD /opt/deepinwine/tools/startbottle.exe &
|
||||
else
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "c:\\Program Files\\Tencent\\BizQQ\\Bin\\QQCRM.exe" &
|
||||
fi
|
||||
}
|
||||
CallPRCReader()
|
||||
{
|
||||
if [ "autostart" == "$1" ]; then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD /opt/deepinwine/tools/startbottle.exe &
|
||||
else
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "c:\\Program Files\\Founder\\Apabi Reader 4.0\\ApaReader.exe" &
|
||||
fi
|
||||
}
|
||||
CallMiniCADSee()
|
||||
{
|
||||
if [ "autostart" == "$1" ]; then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD /opt/deepinwine/tools/startbottle.exe &
|
||||
else
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "c:\\Program Files\\CAD迷你看图\\DWGView.exe" &
|
||||
fi
|
||||
}
|
||||
CallCMBChina()
|
||||
{
|
||||
if [ "autostart" == "$1" ]; then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD /opt/deepinwine/tools/startbottle.exe &
|
||||
else
|
||||
/opt/deepinwine/tools/kill.sh PersonalBankPortal.exe block
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "c:\\windows\\system32\\PersonalBankPortal.exe" &
|
||||
fi
|
||||
}
|
||||
CallWangWang()
|
||||
{
|
||||
if [ "autostart" == "$1" ]; then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD /opt/deepinwine/tools/startbottle.exe &
|
||||
else
|
||||
xdg-mime default deepin.com.taobao.wangwang.desktop x-scheme-handler/aliim
|
||||
chmod 700 "$WINEPREFIX/drive_c/Program Files/AliWangWang/9.12.10C/wwbizsrv.exe"
|
||||
chmod 700 "$WINEPREFIX/drive_c/Program Files/Alibaba/wwbizsrv/wwbizsrv.exe"
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "c:\\Program Files\\AliWangWang\\9.12.10C\\WWCmd.exe" "$1" &
|
||||
fi
|
||||
}
|
||||
CallEM263()
|
||||
{
|
||||
if [ "autostart" == "$1" ]; then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD /opt/deepinwine/tools/startbottle.exe &
|
||||
else
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "c:\\Program Files\\263\\263 Enterprise Messenger\\263em.exe " &
|
||||
fi
|
||||
}
|
||||
CallThunderSpeed()
|
||||
{
|
||||
if [ "autostart" == "$1" ]; then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD /opt/deepinwine/tools/startbottle.exe &
|
||||
else
|
||||
/opt/deepinwine/tools/kill.sh Thunder.exe block
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "c:\\Program Files\\Thunder Network\\Thunder\\Program\\Thunder.exe" &
|
||||
fi
|
||||
}
|
||||
CallApp()
|
||||
{
|
||||
FixLink
|
||||
debug_log "CallApp $BOTTLENAME $1 $2"
|
||||
case $BOTTLENAME in
|
||||
"Deepin-WangWang")
|
||||
CallWangWang "$1" "$2"
|
||||
;;
|
||||
"Deepin-ThunderSpeed")
|
||||
CallThunderSpeed "$1" "$2"
|
||||
;;
|
||||
"Deepin-EM263")
|
||||
CallEM263 "$1" "$2"
|
||||
;;
|
||||
"Deepin-MTXX")
|
||||
CallMTXX "$1" "$2"
|
||||
;;
|
||||
"Deepin-PRCReader")
|
||||
CallPRCReader "$1" "$2"
|
||||
;;
|
||||
"Deepin-MiniCADSee")
|
||||
CallMiniCADSee "$1" "$2"
|
||||
;;
|
||||
"Deepin-CMBChina")
|
||||
CallCMBChina "$1" "$2"
|
||||
;;
|
||||
"Deepin-DecryptDoc")
|
||||
CallDecryptDoc "$1" "$2"
|
||||
;;
|
||||
"Deepin-YNote")
|
||||
CallYNote "$1" "$2"
|
||||
;;
|
||||
"Deepin-Maxthon")
|
||||
CallMaxthon2 "$1" "$2"
|
||||
;;
|
||||
"Deepin-Foobar2000")
|
||||
CallFoobar2000 "$1" "$2"
|
||||
;;
|
||||
"Deepin-QQCRM")
|
||||
CallQQCRM "$1" "$2"
|
||||
;;
|
||||
"Deepin-QQEIM")
|
||||
CallQQEIM "$1" "$2"
|
||||
;;
|
||||
"com.95579.cjsc")
|
||||
CallJCJCJSC "$1" "$2"
|
||||
;;
|
||||
"Deepin-360YaSuo")
|
||||
Call360Zip "$1" "$2"
|
||||
;;
|
||||
"Deepin-WinRAR")
|
||||
CallWinRAR "$1" "$2"
|
||||
;;
|
||||
"Deepin-AAAlog")
|
||||
CallAAAlog "$1" "$2"
|
||||
;;
|
||||
"com.gtja.fuyi")
|
||||
Callgtjafuyi "$1" "$2"
|
||||
;;
|
||||
"Deepin-7zip")
|
||||
Call7zip "$1" "$2"
|
||||
;;
|
||||
"Deepin-QQ")
|
||||
CallQQ "$1" "$2"
|
||||
;;
|
||||
"Deepin-TIM")
|
||||
CallTIM "$1" "$2"
|
||||
;;
|
||||
"Deepin-RTX2015")
|
||||
CallRTX2015 "$1" "$2"
|
||||
;;
|
||||
"Deepin-RTX2009")
|
||||
CallRTX2009 "$1" "$2"
|
||||
;;
|
||||
"Deepin-IrfanView")
|
||||
CallIrfanView "$1" "$2"
|
||||
;;
|
||||
"Deepin-YMRDWS")
|
||||
CallYMRDWS "$1" "$2"
|
||||
;;
|
||||
"Deepin-WeChat")
|
||||
CallWeChat "$1" "$2"
|
||||
;;
|
||||
"Deepin-wangzhanxinxi")
|
||||
CallYMWZXX "$1" "$2"
|
||||
;;
|
||||
"Deepin-dangantongji")
|
||||
CallYMDATJ "$1" "$2"
|
||||
;;
|
||||
"Deepin-renliziyuan")
|
||||
CallYMRLZY "$1" "$2"
|
||||
;;
|
||||
"Deepin-YMPOPS")
|
||||
CallYMPOPS "$1" "$2"
|
||||
;;
|
||||
"Deepin-YMDY")
|
||||
CallYMDY "$1" "$2"
|
||||
;;
|
||||
"Deepin-YMGWY")
|
||||
CallYMGWY "$1" "$2"
|
||||
;;
|
||||
"Deepin-QQHlddz")
|
||||
CallQQGame 363 "$1" "$2"
|
||||
;;
|
||||
"Deepin-QQHlmj")
|
||||
CallQQGame 1101070761 "$1" "$2"
|
||||
;;
|
||||
"Deepin-QQWzry")
|
||||
CallQQGame 1106084547 "$1" "$2"
|
||||
;;
|
||||
"Deepin-QQMnsj")
|
||||
CallQQGame 1105856612 "$1" "$2"
|
||||
;;
|
||||
"Deepin-QQBydr")
|
||||
CallQQGame 1104632801 "$1" "$2"
|
||||
;;
|
||||
"Deepin-QQJlhmjq")
|
||||
CallQQGame 1105370739 "$1" "$2"
|
||||
;;
|
||||
"Deepin-QQXwsd")
|
||||
CallQQGame 1101328322 "$1" "$2"
|
||||
;;
|
||||
"Deepin-QQDldl")
|
||||
CallQQGame 1105208044 "$1" "$2"
|
||||
;;
|
||||
"Deepin-QQSszb")
|
||||
CallQQGame 1105640244 "$1" "$2"
|
||||
;;
|
||||
"Deepin-QQCszj")
|
||||
CallQQGame 1105974527 "$1" "$2"
|
||||
;;
|
||||
"Deepin-WXWork")
|
||||
CallWXWork "$1" "$2"
|
||||
;;
|
||||
"Deepin-QianNiu")
|
||||
CallQIANNIU "$1" "$2"
|
||||
;;
|
||||
"Deepin-ATM")
|
||||
CallATM "$1" "$2"
|
||||
;;
|
||||
*)
|
||||
debug_log "unkown bottle $BOTTLENAME"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
ExtractApp()
|
||||
{
|
||||
$SHELL_DIR/deepin-wine-banner unpack &
|
||||
|
||||
mkdir -p "$1"
|
||||
7z x "$APPDIR/$APPTAR" -o"$1"
|
||||
mv "$1/drive_c/users/@current_user@" "$1/drive_c/users/$USER"
|
||||
sed -i "s#@current_user@#$USER#" $1/*.reg
|
||||
$SHELL_DIR/deepin-wine-banner unpacked
|
||||
}
|
||||
DeployApp()
|
||||
{
|
||||
ExtractApp "$WINEPREFIX"
|
||||
echo "$APPVER" > "$WINEPREFIX/PACKAGE_VERSION"
|
||||
}
|
||||
RemoveApp()
|
||||
{
|
||||
rm -rf "$WINEPREFIX"
|
||||
}
|
||||
ResetApp()
|
||||
{
|
||||
debug_log "Reset $PACKAGENAME....."
|
||||
read -p "* Are you sure?(Y/N)" ANSWER
|
||||
if [ "$ANSWER" = "Y" -o "$ANSWER" = "y" -o -z "$ANSWER" ]; then
|
||||
EvacuateApp
|
||||
DeployApp
|
||||
CallApp
|
||||
fi
|
||||
}
|
||||
UpdateApp()
|
||||
{
|
||||
if [ -f "$WINEPREFIX/PACKAGE_VERSION" ] && [ "$(cat "$WINEPREFIX/PACKAGE_VERSION")" = "$APPVER" ]; then
|
||||
return
|
||||
fi
|
||||
if [ -d "${WINEPREFIX}.tmpdir" ]; then
|
||||
rm -rf "${WINEPREFIX}.tmpdir"
|
||||
fi
|
||||
ExtractApp "${WINEPREFIX}.tmpdir"
|
||||
/opt/deepinwine/tools/updater -s "${WINEPREFIX}.tmpdir" -c "${WINEPREFIX}" -v
|
||||
rm -rf "${WINEPREFIX}.tmpdir"
|
||||
echo "$APPVER" > "$WINEPREFIX/PACKAGE_VERSION"
|
||||
}
|
||||
RunApp()
|
||||
{
|
||||
$SHELL_DIR/deepin-wine-banner
|
||||
if [[ $? != 0 ]]; then
|
||||
debug_log "检测到 deepin-wine-banner 运行, exit 1"
|
||||
exit 1
|
||||
fi
|
||||
$SHELL_DIR/deepin-wine-banner start &
|
||||
if [ -d "$WINEPREFIX" ]; then
|
||||
UpdateApp
|
||||
else
|
||||
DeployApp
|
||||
fi
|
||||
CallApp "$1" "$2"
|
||||
}
|
||||
|
||||
CreateBottle()
|
||||
{
|
||||
CREATE_BOTTLE="1"
|
||||
if [ -d "$WINEPREFIX" ]; then
|
||||
UpdateApp
|
||||
else
|
||||
DeployApp
|
||||
fi
|
||||
}
|
||||
|
||||
# Check if some visual feedback is possible
|
||||
if command -v zenity >/dev/null 2>&1; then
|
||||
progressbar()
|
||||
{
|
||||
WINDOWID="" zenity --progress --title="$1" --text="$2" --pulsate --width=400 --auto-close --no-cancel ||
|
||||
WINDOWID="" zenity --progress --title="$1" --text="$2" --pulsate --width=400 --auto-close
|
||||
}
|
||||
|
||||
else
|
||||
progressbar()
|
||||
{
|
||||
cat -
|
||||
}
|
||||
fi
|
||||
|
||||
if [ -z $1 ] || [ -z $2 ]; then
|
||||
debug_log "Invalid params"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
BOTTLENAME="$1"
|
||||
WINEPREFIX="$HOME/.deepinwine/$1"
|
||||
APPDIR="/opt/deepinwine/apps/$1"
|
||||
APPVER="$2"
|
||||
|
||||
debug_log "Run $1 $2"
|
||||
|
||||
if [ -z "$WINE_WMCLASS" ]; then
|
||||
export WINE_WMCLASS="$DEB_PACKAGE_NAME"
|
||||
fi
|
||||
|
||||
if [ -z "$3" ]; then
|
||||
RunApp
|
||||
exit 0
|
||||
fi
|
||||
case $3 in
|
||||
"-r" | "--reset")
|
||||
ResetApp
|
||||
;;
|
||||
"-cb" | "--create")
|
||||
CreateBottle
|
||||
;;
|
||||
"-e" | "--remove")
|
||||
RemoveApp
|
||||
;;
|
||||
"-u" | "--uri")
|
||||
RunApp "$4" "$5"
|
||||
;;
|
||||
"-h" | "--help")
|
||||
HelpApp
|
||||
;;
|
||||
*)
|
||||
echo "Invalid option: $3"
|
||||
echo "Use -h|--help to get help"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
exit 0
|
1
helper/run_activex.sh
Symbolic link
1
helper/run_activex.sh
Symbolic link
@ -0,0 +1 @@
|
||||
run_v4.sh
|
536
helper/run_v2.sh
Executable file
536
helper/run_v2.sh
Executable file
@ -0,0 +1,536 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (C) 2016 Deepin, Inc.
|
||||
#
|
||||
# Author: Li LongYu <lilongyu@linuxdeepin.com>
|
||||
# Peng Hao <penghao@linuxdeepin.com>
|
||||
|
||||
WINEPREFIX="$HOME/.deepinwine/@public_bottle_name@"
|
||||
APPDIR="/opt/deepinwine/apps/@public_bottle_name@"
|
||||
APPVER="@deb_version_string@"
|
||||
APPTAR="files.7z"
|
||||
BOTTLENAME=""
|
||||
WINE_CMD="deepin-wine"
|
||||
CREATE_BOTTLE=""
|
||||
LOG_FILE=$0
|
||||
|
||||
init_log_file()
|
||||
{
|
||||
if [ ! -d "$DEBUG_LOG" ];then
|
||||
return
|
||||
fi
|
||||
|
||||
LOG_DIR=$(realpath $DEBUG_LOG)
|
||||
if [ -d "$LOG_DIR" ];then
|
||||
LOG_FILE="${LOG_DIR}/${LOG_FILE##*/}.log"
|
||||
echo "" > "$LOG_FILE"
|
||||
debug_log "LOG_FILE=$LOG_FILE"
|
||||
fi
|
||||
}
|
||||
|
||||
debug_log_to_file()
|
||||
{
|
||||
if [ -d "$DEBUG_LOG" ];then
|
||||
echo -e "${1}" >> "$LOG_FILE"
|
||||
fi
|
||||
}
|
||||
|
||||
debug_log()
|
||||
{
|
||||
echo "${1}"
|
||||
}
|
||||
|
||||
init_log_file
|
||||
|
||||
_SetRegistryValue()
|
||||
{
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD reg ADD "$1" /v "$2" /t $3 /d "$4" /f
|
||||
}
|
||||
|
||||
_DeleteRegistry()
|
||||
{
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD reg DELETE "$1" /f &> /dev/null
|
||||
}
|
||||
|
||||
_SetOverride()
|
||||
{
|
||||
_SetRegistryValue 'HKCU\Software\Wine\DllOverrides' "$2" REG_SZ "$1"
|
||||
}
|
||||
|
||||
_DisableAliUpdate()
|
||||
{
|
||||
if [ -f "${WINEPREFIX}/.disable" ];then
|
||||
return
|
||||
fi
|
||||
debug_log "Disable AliUpdate"
|
||||
touch ${WINEPREFIX}/.disable
|
||||
|
||||
/opt/deepinwine/tools/kill.sh AliWorkbench block
|
||||
VERSIONS=$(ls ${WINEPREFIX}'/drive_c/Program Files/AliWorkbench' | grep -E '*.*.*N')
|
||||
VERSIONS=$(echo $VERSIONS | awk '{print $2}')
|
||||
debug_log $VERSIONS
|
||||
|
||||
if [ -n "$VERSIONS" ];then
|
||||
debug_log "Remove bottle"
|
||||
rm -rf "$WINEPREFIX"
|
||||
/opt/deepinwine/apps/Deepin-QianNiu/run.sh -c
|
||||
fi
|
||||
|
||||
_SetOverride "" "AliUpdate"
|
||||
}
|
||||
|
||||
HelpApp()
|
||||
{
|
||||
echo " Extra Commands:"
|
||||
echo " -r/--reset Reset app to fix errors"
|
||||
echo " -e/--remove Remove deployed app files"
|
||||
echo " -h/--help Show program help info"
|
||||
}
|
||||
FixLink()
|
||||
{
|
||||
if [ -d ${WINEPREFIX} ]; then
|
||||
CUR_DIR=$PWD
|
||||
cd "${WINEPREFIX}/dosdevices"
|
||||
rm c: z: y:
|
||||
ln -s -f ../drive_c c:
|
||||
ln -s -f / z:
|
||||
ln -s -f $HOME y:
|
||||
cd $CUR_DIR
|
||||
ls -l "${WINEPREFIX}/dosdevices"
|
||||
fi
|
||||
}
|
||||
urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; }
|
||||
|
||||
uridecode()
|
||||
{
|
||||
local path=$(urldecode "$1")
|
||||
path=${path/file:\/\//}
|
||||
echo $path
|
||||
}
|
||||
|
||||
UnixUriToDosPath()
|
||||
{
|
||||
OPEN_FILE=$(uridecode "$1")
|
||||
if [ -f "$OPEN_FILE" ]; then
|
||||
OPEN_FILE=$(realpath "$OPEN_FILE")
|
||||
OPEN_FILE="z:$OPEN_FILE"
|
||||
debug_log "fond file $OPEN_FILE"
|
||||
OPEN_FILE=$(echo $OPEN_FILE | sed -e 's/\//\\\\/g')
|
||||
fi
|
||||
echo "OPEN_FILE"
|
||||
}
|
||||
|
||||
get_bottle_path_by_process_id()
|
||||
{
|
||||
PID_LIST="$1"
|
||||
PREFIX_LIST=""
|
||||
|
||||
for pid_var in $PID_LIST ; do
|
||||
WINE_PREFIX=$(xargs -0 printf '%s\n' < /proc/$pid_var/environ | grep WINEPREFIX)
|
||||
WINE_PREFIX=${WINE_PREFIX##*=}
|
||||
for path in $(echo -e $PREFIX_LIST) ; do
|
||||
if [[ $path == "$WINE_PREFIX" ]]; then
|
||||
WINE_PREFIX=""
|
||||
fi
|
||||
done
|
||||
if [ -d "$WINE_PREFIX" ]; then
|
||||
debug_log_to_file "found $pid_var : $WINE_PREFIX"
|
||||
PREFIX_LIST+="\n$WINE_PREFIX"
|
||||
fi
|
||||
done
|
||||
echo -e $PREFIX_LIST | grep $HOME
|
||||
}
|
||||
|
||||
get_bottle_path_by_process_name()
|
||||
{
|
||||
PID_LIST=$(ps -ef | grep -E -i "c:.*${1}" | grep -v grep | awk '{print $2}')
|
||||
debug_log_to_file "get pid list: $PID_LIST"
|
||||
get_bottle_path_by_process_id "$PID_LIST"
|
||||
}
|
||||
|
||||
#arg 1: windows process file path
|
||||
#arg 2-*: windows process args
|
||||
CallProcess()
|
||||
{
|
||||
#get file full path
|
||||
path="$1"
|
||||
path=$(echo ${path/c:/${WINEPREFIX}/drive_c})
|
||||
path=$(echo ${path//\\/\/})
|
||||
|
||||
#kill bloack process
|
||||
name="${path##*/}"
|
||||
/opt/deepinwine/tools/kill.sh "$name" block
|
||||
|
||||
#change current dir to excute path
|
||||
path=$(dirname "$path")
|
||||
cd "$path"
|
||||
pwd
|
||||
|
||||
#Set default mime type
|
||||
if [ -n "$MIME_TYPE" ]; then
|
||||
xdg-mime default "$DEB_PACKAGE_NAME".desktop "$MIME_TYPE"
|
||||
fi
|
||||
|
||||
debug_log_to_file "Starting process $* ..."
|
||||
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "$@" &
|
||||
}
|
||||
|
||||
AutoStartBottle()
|
||||
{
|
||||
debug_log "Auto start $WINEPREFIX"
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD /opt/deepinwine/tools/startbottle.exe &
|
||||
}
|
||||
|
||||
CallZhuMu()
|
||||
{
|
||||
#change current dir to excute path
|
||||
path=$(dirname "$path")
|
||||
cd "$path"
|
||||
pwd
|
||||
|
||||
#Set default mime type
|
||||
if [ -n "$MIME_TYPE" ]; then
|
||||
xdg-mime default "$DEB_PACKAGE_NAME".desktop "$MIME_TYPE"
|
||||
fi
|
||||
|
||||
debug_log_to_file "Starting process $* ..."
|
||||
if [ -n "$2" ];then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "$1" "--url=$2" &
|
||||
else
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "$1" &
|
||||
fi
|
||||
}
|
||||
|
||||
#arg 1: startserver just start server, or process file path
|
||||
#arg 2-*: windows process args
|
||||
CallYMDY()
|
||||
{
|
||||
SERVER_BOTTLE=$(get_bottle_path_by_process_name sqlservr.exe | grep $WINEPREFIX)
|
||||
if [ -z "$SERVER_BOTTLE" ]; then
|
||||
debug_log "Starting SQL Server ..."
|
||||
CallProcess "c:\\Program Files\\Microsoft SQL Server\\MSSQL\\Binn\\sqlservr.exe" -s MSSQLSERVER
|
||||
else
|
||||
debug_log "SQL Server is running in $SERVER_BOTTLE"
|
||||
fi
|
||||
|
||||
if [ "startserver" == "$1" ]; then
|
||||
debug_log "Auto start SQL Server"
|
||||
else
|
||||
CallProcess "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
CallYMGWY()
|
||||
{
|
||||
if [ "tongji" == "$1" ]; then
|
||||
firefox "http://127.0.0.1:64022/hzbtj" &
|
||||
else
|
||||
firefox "http://127.0.0.1:64022/hzb" &
|
||||
fi
|
||||
}
|
||||
|
||||
CallATM()
|
||||
{
|
||||
if [ ! -f "$WINEPREFIX/drive_c/Program Files/TradeManager/AliIM.exe" ]; then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "c:\\deepin\\AliIM2015_ATM.exe"
|
||||
fi
|
||||
CallProcess "$@"
|
||||
}
|
||||
|
||||
CallQIANNIU()
|
||||
{
|
||||
_DisableAliUpdate
|
||||
CallProcess "$@"
|
||||
}
|
||||
|
||||
CallYMDATJ()
|
||||
{
|
||||
if [ ! -f "$WINEPREFIX/drive_c/Program Files/JoinCheer/全国档案事业统计年报信息管理系统/ReportE.exe" ]; then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "c:\\deepin\\install\\setup.exe"
|
||||
fi
|
||||
|
||||
CallProcess "$@"
|
||||
}
|
||||
|
||||
CallQQGame()
|
||||
{
|
||||
debug_log "run $1"
|
||||
/opt/deepinwine/tools/kill.sh QQMicroGameBox block
|
||||
env WINEPREFIX="$WINEPREFIX" /opt/deepinwine/tools/QQGameRunner $1 &
|
||||
}
|
||||
|
||||
CallIrfanView()
|
||||
{
|
||||
OPEN_FILE="$(UnixUriToDosPath "$2")"
|
||||
debug_log "file path: $OPEN_FILE"
|
||||
|
||||
if [ -n "$OPEN_FILE" ]; then
|
||||
CallProcess "$1" "$OPEN_FILE"
|
||||
else
|
||||
CallProcess "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
CallQQ()
|
||||
{
|
||||
if [ ! -f "$WINEPREFIX/../.QQ_run" ]; then
|
||||
debug_log "first run time"
|
||||
/opt/deepinwine/tools/add_hotkeys
|
||||
/opt/deepinwine/tools/fontconfig
|
||||
touch "$WINEPREFIX/../.QQ_run"
|
||||
fi
|
||||
|
||||
#Support use native file dialog
|
||||
export ATTACH_FILE_DIALOG=1
|
||||
|
||||
CallProcess "$@"
|
||||
}
|
||||
|
||||
CallTIM()
|
||||
{
|
||||
if [ ! -f "$WINEPREFIX/../.QQ_run" ]; then
|
||||
debug_log "first run time"
|
||||
/opt/deepinwine/tools/add_hotkeys
|
||||
/opt/deepinwine/tools/fontconfig
|
||||
# If the bottle not exists, run reg may cost lots of times
|
||||
# So create the bottle befor run reg
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD uninstaller --list
|
||||
touch $WINEPREFIX/../.QQ_run
|
||||
fi
|
||||
|
||||
#Support use native file dialog
|
||||
export ATTACH_FILE_DIALOG=1
|
||||
|
||||
CallProcess "$@"
|
||||
|
||||
#disable Tencent MiniBrowser
|
||||
_DeleteRegistry "HKCU\\Software\\Tencent\\MiniBrowser"
|
||||
}
|
||||
|
||||
CallWeChat()
|
||||
{
|
||||
debug_log "Disable auto update"
|
||||
_DeleteRegistry "HKCU\\Software\\Tencent\\WeChat" "UpdateFailCnt"
|
||||
_DeleteRegistry "HKCU\\Software\\Tencent\\WeChat" "NeedUpdateType"
|
||||
rm "${WINEPREFIX}/drive_c/users/${USER}/Application Data/Tencent/WeChat/All Users/config/configEx.ini"
|
||||
|
||||
export DISABLE_RENDER_CLIPBOARD=1
|
||||
export ATTACH_FILE_DIALOG=1
|
||||
CallProcess "$@"
|
||||
}
|
||||
|
||||
CallWXWork()
|
||||
{
|
||||
if [ -d "${WINEPREFIX}/drive_c/users/${USER}/Application Data/Tencent/WXWork/Update" ]; then
|
||||
rm -rf "${WINEPREFIX}/drive_c/users/${USER}/Application Data/Tencent/WXWork/Update"
|
||||
fi
|
||||
if [ -d "${WINEPREFIX}/drive_c/users/${USER}/Application Data/Tencent/WXWork/upgrade" ]; then
|
||||
rm -rf "${WINEPREFIX}/drive_c/users/${USER}/Application Data/Tencent/WXWork/upgrade"
|
||||
fi
|
||||
#Support use native file dialog
|
||||
export ATTACH_FILE_DIALOG=1
|
||||
|
||||
CallProcess "$@"
|
||||
}
|
||||
|
||||
CallWangWang()
|
||||
{
|
||||
chmod 700 "$WINEPREFIX/drive_c/Program Files/AliWangWang/9.12.10C/wwbizsrv.exe"
|
||||
chmod 700 "$WINEPREFIX/drive_c/Program Files/Alibaba/wwbizsrv/wwbizsrv.exe"
|
||||
CallProcess "$@"
|
||||
}
|
||||
|
||||
#arg 1: exec file path
|
||||
#arg 2: autostart ,or exec arg 1
|
||||
#arg 3: exec arg 2
|
||||
CallApp()
|
||||
{
|
||||
FixLink
|
||||
debug_log "CallApp $BOTTLENAME $*"
|
||||
if [ "autostart" == "$2" ];then
|
||||
AutoStartBottle
|
||||
return
|
||||
fi
|
||||
|
||||
case $BOTTLENAME in
|
||||
"Deepin-WangWang")
|
||||
CallWangWang "$@"
|
||||
;;
|
||||
"Deepin-ZhuMu")
|
||||
CallZhuMu "$@"
|
||||
;;
|
||||
"Deepin-QQ")
|
||||
CallQQ "$@"
|
||||
;;
|
||||
"Deepin-TIM")
|
||||
CallTIM "$@"
|
||||
;;
|
||||
"Deepin-IrfanView")
|
||||
CallIrfanView "$@"
|
||||
;;
|
||||
"Deepin-dangantongji")
|
||||
CallYMDATJ "$@"
|
||||
;;
|
||||
"Deepin-YMDY")
|
||||
CallYMDY "$@"
|
||||
;;
|
||||
"Deepin-YMGWY")
|
||||
CallYMGWY "$@"
|
||||
;;
|
||||
"Deepin-QQGame"*)
|
||||
CallQQGame "$@"
|
||||
;;
|
||||
"Deepin-QianNiu")
|
||||
CallQIANNIU "$@"
|
||||
;;
|
||||
"Deepin-ATM")
|
||||
CallATM "$@"
|
||||
;;
|
||||
"Deepin-WeChat")
|
||||
CallWeChat "$@"
|
||||
;;
|
||||
"Deepin-WXWork")
|
||||
CallWXWork "$@"
|
||||
;;
|
||||
*)
|
||||
CallProcess "$@"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
ExtractApp()
|
||||
{
|
||||
$SHELL_DIR/deepin-wine-banner unpack &
|
||||
|
||||
mkdir -p "$1"
|
||||
7z x "$APPDIR/$APPTAR" -o"$1"
|
||||
mv "$1/drive_c/users/@current_user@" "$1/drive_c/users/$USER"
|
||||
sed -i "s#@current_user@#$USER#" $1/*.reg
|
||||
FixLink
|
||||
$SHELL_DIR/deepin-wine-banner unpacked
|
||||
}
|
||||
DeployApp()
|
||||
{
|
||||
ExtractApp "$WINEPREFIX"
|
||||
echo "$APPVER" > "$WINEPREFIX/PACKAGE_VERSION"
|
||||
}
|
||||
RemoveApp()
|
||||
{
|
||||
rm -rf "$WINEPREFIX"
|
||||
}
|
||||
ResetApp()
|
||||
{
|
||||
debug_log "Reset $PACKAGENAME....."
|
||||
read -p "* Are you sure?(Y/N)" ANSWER
|
||||
if [ "$ANSWER" = "Y" -o "$ANSWER" = "y" -o -z "$ANSWER" ]; then
|
||||
EvacuateApp
|
||||
DeployApp
|
||||
CallApp
|
||||
fi
|
||||
}
|
||||
UpdateApp()
|
||||
{
|
||||
if [ -f "$WINEPREFIX/PACKAGE_VERSION" ] && [ "$(cat "$WINEPREFIX/PACKAGE_VERSION")" = "$APPVER" ]; then
|
||||
return
|
||||
fi
|
||||
if [ -d "${WINEPREFIX}.tmpdir" ]; then
|
||||
rm -rf "${WINEPREFIX}.tmpdir"
|
||||
fi
|
||||
|
||||
case $BOTTLENAME in
|
||||
"Deepin-Intelligent" | "Deepin-QQ" | "Deepin-TIM" | "Deepin-WeChat" | "Deepin-WXWork")
|
||||
rm -rf "$WINEPREFIX"
|
||||
DeployApp
|
||||
return
|
||||
;;
|
||||
esac
|
||||
|
||||
ExtractApp "${WINEPREFIX}.tmpdir"
|
||||
/opt/deepinwine/tools/updater -s "${WINEPREFIX}.tmpdir" -c "${WINEPREFIX}" -v
|
||||
rm -rf "${WINEPREFIX}.tmpdir"
|
||||
echo "$APPVER" > "$WINEPREFIX/PACKAGE_VERSION"
|
||||
}
|
||||
RunApp()
|
||||
{
|
||||
$SHELL_DIR/deepin-wine-banner
|
||||
if [[ $? != 0 ]]; then
|
||||
debug_log "检测到 deepin-wine-banner 运行, exit 1"
|
||||
exit 1
|
||||
fi
|
||||
$SHELL_DIR/deepin-wine-banner start &
|
||||
if [ -d "$WINEPREFIX" ]; then
|
||||
UpdateApp
|
||||
else
|
||||
DeployApp
|
||||
fi
|
||||
CallApp "$@"
|
||||
}
|
||||
|
||||
CreateBottle()
|
||||
{
|
||||
CREATE_BOTTLE="1"
|
||||
if [ -d "$WINEPREFIX" ]; then
|
||||
UpdateApp
|
||||
else
|
||||
DeployApp
|
||||
fi
|
||||
}
|
||||
|
||||
# Check if some visual feedback is possible
|
||||
if command -v zenity >/dev/null 2>&1; then
|
||||
progressbar()
|
||||
{
|
||||
WINDOWID="" zenity --progress --title="$1" --text="$2" --pulsate --width=400 --auto-close --no-cancel ||
|
||||
WINDOWID="" zenity --progress --title="$1" --text="$2" --pulsate --width=400 --auto-close
|
||||
}
|
||||
|
||||
else
|
||||
progressbar()
|
||||
{
|
||||
cat -
|
||||
}
|
||||
fi
|
||||
|
||||
if [ -z $1 ] || [ -z $2 ] || [ -z "$3" ]; then
|
||||
debug_log "Invalid params"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
BOTTLENAME="$1"
|
||||
WINEPREFIX="$HOME/.deepinwine/$1"
|
||||
APPDIR="/opt/deepinwine/apps/$1"
|
||||
APPVER="$2"
|
||||
|
||||
debug_log "Run $*"
|
||||
|
||||
if [ -z "$WINE_WMCLASS" ]; then
|
||||
export WINE_WMCLASS="$DEB_PACKAGE_NAME"
|
||||
fi
|
||||
|
||||
if [ -z "$4" ]; then
|
||||
RunApp "$3"
|
||||
exit 0
|
||||
fi
|
||||
case $4 in
|
||||
"-r" | "--reset")
|
||||
ResetApp
|
||||
;;
|
||||
"-cb" | "--create")
|
||||
CreateBottle
|
||||
;;
|
||||
"-e" | "--remove")
|
||||
RemoveApp
|
||||
;;
|
||||
"-u" | "--uri")
|
||||
RunApp "$3" "$5" "$6"
|
||||
;;
|
||||
"-h" | "--help")
|
||||
HelpApp
|
||||
;;
|
||||
*)
|
||||
echo "Invalid option: $4"
|
||||
echo "Use -h|--help to get help"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
exit 0
|
600
helper/run_v3.sh
Executable file
600
helper/run_v3.sh
Executable file
@ -0,0 +1,600 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (C) 2016 Deepin, Inc.
|
||||
#
|
||||
# Author: Li LongYu <lilongyu@linuxdeepin.com>
|
||||
# Peng Hao <penghao@linuxdeepin.com>
|
||||
|
||||
WINEPREFIX="$HOME/.deepinwine/@public_bottle_name@"
|
||||
APPDIR="/opt/deepinwine/apps/@public_bottle_name@"
|
||||
APPVER="@deb_version_string@"
|
||||
APPTAR="files.7z"
|
||||
BOTTLENAME=""
|
||||
WINE_CMD="deepin-wine"
|
||||
LOG_FILE=$0
|
||||
CREATE_BOTTLE=""
|
||||
|
||||
SHELL_DIR=$(dirname $0)
|
||||
SHELL_DIR=$(realpath "$SHELL_DIR")
|
||||
if [ $SPECIFY_SHELL_DIR ]; then
|
||||
SHELL_DIR=$SPECIFY_SHELL_DIR
|
||||
fi
|
||||
|
||||
if [ $APPRUN_CMD ]; then
|
||||
WINE_CMD=$APPRUN_CMD
|
||||
fi
|
||||
|
||||
if [ $SPECIFY_SHELL_DIR ]; then
|
||||
SHELL_DIR=$SPECIFY_SHELL_DIR
|
||||
fi
|
||||
|
||||
_DeleteRegistry()
|
||||
{
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD reg DELETE "$1" /f &> /dev/null
|
||||
}
|
||||
|
||||
init_log_file()
|
||||
{
|
||||
if [ ! -d "$DEBUG_LOG" ];then
|
||||
return
|
||||
fi
|
||||
|
||||
LOG_DIR=$(realpath $DEBUG_LOG)
|
||||
if [ -d "$LOG_DIR" ];then
|
||||
LOG_FILE="${LOG_DIR}/${LOG_FILE##*/}.log"
|
||||
echo "" > "$LOG_FILE"
|
||||
debug_log "LOG_FILE=$LOG_FILE"
|
||||
fi
|
||||
}
|
||||
|
||||
debug_log_to_file()
|
||||
{
|
||||
if [ -d "$DEBUG_LOG" ];then
|
||||
echo -e "${1}" >> "$LOG_FILE"
|
||||
fi
|
||||
}
|
||||
|
||||
debug_log()
|
||||
{
|
||||
echo "${1}"
|
||||
}
|
||||
|
||||
HelpApp()
|
||||
{
|
||||
echo " Extra Commands:"
|
||||
echo " -r/--reset Reset app to fix errors"
|
||||
echo " -e/--remove Remove deployed app files"
|
||||
echo " -h/--help Show program help info"
|
||||
}
|
||||
|
||||
FixLink()
|
||||
{
|
||||
if [ -d ${WINEPREFIX} ]; then
|
||||
CUR_DIR=$PWD
|
||||
cd "${WINEPREFIX}/dosdevices"
|
||||
rm c: z: y:
|
||||
ln -s -f ../drive_c c:
|
||||
ln -s -f / z:
|
||||
ln -s -f $HOME y:
|
||||
cd $CUR_DIR
|
||||
ls -l "${WINEPREFIX}/dosdevices"
|
||||
fi
|
||||
}
|
||||
|
||||
DisableWrite()
|
||||
{
|
||||
if [ -d "${1}" ]; then
|
||||
chmod +w "${1}"
|
||||
rm -rf "${1}"
|
||||
fi
|
||||
|
||||
mkdir "${1}"
|
||||
chmod -w "${1}"
|
||||
}
|
||||
|
||||
is_autostart()
|
||||
{
|
||||
AUTOSTART="/opt/deepinwine/tools/autostart"
|
||||
if [ -f "$AUTOSTART.all" ]&&[ -f "/opt/apps/$1/files/run.sh" ];then
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ -f $AUTOSTART ];then
|
||||
grep -c "$1" $AUTOSTART > /dev/null
|
||||
return $?
|
||||
fi
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
#arg 1: windows process file path
|
||||
#arg 2-*: windows process args
|
||||
CallProcess()
|
||||
{
|
||||
#get file full path
|
||||
path="$1"
|
||||
path=$(echo ${path/c:/${WINEPREFIX}/drive_c})
|
||||
path=$(echo ${path//\\/\/})
|
||||
|
||||
#kill bloack process
|
||||
is_autostart $DEB_PACKAGE_NAME
|
||||
autostart=$?
|
||||
if [ $autostart -ne 0 ];then
|
||||
$SHELL_DIR/kill.sh "$BOTTLENAME" block
|
||||
fi
|
||||
|
||||
#change current dir to excute path
|
||||
path=$(dirname "$path")
|
||||
cd "$path"
|
||||
pwd
|
||||
|
||||
#Set default mime type
|
||||
if [ -n "$MIME_TYPE" ]; then
|
||||
xdg-mime default "$DEB_PACKAGE_NAME".desktop "$MIME_TYPE"
|
||||
fi
|
||||
|
||||
debug_log_to_file "Starting process $* ..."
|
||||
|
||||
export ATTACH_FILE_DIALOG=1
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "$@" &
|
||||
|
||||
#start autobottle
|
||||
if [ $autostart -eq 0 ];then
|
||||
$SHELL_DIR/autostart_wine.sh $DEB_PACKAGE_NAME
|
||||
fi
|
||||
}
|
||||
|
||||
CallZhuMu()
|
||||
{
|
||||
#change current dir to excute path
|
||||
path=$(dirname "$path")
|
||||
cd "$path"
|
||||
pwd
|
||||
|
||||
#Set default mime type
|
||||
if [ -n "$MIME_TYPE" ]; then
|
||||
xdg-mime default "$DEB_PACKAGE_NAME".desktop "$MIME_TYPE"
|
||||
fi
|
||||
|
||||
debug_log_to_file "Starting process $* ..."
|
||||
if [ -n "$2" ];then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "$1" "--url=$2" &
|
||||
else
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "$1" &
|
||||
fi
|
||||
}
|
||||
|
||||
CallQQGame()
|
||||
{
|
||||
debug_log "run $1"
|
||||
$SHELL_DIR/kill.sh qqgame block
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "$1" &
|
||||
}
|
||||
|
||||
CallQQ()
|
||||
{
|
||||
if [ ! -f "$WINEPREFIX/../.QQ_run" ]; then
|
||||
debug_log "first run time"
|
||||
$SHELL_DIR/add_hotkeys
|
||||
$SHELL_DIR/fontconfig
|
||||
touch "$WINEPREFIX/../.QQ_run"
|
||||
fi
|
||||
|
||||
DisableWrite "${WINEPREFIX}/drive_c/Program Files/Tencent/QQ/Bin/QQLiveMPlayer"
|
||||
DisableWrite "${WINEPREFIX}/drive_c/Program Files/Tencent/QQ/Bin/QQLiveMPlayer1"
|
||||
DisableWrite "${WINEPREFIX}/drive_c/Program Files/Tencent/QzoneMusic"
|
||||
|
||||
DisableWrite "${WINEPREFIX}/drive_c/Program Files/Tencent/QQBrowser"
|
||||
DisableWrite "${WINEPREFIX}/drive_c/Program Files/Common Files/Tencent/QQBrowser"
|
||||
DisableWrite "${WINEPREFIX}/drive_c/users/Public/Application Data/Tencent/QQBrowserBin"
|
||||
DisableWrite "${WINEPREFIX}/drive_c/users/Public/Application Data/Tencent/QQBrowserDefault"
|
||||
DisableWrite "${WINEPREFIX}/drive_c/users/${USER}/Application Data/Tencent/QQBrowserDefault"
|
||||
|
||||
DisableWrite "${WINEPREFIX}/drive_c/users/Public/Application Data/Tencent/QQPCMgr"
|
||||
DisableWrite "${WINEPREFIX}/drive_c/Program Files/Common Files/Tencent/QQPCMgr"
|
||||
|
||||
DisableWrite "${WINEPREFIX}/drive_c/Program Files/Common Files/Tencent/HuaYang"
|
||||
DisableWrite "${WINEPREFIX}/drive_c/users/${USER}/Application Data/Tencent/HuaYang"
|
||||
|
||||
#Support use native file dialog
|
||||
export ATTACH_FILE_DIALOG=1
|
||||
|
||||
CallProcess "$@"
|
||||
}
|
||||
|
||||
CallTIM()
|
||||
{
|
||||
if [ ! -f "$WINEPREFIX/../.QQ_run" ]; then
|
||||
debug_log "first run time"
|
||||
$SHELL_DIR/add_hotkeys
|
||||
$SHELL_DIR/fontconfig
|
||||
# If the bottle not exists, run reg may cost lots of times
|
||||
# So create the bottle befor run reg
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD uninstaller --list
|
||||
touch $WINEPREFIX/../.QQ_run
|
||||
fi
|
||||
|
||||
#Support use native file dialog
|
||||
export ATTACH_FILE_DIALOG=1
|
||||
|
||||
CallProcess "$@"
|
||||
|
||||
#disable Tencent MiniBrowser
|
||||
_DeleteRegistry "HKCU\\Software\\Tencent\\MiniBrowser"
|
||||
}
|
||||
|
||||
CallWeChat()
|
||||
{
|
||||
debug_log "Disable auto update"
|
||||
_DeleteRegistry "HKCU\\Software\\Tencent\\WeChat" "UpdateFailCnt"
|
||||
_DeleteRegistry "HKCU\\Software\\Tencent\\WeChat" "NeedUpdateType"
|
||||
rm "${WINEPREFIX}/drive_c/users/${USER}/Application Data/Tencent/WeChat/All Users/config/configEx.ini"
|
||||
|
||||
export DISABLE_RENDER_CLIPBOARD=1
|
||||
export ATTACH_FILE_DIALOG=1
|
||||
CallProcess "$@"
|
||||
}
|
||||
|
||||
CallWangWang()
|
||||
{
|
||||
chmod 700 "$WINEPREFIX/drive_c/Program Files/AliWangWang/9.12.10C/wwbizsrv.exe"
|
||||
chmod 700 "$WINEPREFIX/drive_c/Program Files/Alibaba/wwbizsrv/wwbizsrv.exe"
|
||||
if [ $# = 3 ] && [ -z "$3" ];then
|
||||
EXEC_PATH="c:/Program Files/AliWangWang/9.12.10C/WWCmd.exe"
|
||||
export ATTACH_FILE_DIALOG=1
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "$EXEC_PATH" "$2" &
|
||||
else
|
||||
CallProcess "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
CallWXWork()
|
||||
{
|
||||
if [ -d "${WINEPREFIX}/drive_c/users/${USER}/Application Data/Tencent/WXWork/Update" ]; then
|
||||
rm -rf "${WINEPREFIX}/drive_c/users/${USER}/Application Data/Tencent/WXWork/Update"
|
||||
fi
|
||||
if [ -d "${WINEPREFIX}/drive_c/users/${USER}/Application Data/Tencent/WXWork/upgrade" ]; then
|
||||
rm -rf "${WINEPREFIX}/drive_c/users/${USER}/Application Data/Tencent/WXWork/upgrade"
|
||||
fi
|
||||
#Support use native file dialog
|
||||
export ATTACH_FILE_DIALOG=1
|
||||
|
||||
CallProcess "$@"
|
||||
}
|
||||
|
||||
CallDingTalk()
|
||||
{
|
||||
debug_log "run $1"
|
||||
$SHELL_DIR/kill.sh DingTalk block
|
||||
|
||||
export ATTACH_FILE_DIALOG=1
|
||||
CallProcess "$@"
|
||||
}
|
||||
|
||||
urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; }
|
||||
|
||||
CallMeiTuXiuXiu()
|
||||
{
|
||||
#set -- "$1" "${2#file://*}"
|
||||
local path=$(urldecode "$2")
|
||||
path=${path/file:\/\//}
|
||||
set -- "$1" $path
|
||||
CallProcess "$@"
|
||||
}
|
||||
|
||||
CallFastReadPDF()
|
||||
{
|
||||
#set -- "$1" "${2#file://*}"
|
||||
local path=$(urldecode "$2")
|
||||
path=${path/file:\/\//}
|
||||
set -- "$1" $path
|
||||
CallProcess "$@"
|
||||
}
|
||||
|
||||
CallEvernote()
|
||||
{
|
||||
local path=$(urldecode "$2")
|
||||
path=${path/file:\/\//}
|
||||
set -- "$1" $path
|
||||
CallProcess "$@"
|
||||
}
|
||||
|
||||
CallTencentVideo()
|
||||
{
|
||||
if [ -f "${WINEPREFIX}/drive_c/Program Files/Tencent/QQLive/Upgrade.dll" ]; then
|
||||
rm -rf "${WINEPREFIX}/drive_c/Program Files/Tencent/QQLive/Upgrade.dll"
|
||||
fi
|
||||
|
||||
CallProcess "$@"
|
||||
}
|
||||
|
||||
CallFoxmail()
|
||||
{
|
||||
sed -i '/LogPixels/d' ${WINEPREFIX}/user.reg
|
||||
CallProcess "$@"
|
||||
}
|
||||
|
||||
CallTHS()
|
||||
{
|
||||
$SHELL_DIR/kill.sh ths block
|
||||
|
||||
debug_log "Start run $1"
|
||||
#get file full path
|
||||
path="$1"
|
||||
path=$(echo ${path/c:/${WINEPREFIX}/drive_c})
|
||||
path=$(echo ${path//\\/\/})
|
||||
|
||||
#kill bloack process
|
||||
name="${path##*/}"
|
||||
$SHELL_DIR/kill.sh "$name" block
|
||||
|
||||
#change current dir to excute path
|
||||
path=$(dirname "$path")
|
||||
cd "$path"
|
||||
pwd
|
||||
|
||||
#Set default mime type
|
||||
if [ -n "$MIME_TYPE" ]; then
|
||||
xdg-mime default "$DEB_PACKAGE_NAME".desktop "$MIME_TYPE"
|
||||
fi
|
||||
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "$@" &
|
||||
}
|
||||
|
||||
CallQQGameV2()
|
||||
{
|
||||
debug_log "run $1"
|
||||
$SHELL_DIR/kill.sh QQMicroGameBox block
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "$1" -action:force_download -appid:${2} -pid:8 -bin_version:1.1.2.4 -loginuin: &
|
||||
}
|
||||
|
||||
CallEBS250()
|
||||
{
|
||||
CallProcess "$@"
|
||||
}
|
||||
|
||||
CallPsCs6()
|
||||
{
|
||||
#get file full path
|
||||
path="$1"
|
||||
path=$(echo ${path/c:/${WINEPREFIX}/drive_c})
|
||||
path=$(echo ${path//\\/\/})
|
||||
|
||||
#kill bloack process
|
||||
name="${path##*/}"
|
||||
$SHELL_DIR/kill.sh "$name" block
|
||||
|
||||
#change current dir to excute path
|
||||
path=$(dirname "$path")
|
||||
cd "$path"
|
||||
pwd
|
||||
|
||||
#Set default mime type
|
||||
if [ -n "$MIME_TYPE" ]; then
|
||||
xdg-mime default "$DEB_PACKAGE_NAME".desktop "$MIME_TYPE"
|
||||
fi
|
||||
|
||||
debug_log_to_file "Starting process $* ..."
|
||||
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "$@" &
|
||||
}
|
||||
|
||||
#arg 1: exec file path
|
||||
#arg 2: autostart ,or exec arg 1
|
||||
#arg 3: exec arg 2
|
||||
CallApp()
|
||||
{
|
||||
FixLink
|
||||
debug_log "CallApp $BOTTLENAME $*"
|
||||
|
||||
case $BOTTLENAME in
|
||||
"Deepin-WangWang")
|
||||
CallWangWang "$@"
|
||||
;;
|
||||
"Deepin-ZhuMu")
|
||||
CallZhuMu "$@"
|
||||
;;
|
||||
"Deepin-QQ")
|
||||
CallQQ "$@"
|
||||
;;
|
||||
"Deepin-TIM")
|
||||
CallTIM "$@"
|
||||
;;
|
||||
"Deepin-QQGame"*)
|
||||
CallQQGame "$@"
|
||||
;;
|
||||
"Deepin-ATM")
|
||||
CallATM "$@"
|
||||
;;
|
||||
"Deepin-WeChat")
|
||||
CallWeChat "$@"
|
||||
;;
|
||||
"Deepin-WXWork")
|
||||
CallWXWork "$@"
|
||||
;;
|
||||
"Deepin-Dding")
|
||||
CallDingTalk "$@"
|
||||
;;
|
||||
"Deepin-MTXX")
|
||||
CallMeiTuXiuXiu "$@"
|
||||
;;
|
||||
"Deepin-FastReadPDF")
|
||||
CallFastReadPDF "$@"
|
||||
;;
|
||||
"Deepin-Evernote")
|
||||
CallEvernote "$@"
|
||||
;;
|
||||
"Deepin-TencentVideo")
|
||||
CallTencentVideo "$@"
|
||||
;;
|
||||
"Deepin-Foxmail")
|
||||
CallFoxmail "$@"
|
||||
;;
|
||||
"Deepin-THS")
|
||||
CallTHS "$@"
|
||||
;;
|
||||
"Deepin-QQHlddz")
|
||||
CallQQGameV2 "$1" 363
|
||||
;;
|
||||
"Deepin-QQBydr")
|
||||
CallQQGameV2 "$1" 1104632801
|
||||
;;
|
||||
"Deepin-QQMnsj")
|
||||
CallQQGameV2 "$1" 1105856612
|
||||
;;
|
||||
"Deepin-QQSszb")
|
||||
CallQQGameV2 "$1" 1105640244
|
||||
;;
|
||||
"Deepin-CS6")
|
||||
CallPsCs6 "$@"
|
||||
;;
|
||||
"Deepin-EBS250")
|
||||
CallEBS250 "$1"
|
||||
;;
|
||||
*)
|
||||
CallProcess "$@"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
ExtractApp()
|
||||
{
|
||||
$SHELL_DIR/deepin-wine-banner unpack &
|
||||
|
||||
mkdir -p "$1"
|
||||
7z x "$APPDIR/$APPTAR" -o"$1"
|
||||
mv "$1/drive_c/users/@current_user@" "$1/drive_c/users/$USER"
|
||||
sed -i "s#@current_user@#$USER#" $1/*.reg
|
||||
FixLink
|
||||
$SHELL_DIR/deepin-wine-banner unpacked
|
||||
}
|
||||
DeployApp()
|
||||
{
|
||||
ExtractApp "$WINEPREFIX"
|
||||
echo "$APPVER" > "$WINEPREFIX/PACKAGE_VERSION"
|
||||
}
|
||||
RemoveApp()
|
||||
{
|
||||
rm -rf "$WINEPREFIX"
|
||||
}
|
||||
ResetApp()
|
||||
{
|
||||
debug_log "Reset $PACKAGENAME....."
|
||||
read -p "* Are you sure?(Y/N)" ANSWER
|
||||
if [ "$ANSWER" = "Y" -o "$ANSWER" = "y" -o -z "$ANSWER" ]; then
|
||||
EvacuateApp
|
||||
DeployApp
|
||||
CallApp
|
||||
fi
|
||||
}
|
||||
UpdateApp()
|
||||
{
|
||||
if [ -f "$WINEPREFIX/PACKAGE_VERSION" ] && [ "$(cat "$WINEPREFIX/PACKAGE_VERSION")" = "$APPVER" ]; then
|
||||
return
|
||||
fi
|
||||
if [ -d "${WINEPREFIX}.tmpdir" ]; then
|
||||
rm -rf "${WINEPREFIX}.tmpdir"
|
||||
fi
|
||||
|
||||
case $BOTTLENAME in
|
||||
"Deepin-Intelligent" | "Deepin-QQ" | "Deepin-TIM" | "Deepin-WeChat" | "Deepin-WXWork" | "Deepin-Dding")
|
||||
rm -rf "$WINEPREFIX"
|
||||
DeployApp
|
||||
return
|
||||
;;
|
||||
esac
|
||||
|
||||
ExtractApp "${WINEPREFIX}.tmpdir"
|
||||
$SHELL_DIR/updater -s "${WINEPREFIX}.tmpdir" -c "${WINEPREFIX}" -v
|
||||
rm -rf "${WINEPREFIX}.tmpdir"
|
||||
echo "$APPVER" > "$WINEPREFIX/PACKAGE_VERSION"
|
||||
}
|
||||
RunApp()
|
||||
{
|
||||
$SHELL_DIR/deepin-wine-banner
|
||||
if [[ $? != 0 ]]; then
|
||||
debug_log "检测到 deepin-wine-banner 运行, exit 1"
|
||||
exit 1
|
||||
fi
|
||||
$SHELL_DIR/deepin-wine-banner start &
|
||||
if [ -d "$WINEPREFIX" ]; then
|
||||
UpdateApp
|
||||
else
|
||||
DeployApp
|
||||
fi
|
||||
CallApp "$@"
|
||||
}
|
||||
|
||||
CreateBottle()
|
||||
{
|
||||
CREATE_BOTTLE="1"
|
||||
if [ -d "$WINEPREFIX" ]; then
|
||||
UpdateApp
|
||||
else
|
||||
DeployApp
|
||||
fi
|
||||
}
|
||||
|
||||
init_log_file
|
||||
|
||||
# Check if some visual feedback is possible
|
||||
if command -v zenity >/dev/null 2>&1; then
|
||||
progressbar()
|
||||
{
|
||||
WINDOWID="" zenity --progress --title="$1" --text="$2" --pulsate --width=400 --auto-close --no-cancel ||
|
||||
WINDOWID="" zenity --progress --title="$1" --text="$2" --pulsate --width=400 --auto-close
|
||||
}
|
||||
|
||||
else
|
||||
progressbar()
|
||||
{
|
||||
cat -
|
||||
}
|
||||
fi
|
||||
|
||||
if [ -z $1 ] || [ -z $2 ] || [ -z "$3" ]; then
|
||||
debug_log "Invalid params"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
BOTTLENAME="$1"
|
||||
WINEPREFIX="$HOME/.deepinwine/$1"
|
||||
APPDIR="/opt/apps/${DEB_PACKAGE_NAME}/files"
|
||||
if [ -f "$APPDIR/files.md5sum" ];then
|
||||
APPVER="$(cat $APPDIR/files.md5sum)"
|
||||
else
|
||||
APPVER="$2"
|
||||
fi
|
||||
|
||||
debug_log "Run $*"
|
||||
|
||||
if [ -z "$WINE_WMCLASS" ]; then
|
||||
export WINE_WMCLASS="$DEB_PACKAGE_NAME"
|
||||
fi
|
||||
|
||||
if [ -z "$4" ]; then
|
||||
RunApp "$3"
|
||||
exit 0
|
||||
fi
|
||||
case $4 in
|
||||
"-r" | "--reset")
|
||||
ResetApp
|
||||
;;
|
||||
"-cb" | "--create")
|
||||
CreateBottle
|
||||
;;
|
||||
"-e" | "--remove")
|
||||
RemoveApp
|
||||
;;
|
||||
"-u" | "--uri")
|
||||
RunApp "$3" "$5" "$6"
|
||||
;;
|
||||
"-h" | "--help")
|
||||
HelpApp
|
||||
;;
|
||||
*)
|
||||
echo "Invalid option: $4"
|
||||
echo "Use -h|--help to get help"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
exit 0
|
698
helper/run_v4.sh
Executable file
698
helper/run_v4.sh
Executable file
@ -0,0 +1,698 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (C) 2016 Deepin, Inc.
|
||||
#
|
||||
# Author: Li LongYu <lilongyu@linuxdeepin.com>
|
||||
# Peng Hao <penghao@linuxdeepin.com>
|
||||
BOTTLENAME="$1"
|
||||
WINEPREFIX="$HOME/.deepinwine/$1"
|
||||
APPDIR="/opt/apps/${DEB_PACKAGE_NAME}/files"
|
||||
APPVER=""
|
||||
APPTAR="files.7z"
|
||||
WINE_CMD="deepin-wine"
|
||||
LOG_FILE=$0
|
||||
PUBLIC_DIR="/var/public"
|
||||
export WINEBANNER=1
|
||||
|
||||
SHELL_DIR=${0%/*}
|
||||
if [ $SPECIFY_SHELL_DIR ]; then
|
||||
SHELL_DIR=$SPECIFY_SHELL_DIR
|
||||
fi
|
||||
|
||||
if [ $APPRUN_CMD ]; then
|
||||
WINE_CMD=$APPRUN_CMD
|
||||
fi
|
||||
|
||||
if [ $SPECIFY_SHELL_DIR ]; then
|
||||
SHELL_DIR=$SPECIFY_SHELL_DIR
|
||||
fi
|
||||
|
||||
UsePublicDir()
|
||||
{
|
||||
if [ -z "$USE_PUBLIC_DIR" ]; then
|
||||
echo "Don't use public dir"
|
||||
return 1
|
||||
fi
|
||||
if [ ! -d "$PUBLIC_DIR" ];then
|
||||
echo "Not found $PUBLIC_DIR"
|
||||
return 1
|
||||
fi
|
||||
if [ ! -r "$PUBLIC_DIR" ];then
|
||||
echo "Can't read for $PUBLIC_DIR"
|
||||
return 1
|
||||
fi
|
||||
if [ ! -w "$PUBLIC_DIR" ];then
|
||||
echo "Can't write for $PUBLIC_DIR"
|
||||
return 1
|
||||
fi
|
||||
if [ ! -x "$PUBLIC_DIR" ];then
|
||||
echo "Can't excute for $PUBLIC_DIR"
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
_DeleteRegistry()
|
||||
{
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD reg DELETE "$1" /f &> /dev/null
|
||||
}
|
||||
|
||||
init_log_file()
|
||||
{
|
||||
if [ ! -d "$DEBUG_LOG" ];then
|
||||
return
|
||||
fi
|
||||
|
||||
LOG_DIR=$(realpath $DEBUG_LOG)
|
||||
if [ -d "$LOG_DIR" ];then
|
||||
LOG_FILE="${LOG_DIR}/${LOG_FILE##*/}.log"
|
||||
echo "" > "$LOG_FILE"
|
||||
debug_log "LOG_FILE=$LOG_FILE"
|
||||
fi
|
||||
}
|
||||
|
||||
debug_log_to_file()
|
||||
{
|
||||
if [ -d "$DEBUG_LOG" ];then
|
||||
echo -e "${1}" >> "$LOG_FILE"
|
||||
fi
|
||||
}
|
||||
|
||||
debug_log()
|
||||
{
|
||||
echo "${1}"
|
||||
}
|
||||
|
||||
HelpApp()
|
||||
{
|
||||
echo " Extra Commands:"
|
||||
echo " -r/--reset Reset app to fix errors"
|
||||
echo " -e/--remove Remove deployed app files"
|
||||
echo " -h/--help Show program help info"
|
||||
}
|
||||
|
||||
check_link()
|
||||
{
|
||||
if [ ! -d "$1" ];then
|
||||
echo "$1 不是目录,不能创建$2软连接"
|
||||
return
|
||||
fi
|
||||
link_path=$(realpath "$2")
|
||||
target_path=$(realpath "$1")
|
||||
if [ "$link_path" != "$target_path" ];then
|
||||
if [ -d "$2" ];then
|
||||
mv "$2" "${2}.bak"
|
||||
else
|
||||
rm "$2"
|
||||
fi
|
||||
echo "修复$2软连接为$1"
|
||||
ln -s -f "$1" "$2"
|
||||
fi
|
||||
}
|
||||
|
||||
FixLink()
|
||||
{
|
||||
if [ -d ${WINEPREFIX} ]; then
|
||||
CUR_DIR=$PWD
|
||||
cd "${WINEPREFIX}/dosdevices"
|
||||
check_link ../drive_c c:
|
||||
check_link / z:
|
||||
check_link $HOME y:
|
||||
cd "../drive_c/users/$USER"
|
||||
check_link "$HOME/Desktop" Desktop
|
||||
check_link "$HOME/Downloads" Downloads
|
||||
if [[ $WINE_CMD == *"deepin-wine8-stable"* ]];then
|
||||
check_link "$HOME/Documents" Documents
|
||||
else
|
||||
check_link "$HOME/Documents" "My Documents"
|
||||
fi
|
||||
cd $CUR_DIR
|
||||
#ls -l "${WINEPREFIX}/dosdevices"
|
||||
fi
|
||||
}
|
||||
|
||||
DisableWrite()
|
||||
{
|
||||
if [ -d "${1}" ]; then
|
||||
chmod +w "${1}"
|
||||
rm -rf "${1}"
|
||||
fi
|
||||
|
||||
mkdir "${1}"
|
||||
chmod -w "${1}"
|
||||
}
|
||||
|
||||
is_autostart()
|
||||
{
|
||||
AUTOSTART="/opt/deepinwine/tools/autostart"
|
||||
if [ -f "$AUTOSTART.all" ]&&[ -f "/opt/apps/$1/files/run.sh" ];then
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ -f $AUTOSTART ];then
|
||||
grep -c "$1" $AUTOSTART > /dev/null
|
||||
return $?
|
||||
fi
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
#arg 1: windows process file path
|
||||
#arg 2-*: windows process args
|
||||
CallProcess()
|
||||
{
|
||||
#get file full path
|
||||
path="$1"
|
||||
path=${path/c:/${WINEPREFIX}/drive_c}
|
||||
path=${path//\\/\/}
|
||||
|
||||
#kill bloack process
|
||||
is_autostart $DEB_PACKAGE_NAME
|
||||
autostart=$?
|
||||
if [[ $autostart -ne 0 ]] && [[ "$1" != *"pluginloader.exe" ]];then
|
||||
$SHELL_DIR/kill.sh "$BOTTLENAME" block
|
||||
fi
|
||||
|
||||
#change current dir to excute path
|
||||
path=${path%/*}
|
||||
cd "$path"
|
||||
#pwd
|
||||
|
||||
#Set default mime type
|
||||
if [ -n "$MIME_TYPE" ]; then
|
||||
xdg-mime default "$DEB_PACKAGE_NAME".desktop "$MIME_TYPE"
|
||||
fi
|
||||
|
||||
debug_log "Starting process $* ..."
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "$@" &
|
||||
|
||||
#start autobottle
|
||||
if [ $autostart -eq 0 ];then
|
||||
$SHELL_DIR/autostart_wine.sh $DEB_PACKAGE_NAME
|
||||
fi
|
||||
}
|
||||
|
||||
CallZhuMu()
|
||||
{
|
||||
#change current dir to excute path
|
||||
path=$(dirname "$path")
|
||||
cd "$path"
|
||||
pwd
|
||||
|
||||
#Set default mime type
|
||||
if [ -n "$MIME_TYPE" ]; then
|
||||
xdg-mime default "$DEB_PACKAGE_NAME".desktop "$MIME_TYPE"
|
||||
fi
|
||||
|
||||
debug_log_to_file "Starting process $* ..."
|
||||
if [ -n "$2" ];then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "$1" "--url=$2" &
|
||||
else
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "$1" &
|
||||
fi
|
||||
}
|
||||
|
||||
CallQQGame()
|
||||
{
|
||||
debug_log "run $1"
|
||||
$SHELL_DIR/kill.sh qqgame block
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "$1" &
|
||||
}
|
||||
|
||||
CallQQ()
|
||||
{
|
||||
if [ ! -f "$WINEPREFIX/../.QQ_run" ]; then
|
||||
debug_log "first run time"
|
||||
$SHELL_DIR/add_hotkeys
|
||||
$SHELL_DIR/fontconfig
|
||||
touch "$WINEPREFIX/../.QQ_run"
|
||||
fi
|
||||
|
||||
DisableWrite "${WINEPREFIX}/drive_c/Program Files/Tencent/QQ/Bin/QQLiveMPlayer"
|
||||
DisableWrite "${WINEPREFIX}/drive_c/Program Files/Tencent/QQ/Bin/QQLiveMPlayer1"
|
||||
DisableWrite "${WINEPREFIX}/drive_c/Program Files/Tencent/QzoneMusic"
|
||||
|
||||
DisableWrite "${WINEPREFIX}/drive_c/Program Files/Tencent/QQBrowser"
|
||||
DisableWrite "${WINEPREFIX}/drive_c/Program Files/Common Files/Tencent/QQBrowser"
|
||||
DisableWrite "${WINEPREFIX}/drive_c/users/Public/Application Data/Tencent/QQBrowserBin"
|
||||
DisableWrite "${WINEPREFIX}/drive_c/users/Public/Application Data/Tencent/QQBrowserDefault"
|
||||
DisableWrite "${WINEPREFIX}/drive_c/users/${USER}/Application Data/Tencent/QQBrowserDefault"
|
||||
|
||||
DisableWrite "${WINEPREFIX}/drive_c/users/Public/Application Data/Tencent/QQPCMgr"
|
||||
DisableWrite "${WINEPREFIX}/drive_c/Program Files/Common Files/Tencent/QQPCMgr"
|
||||
|
||||
DisableWrite "${WINEPREFIX}/drive_c/Program Files/Common Files/Tencent/HuaYang"
|
||||
DisableWrite "${WINEPREFIX}/drive_c/users/${USER}/Application Data/Tencent/HuaYang"
|
||||
|
||||
CallProcess "$@"
|
||||
}
|
||||
|
||||
CallTIM()
|
||||
{
|
||||
if [ ! -f "$WINEPREFIX/../.QQ_run" ]; then
|
||||
debug_log "first run time"
|
||||
$SHELL_DIR/add_hotkeys
|
||||
$SHELL_DIR/fontconfig
|
||||
# If the bottle not exists, run reg may cost lots of times
|
||||
# So create the bottle befor run reg
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD uninstaller --list
|
||||
touch $WINEPREFIX/../.QQ_run
|
||||
fi
|
||||
|
||||
CallProcess "$@"
|
||||
|
||||
#disable Tencent MiniBrowser
|
||||
_DeleteRegistry "HKCU\\Software\\Tencent\\MiniBrowser"
|
||||
}
|
||||
|
||||
CallWeChat()
|
||||
{
|
||||
export DISABLE_RENDER_CLIPBOARD=1
|
||||
CallProcess "$@"
|
||||
}
|
||||
|
||||
CallWangWang()
|
||||
{
|
||||
chmod 700 "$WINEPREFIX/drive_c/Program Files/AliWangWang/9.12.10C/wwbizsrv.exe"
|
||||
chmod 700 "$WINEPREFIX/drive_c/Program Files/Alibaba/wwbizsrv/wwbizsrv.exe"
|
||||
if [ $# = 3 ] && [ -z "$3" ];then
|
||||
EXEC_PATH="c:/Program Files/AliWangWang/9.12.10C/WWCmd.exe"
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "$EXEC_PATH" "$2" &
|
||||
else
|
||||
CallProcess "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
CallWXWork()
|
||||
{
|
||||
if [ -d "${WINEPREFIX}/drive_c/users/${USER}/Application Data/Tencent/WXWork/Update" ]; then
|
||||
rm -rf "${WINEPREFIX}/drive_c/users/${USER}/Application Data/Tencent/WXWork/Update"
|
||||
fi
|
||||
if [ -d "${WINEPREFIX}/drive_c/users/${USER}/Application Data/Tencent/WXWork/upgrade" ]; then
|
||||
rm -rf "${WINEPREFIX}/drive_c/users/${USER}/Application Data/Tencent/WXWork/upgrade"
|
||||
fi
|
||||
#Support use native file dialog
|
||||
|
||||
CallProcess "$@"
|
||||
}
|
||||
|
||||
CallDingTalk()
|
||||
{
|
||||
debug_log "run $1"
|
||||
$SHELL_DIR/kill.sh DingTalk block
|
||||
|
||||
CallProcess "$@"
|
||||
}
|
||||
|
||||
urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; }
|
||||
|
||||
CallMeiTuXiuXiu()
|
||||
{
|
||||
#set -- "$1" "${2#file://*}"
|
||||
local path=$(urldecode "$2")
|
||||
path=${path/file:\/\//}
|
||||
set -- "$1" $path
|
||||
CallProcess "$@"
|
||||
}
|
||||
|
||||
CallFastReadPDF()
|
||||
{
|
||||
#set -- "$1" "${2#file://*}"
|
||||
local path=$(urldecode "$2")
|
||||
path=${path/file:\/\//}
|
||||
set -- "$1" $path
|
||||
CallProcess "$@"
|
||||
}
|
||||
|
||||
CallEvernote()
|
||||
{
|
||||
local path=$(urldecode "$2")
|
||||
path=${path/file:\/\//}
|
||||
set -- "$1" $path
|
||||
CallProcess "$@"
|
||||
}
|
||||
|
||||
CallTencentVideo()
|
||||
{
|
||||
if [ -f "${WINEPREFIX}/drive_c/Program Files/Tencent/QQLive/Upgrade.dll" ]; then
|
||||
rm -rf "${WINEPREFIX}/drive_c/Program Files/Tencent/QQLive/Upgrade.dll"
|
||||
fi
|
||||
|
||||
CallProcess "$@"
|
||||
}
|
||||
|
||||
CallFoxmail()
|
||||
{
|
||||
sed -i '/LogPixels/d' ${WINEPREFIX}/user.reg
|
||||
CallProcess "$@"
|
||||
}
|
||||
|
||||
CallTHS()
|
||||
{
|
||||
$SHELL_DIR/kill.sh ths block
|
||||
|
||||
debug_log "Start run $1"
|
||||
#get file full path
|
||||
path="$1"
|
||||
path=$(echo ${path/c:/${WINEPREFIX}/drive_c})
|
||||
path=$(echo ${path//\\/\/})
|
||||
|
||||
#kill bloack process
|
||||
name="${path##*/}"
|
||||
$SHELL_DIR/kill.sh "$name" block
|
||||
|
||||
#change current dir to excute path
|
||||
path=$(dirname "$path")
|
||||
cd "$path"
|
||||
pwd
|
||||
|
||||
#Set default mime type
|
||||
if [ -n "$MIME_TYPE" ]; then
|
||||
xdg-mime default "$DEB_PACKAGE_NAME".desktop "$MIME_TYPE"
|
||||
fi
|
||||
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "$@" &
|
||||
}
|
||||
|
||||
CallQQGameV2()
|
||||
{
|
||||
debug_log "run $1"
|
||||
$SHELL_DIR/kill.sh QQMicroGameBox block
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "$1" -action:force_download -appid:${2} -pid:8 -bin_version:1.1.2.4 -loginuin: &
|
||||
}
|
||||
|
||||
CallPsCs6()
|
||||
{
|
||||
#get file full path
|
||||
path="$1"
|
||||
path=$(echo ${path/c:/${WINEPREFIX}/drive_c})
|
||||
path=$(echo ${path//\\/\/})
|
||||
|
||||
#kill bloack process
|
||||
name="${path##*/}"
|
||||
$SHELL_DIR/kill.sh "$name" block
|
||||
|
||||
#change current dir to excute path
|
||||
path=$(dirname "$path")
|
||||
cd "$path"
|
||||
pwd
|
||||
|
||||
#Set default mime type
|
||||
if [ -n "$MIME_TYPE" ]; then
|
||||
xdg-mime default "$DEB_PACKAGE_NAME".desktop "$MIME_TYPE"
|
||||
fi
|
||||
|
||||
debug_log_to_file "Starting process $* ..."
|
||||
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "$@" &
|
||||
}
|
||||
|
||||
UnixUriToDosPath()
|
||||
{
|
||||
OPEN_FILE="$1"
|
||||
if [ -f "$OPEN_FILE" ]; then
|
||||
OPEN_FILE=$(realpath "$OPEN_FILE")
|
||||
OPEN_FILE="z:$OPEN_FILE"
|
||||
OPEN_FILE=$(echo $OPEN_FILE | sed -e 's/\//\\\\/g')
|
||||
fi
|
||||
echo $OPEN_FILE
|
||||
}
|
||||
|
||||
#arg 1: exec file path
|
||||
#arg 2: autostart ,or exec arg 1
|
||||
#arg 3: exec arg 2
|
||||
CallApp()
|
||||
{
|
||||
FixLink
|
||||
debug_log "CallApp $BOTTLENAME arg count $#: $*"
|
||||
|
||||
if [ -f "/opt/apps/${DEB_PACKAGE_NAME}/files/pre_run.sh" ];then
|
||||
source "/opt/apps/${DEB_PACKAGE_NAME}/files/pre_run.sh"
|
||||
CallPreRun "$@"
|
||||
fi
|
||||
|
||||
case $BOTTLENAME in
|
||||
"Deepin-WangWang")
|
||||
CallWangWang "$@"
|
||||
;;
|
||||
"Deepin-ZhuMu")
|
||||
CallZhuMu "$@"
|
||||
;;
|
||||
"Deepin-QQ")
|
||||
CallQQ "$@"
|
||||
;;
|
||||
"Deepin-TIM")
|
||||
CallTIM "$@"
|
||||
;;
|
||||
"Deepin-QQGame"*)
|
||||
CallQQGame "$@"
|
||||
;;
|
||||
"Deepin-ATM")
|
||||
CallATM "$@"
|
||||
;;
|
||||
"Deepin-WeChat")
|
||||
CallWeChat "$@"
|
||||
;;
|
||||
"Deepin-WXWork")
|
||||
CallWXWork "$@"
|
||||
;;
|
||||
"Deepin-Dding")
|
||||
CallDingTalk "$@"
|
||||
;;
|
||||
"Deepin-MTXX")
|
||||
CallMeiTuXiuXiu "$@"
|
||||
;;
|
||||
"Deepin-FastReadPDF")
|
||||
CallFastReadPDF "$@"
|
||||
;;
|
||||
"Deepin-Evernote")
|
||||
CallEvernote "$@"
|
||||
;;
|
||||
"Deepin-TencentVideo")
|
||||
CallTencentVideo "$@"
|
||||
;;
|
||||
"Deepin-Foxmail")
|
||||
CallFoxmail "$@"
|
||||
;;
|
||||
"Deepin-THS")
|
||||
CallTHS "$@"
|
||||
;;
|
||||
"Deepin-QQHlddz")
|
||||
CallQQGameV2 "$1" 363
|
||||
;;
|
||||
"Deepin-QQBydr")
|
||||
CallQQGameV2 "$1" 1104632801
|
||||
;;
|
||||
"Deepin-QQMnsj")
|
||||
CallQQGameV2 "$1" 1105856612
|
||||
;;
|
||||
"Deepin-QQSszb")
|
||||
CallQQGameV2 "$1" 1105640244
|
||||
;;
|
||||
"Deepin-CS6")
|
||||
CallPsCs6 "$@"
|
||||
;;
|
||||
*)
|
||||
CallProcess "$@"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
ExtractApp()
|
||||
{
|
||||
$SHELL_DIR/deepin-wine-banner unpack &
|
||||
mkdir -p "$1"
|
||||
7z x "$APPDIR/$APPTAR" -o"$1"
|
||||
if [ $? != 0 ];then
|
||||
$SHELL_DIR/deepin-wine-banner info "解压失败"
|
||||
rm -rf "$1"
|
||||
exit 1
|
||||
fi
|
||||
mv "$1/drive_c/users/@current_user@" "$1/drive_c/users/$USER"
|
||||
sed -i "s#@current_user@#$USER#" $1/*.reg
|
||||
FixLink
|
||||
$SHELL_DIR/deepin-wine-banner unpacked
|
||||
}
|
||||
DeployApp()
|
||||
{
|
||||
ExtractApp "$WINEPREFIX"
|
||||
|
||||
if UsePublicDir;then
|
||||
chgrp -R users "$WINEPREFIX"
|
||||
chmod -R 0775 "$WINEPREFIX"
|
||||
fi
|
||||
|
||||
echo "$APPVER" > "$WINEPREFIX/PACKAGE_VERSION"
|
||||
}
|
||||
RemoveApp()
|
||||
{
|
||||
rm -rf "$WINEPREFIX"
|
||||
}
|
||||
ResetApp()
|
||||
{
|
||||
debug_log "Reset $PACKAGENAME....."
|
||||
read -p "* Are you sure?(Y/N)" ANSWER
|
||||
if [ "$ANSWER" = "Y" -o "$ANSWER" = "y" -o -z "$ANSWER" ]; then
|
||||
EvacuateApp
|
||||
DeployApp
|
||||
CallApp
|
||||
fi
|
||||
}
|
||||
UpdateApp()
|
||||
{
|
||||
if [ -d "${WINEPREFIX}.tmpdir" ]; then
|
||||
rm -rf "${WINEPREFIX}.tmpdir"
|
||||
fi
|
||||
|
||||
if [ -f "/opt/apps/${DEB_PACKAGE_NAME}/files/pre_update.sh" ];then
|
||||
source "/opt/apps/${DEB_PACKAGE_NAME}/files/pre_update.sh"
|
||||
CallPreUpdate
|
||||
return
|
||||
fi
|
||||
|
||||
case $BOTTLENAME in
|
||||
"Deepin-Intelligent" | "Deepin-QQ" | "Deepin-TIM" | "Deepin-WeChat" | "Deepin-WXWork" | "Deepin-Dding")
|
||||
rm -rf "$WINEPREFIX"
|
||||
DeployApp
|
||||
return
|
||||
;;
|
||||
esac
|
||||
|
||||
ExtractApp "${WINEPREFIX}.tmpdir"
|
||||
$SHELL_DIR/updater -s "${WINEPREFIX}.tmpdir" -c "${WINEPREFIX}" -v
|
||||
|
||||
if UsePublicDir;then
|
||||
chgrp -R users "$WINEPREFIX"
|
||||
chmod -R 0775 "$WINEPREFIX"
|
||||
fi
|
||||
|
||||
rm -rf "${WINEPREFIX}.tmpdir"
|
||||
echo "$APPVER" > "$WINEPREFIX/PACKAGE_VERSION"
|
||||
}
|
||||
RunApp()
|
||||
{
|
||||
$SHELL_DIR/deepin-wine-banner
|
||||
if [[ $? != 0 ]]; then
|
||||
debug_log "检测到 deepin-wine-banner 运行, exit 1"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
$SHELL_DIR/deepin-wine-banner start &
|
||||
|
||||
if [ -d "$WINEPREFIX" ]; then
|
||||
if [ ! -f "$WINEPREFIX/PACKAGE_VERSION" ] || [ "$(cat "$WINEPREFIX/PACKAGE_VERSION")" != "$APPVER" ]; then
|
||||
UpdateApp
|
||||
fi
|
||||
else
|
||||
DeployApp
|
||||
fi
|
||||
CallApp "$@"
|
||||
}
|
||||
|
||||
CreateBottle()
|
||||
{
|
||||
if [ -d "$WINEPREFIX" ]; then
|
||||
if [ ! -f "$WINEPREFIX/PACKAGE_VERSION" ] || [ "$(cat "$WINEPREFIX/PACKAGE_VERSION")" != "$APPVER" ]; then
|
||||
UpdateApp
|
||||
fi
|
||||
else
|
||||
DeployApp
|
||||
fi
|
||||
}
|
||||
|
||||
ParseArgs()
|
||||
{
|
||||
if [ $# -eq 4 ];then
|
||||
RunApp "$3"
|
||||
elif [ -f "$5" ];then
|
||||
if [ -n "$MIME_EXEC" ];then
|
||||
RunApp "$MIME_EXEC" "$(UnixUriToDosPath "$5")" "${@:6}"
|
||||
else
|
||||
RunApp "$3" "$(UnixUriToDosPath "$5")" "${@:6}"
|
||||
fi
|
||||
else
|
||||
RunApp "$3" "${@:5}"
|
||||
fi
|
||||
}
|
||||
|
||||
#init_log_file
|
||||
|
||||
# Check if some visual feedback is possible
|
||||
if command -v zenity >/dev/null 2>&1; then
|
||||
progressbar()
|
||||
{
|
||||
WINDOWID="" zenity --progress --title="$1" --text="$2" --pulsate --width=400 --auto-close --no-cancel ||
|
||||
WINDOWID="" zenity --progress --title="$1" --text="$2" --pulsate --width=400 --auto-close
|
||||
}
|
||||
|
||||
else
|
||||
progressbar()
|
||||
{
|
||||
cat -
|
||||
}
|
||||
fi
|
||||
|
||||
if [ $# -lt 3 ]; then
|
||||
debug_log "参数个数小于3个"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if UsePublicDir;then
|
||||
WINEPREFIX="$PUBLIC_DIR/$1"
|
||||
fi
|
||||
|
||||
if [ -f "$APPDIR/files.md5sum" ];then
|
||||
APPVER="$(cat $APPDIR/files.md5sum)"
|
||||
else
|
||||
APPVER="$2"
|
||||
fi
|
||||
|
||||
# ARM 需要指定模拟器参数
|
||||
if [ -f "/opt/deepinemu/tools/init_emu.sh" ];then
|
||||
source "/opt/deepinemu/tools/init_emu.sh"
|
||||
export EMU_CMD="$EMU_CMD"
|
||||
export EMU_ARGS="$EMU_ARGS"
|
||||
fi
|
||||
|
||||
debug_log "Run $*"
|
||||
|
||||
if [ -z "$WINE_WMCLASS" ]; then
|
||||
export WINE_WMCLASS="$DEB_PACKAGE_NAME"
|
||||
fi
|
||||
|
||||
#执行lnk文件通过判断第5个参数是否是“/Unix”来判断
|
||||
if [ "$4" == "/Unix" ];then
|
||||
RunApp "$3" "$4" "$5"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ $# -lt 4 ]; then
|
||||
RunApp "$3"
|
||||
exit 0
|
||||
fi
|
||||
case $4 in
|
||||
"-r" | "--reset")
|
||||
ResetApp
|
||||
;;
|
||||
"-cb" | "--create")
|
||||
CreateBottle
|
||||
;;
|
||||
"-e" | "--remove")
|
||||
RemoveApp
|
||||
;;
|
||||
"-u" | "--uri")
|
||||
ParseArgs "$@"
|
||||
;;
|
||||
"-f" | "--file")
|
||||
ParseArgs "$@"
|
||||
;;
|
||||
"-h" | "--help")
|
||||
HelpApp
|
||||
;;
|
||||
*)
|
||||
echo "Invalid option: $4"
|
||||
echo "Use -h|--help to get help"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
exit 0
|
BIN
helper/sendkeys.exe
Executable file
BIN
helper/sendkeys.exe
Executable file
Binary file not shown.
122
helper/sendkeys.sh
Executable file
122
helper/sendkeys.sh
Executable file
@ -0,0 +1,122 @@
|
||||
#!/bin/bash
|
||||
|
||||
# $1 key value
|
||||
# $2 process name , default QQ|TIM
|
||||
# $3 control mode , default ctrl+alt
|
||||
# 0 no control key
|
||||
# 1 shift+
|
||||
# 2 ctrl+
|
||||
# 3 alt+
|
||||
# 4 ctrl+alt+
|
||||
# 5 ctrl+shift+
|
||||
# 6 alt+shift+
|
||||
# 7 ctrl+alt+shift+
|
||||
|
||||
SHELL_DIR=$(dirname $0)
|
||||
SHELL_DIR=$(realpath "$SHELL_DIR")
|
||||
if [ $SPECIFY_SHELL_DIR ]; then
|
||||
SHELL_DIR=$SPECIFY_SHELL_DIR
|
||||
fi
|
||||
|
||||
get_wine_by_pid()
|
||||
{
|
||||
cat /proc/$1/maps | grep -E "\/wine$|\/wine64$|\/wine |\/wine64 " | head -1 | awk '{print $6}'
|
||||
}
|
||||
|
||||
get_winepredll_by_pid()
|
||||
{
|
||||
WINE_PREDLL=$(xargs -0 printf '%s\n' < /proc/$1/environ | grep WINEPREDLL)
|
||||
WINE_PREDLL=${WINE_PREDLL##*=}
|
||||
echo $WINE_PREDLL
|
||||
}
|
||||
|
||||
get_winedllpath_by_pid()
|
||||
{
|
||||
WINE_DLLPATH=$(xargs -0 printf '%s\n' < /proc/$1/environ | grep WINEDLLPATH)
|
||||
WINE_DLLPATH=${WINE_DLLPATH##*=}
|
||||
echo $WINE_DLLPATH
|
||||
}
|
||||
|
||||
is_wine_process()
|
||||
{
|
||||
wine_module=$(get_wine_by_pid $1)
|
||||
if [ -z "$wine_module" ];then
|
||||
wine_module=$(cat /proc/$1/maps | grep -E "\/wineserver$" | head -1)
|
||||
fi
|
||||
echo $wine_module
|
||||
}
|
||||
|
||||
get_prefix_by_pid()
|
||||
{
|
||||
WINE_PREFIX=$(xargs -0 printf '%s\n' < /proc/$1/environ | grep WINEPREFIX)
|
||||
WINE_PREFIX=${WINE_PREFIX##*=}
|
||||
if [ -z "$WINE_PREFIX" ] && [ -n "$(is_wine_process $1)" ]; then
|
||||
#不指定容器的情况用默认容器目录
|
||||
WINE_PREFIX="$HOME/.wine"
|
||||
fi
|
||||
WINE_PREFIX=$(realpath $WINE_PREFIX)
|
||||
echo $WINE_PREFIX
|
||||
}
|
||||
|
||||
get_bottle_path_by_process_id()
|
||||
{
|
||||
PID_LIST="$1"
|
||||
PREFIX_LIST=""
|
||||
|
||||
for pid_var in $PID_LIST ; do
|
||||
WINE_PREFIX=$(get_prefix_by_pid $pid_var)
|
||||
for path in $(echo -e $PREFIX_LIST) ; do
|
||||
prefix=${path#*=}
|
||||
if [ "$prefix" == "$WINE_PREFIX" ]; then
|
||||
WINE_PREFIX=""
|
||||
fi
|
||||
done
|
||||
if [ -n "$WINE_PREFIX" ];then
|
||||
PREFIX_LIST+="\n$pid_var=$WINE_PREFIX"
|
||||
fi
|
||||
done
|
||||
echo -e $PREFIX_LIST
|
||||
}
|
||||
|
||||
get_bottle_path_by_process_name()
|
||||
{
|
||||
PID_LIST=""
|
||||
for pid_var in $(ps -ef | grep -E -i "$1" | grep -v grep | awk '{print $2}');do
|
||||
#通过判断是否加载wine来判断是不是wine进程
|
||||
if [ -n "$(is_wine_process $pid_var)" ];then
|
||||
PID_LIST+=" $pid_var"
|
||||
fi
|
||||
done
|
||||
get_bottle_path_by_process_id "$PID_LIST"
|
||||
}
|
||||
|
||||
send_to_process()
|
||||
{
|
||||
if [ -z "$2" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
for path in $(get_bottle_path_by_process_name $2); do
|
||||
proc_pid=${path%=*}
|
||||
prefix=${path#*=}
|
||||
wine_cmd=$(get_wine_by_pid $proc_pid)
|
||||
wine_name=$(echo $wine_cmd | awk -F / '{print $(NF-2)}')
|
||||
if command -v $wine_name > /dev/null 2>&1; then
|
||||
wine_cmd="$wine_name"
|
||||
fi
|
||||
echo "send to $path by $wine_cmd"
|
||||
|
||||
env WINEPREDLL="$(get_winepredll_by_pid $proc_pid)" WINEDLLPATH="$(get_winedllpath_by_pid $proc_pid)" WINEPREFIX="$prefix" "$wine_cmd" "$SHELL_DIR/sendkeys.exe" $1 $3
|
||||
done
|
||||
}
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "Please input a key [a-zA-Z]"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -n "$2" ]; then
|
||||
send_to_process $1 $2 $3
|
||||
else
|
||||
send_to_process $1 "QQ|TIM"
|
||||
fi
|
22
helper/spark_get_tray_window
Executable file
22
helper/spark_get_tray_window
Executable file
@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env python3
|
||||
# vim: set ts=4 sw=4 fileencoding=utf-8:
|
||||
# Luomio <nohappiness@gmail.com>
|
||||
# Filename: dde-first-run.py
|
||||
# Create Date: 27-03, 13
|
||||
|
||||
import dbus
|
||||
|
||||
def get_tray_window():
|
||||
bus = dbus.SessionBus()
|
||||
traymanager = bus.get_object("com.deepin.dde.TrayManager", "/com/deepin/dde/TrayManager")
|
||||
|
||||
traymanager_iface = dbus.Interface(traymanager, dbus_interface='org.freedesktop.DBus.Properties')
|
||||
windows = traymanager_iface.Get("com.deepin.dde.TrayManager","TrayIcons")
|
||||
str="window_id:"
|
||||
for i in range(len(windows)):
|
||||
str += '{:#x} '.format(windows[i])
|
||||
|
||||
print(str)
|
||||
|
||||
if __name__ == "__main__":
|
||||
get_tray_window()
|
277
helper/spark_kill.sh
Executable file
277
helper/spark_kill.sh
Executable file
@ -0,0 +1,277 @@
|
||||
#!/bin/bash
|
||||
#####因为arm版本的deepin-wine-helper不带这个,又不想破坏x86兼容性,故改名
|
||||
APP_NAME="QQ"
|
||||
LOG_FILE=$0
|
||||
SHELL_DIR=${0%/*}
|
||||
if [ $SPECIFY_SHELL_DIR ]; then
|
||||
SHELL_DIR=$SPECIFY_SHELL_DIR
|
||||
fi
|
||||
|
||||
PUBLIC_DIR="/var/public"
|
||||
|
||||
UsePublicDir()
|
||||
{
|
||||
if [ -z "$USE_PUBLIC_DIR" ]; then
|
||||
echo "Don't use public dir"
|
||||
return 1
|
||||
fi
|
||||
if [ ! -d "$PUBLIC_DIR" ];then
|
||||
echo "Not found $PUBLIC_DIR"
|
||||
return 1
|
||||
fi
|
||||
if [ ! -r "$PUBLIC_DIR" ];then
|
||||
echo "Can't read for $PUBLIC_DIR"
|
||||
return 1
|
||||
fi
|
||||
if [ ! -w "$PUBLIC_DIR" ];then
|
||||
echo "Can't write for $PUBLIC_DIR"
|
||||
return 1
|
||||
fi
|
||||
if [ ! -x "$PUBLIC_DIR" ];then
|
||||
echo "Can't excute for $PUBLIC_DIR"
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
WINE_BOTTLE="$HOME/.deepinwine"
|
||||
|
||||
if UsePublicDir;then
|
||||
WINE_BOTTLE="$PUBLIC_DIR"
|
||||
fi
|
||||
|
||||
get_wine_by_pid()
|
||||
{
|
||||
wine_path=$(cat /proc/$1/maps | grep -E "\/wine$|\/wine64$|\/wine |\/wine64 " | head -1 | awk '{print $6}')
|
||||
if [ -z "$wine_path" ];then
|
||||
cat /proc/$1/cmdline| xargs -0 -L1 -I{} echo {} | grep -E "\/wine$|\/wine64$|\/wine |\/wine64 " | head -1
|
||||
else
|
||||
echo $wine_path
|
||||
fi
|
||||
}
|
||||
|
||||
is_wine_process()
|
||||
{
|
||||
wine_module=$(get_wine_by_pid $1)
|
||||
if [ -z "$wine_module" ];then
|
||||
wine_module=$(cat /proc/$1/maps | grep -E "\/wineserver$" | head -1)
|
||||
fi
|
||||
echo $wine_module
|
||||
}
|
||||
|
||||
get_prefix_by_pid()
|
||||
{
|
||||
WINE_PREFIX=$(xargs -0 printf '%s\n' < /proc/$1/environ | grep WINEPREFIX)
|
||||
WINE_PREFIX=${WINE_PREFIX##*=}
|
||||
if [ -z "$WINE_PREFIX" ] && [ -n "$(is_wine_process $1)" ]; then
|
||||
#不指定容器的情况用默认容器目录
|
||||
WINE_PREFIX="$HOME/.wine"
|
||||
fi
|
||||
if [ -n "$WINE_PREFIX" ];then
|
||||
WINE_PREFIX=$(realpath $WINE_PREFIX)
|
||||
echo $WINE_PREFIX
|
||||
fi
|
||||
}
|
||||
|
||||
get_wineserver()
|
||||
{
|
||||
if [ -z "$1" ];then
|
||||
return
|
||||
fi
|
||||
targ_prefix=$(realpath $1)
|
||||
ps -ef | grep wineserver | while read server_info ;do
|
||||
debug_log_to_file "get server info: $server_info"
|
||||
server_pid=$(echo $server_info | awk '{print $2}')
|
||||
server_prefix=$(get_prefix_by_pid $server_pid)
|
||||
debug_log_to_file "get server pid $server_pid, prefix: $server_prefix"
|
||||
|
||||
if [ "$targ_prefix" = "$server_prefix" ];then
|
||||
server=$(echo $server_info | awk '{print $NF}')
|
||||
if [ "-p0" = "$server" ];then
|
||||
server=$(echo $server_info | awk '{print $(NF-1)}')
|
||||
fi
|
||||
debug_log_to_file "get server $server"
|
||||
echo $server
|
||||
return
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
init_log_file()
|
||||
{
|
||||
if [ -d "$DEBUG_LOG" ];then
|
||||
LOG_DIR=$(realpath $DEBUG_LOG)
|
||||
if [ -d "$LOG_DIR" ];then
|
||||
LOG_FILE="${LOG_DIR}/${LOG_FILE##*/}.log"
|
||||
echo "" > "$LOG_FILE"
|
||||
debug_log "LOG_FILE=$LOG_FILE"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
debug_log_to_file()
|
||||
{
|
||||
if [ -d "$DEBUG_LOG" ];then
|
||||
strDate=$(date)
|
||||
echo -e "${strDate}:${1}" >> "$LOG_FILE"
|
||||
fi
|
||||
}
|
||||
|
||||
debug_log()
|
||||
{
|
||||
strDate=$(date)
|
||||
echo "${strDate}:${1}"
|
||||
}
|
||||
|
||||
init_log_file
|
||||
|
||||
get_bottle_path_by_process_id()
|
||||
{
|
||||
PID_LIST="$1"
|
||||
PREFIX_LIST=""
|
||||
|
||||
for pid_var in $PID_LIST ; do
|
||||
WINE_PREFIX=$(get_prefix_by_pid $pid_var)
|
||||
#去掉重复项
|
||||
for path in $(echo -e $PREFIX_LIST) ; do
|
||||
if [[ $path == "$WINE_PREFIX" ]]; then
|
||||
WINE_PREFIX=""
|
||||
fi
|
||||
done
|
||||
if [ -d "$WINE_PREFIX" ]; then
|
||||
debug_log_to_file "found $pid_var : $WINE_PREFIX"
|
||||
PREFIX_LIST+="\n$WINE_PREFIX"
|
||||
fi
|
||||
done
|
||||
echo -e $PREFIX_LIST
|
||||
}
|
||||
|
||||
get_pid_by_process_name()
|
||||
{
|
||||
PID_LIST=""
|
||||
for pid_var in $(ps -ef | grep -E -i "$1" | grep -v grep | awk '{print $2}');do
|
||||
#通过判断是否加载wine来判断是不是wine进程
|
||||
if [ -n "$(is_wine_process $pid_var)" ];then
|
||||
PID_LIST+=" $pid_var"
|
||||
fi
|
||||
done
|
||||
echo "$PID_LIST"
|
||||
}
|
||||
|
||||
get_bottle_path_by_process_name()
|
||||
{
|
||||
PID_LIST=$(get_pid_by_process_name $1)
|
||||
debug_log_to_file "get pid list: $PID_LIST"
|
||||
get_bottle_path_by_process_id "$PID_LIST"
|
||||
}
|
||||
|
||||
get_bottle_path()
|
||||
{
|
||||
if [ -z "$1" ];then
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ -f "$1/user.reg" ]; then
|
||||
realpath "$1"
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ -f "$WINE_BOTTLE/$1/user.reg" ]; then
|
||||
realpath "$WINE_BOTTLE/$1"
|
||||
return 0
|
||||
fi
|
||||
get_bottle_path_by_process_name "$1"
|
||||
}
|
||||
|
||||
kill_app()
|
||||
{
|
||||
debug_log "try to kill $1"
|
||||
for path in $(get_bottle_path $1); do
|
||||
if [ -n "$path" ];then
|
||||
WINESERVER=$(get_wineserver "$path")
|
||||
|
||||
if [ -f "$WINESERVER" ];then
|
||||
debug_log "kill $path by $WINESERVER"
|
||||
env WINEPREFIX="$path" "$WINESERVER" -k
|
||||
fi
|
||||
|
||||
PID_LIST=$(get_pid_by_process_name "exe|wine")
|
||||
for tag_pid in $PID_LIST; do
|
||||
bottle=$(get_bottle_path_by_process_id "$tag_pid")
|
||||
bottle=${bottle:1}
|
||||
if [ "$path" = "$bottle" ];then
|
||||
echo "kill $tag_pid for $bottle"
|
||||
kill -9 $tag_pid
|
||||
fi
|
||||
done
|
||||
fi
|
||||
done
|
||||
|
||||
#Kill defunct process
|
||||
ps -ef | grep -E "$USER.*exe.*<defunct>"
|
||||
ps -ef | grep -E "$USER.*exe.*<defunct>" | grep -v grep | awk '{print $2}' | xargs -i kill -9 {}
|
||||
}
|
||||
|
||||
get_tray_window()
|
||||
{
|
||||
$SHELL_DIR/spark_get_tray_window | awk -F: '{print $2}'
|
||||
}
|
||||
|
||||
get_stacking_window()
|
||||
{
|
||||
xprop -root _NET_CLIENT_LIST_STACKING | awk -F# '{print $2}' | sed -e 's/, / /g'
|
||||
}
|
||||
|
||||
get_window_pid()
|
||||
{
|
||||
for winid in $(echo "$1" | sed -e 's/ /\n/g') ;
|
||||
do
|
||||
xprop -id $winid _NET_WM_PID | awk -F= '{print $2}'
|
||||
done
|
||||
}
|
||||
|
||||
get_window_bottle()
|
||||
{
|
||||
debug_log_to_file "get_window_bottle $1"
|
||||
PID_LIST=$(get_window_pid "$1")
|
||||
debug_log_to_file "get_window_bottle pid list: $PID_LIST"
|
||||
get_bottle_path_by_process_id "$PID_LIST"
|
||||
}
|
||||
|
||||
get_active_bottles()
|
||||
{
|
||||
TRAYWINDOWS=$(get_tray_window)
|
||||
STACKINGWINDOWS=$(get_stacking_window)
|
||||
debug_log_to_file "tray window id: $TRAYWINDOWS"
|
||||
debug_log_to_file "stacking window id: $STACKINGWINDOWS"
|
||||
PID_LIST="$TRAYWINDOWS $STACKINGWINDOWS"
|
||||
get_window_bottle "$PID_LIST"
|
||||
}
|
||||
|
||||
kill_exit_block_app()
|
||||
{
|
||||
TAGBOTTLE=$(get_bottle_path $1)
|
||||
debug_log "tag bottle: $TAGBOTTLE"
|
||||
ACTIVEBOTTLES=$(get_active_bottles)
|
||||
debug_log "active bottles: $ACTIVEBOTTLES"
|
||||
|
||||
if [[ "$ACTIVEBOTTLES" != *"$TAGBOTTLE"* ]]; then
|
||||
kill_app "$TAGBOTTLE"
|
||||
fi
|
||||
}
|
||||
|
||||
#get_active_bottles
|
||||
#exit
|
||||
|
||||
debug_log "kill $1 $2"
|
||||
|
||||
if [ -n "$1" ]; then
|
||||
APP_NAME="$1"
|
||||
fi
|
||||
|
||||
if [ "$2" = "block" ]; then
|
||||
kill_exit_block_app $APP_NAME $3
|
||||
else
|
||||
kill_app $APP_NAME
|
||||
fi
|
401
helper/spark_run_v4.sh
Executable file
401
helper/spark_run_v4.sh
Executable file
@ -0,0 +1,401 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (C) 2016 Deepin, Inc.
|
||||
# Copyright (C) 2022 The Spark Project
|
||||
#
|
||||
# Author: Li LongYu <lilongyu@linuxdeepin.com>
|
||||
# Peng Hao <penghao@linuxdeepin.com>
|
||||
#
|
||||
# Modifier: shenmo <shenmo@spark-app.store>
|
||||
#
|
||||
#
|
||||
|
||||
source /opt/durapps/transhell/transhell.sh
|
||||
load_transhell_debug
|
||||
|
||||
WINEPREFIX="$HOME/.deepinwine/@public_bottle_name@"
|
||||
APPDIR="/opt/deepinwine/apps/@public_bottle_name@"
|
||||
APPVER="@deb_version_string@"
|
||||
APPTAR="files.7z"
|
||||
BOTTLENAME=""
|
||||
WINE_CMD="deepin-wine"
|
||||
#这里会被后续覆盖,似乎没啥用
|
||||
LOG_FILE=$0
|
||||
PUBLIC_DIR="/var/public"
|
||||
|
||||
SHELL_DIR=$(dirname $0)
|
||||
SHELL_DIR=$(realpath "$SHELL_DIR")
|
||||
if [ $SPECIFY_SHELL_DIR ]; then
|
||||
SHELL_DIR=$SPECIFY_SHELL_DIR
|
||||
fi
|
||||
|
||||
if [ $APPRUN_CMD ]; then
|
||||
WINE_CMD=$APPRUN_CMD
|
||||
fi
|
||||
|
||||
if [ $SPECIFY_SHELL_DIR ]; then
|
||||
SHELL_DIR=$SPECIFY_SHELL_DIR
|
||||
fi
|
||||
|
||||
# Check if some visual feedback is possible
|
||||
if command -v zenity >/dev/null 2>&1; then
|
||||
progressbar()
|
||||
{
|
||||
WINDOWID="" zenity --progress --title="$1" --text="$2" --pulsate --width=400 --auto-close --no-cancel ||
|
||||
WINDOWID="" zenity --progress --title="$1" --text="$2" --pulsate --width=400 --auto-close
|
||||
}
|
||||
|
||||
else
|
||||
progressbar()
|
||||
{
|
||||
cat -
|
||||
}
|
||||
fi
|
||||
|
||||
_DeleteRegistry()
|
||||
{
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD reg DELETE "$1" /f &> /dev/null
|
||||
}
|
||||
#########功能:删除注册表
|
||||
init_log_file()
|
||||
{
|
||||
if [ ! -d "$DEBUG_LOG" ];then
|
||||
return
|
||||
fi
|
||||
|
||||
LOG_DIR=$(realpath $DEBUG_LOG)
|
||||
if [ -d "$LOG_DIR" ];then
|
||||
LOG_FILE="${LOG_DIR}/${LOG_FILE##*/}.log"
|
||||
echo "" > "$LOG_FILE"
|
||||
debug_log "LOG_FILE=$LOG_FILE"
|
||||
fi
|
||||
}
|
||||
|
||||
debug_log_to_file()
|
||||
{
|
||||
if [ -d "$DEBUG_LOG" ];then
|
||||
echo -e "${1}" >> "$LOG_FILE"
|
||||
fi
|
||||
}
|
||||
|
||||
debug_log()
|
||||
{
|
||||
echo "${1}"
|
||||
}
|
||||
################log相关功能
|
||||
HelpApp()
|
||||
{
|
||||
echo " Extra Commands:"
|
||||
echo " -r/--reset Reset app to fix errors"
|
||||
echo " -e/--remove Remove deployed app files"
|
||||
echo " -h/--help Show program help info"
|
||||
}
|
||||
#############帮助文件
|
||||
FixLink()
|
||||
{
|
||||
if [ -d ${WINEPREFIX} ]; then
|
||||
CUR_DIR=$PWD
|
||||
cd "${WINEPREFIX}/dosdevices"
|
||||
rm c: z: y:
|
||||
ln -s -f ../drive_c c:
|
||||
ln -s -f / z:
|
||||
ln -s -f $HOME y:
|
||||
cd $CUR_DIR
|
||||
#ls -l "${WINEPREFIX}/dosdevices"
|
||||
fi
|
||||
}
|
||||
###########会在应用启动和解压时执行,驱动器绑定
|
||||
DisableWrite()
|
||||
{
|
||||
if [ -d "${1}" ]; then
|
||||
chmod +w "${1}"
|
||||
rm -rf "${1}"
|
||||
fi
|
||||
|
||||
mkdir "${1}"
|
||||
chmod -w "${1}"
|
||||
}
|
||||
########如果有该文件夹则删除,然后再创建一个不允许写入的(这东西是被用在了QQ启动上,看来腾讯不怎么好对付)
|
||||
is_autostart()
|
||||
{
|
||||
AUTOSTART="/opt/deepinwine/tools/autostart"
|
||||
if [ -f "$AUTOSTART.all" ]&&[ -f "/opt/apps/$1/files/run.sh" ];then
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ -f $AUTOSTART ];then
|
||||
grep -c "$1" $AUTOSTART > /dev/null
|
||||
return $?
|
||||
fi
|
||||
|
||||
return 1
|
||||
}
|
||||
#########自动启动相关,等用到了再研究
|
||||
urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; }
|
||||
#######url转义
|
||||
|
||||
#arg 1: windows process file path
|
||||
#arg 2-*: windows process args
|
||||
CallProcess()
|
||||
{
|
||||
#get file full path
|
||||
path="$1"
|
||||
path=$(echo ${path/c:/${WINEPREFIX}/drive_c})
|
||||
path=$(echo ${path//\\/\/})
|
||||
|
||||
#kill bloack process
|
||||
is_autostart $DEB_PACKAGE_NAME
|
||||
autostart=$?
|
||||
if [ $autostart -ne 0 ];then
|
||||
$SHELL_DIR/spark_kill.sh "$BOTTLENAME" block
|
||||
fi
|
||||
|
||||
#change current dir to excute path
|
||||
path=$(dirname "$path")
|
||||
cd "$path"
|
||||
pwd
|
||||
|
||||
#Set default mime type
|
||||
if [ -n "$MIME_TYPE" ]; then
|
||||
xdg-mime default "$DEB_PACKAGE_NAME".desktop "$MIME_TYPE"
|
||||
fi
|
||||
# Disable winemenubuilder
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD reg add 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v winemenubuilder.exe /f
|
||||
# Link to Document
|
||||
if [ -L "$WINEPREFIX/drive_c/users/$(whoami)/My Documents" ]; then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD reg add 'HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders' /t REG_EXPAND_SZ /v Personal /d "%USERPROFILE%\My Documents" /f
|
||||
|
||||
else
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD reg add 'HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders' /t REG_EXPAND_SZ /v Personal /d "%USERPROFILE%\Documents" /f
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
debug_log_to_file "Starting process $* ..."
|
||||
|
||||
############# WARNING: Here is the modified content: Now will run set-dwine-scale.sh
|
||||
/opt/durapps/spark-dwine-helper/scale-set-helper/set-wine-scale.sh "$WINEPREFIX"
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "$@"
|
||||
|
||||
#start autobottle
|
||||
if [ $autostart -eq 0 ];then
|
||||
$SHELL_DIR/autostart_wine.sh $DEB_PACKAGE_NAME
|
||||
fi
|
||||
}
|
||||
###通用启动APP逻辑。对于没有被case捕捉的非适配APP,则直接执行此部分。似乎已经有了防止残留的功能
|
||||
###一些自定义的应用不会使用这个启动,而另一些则会调用这个
|
||||
###有设置mimetype和自动启动(这个暂时没分析)的功能
|
||||
|
||||
###########专属优化段:
|
||||
|
||||
|
||||
UnixUriToDosPath()
|
||||
{
|
||||
OPEN_FILE="$1"
|
||||
if [ -f "$OPEN_FILE" ]; then
|
||||
OPEN_FILE=$(realpath "$OPEN_FILE")
|
||||
OPEN_FILE="z:$OPEN_FILE"
|
||||
OPEN_FILE=$(echo $OPEN_FILE | sed -e 's/\//\\\\/g')
|
||||
fi
|
||||
echo $OPEN_FILE
|
||||
}
|
||||
|
||||
#arg 1: exec file path
|
||||
#arg 2: autostart ,or exec arg 1
|
||||
#arg 3: exec arg 2
|
||||
|
||||
#### CallApp段,根据容器名找专属优化,没有就走通用启动
|
||||
CallApp()
|
||||
{
|
||||
FixLink
|
||||
debug_log "CallApp $BOTTLENAME arg count $#: $*"
|
||||
if [ -f "/opt/apps/${DEB_PACKAGE_NAME}/files/pre_run.sh" ];then
|
||||
source "/opt/apps/${DEB_PACKAGE_NAME}/files/pre_run.sh"
|
||||
CallPreRun "$@"
|
||||
fi
|
||||
|
||||
APP_CONFIG_PATH="/opt/deepinwine/tools/spark_run_v4_app_configs/${BOTTLENAME}.sh"
|
||||
|
||||
if [ -f "$APP_CONFIG_PATH" ]; then
|
||||
echo "执行 ${BOTTLENAME}.sh ..."
|
||||
source $APP_CONFIG_PATH
|
||||
else
|
||||
echo "$APP_CONFIG_PATH 文件不存在,执行通用启动"
|
||||
CallProcess "$@"
|
||||
fi
|
||||
|
||||
}
|
||||
ExtractApp()
|
||||
{
|
||||
local tmp_log=$(mktemp)
|
||||
mkdir -p "$1"
|
||||
(7z x "$APPDIR/$APPTAR" -o"$1" -bsp1 -bb1 -bse2 | grep --line-buffered -oP "(\d+(\.\d+)?(?=%))" > $tmp_log)&
|
||||
|
||||
cmd_pid=$!
|
||||
(while kill -0 $cmd_pid 2> /dev/null; do
|
||||
cat "${tmp_log}"
|
||||
sleep 1
|
||||
done)| zenity --progress --title="$BOTTLENAME" --text="${TRANSHELL_CONTENT_UNPACKING} $BOTTLENAME..." --width=400 --auto-close --no-cancel
|
||||
|
||||
|
||||
|
||||
mv "$1/drive_c/users/@current_user@" "$1/drive_c/users/$USER"
|
||||
sed -i "s#@current_user@#$USER#" $1/*.reg
|
||||
FixLink
|
||||
}
|
||||
DeployApp()
|
||||
{
|
||||
ExtractApp "$WINEPREFIX"
|
||||
|
||||
|
||||
echo "$APPVER" > "$WINEPREFIX/PACKAGE_VERSION"
|
||||
|
||||
}
|
||||
RemoveApp()
|
||||
{
|
||||
rm -rf "$WINEPREFIX"
|
||||
}
|
||||
ResetApp()
|
||||
{
|
||||
debug_log "Reset $PACKAGENAME....."
|
||||
read -p "* Are you sure?(Y/N)" ANSWER
|
||||
if [ "$ANSWER" = "Y" -o "$ANSWER" = "y" -o -z "$ANSWER" ]; then
|
||||
EvacuateApp
|
||||
DeployApp
|
||||
CallApp
|
||||
fi
|
||||
}
|
||||
UpdateApp()
|
||||
{
|
||||
if [ -f "$WINEPREFIX/PACKAGE_VERSION" ] && [ "$(cat "$WINEPREFIX/PACKAGE_VERSION")" = "$APPVER" ]; then
|
||||
return
|
||||
fi
|
||||
if [ -d "${WINEPREFIX}.tmpdir" ]; then
|
||||
rm -rf "${WINEPREFIX}.tmpdir"
|
||||
fi
|
||||
if [ -f "/opt/apps/${DEB_PACKAGE_NAME}/files/pre_update.sh" ];then
|
||||
source "/opt/apps/${DEB_PACKAGE_NAME}/files/pre_update.sh"
|
||||
CallPreUpdate
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
case $BOTTLENAME in
|
||||
"Deepin-Intelligent" | "Deepin-QQ" | "Deepin-TIM" | "Deepin-WeChat" | "Deepin-WXWork" | "Deepin-Dding" | "Wine-QQ" | "Spark-QQ" | "Spark-weixin")
|
||||
rm -rf "$WINEPREFIX"
|
||||
DeployApp
|
||||
return
|
||||
;;
|
||||
esac
|
||||
|
||||
ExtractApp "${WINEPREFIX}.tmpdir"
|
||||
$SHELL_DIR/spark_updater -s "${WINEPREFIX}.tmpdir" -c "${WINEPREFIX}" -v
|
||||
|
||||
|
||||
rm -rf "${WINEPREFIX}.tmpdir"
|
||||
echo "$APPVER" > "$WINEPREFIX/PACKAGE_VERSION"
|
||||
}
|
||||
RunApp()
|
||||
{
|
||||
progpid=$(ps -ef | grep "zenity --progress --title=${BOTTLENAME}" | grep -v grep)
|
||||
debug_log "run ${BOTTLENAME} progress pid $progpid"
|
||||
if [ -n "$progpid" ]; then
|
||||
debug_log "$BOTTLENAME is running"
|
||||
exit 0
|
||||
fi
|
||||
if [ -d "$WINEPREFIX" ]; then
|
||||
UpdateApp
|
||||
else
|
||||
DeployApp
|
||||
fi
|
||||
|
||||
CallApp "$@"
|
||||
}
|
||||
|
||||
CreateBottle()
|
||||
{
|
||||
if [ -d "$WINEPREFIX" ]; then
|
||||
UpdateApp
|
||||
else
|
||||
DeployApp
|
||||
fi
|
||||
}
|
||||
|
||||
ParseArgs()
|
||||
{
|
||||
if [ $# -eq 4 ];then
|
||||
RunApp "$3"
|
||||
elif [ -f "$5" ];then
|
||||
if [ -n "$MIME_EXEC" ];then
|
||||
RunApp "$MIME_EXEC" "$(UnixUriToDosPath "$5")" "${@:6}"
|
||||
else
|
||||
RunApp "$3" "$(UnixUriToDosPath "$5")" "${@:6}"
|
||||
fi
|
||||
else
|
||||
RunApp "$3" "${@:5}"
|
||||
fi
|
||||
}
|
||||
|
||||
init_log_file
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#####准备启动进程,分析在 https://blog.shenmo.tech/post/deepin-wine6%E7%9A%84run_v4%E8%84%9A%E6%9C%AC%E6%8E%A2%E7%B4%A2%E5%90%AF%E5%8A%A8%E6%96%B9%E5%BC%8F/
|
||||
if [ $# -lt 3 ]; then
|
||||
debug_log "参数个数小于3个"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
BOTTLENAME="$1"
|
||||
WINEPREFIX="$HOME/.deepinwine/$1"
|
||||
|
||||
|
||||
APPDIR="/opt/apps/${DEB_PACKAGE_NAME}/files"
|
||||
if [ -f "$APPDIR/files.md5sum" ];then
|
||||
APPVER="$(cat $APPDIR/files.md5sum)"
|
||||
else
|
||||
APPVER="$2"
|
||||
fi
|
||||
|
||||
debug_log "Run $*"
|
||||
|
||||
#执行lnk文件通过判断第5个参数是否是“/Unix”来判断
|
||||
if [ "$4" == "/Unix" ];then
|
||||
RunApp "$3" "$4" "$5"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ $# -lt 4 ]; then
|
||||
RunApp "$3"
|
||||
exit 0
|
||||
fi
|
||||
case $4 in
|
||||
"-r" | "--reset")
|
||||
ResetApp
|
||||
;;
|
||||
"-c" | "--create")
|
||||
CreateBottle
|
||||
;;
|
||||
"-e" | "--remove")
|
||||
RemoveApp
|
||||
;;
|
||||
"-u" | "--uri")
|
||||
ParseArgs "$@"
|
||||
;;
|
||||
"-f" | "--file")
|
||||
ParseArgs "$@"
|
||||
;;
|
||||
"-h" | "--help")
|
||||
HelpApp
|
||||
;;
|
||||
*)
|
||||
echo "Invalid option: $4"
|
||||
echo "Use -h|--help to get help"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
exit 0
|
22
helper/spark_run_v4_app_configs/Deepin-CS6.sh
Normal file
22
helper/spark_run_v4_app_configs/Deepin-CS6.sh
Normal file
@ -0,0 +1,22 @@
|
||||
#get file full path
|
||||
path="$1"
|
||||
path=$(echo ${path/c:/${WINEPREFIX}/drive_c})
|
||||
path=$(echo ${path//\\/\/})
|
||||
|
||||
#kill bloack process
|
||||
name="${path##*/}"
|
||||
$SHELL_DIR/spark_kill.sh "$name" block
|
||||
|
||||
#change current dir to excute path
|
||||
path=$(dirname "$path")
|
||||
cd "$path"
|
||||
pwd
|
||||
|
||||
#Set default mime type
|
||||
if [ -n "$MIME_TYPE" ]; then
|
||||
xdg-mime default "$DEB_PACKAGE_NAME".desktop "$MIME_TYPE"
|
||||
fi
|
||||
|
||||
debug_log_to_file "Starting process $* ..."
|
||||
|
||||
CallProcess "$@"
|
4
helper/spark_run_v4_app_configs/Deepin-Dding.sh
Normal file
4
helper/spark_run_v4_app_configs/Deepin-Dding.sh
Normal file
@ -0,0 +1,4 @@
|
||||
debug_log "run $1"
|
||||
$SHELL_DIR/spark_kill.sh DingTalk block
|
||||
|
||||
CallProcess "$@"
|
9
helper/spark_run_v4_app_configs/Deepin-Evernote.sh
Normal file
9
helper/spark_run_v4_app_configs/Deepin-Evernote.sh
Normal file
@ -0,0 +1,9 @@
|
||||
#set -- "$1" "${2#file://*}"
|
||||
local path=$(urldecode "$2")
|
||||
path=${path/file:\/\//}
|
||||
set -- "$1" "$path"
|
||||
if [ "$path" ];then
|
||||
CallProcess "$@"
|
||||
else
|
||||
CallProcess "$1"
|
||||
fi
|
9
helper/spark_run_v4_app_configs/Deepin-FastReadPDF.sh
Normal file
9
helper/spark_run_v4_app_configs/Deepin-FastReadPDF.sh
Normal file
@ -0,0 +1,9 @@
|
||||
#set -- "$1" "${2#file://*}"
|
||||
local path=$(urldecode "$2")
|
||||
path=${path/file:\/\//}
|
||||
set -- "$1" "$path"
|
||||
if [ "$path" ];then
|
||||
CallProcess "$@"
|
||||
else
|
||||
CallProcess "$1"
|
||||
fi
|
2
helper/spark_run_v4_app_configs/Deepin-Foxmail.sh
Normal file
2
helper/spark_run_v4_app_configs/Deepin-Foxmail.sh
Normal file
@ -0,0 +1,2 @@
|
||||
sed -i '/LogPixels/d' ${WINEPREFIX}/user.reg
|
||||
CallProcess "$@"
|
9
helper/spark_run_v4_app_configs/Deepin-MTXX.sh
Normal file
9
helper/spark_run_v4_app_configs/Deepin-MTXX.sh
Normal file
@ -0,0 +1,9 @@
|
||||
#set -- "$1" "${2#file://*}"
|
||||
local path=$(urldecode "$2")
|
||||
path=${path/file:\/\//}
|
||||
set -- "$1" "$path"
|
||||
if [ "$path" ];then
|
||||
CallProcess "$@"
|
||||
else
|
||||
CallProcess "$1"
|
||||
fi
|
1
helper/spark_run_v4_app_configs/Deepin-QQ-Spark.sh
Symbolic link
1
helper/spark_run_v4_app_configs/Deepin-QQ-Spark.sh
Symbolic link
@ -0,0 +1 @@
|
||||
Deepin-QQ.sh
|
25
helper/spark_run_v4_app_configs/Deepin-QQ.sh
Normal file
25
helper/spark_run_v4_app_configs/Deepin-QQ.sh
Normal file
@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
if [ ! -f "$WINEPREFIX/../.QQ_run" ]; then
|
||||
debug_log "first run time"
|
||||
$SHELL_DIR/add_hotkeys
|
||||
$SHELL_DIR/fontconfig
|
||||
touch "$WINEPREFIX/../.QQ_run"
|
||||
fi
|
||||
|
||||
DisableWrite "${WINEPREFIX}/drive_c/Program Files/Tencent/QQ/Bin/QQLiveMPlayer"
|
||||
DisableWrite "${WINEPREFIX}/drive_c/Program Files/Tencent/QQ/Bin/QQLiveMPlayer1"
|
||||
DisableWrite "${WINEPREFIX}/drive_c/Program Files/Tencent/QzoneMusic"
|
||||
|
||||
DisableWrite "${WINEPREFIX}/drive_c/Program Files/Tencent/QQBrowser"
|
||||
DisableWrite "${WINEPREFIX}/drive_c/Program Files/Common Files/Tencent/QQBrowser"
|
||||
DisableWrite "${WINEPREFIX}/drive_c/users/Public/Application Data/Tencent/QQBrowserBin"
|
||||
DisableWrite "${WINEPREFIX}/drive_c/users/Public/Application Data/Tencent/QQBrowserDefault"
|
||||
DisableWrite "${WINEPREFIX}/drive_c/users/${USER}/Application Data/Tencent/QQBrowserDefault"
|
||||
|
||||
DisableWrite "${WINEPREFIX}/drive_c/users/Public/Application Data/Tencent/QQPCMgr"
|
||||
DisableWrite "${WINEPREFIX}/drive_c/Program Files/Common Files/Tencent/QQPCMgr"
|
||||
|
||||
DisableWrite "${WINEPREFIX}/drive_c/Program Files/Common Files/Tencent/HuaYang"
|
||||
DisableWrite "${WINEPREFIX}/drive_c/users/${USER}/Application Data/Tencent/HuaYang"
|
||||
|
||||
CallProcess "$@"
|
3
helper/spark_run_v4_app_configs/Deepin-QQBydr.sh
Normal file
3
helper/spark_run_v4_app_configs/Deepin-QQBydr.sh
Normal file
@ -0,0 +1,3 @@
|
||||
debug_log "run $1"
|
||||
$SHELL_DIR/spark_kill.sh QQMicroGameBox block
|
||||
CallProcess "$1" -action:force_download -appid:1104632801 -pid:8 -bin_version:1.1.2.4 -loginuin:
|
4
helper/spark_run_v4_app_configs/Deepin-QQGame.sh
Normal file
4
helper/spark_run_v4_app_configs/Deepin-QQGame.sh
Normal file
@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
debug_log "run $1"
|
||||
$SHELL_DIR/spark_kill.sh qqgame block
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "$1" &
|
3
helper/spark_run_v4_app_configs/Deepin-QQHlddz.sh
Normal file
3
helper/spark_run_v4_app_configs/Deepin-QQHlddz.sh
Normal file
@ -0,0 +1,3 @@
|
||||
debug_log "run $1"
|
||||
$SHELL_DIR/spark_kill.sh QQMicroGameBox block
|
||||
CallProcess "$1" -action:force_download -appid:363 -pid:8 -bin_version:1.1.2.4 -loginuin:
|
3
helper/spark_run_v4_app_configs/Deepin-QQMnsj.sh
Normal file
3
helper/spark_run_v4_app_configs/Deepin-QQMnsj.sh
Normal file
@ -0,0 +1,3 @@
|
||||
debug_log "run $1"
|
||||
$SHELL_DIR/spark_kill.sh QQMicroGameBox block
|
||||
CallProcess "$1" -action:force_download -appid:1105856612 -pid:8 -bin_version:1.1.2.4 -loginuin:
|
3
helper/spark_run_v4_app_configs/Deepin-QQSszb.sh
Normal file
3
helper/spark_run_v4_app_configs/Deepin-QQSszb.sh
Normal file
@ -0,0 +1,3 @@
|
||||
debug_log "run $1"
|
||||
$SHELL_DIR/spark_kill.sh QQMicroGameBox block
|
||||
CallProcess "$1" -action:force_download -appid:1105640244 -pid:8 -bin_version:1.1.2.4 -loginuin:
|
23
helper/spark_run_v4_app_configs/Deepin-THS.sh
Normal file
23
helper/spark_run_v4_app_configs/Deepin-THS.sh
Normal file
@ -0,0 +1,23 @@
|
||||
$SHELL_DIR/spark_kill.sh ths block
|
||||
|
||||
debug_log "Start run $1"
|
||||
#get file full path
|
||||
path="$1"
|
||||
path=$(echo ${path/c:/${WINEPREFIX}/drive_c})
|
||||
path=$(echo ${path//\\/\/})
|
||||
|
||||
#kill bloack process
|
||||
name="${path##*/}"
|
||||
$SHELL_DIR/spark_kill.sh "$name" block
|
||||
|
||||
#change current dir to excute path
|
||||
path=$(dirname "$path")
|
||||
cd "$path"
|
||||
pwd
|
||||
|
||||
#Set default mime type
|
||||
if [ -n "$MIME_TYPE" ]; then
|
||||
xdg-mime default "$DEB_PACKAGE_NAME".desktop "$MIME_TYPE"
|
||||
fi
|
||||
|
||||
CallProcess "$@"
|
17
helper/spark_run_v4_app_configs/Deepin-TIM.sh
Normal file
17
helper/spark_run_v4_app_configs/Deepin-TIM.sh
Normal file
@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
if [ ! -f "$WINEPREFIX/../.QQ_run" ]; then
|
||||
debug_log "first run time"
|
||||
$SHELL_DIR/add_hotkeys
|
||||
####似乎是给dde-control-center添加快捷键
|
||||
$SHELL_DIR/fontconfig
|
||||
####暂时无法得知用途和用法
|
||||
# If the bottle not exists, run reg may cost lots of times
|
||||
# So create the bottle befor run reg
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD uninstaller --list
|
||||
touch $WINEPREFIX/../.QQ_run
|
||||
fi
|
||||
|
||||
CallProcess "$@"
|
||||
|
||||
#disable Tencent MiniBrowser
|
||||
_DeleteRegistry "HKCU\\Software\\Tencent\\MiniBrowser"
|
5
helper/spark_run_v4_app_configs/Deepin-TencentVideo.sh
Normal file
5
helper/spark_run_v4_app_configs/Deepin-TencentVideo.sh
Normal file
@ -0,0 +1,5 @@
|
||||
if [ -f "${WINEPREFIX}/drive_c/Program Files/Tencent/QQLive/Upgrade.dll" ]; then
|
||||
rm -rf "${WINEPREFIX}/drive_c/Program Files/Tencent/QQLive/Upgrade.dll"
|
||||
fi
|
||||
|
||||
CallProcess "$@"
|
9
helper/spark_run_v4_app_configs/Deepin-WXWork.sh
Normal file
9
helper/spark_run_v4_app_configs/Deepin-WXWork.sh
Normal file
@ -0,0 +1,9 @@
|
||||
if [ -d "${WINEPREFIX}/drive_c/users/${USER}/Application Data/Tencent/WXWork/Update" ]; then
|
||||
rm -rf "${WINEPREFIX}/drive_c/users/${USER}/Application Data/Tencent/WXWork/Update"
|
||||
fi
|
||||
if [ -d "${WINEPREFIX}/drive_c/users/${USER}/Application Data/Tencent/WXWork/upgrade" ]; then
|
||||
rm -rf "${WINEPREFIX}/drive_c/users/${USER}/Application Data/Tencent/WXWork/upgrade"
|
||||
fi
|
||||
#Support use native file dialog
|
||||
|
||||
CallProcess "$@"
|
9
helper/spark_run_v4_app_configs/Deepin-WangWang.sh
Normal file
9
helper/spark_run_v4_app_configs/Deepin-WangWang.sh
Normal file
@ -0,0 +1,9 @@
|
||||
#/bin/bash
|
||||
chmod 700 "$WINEPREFIX/drive_c/Program Files/AliWangWang/9.12.10C/wwbizsrv.exe"
|
||||
chmod 700 "$WINEPREFIX/drive_c/Program Files/Alibaba/wwbizsrv/wwbizsrv.exe"
|
||||
if [ $# = 3 ] && [ -z "$3" ];then
|
||||
EXEC_PATH="c:/Program Files/AliWangWang/9.12.10C/WWCmd.exe"
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "$EXEC_PATH" "$2" &
|
||||
else
|
||||
CallProcess "$@"
|
||||
fi
|
2
helper/spark_run_v4_app_configs/Deepin-WeChat.sh
Normal file
2
helper/spark_run_v4_app_configs/Deepin-WeChat.sh
Normal file
@ -0,0 +1,2 @@
|
||||
export DISABLE_RENDER_CLIPBOARD=1
|
||||
CallProcess "$@"
|
18
helper/spark_run_v4_app_configs/Deepin-ZhuMu.sh
Normal file
18
helper/spark_run_v4_app_configs/Deepin-ZhuMu.sh
Normal file
@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
#change current dir to excute path
|
||||
path=$(dirname "$path")
|
||||
cd "$path"
|
||||
pwd
|
||||
|
||||
#Set default mime type
|
||||
if [ -n "$MIME_TYPE" ]; then
|
||||
xdg-mime default "$DEB_PACKAGE_NAME".desktop "$MIME_TYPE"
|
||||
fi
|
||||
|
||||
debug_log_to_file "Starting process $* ..."
|
||||
if [ -n "$2" ];then
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "$1" "--url=$2" &
|
||||
else
|
||||
env WINEPREFIX="$WINEPREFIX" $WINE_CMD "$1" &
|
||||
fi
|
3
helper/spark_run_v4_app_configs/IE8.sh
Normal file
3
helper/spark_run_v4_app_configs/IE8.sh
Normal file
@ -0,0 +1,3 @@
|
||||
rm -f "$WINEPREFIX/system.reg"
|
||||
cp $APPDIR/system.reg "$WINEPREFIX/system.reg"
|
||||
CallProcess "$@"
|
4
helper/spark_run_v4_app_configs/Spark-CloudMusic.sh
Normal file
4
helper/spark_run_v4_app_configs/Spark-CloudMusic.sh
Normal file
@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
CallProcess "$@"
|
||||
sleep 2
|
||||
/opt/apps/com.163.music.spark/files/disable_cloudmusic_shadows
|
3
helper/spark_run_v4_app_configs/Spark-MailMaster.sh
Normal file
3
helper/spark_run_v4_app_configs/Spark-MailMaster.sh
Normal file
@ -0,0 +1,3 @@
|
||||
CallProcess "$@"
|
||||
sleep 2
|
||||
/opt/apps/com.163.dashi.mailmaster.spark/files/disable_mailmaster_shadows
|
4
helper/spark_run_v4_app_configs/Spark-MuBu.sh
Normal file
4
helper/spark_run_v4_app_configs/Spark-MuBu.sh
Normal file
@ -0,0 +1,4 @@
|
||||
if [ -f "${WINEPREFIX}/drive_c/ProgramData/Microsoft/Windows/Start\ Menu/Programs/MuBu.lnk" ]; then
|
||||
chmod 555 ${WINEPREFIX}/drive_c/ProgramData/Microsoft/Windows/Start\ Menu/Programs/MuBu.lnk
|
||||
fi
|
||||
CallProcess "$@"
|
1
helper/spark_run_v4_app_configs/Spark-QQ.sh
Symbolic link
1
helper/spark_run_v4_app_configs/Spark-QQ.sh
Symbolic link
@ -0,0 +1 @@
|
||||
Deepin-QQ.sh
|
16
helper/spark_run_v4_app_configs/Spark-QQMusic.sh
Normal file
16
helper/spark_run_v4_app_configs/Spark-QQMusic.sh
Normal file
@ -0,0 +1,16 @@
|
||||
if [ -e ${WINEPREFIX}/drive_c/Program\ Files/Tencent/QQMusic/QQMusic.exe ]; then
|
||||
sleep 1
|
||||
rm -rf ${WINEPREFIX}/drive_c/Program\ Files/Tencent/QQMusic/*.log
|
||||
else
|
||||
mkdir ${WINEPREFIX}/drive_c/Program\ Files/Tencent/updatetemp
|
||||
mv ${WINEPREFIX}/drive_c/Program\ Files/Tencent/QQMusic/*.dll ${WINEPREFIX}/drive_c/Program\ Files/Tencent/updatetemp
|
||||
mv ${WINEPREFIX}/drive_c/Program\ Files/Tencent/QQMusic/*.exe ${WINEPREFIX}/drive_c/Program\ Files/Tencent/updatetemp
|
||||
mv ${WINEPREFIX}/drive_c/Program\ Files/Tencent/QQMusic/*.rdb ${WINEPREFIX}/drive_c/Program\ Files/Tencent/updatetemp
|
||||
mv ${WINEPREFIX}/drive_c/Program\ Files/Tencent/QQMusic/*.log ${WINEPREFIX}/drive_c/Program\ Files/Tencent/updatetemp
|
||||
mv ${WINEPREFIX}/drive_c/Program\ Files/Tencent/QQMusic/QQMusic* ${WINEPREFIX}/drive_c/Program\ Files/Tencent
|
||||
rm -rf ${WINEPREFIX}/drive_c/Program\ Files/Tencent/QQMusic
|
||||
rm -rf ${WINEPREFIX}/drive_c/Program\ Files/Tencent/updatetemp
|
||||
rm -rf ${WINEPREFIX}/drive_c/Program\ Files/Tencent/*.log
|
||||
mv ${WINEPREFIX}/drive_c/Program\ Files/Tencent/QQMusic* ${WINEPREFIX}/drive_c/Program\ Files/Tencent/QQMusic
|
||||
fi
|
||||
CallProcess "$@"
|
1
helper/spark_run_v4_app_configs/Spark-TIM.sh
Symbolic link
1
helper/spark_run_v4_app_configs/Spark-TIM.sh
Symbolic link
@ -0,0 +1 @@
|
||||
Deepin-TIM.sh
|
1
helper/spark_run_v4_app_configs/Spark-WeCom.sh
Symbolic link
1
helper/spark_run_v4_app_configs/Spark-WeCom.sh
Symbolic link
@ -0,0 +1 @@
|
||||
Deepin-WXWork.sh
|
6
helper/spark_run_v4_app_configs/Spark-douyin.sh
Normal file
6
helper/spark_run_v4_app_configs/Spark-douyin.sh
Normal file
@ -0,0 +1,6 @@
|
||||
if [ -f "${WINEPREFIX}/drive_c/users/${USER}/Application Data/douyin" ]; then
|
||||
rm "${WINEPREFIX}/drive_c/users/${USER}/Application Data/douyin"
|
||||
mv ${WINEPREFIX}/drive_c/users/${USER}/Application\ Data/*.tmp ${WINEPREFIX}/drive_c/users/${USER}/Application\ Data/douyin
|
||||
chmod 755 ${WINEPREFIX}/drive_c/users/${USER}/Application\ Data/douyin
|
||||
fi
|
||||
CallProcess "$@"
|
2
helper/spark_run_v4_app_configs/Spark-ecloud.sh
Normal file
2
helper/spark_run_v4_app_configs/Spark-ecloud.sh
Normal file
@ -0,0 +1,2 @@
|
||||
DisableWrite ${WINEPREFIX}/drive_c/users/${USER}/Temp
|
||||
CallProcess "$@"
|
5
helper/spark_run_v4_app_configs/Spark-flyele.sh
Normal file
5
helper/spark_run_v4_app_configs/Spark-flyele.sh
Normal file
@ -0,0 +1,5 @@
|
||||
if [ -w ${WINEPREFIX}/drive_c/users/${USER}/Application\ Data/飞项/Crashpad/reports ]; then
|
||||
rm -rf ${WINEPREFIX}/drive_c/users/${USER}/Application\ Data/飞项/Crashpad/reports/*
|
||||
chmod 555 ${WINEPREFIX}/drive_c/users/${USER}/Application\ Data/飞项/Crashpad/reports
|
||||
fi
|
||||
CallProcess "$@"
|
37
helper/spark_run_v4_app_configs/Spark-weixin.sh
Normal file
37
helper/spark_run_v4_app_configs/Spark-weixin.sh
Normal file
@ -0,0 +1,37 @@
|
||||
echo
|
||||
echo "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⡟⠉⠻⣷⡄⠀⠀⠀⠀⠀⠀⢀⣀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⣴⣶⣶⣿⣿⡄⠀⠀⢀⣤⣾⠿⠻⣿⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⣿⣿⣿⣿⣿⣿⣿⣤⣾⣿⣏⡁⠀⠀⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⡿⢿⣿⣯⣀⣿⣿⡿⢿⣿⣿⣿⣿⣿⣷⣄⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣶⣬⡙⠿⠋⣡⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||
⠀⠀⠀⠀⠀⠀⠀⣀⣀⣀⣀⣀⠀⠀⠀⠀⠀⠈⢻⣿⣿⠟⣁⣴⣤⡙⠻⣿⣿⣿⣿⣿⣿⣿⣿⡿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||
⠀⠀⠀⠀⠀⠀⠺⢿⣿⣿⣿⢿⠇⠀⠀⠀⠀⠀⠀⠹⣷⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠛⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||
⠀⠀⠀⣖⣆⣀⣀⣀⣀⣀⣀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠙⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠟⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||
⠀⠀⠀⣿⠟⠛⠛⠛⠛⠛⠛⠛⠷⠿⠿⢿⣷⣶⣤⣤⣀⣸⣿⣿⣿⣿⣿⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||
⠀⠀⠀⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉⠛⢻⡏⠁⣈⢻⠙⣿⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||
⠀⠀⠀⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠛⣲⡟⠞⢀⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||
⠀⠀⠀⣿⡇⠀⠀⠀⠀⢀⣀⣀⣤⣤⣤⣤⣤⣶⣶⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⣶⣤⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||
⠀⠀⠀⣿⣷⣶⣾⡿⠿⠿⠛⢛⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣄⠀⠀⠀⠀⠀⠀⠀⢀⣠⡤⣀⠀⠀⠀⠀⠀⠀
|
||||
⠀⠀⠀⠙⠋⠀⠀⠀⠀⢀⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⡄⠀⠀⠀⢠⣾⣿⣿⣿⣿⡆⠀⠀⠀⠀⠀
|
||||
⠀⠀⠀⠀⠀⠀⠀⠀⣠⣿⣿⣿⣿⣥⣼⣿⣿⣿⣿⣿⣿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣆⠀⠀⠸⠽⠻⣿⡿⠟⠁⠀⠀⠀⠀⠀
|
||||
⠀⠀⠀⠀⠀⠀⠀⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣾⣿⣁⣼⣿⣿⣿⣿⣿⢻⣿⡀⠙⣿⣿⣿⣿⣿⣧⠀⠀⠀⠀⣀⣤⣤⣄⠀⠀⠀⠀⠀
|
||||
⠀⠀⠀⠀⠀⠀⢰⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣾⣿⣿⣶⣿⣿⣿⣿⣿⣿⣇⠀⠀⠀⢿⣿⣿⣿⠇⠀⠀⠀⠀
|
||||
⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡄⠀⠀⠀⠉⠉⠁⠀⠀⠀⠀⠀
|
||||
⠀⠀⠀⠀⠀⢀⣾⣿⣿⣿⣿⣿⣿⣿⣿⡿⠿⠾⣿⣿⣿⣿⣿⣿⣿⡿⠷⣬⡻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||
⠀⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣄⠀⢘⣿⣿⣿⣿⣿⠏⠀⠀⣀⣤⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||
⠀⠀⠻⣿⣿⣿⣿⣿⣿⣿⣿⠁⠀⠈⠙⢿⣿⣷⣾⣿⠿⣿⣿⣇⣤⣶⣿⣿⠿⠛⠋⠙⠻⣿⣿⣿⣿⣿⣿⣿⣿⣧⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||
⠀⠀⠀⠀⠉⠻⣿⣿⣿⣿⣷⠀⠀⣠⣶⣿⠿⠉⠁⠀⠀⠀⠉⠉⠉⠻⣿⣷⣄⠀⠀⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣤⣤⣤⣤⠀⠀⠀⠀⠀
|
||||
⠀⠀⠀⠀⠀⠀⠙⠿⣿⣿⣿⣷⠿⡿⠋⠀⠀⠀⠀⣄⢀⣀⠀⠀⠀⠀⠀⠙⢿⣷⣄⠀⢀⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠛⠀⠀⠀⠀⠀
|
||||
⣀⣀⠀⠀⠀⠀⢀⣴⣿⣿⠛⠀⠀⢸⣧⡿⠀⠀⣸⠋⠋⠉⢻⡄⠀⠀⠀⠀⠀⠉⢁⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠟⠋⠁⠀⠀⠀⠀⠀⠀⠀
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄⠀⠀⠈⠀⠀⠀⢻⣀⣀⣀⣀⡿⠀⠀⠀⠀⠀⠀⠀⢉⣭⣭⣽⣿⣿⣿⣿⣿⣿⣿⣿⣦⣄⠀⠀⠀⠀⠀⣀⣤⡄
|
||||
⠘⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣄⣀⠀⠀⠀⠉⠀⠀⠉⠀⠀⠀⠀⠀⢀⣀⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠃
|
||||
⠀⠈⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢟⣿⣿⣿⣿⣶⣶⡶⣶⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠃⠀
|
||||
⠀⠀⠀⠈⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⣿⢿⡸⣿⣿⣿⣿⣎⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠋⠀⠀⠀
|
||||
⠀⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣯⣽⣿⣿⡟⠁⠀⢙⣿⣿⣿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡏⠉⠀⠀⠀⠀⠀⠀
|
||||
⠀⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⣿⣿⣿⣿⣿⣦⣶⣿⣿⣿⣿⣿⡿⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠇⠀⠀⠀⠀⠀⠀⠀
|
||||
⠀⠀⠀⠀⢿⣿⣿⣿⣿⣿⣿⣿⡿⠁⠀⠘⣿⣿⡿⠟⠉⢿⣯⣿⣿⣿⠁⠀⠀⠈⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠃⠀⠀⠀⠀⠀⠀⠀⠀
|
||||
⠀⠀⠀⠀⠀⠙⠿⣿⣿⣿⣿⣿⡇⠀⠀⢸⡟⠋⠀⠀⠀⠀⠙⠛⠋⢸⠀⠀⠀⠀⠀⠘⣿⣿⣿⣿⣿⣿⣿⡿⠿⠛⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||
⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉⢻⣿⠀⠀⠀⢸⡇⠀⠀⠀⠀⠀⠀⠀⠀⢸⡆⠀⠀⠀⠀⠀⢻⣿⣿⣿⣿⠟⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀"
|
||||
|
||||
echo "以此纪念2.4.0版本"
|
||||
CallProcess "$@"
|
1
helper/spark_run_v4_app_configs/Wine-QQ.sh
Symbolic link
1
helper/spark_run_v4_app_configs/Wine-QQ.sh
Symbolic link
@ -0,0 +1 @@
|
||||
Deepin-QQ.sh
|
1
helper/spark_run_v4_app_configs/wxwork-spark-uk.sh
Symbolic link
1
helper/spark_run_v4_app_configs/wxwork-spark-uk.sh
Symbolic link
@ -0,0 +1 @@
|
||||
Deepin-WXWork.sh
|
42
helper/spark_updater
Executable file
42
helper/spark_updater
Executable file
@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 检查是否提供了-c和-s选项
|
||||
if [[ ! "$*" =~ "-c" ]] || [[ ! "$*" =~ "-s" ]]; then
|
||||
echo "用法: updater -c <目标目录> -s <源目录> [-v]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 解析命令行参数
|
||||
while getopts ":c:s:v" opt; do
|
||||
case $opt in
|
||||
c)
|
||||
destination_dir=$OPTARG
|
||||
;;
|
||||
s)
|
||||
source_dir=$OPTARG
|
||||
;;
|
||||
v)
|
||||
verbose=true
|
||||
;;
|
||||
\?)
|
||||
echo "无效选项: -$OPTARG" >&2
|
||||
exit 1
|
||||
;;
|
||||
:)
|
||||
echo "选项 -$OPTARG 需要一个参数." >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# 从源目录复制文件到目标目录
|
||||
if [ "$verbose" = true ]; then
|
||||
echo "正在从 $source_dir 复制文件到 $destination_dir"
|
||||
fi
|
||||
|
||||
# 使用cp命令覆盖同名文件
|
||||
cp -rf "$source_dir"/* "$destination_dir"
|
||||
|
||||
echo "文件复制完成!"
|
||||
exit 0
|
||||
|
BIN
helper/startbottle.exe
Executable file
BIN
helper/startbottle.exe
Executable file
Binary file not shown.
2
helper/transhell/spark_run_v4.sh_en_US.transhell
Normal file
2
helper/transhell/spark_run_v4.sh_en_US.transhell
Normal file
@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
TRANSHELL_CONTENT_UNPACKING="Unpacking"
|
2
helper/transhell/spark_run_v4.sh_zh_CN.transhell
Normal file
2
helper/transhell/spark_run_v4.sh_zh_CN.transhell
Normal file
@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
TRANSHELL_CONTENT_UNPACKING="解包"
|
BIN
helper/updater
Executable file
BIN
helper/updater
Executable file
Binary file not shown.
Loading…
Reference in New Issue
Block a user