summarylogtreecommitdiffstats
path: root/microsip
diff options
context:
space:
mode:
authorOleksandr Natalenko2018-09-24 18:18:22 +0200
committerOleksandr Natalenko2018-09-24 18:19:19 +0200
commit5d681c4116af3c7b3faad7cba04ac4d159ca5aa9 (patch)
tree33b5076fa648c1da8e7df62a221247832a62e89b /microsip
parente9cddd03e57c63ac3e937b3b4c897ec61ca69637 (diff)
downloadaur-5d681c4116af3c7b3faad7cba04ac4d159ca5aa9.tar.gz
init wine prefix correctly and only once
Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
Diffstat (limited to 'microsip')
-rwxr-xr-xmicrosip75
1 files changed, 42 insertions, 33 deletions
diff --git a/microsip b/microsip
index c55fc9e0da1..5d7f6e3bcb6 100755
--- a/microsip
+++ b/microsip
@@ -1,8 +1,10 @@
#!/usr/bin/env bash
+__REV=1
__APPNAME=$(basename $0)
__WINEPREFIX="${XDG_DATA_HOME:-$HOME/.local}/wine/${__APPNAME}"
__APPDIR="${__WINEPREFIX}/dosdevices/c:/${__APPNAME}"
+__INSTALLED="${__APPDIR}/.installed.${__REV}"
__APPCFG="${XDG_CONFIG_HOME:-$HOME/.config}/${__APPNAME}"
__APPLOG="${XDG_CACHE_HOME:-$HOME/.cache}/${__APPNAME}"
__REGFILE="${__APPDIR}/${__APPNAME}.reg"
@@ -14,39 +16,46 @@ __symlink() {
ln -sf "$1" "${__APPDIR}/${1##*/}"
}
-mkdir -p "${__APPDIR}"
-
-__symlink "/usr/share/licenses/${__APPNAME}/License.txt"
-__symlink "/usr/share/doc/${__APPNAME}/MicroSIP Website.url"
-__symlink "/usr/share/${__APPNAME}/hangup.wav"
-__symlink "/usr/share/${__APPNAME}/messagein.wav"
-__symlink "/usr/share/${__APPNAME}/messageout.wav"
-__symlink "/usr/share/${__APPNAME}/ringin.wav"
-__symlink "/usr/share/${__APPNAME}/ringin2.wav"
-__symlink "/usr/share/${__APPNAME}/ringout.wav"
-__symlink "/usr/lib/${__APPNAME}/SDL2.dll"
-__symlink "/usr/lib/${__APPNAME}/avcodec-57.dll"
-__symlink "/usr/lib/${__APPNAME}/avformat-57.dll"
-__symlink "/usr/lib/${__APPNAME}/avutil-55.dll"
-__symlink "/usr/lib/${__APPNAME}/microsip.exe"
-__symlink "/usr/lib/${__APPNAME}/swscale-4.dll"
-
-cp "/usr/share/${__APPNAME}/${__APPNAME}.reg" "${__TMPREGFILE}"
-sed -i "s/{DPI}/${__DPIX}/g" "${__TMPREGFILE}"
-iconv -f utf-8 -t utf-16le "${__TMPREGFILE}" >"${__REGFILE}"
-rm -f "${__TMPREGFILE}"
-WINEPREFIX="${__WINEPREFIX}" regedit "${__REGFILE}"
-rm -f "${__REGFILE}"
-
-mkdir -p "${__APPCFG}"
-touch "${__APPCFG}/Contacts.xml"
-touch "${__APPCFG}/microsip.ini"
-__symlink "${__APPCFG}/Contacts.xml"
-__symlink "${__APPCFG}/microsip.ini"
-
-mkdir -p "${__APPLOG}"
-touch "${__APPLOG}/microsip_log.txt"
-__symlink "${__APPLOG}/microsip_log.txt"
+if [[ ! -f "${__INSTALLED}" ]]; then
+ mkdir -p "${__WINEPREFIX}"
+ WINEPREFIX="${__WINEPREFIX}" wineboot -u
+
+ mkdir -p "${__APPDIR}"
+
+ cp "/usr/share/${__APPNAME}/${__APPNAME}.reg" "${__TMPREGFILE}"
+ sed -i "s/{DPI}/${__DPIX}/g" "${__TMPREGFILE}"
+ iconv -f utf-8 -t utf-16le "${__TMPREGFILE}" >"${__REGFILE}"
+ rm -f "${__TMPREGFILE}"
+ WINEPREFIX="${__WINEPREFIX}" regedit "${__REGFILE}"
+ rm -f "${__REGFILE}"
+
+ __symlink "/usr/share/licenses/${__APPNAME}/License.txt"
+ __symlink "/usr/share/doc/${__APPNAME}/MicroSIP Website.url"
+ __symlink "/usr/share/${__APPNAME}/hangup.wav"
+ __symlink "/usr/share/${__APPNAME}/messagein.wav"
+ __symlink "/usr/share/${__APPNAME}/messageout.wav"
+ __symlink "/usr/share/${__APPNAME}/ringin.wav"
+ __symlink "/usr/share/${__APPNAME}/ringin2.wav"
+ __symlink "/usr/share/${__APPNAME}/ringout.wav"
+ __symlink "/usr/lib/${__APPNAME}/SDL2.dll"
+ __symlink "/usr/lib/${__APPNAME}/avcodec-57.dll"
+ __symlink "/usr/lib/${__APPNAME}/avformat-57.dll"
+ __symlink "/usr/lib/${__APPNAME}/avutil-55.dll"
+ __symlink "/usr/lib/${__APPNAME}/microsip.exe"
+ __symlink "/usr/lib/${__APPNAME}/swscale-4.dll"
+
+ mkdir -p "${__APPCFG}"
+ touch "${__APPCFG}/Contacts.xml"
+ touch "${__APPCFG}/microsip.ini"
+ __symlink "${__APPCFG}/Contacts.xml"
+ __symlink "${__APPCFG}/microsip.ini"
+
+ mkdir -p "${__APPLOG}"
+ touch "${__APPLOG}/microsip_log.txt"
+ __symlink "${__APPLOG}/microsip_log.txt"
+
+ touch "${__INSTALLED}"
+fi
WINEPREFIX="${__WINEPREFIX}" wine "${__APPDIR}/microsip.exe"