summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorcrimsonote2020-07-28 18:46:08 +0800
committercrimsonote2020-07-28 18:46:08 +0800
commitec9dd328f445b991721a317cc1a8db7ddb5fadd6 (patch)
treeb8f644ad7edad4e54d63cf4a30757cc8a52f41fc
downloadaur-ec9dd328f445b991721a317cc1a8db7ddb5fadd6.tar.gz
Initial import
-rw-r--r--.SRCINFO31
-rw-r--r--.gitignore4
-rw-r--r--PKGBUILD62
-rw-r--r--no-makeself.patch11
-rwxr-xr-xtrans-edit.sh150
-rw-r--r--veracrypt.desktop9
6 files changed, 267 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 00000000000..b987c626d3d
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,31 @@
+pkgbase = veracrypt-trans
+ pkgdesc = Disk encryption with strong security based on TrueCrypt.Translate the interface to other languages. (The language cannot be changed after compilation)
+ pkgver = 1.24_Update4
+ pkgrel = 1
+ url = https://www.veracrypt.fr/
+ arch = i686
+ arch = x86_64
+ license = custom:TrueCrypt
+ makedepends = git
+ makedepends = yasm
+ makedepends = libxml2
+ makedepends = coreutils
+ depends = fuse2>=2.8.0
+ depends = wxgtk3>=3.0
+ depends = libsm
+ depends = device-mapper
+ optdepends = sudo: mounting encrypted volumes as nonroot users
+ provides = veracrypt
+ conflicts = veracrypt
+ conflicts = veracrypt-git
+ source = VeraCrypt_1.24-Update4.tar.gz::https://github.com/veracrypt/VeraCrypt/archive/VeraCrypt_1.24-Update4.tar.gz
+ source = no-makeself.patch::https://gitlab.com/crimsonote/veracrypt-trans/-/raw/master/no-makeself.patch
+ source = veracrypt.desktop::https://gitlab.com/crimsonote/veracrypt-trans/-/raw/master/veracrypt.desktop
+ source = trans-edit.sh::https://gitlab.com/crimsonote/veracrypt-trans/-/raw/128e174fc3e2d64eeabdd11fa91484c2c1e045cf/trans-edit.sh
+ sha512sums = e077d6fe6a35234737387c4a6997399a251e238ab75524f53efe8ed742a35164fa4d5fcb0f15816dcb29d31fb8a4bb175d45b9aefb912c4747194fb320fa408d
+ sha512sums = 40c269859bb97fbcceb443e5f457788bac650271ed118ec79d34f56fc340ad6e613114fe905ec5aba8c4d171c51c9a6865f97e9fa1ba01fa98ef18be4e97bbe1
+ sha512sums = f689ca64bac7042030de7714aed8cc89f2c5f87b407444b1b121491c1d89c147babaaa454ddc2a93b70ae20d4da59f96ad64f01b04bea9017d658c377faeb75d
+ sha512sums = 5dc24362d3089ca2855b8da73db24212e8fd36adb6357dfff0054c6b56ef4250821e69d6b3d8438afb2fc41061fb1c1c7654983149ba909f7c1b0e8eac68d44e
+
+pkgname = veracrypt-trans
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000000..8f736322fd8
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+*~
+*#*
+*.log
+*.tmp
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 00000000000..d0497dce228
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,62 @@
+# Maintainer: crimsonote <crimsonote@outlook.com>
+# Contributor: Felix Golatofski <contact@xdfr.de>
+# Contributor: Andy Weidenbaum <archbaum@gmail.com>
+# Contributor: Sebastian Lau <archlinux _at_ slau _dot_ info>
+# Contributor: Eric Ozwigh <ozwigh at gmail dot com>
+pkgname=veracrypt-trans
+_pkgname=VeraCrypt
+pkgver=1.24_Update4
+pkgrel=1
+pkgdesc='Disk encryption with strong security based on TrueCrypt.Translate the interface to other languages. (The language cannot be changed after compilation)'
+url='https://www.veracrypt.fr/'
+arch=('i686' 'x86_64')
+license=('custom:TrueCrypt')
+depends=('fuse2>=2.8.0' 'wxgtk3>=3.0' 'libsm' 'device-mapper')
+optdepends=('sudo: mounting encrypted volumes as nonroot users')
+makedepends=('git' 'yasm' 'libxml2' 'coreutils' )
+source=("${_pkgname}_${pkgver//_/-}.tar.gz::https://github.com/veracrypt/VeraCrypt/archive/${_pkgname}_${pkgver//_/-}.tar.gz"
+ "no-makeself.patch::https://gitlab.com/crimsonote/veracrypt-trans/-/raw/master/no-makeself.patch"
+ "veracrypt.desktop::https://gitlab.com/crimsonote/veracrypt-trans/-/raw/master/veracrypt.desktop"
+ "trans-edit.sh::https://gitlab.com/crimsonote/veracrypt-trans/-/raw/128e174fc3e2d64eeabdd11fa91484c2c1e045cf/trans-edit.sh")
+sha512sums=('e077d6fe6a35234737387c4a6997399a251e238ab75524f53efe8ed742a35164fa4d5fcb0f15816dcb29d31fb8a4bb175d45b9aefb912c4747194fb320fa408d'
+ '40c269859bb97fbcceb443e5f457788bac650271ed118ec79d34f56fc340ad6e613114fe905ec5aba8c4d171c51c9a6865f97e9fa1ba01fa98ef18be4e97bbe1'
+ 'f689ca64bac7042030de7714aed8cc89f2c5f87b407444b1b121491c1d89c147babaaa454ddc2a93b70ae20d4da59f96ad64f01b04bea9017d658c377faeb75d'
+ '5dc24362d3089ca2855b8da73db24212e8fd36adb6357dfff0054c6b56ef4250821e69d6b3d8438afb2fc41061fb1c1c7654983149ba909f7c1b0e8eac68d44e')
+provides=('veracrypt')
+conflicts=('veracrypt' 'veracrypt-git')
+
+#pkgver() {
+# cd $srcdir/${_pkgname}-${_pkgname}_${pkgver//_/-}
+# git log -1 --format="%cd" --date=short --no-show-signature | tr -d '-'
+#}
+
+prepare() {
+ #cd $srcdir/${pkgname%-trans}/src
+ cd $srcdir/${_pkgname}-${_pkgname}_${pkgver//_/-}
+ cp $srcdir/../Translations/attach-language.*.xml Translations/ 2>&1||echo -n ""
+ bash $srcdir/../trans-edit.sh true
+
+ cd $srcdir/${_pkgname}-${_pkgname}_${pkgver//_/-}/src
+ chmod -R u+w . # WAT award
+ patch -Np1 < "${srcdir}/no-makeself.patch"
+}
+
+build() {
+ # cd $srcdir/${pkgname%-trans}
+ cd $srcdir/${_pkgname}-${_pkgname}_${pkgver//_/-}/src
+ make PKG_CONFIG_PATH=/usr/lib/pkgconfig \
+ WX_CONFIG=/usr/bin/wx-config-gtk3 \
+ TC_EXTRA_LFLAGS+="-ldl ${LDFLAGS}" \
+ TC_EXTRA_CXXFLAGS="${CXXFLAGS} ${CPPFLAGS}" \
+ TC_EXTRA_CFLAGS="${CFLAGS} ${CPPFLAGS}"
+}
+
+package() {
+ # cd $srcdir/${pkgname%-trans}/src
+ cd $srcdir/${_pkgname}-${_pkgname}_${pkgver//_/-}/src
+ pwd
+ install -Dm 755 Main/${pkgname%-trans} "${pkgdir}/usr/bin/${pkgname%-trans}"
+ install -Dm 644 "${srcdir}/veracrypt.desktop" -t "${pkgdir}/usr/share/applications"
+ install -Dm 644 Resources/Icons/VeraCrypt-256x256.xpm "${pkgdir}/usr/share/pixmaps/veracrypt.xpm"
+ install -Dm 644 License.txt -t "${pkgdir}/usr/share/licenses/${pkgname%-trans}"
+}
diff --git a/no-makeself.patch b/no-makeself.patch
new file mode 100644
index 00000000000..30f19a97fd8
--- /dev/null
+++ b/no-makeself.patch
@@ -0,0 +1,11 @@
+diff -aur clean/veracrypt/src/Main/Main.make src/veracrypt/src/Main/Main.make
+--- clean/Main/Main.make 2014-10-14 19:12:32.000000000 +0300
++++ src/Main/Main.make 2014-10-14 19:13:27.330705412 +0300
+@@ -206,7 +206,6 @@
+ rm -fr $(BASE_DIR)/Setup/Linux/packaging
+ mkdir -p $(BASE_DIR)/Setup/Linux/packaging
+ cp $(INTERNAL_INSTALLER_NAME) $(BASE_DIR)/Setup/Linux/packaging/.
+- makeself $(BASE_DIR)/Setup/Linux/packaging $(BASE_DIR)/Setup/Linux/$(INSTALLER_NAME) "VeraCrypt $(TC_VERSION) Installer" ./$(INTERNAL_INSTALLER_NAME)
+
+ endif
+
diff --git a/trans-edit.sh b/trans-edit.sh
new file mode 100755
index 00000000000..ca88f22142d
--- /dev/null
+++ b/trans-edit.sh
@@ -0,0 +1,150 @@
+#!/bin/bash
+function locale_var(){
+ #指定所使用的语言
+ locale=$(echo ${LANG}|tr '.' ' '|cut -f 1 -d ' '|tr '_' '-'|tr 'A-Z' 'a-z' )
+ if [ ! -f "${source_path}/Translations/Language.${locale}.xml" ]
+ then
+ locale="$(echo "${locale}"|cut -f 1 -d '-')"
+ if [ ! -f "${source_path}/Translations/Language.${locale}.xml" ]
+ then
+ echo "未找到所使用语言所对应的翻译文件${source_path}Translations/Language.${locale}.xml"
+ echo "The translation file ${source_path}/Translations/Language.${locale}.xml corresponding to the language used was not found"
+ exit ;
+ else
+ download_attach_language_file
+ fi
+ else
+ download_attach_language_file
+ fi
+}
+function download_attach_language_file(){
+ #下载补充语言包
+ [ -f " ${source_path}/Translations/attach-${locale}-language.en.xml" ] ||\
+ wget https://gitlab.com/crimsonote/veracrypt-trans/-/raw/master/Translations/attach-${locale}-language.en.xml -O Translations/attach-${locale}-language.en.xml||\
+ wget https://github.com/crimsonote/veracrypt-trans/raw/master/Translations/attach-${locale}-language.en.xml -O Translations/attach-${locale}-language.en.xml||\
+ echo "补充原文下载失败"
+ [ -f " ${source_path}/Translations/attach-language.${locale}.xml" ] ||\
+ wget https://gitlab.com/crimsonote/veracrypt-trans/-/raw/master/Translations/attach-language.${locale}.xml -O Translations/attach-language.${locale}.xml||\
+ wget https://github.com/crimsonote/veracrypt-trans/raw/master/Translations/attach-language.${locale}.xml -O Translations/attach-language.${locale}.xml||\
+ (echo "补充译文下载失败";rm -f "Translations/attach-${locale}-language.en.xml")
+}
+function xml_var(){
+ #用于提取xml翻译文件至变量并做修补
+ en_xml_end_line="$(grep '</localization>' -n "${en_xml_file}"|cut -f 1 -d ':')"
+ let en_xml_end_line=en_xml_end_line-1 #因为sed的r会在行尾追加,所以需要减1
+ locale_xml_end_line="$(grep '</localization>' -n "${locale_xml_file}"|cut -f 1 -d ':')"
+ let locale_xml_end_line=locale_xml_end_line-1
+ en_xml="$(sed "${en_xml_end_line} r ${source_path}/Translations/attach-${locale}-language.en.xml" "${en_xml_file}")"
+ locale_xml="$(sed "${locale_xml_end_line} r ${source_path}/Translations/attach-language.${locale}.xml" "${locale_xml_file}")"
+}
+function no_makeself(){
+ #make时禁用makeself
+ if [ -n "${1}" ]
+ then
+ sed "/^ *makeself/ d" src/Main/Main.make -i
+ fi
+}
+function sed_code_trans(){
+ #替换源码文件显示文本
+ en_sed_string="$(echo "${1}"|sed "s#[\][n]#[\\\][n]#g"|sed 's/#/\\\#/g')"
+ locale_sed_string="$(echo "${2}"|sed "s#[\][n]#\\\\\\\\\\\n#g;s#&#\\\&#g"|sed 's/#/\\\#/g')"
+ sed "s#\"${en_sed_string}\"#\"${locale_sed_string}\"#g" -i ${3}
+ #echo "s#${1}#${2}#g" "-i" "${3}"
+}
+function filter_code(){
+ filter=${1}
+ continue_filter ${filter} "${en_string}" "${locale_string}"
+}
+function continue_filter(){
+ #根据grep搜索情况,进行替换操作
+ case $1 in
+ a|b)
+ edit_code_file_list="$(echo "${filter_result}"|cut -f 1 -d ":"|sort | uniq|tr '\n' ' ')"
+ sed_code_trans "${en_string}" "${locale_string}" "${edit_code_file_list}"
+ ;;
+ c)
+ #黑名单
+ blacklist_line="84,85"
+ if (echo "${blacklist_line}"|tr ',' '\n'|sed "s/^/./g;s/$/..g"|grep "${keynum}")
+ then
+ true
+ #跳过翻译
+ else
+ edit_code_file_list="$(echo "${filter_result}"|cut -f 1 -d ":"|sort | uniq|tr '\n' ' ')"
+ sed_code_trans "${en_string}" "${locale_string}" "${edit_code_file_list}"
+ fi
+ ;;
+ d)
+ #白名单
+ whitelist_line="1,260,"
+ if (echo "${whitelist_line}"|tr ',' '\n'|sed "s/^/./g;s/$/../g"|grep "${keynum}")
+ then
+ edit_code_file_list="$(echo "${filter_result}"|cut -f 1 -d ":"|sort | uniq|tr '\n' ' ')"
+ sed_code_trans "${en_string}" "${locale_string}" "${edit_code_file_list}"
+ else
+ true
+ fi
+ ;;
+ e|f)
+ ;;
+ esac
+}
+
+TMPFILE="$(mktemp -td vera_transXXXXX)"
+source_path="."
+cd "${source_path}"
+locale_var
+en_xml_file="${source_path}/src/Common/Language.xml"
+locale_xml_file="${source_path}/Translations/Language.${locale}.xml"
+no_makeself "${1}"
+xml_var
+key_total="$(echo "${locale_xml}"|xmllint --xpath "/VeraCrypt/localization/entry/@key" -|wc -l)"
+keynum=1
+while [ "${keynum}" -le "${key_total:-0}" ]
+do
+ num_key=$(echo "${locale_xml}"|xmllint --xpath "/VeraCrypt/localization/entry[${keynum}]/@key" -|cut -f 2 -d '=')
+ key_xpath="/VeraCrypt/localization/entry[@key="${num_key}"]/text()"
+ en_string="$(echo "${en_xml}"|xmllint --xpath ${key_xpath} -|sed "s#&amp;#\&#g"|sed 's#&lt;#<#g'|sed 's#&gt;#>#g')"
+ locale_string="$(echo "${locale_xml}"|xmllint --xpath ${key_xpath} -|sed "s#&amp;#\&#g"|sed "s#&lt;#<#g"|sed "s#&gt;#>#g")"
+ filter_result="$(grep -Er "[^=]\"$(echo "${en_string}"|sed 's#\\#\\\\#g')\"" * --binary-files=without-match --exclude="*.log" --exclude="*.txt" --exclude="*.sh" --exclude="Language.xml"|tr '\r' '\n'|sed "/^ *$/d")"
+ if [ -z "${filter_result}" ]
+ then
+ filter_result="$(grep -ir "\"$(echo "${en_string}"|sed 's#\\#\\\\#g')\"" * --binary-files=without-match --exclude="*.log" --exclude="*.txt" --exclude="*.sh" --exclude="Language.xml"|tr '\r' '\n'|sed "/^ *$/d")"
+ fi
+ filter_num=$(echo -n "${filter_result}"|wc -l)
+ if !(echo ${en_string}|grep ' ' >/dev/null)
+ then #无空格输出
+ if [ "${filter_num}" -le 10 ] && [ -n "${filter_result}" ]
+ then #无空格且筛选结果小于10
+ filter_code b ${TMPFILE}/b
+ elif [ "${filter_num}" -gt 10 ] #无空格 大于10
+ then
+ filter_code d ${TMPFILE}/d
+ elif [ -z "${filter_result}" ] #无空格 无结果
+ then
+ filter_code f ${TMPFILE}/f
+ fi
+ else
+ if [ "${filter_num}" -le 10 ] && [ -n "${filter_result}" ]
+ then #筛选结果小于10
+ filter_code a ${TMPFILE}/a
+ elif [ "${filter_num}" -gt 10 ] #大于10
+ then
+ filter_code c ${TMPFILE}/c
+ elif [ -z "${filter_result}" ] #无结果
+ then
+ filter_code e ${TMPFILE}/e
+ fi
+ fi
+ if [ "${locale%%-*}" == "zh" ]
+ then
+ echo "${keynum}"-"${filter}:""${en_string} >翻译为> ${locale_string}"
+ echo -ne "搜索替换翻译中:${keynum}/${key_total}\r"
+ else
+ echo "${keynum}"-"${filter}""${en_string} >translate to> ${locale_string}"
+ echo -ne "Searching and replacing:${keynum}/${key_total}\r"
+ fi
+ let keynum=keynum+1
+done
+mv src/Common/Language.xml Translations/Language.en.xml
+cp Translations/Language.${locale}.xml src/Common/Language.xml
diff --git a/veracrypt.desktop b/veracrypt.desktop
new file mode 100644
index 00000000000..8cc5e683997
--- /dev/null
+++ b/veracrypt.desktop
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Type=Application
+Exec=veracrypt
+Icon=veracrypt.xpm
+Comment=Disk encryption with strong security based on TrueCrypt
+Terminal=false
+Name=VeraCrypt
+StartupNotify=true
+Categories=System;Administration;