修改postrm

This commit is contained in:
gfdgd xi 2022-09-09 22:12:27 +08:00
parent d28d21557c
commit ee692c8962
3 changed files with 170 additions and 3 deletions

View File

@ -1,6 +1,46 @@
#!/bin/sh
#!/bin/bash
# 删除软件残留,简单粗暴一点直接全部删掉,防止出现警告
# 加判断是为了怕 reinstall 后程序就再也打不开了(除非卸载后重新安装)
if [ "$1" = "remove" ] || [ "$1" = "purge" ]; then
rm -rf /opt/apps/deepin-wine-runner/
fi
# 删除软件缓存(留着也没什么用了)
# 缓存目录:~/.cache/deepin-wine-runner
if [ "$1" = "remove" ] || [ "$1" = "purge" ]; then
echo "清理程序缓存"
for username in $(ls /home); do
echo /home/$username
if [ -d "/home/$username/.cache/deepin-wine-runner/" ]; then
rm -rf "/home/$username/.cache/deepin-wine-runner/"
fi
done
# 清理 root 用户的缓存文件
echo /root
if [ -d "/root/.cache/deepin-wine-runner/" ]; then
rm -rf "/root/.cache/deepin-wine-runner/"
fi
else
echo "非卸载,跳过清理"
fi
# 删除软件配置文件只限“purge”
# 配置目录:~/.config/deepin-wine-runner
if [ "$1" = "purge" ]; then
echo "清理程序配置文件"
for username in $(ls /home); do
echo /home/$username
if [ -d "/home/$username/.config/deepin-wine-runner/" ]; then
rm -rf "/home/$username/.config/deepin-wine-runner/"
fi
done
# 清理 root 用户的配置文件
echo /root
if [ -d "/root/.config/deepin-wine-runner/" ]; then
rm -rf "/root/.config/deepin-wine-runner/"
fi
else
echo "非 purge跳过清理"
fi

View File

@ -102,6 +102,17 @@ def make_deb(build=False):
if QtWidgets.QMessageBox.question(widget, QtCore.QCoreApplication.translate("U", "提示"), QtCore.QCoreApplication.translate("U", "打包将会改动现在选择的容器,是否继续?")) == QtWidgets.QMessageBox.No:
disabled_or_NORMAL_all(True)
return
# 警告信息
if os.path.exists(e7_text.text()):
if QtWidgets.QMessageBox.warning(window, "警告", "输入的路径似乎是一个绝对路径\n不建议打包绝对路径,建议是 Wine 容器内路径\n是否继续打包?", QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No) == QtWidgets.QMessageBox.No:
disabled_or_NORMAL_all(True)
return
if e7_text.text()[:2].lower() == "c:" and not os.path.exists("{}/drive_c/{}".format(
e6_text.text(),
e7_text.text()[3:].replace("\\", '/'))):
if QtWidgets.QMessageBox.warning(window, "警告", "输入的路径似乎在 Wine 容器不存在(如果只是大小写错误导致的误判,请忽略)\n是否继续打包?", QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No) == QtWidgets.QMessageBox.No:
disabled_or_NORMAL_all(True)
return
#thread = threading.Thread(target=make_deb_threading)
QT.thread = make_deb_threading(build)
QT.thread.signal.connect(chang_textbox1_things)

View File

@ -1111,7 +1111,7 @@ class ProgramRunStatusUpload():
try:
if ProgramRunStatusUpload.sha1Value == "":
ProgramRunStatusUpload.sha1Value = ProgramRunStatusUpload.GetSHA1(e2.currentText())
QtWidgets.QMessageBox.information(None, QtCore.QCoreApplication.translate("U", "提示"), json.loads(requests.post(base64.b64decode("aHR0cDovL2dmZGdkeGkucWljcC52aXA6Mjc1MDI=").decode("utf-8"), {
QtWidgets.QMessageBox.information(None, QtCore.QCoreApplication.translate("U", "提示"), json.loads(requests.post(base64.b64decode("aHR0cDovLzEyMC4yNS4xNTMuMTQ0OjMwMjUw").decode("utf-8"), {
"SHA1": ProgramRunStatusUpload.sha1Value,
"Name": ProgramRunStatusUpload.programName.text(),
"Fen": ProgramRunStatusUpload.fen.currentIndex(),
@ -1236,7 +1236,103 @@ class ProgramSetting():
return
QtWidgets.QMessageBox.information(ProgramSetting.message, "提示", "保存完毕!")
class ValueCheck():
def __init__(self):
pass
def BASE64(self, filePath):
src = ""
with open(filePath, "rb") as f:
base64Byte = base64.b64encode(f.read())
src += base64Byte.decode("utf-8")
return src
def SHA1(self, filePath):
sha1 = hashlib.sha1()
file = open(filePath, "rb")
while True:
readByte = file.read(1024 * 1024)
sha1.update(readByte)
if not readByte:
break
file.close()
return sha1.hexdigest()
def MD5(self, filePath):
md5 = hashlib.md5()
file = open(filePath, "rb")
while True:
readByte = file.read(1024 * 1024)
md5.update(readByte)
if not readByte:
break
file.close()
return md5.hexdigest()
def SHA256(self, filePath):
value = hashlib.sha256()
file = open(filePath, "rb")
while True:
readByte = file.read(1024 * 1024)
value.update(readByte)
if not readByte:
break
file.close()
return value.hexdigest()
def SHA384(self, filePath):
value = hashlib.sha384()
file = open(filePath, "rb")
while True:
readByte = file.read(1024 * 1024)
value.update(readByte)
if not readByte:
break
file.close()
return value.hexdigest()
def SHA224(self, filePath):
value = hashlib.sha224()
file = open(filePath, "rb")
while True:
readByte = file.read(1024 * 1024)
value.update(readByte)
if not readByte:
break
file.close()
return value.hexdigest()
def SHA512(self, filePath):
value = hashlib.sha512()
file = open(filePath, "rb")
while True:
readByte = file.read(1024 * 1024)
value.update(readByte)
if not readByte:
break
file.close()
return value.hexdigest()
link = {
"SHA1": SHA1,
"MD5": MD5,
"SHA256": SHA256,
"SHA512": SHA512,
"SHA224": SHA224,
"SHA384": SHA384,
"BASE64": BASE64
}
def Get(self, types):
QtWidgets.QMessageBox.information(window, "提示", "在计算过程中,程序可能会出现无响应的问题,请稍后\n请在接下来的打开对话框中选择要计算的文件")
file = QtWidgets.QFileDialog.getOpenFileName(window, "打开")[0]
if file == "":
return
try:
QtWidgets.QInputDialog.getMultiLineText(window, "", "计算得到的值", self.link[types](self, file))
except:
traceback.print_exc()
QtWidgets.QMessageBox.critical(window, "错误", traceback.format_exc())
###########################
# 加载配置
@ -1753,6 +1849,24 @@ v1 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "使用 Virtualbox
virtualMachine.addAction(v1)
v1.triggered.connect(RunVM)
checkValue = menu.addMenu(QtCore.QCoreApplication.translate("U", "校验值计算(&S)"))
md5Value = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "MD5(&M)"))
sha1Value = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "SHA1(&M)"))
base64Value = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "Base64(建议小文件)(&B)"))
sha256Value = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "SHA256(&S)"))
sha512Value = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "SHA512(&S)"))
md5Value.triggered.connect(lambda: ValueCheck().Get("MD5"))
sha1Value.triggered.connect(lambda: ValueCheck().Get("SHA1"))
base64Value.triggered.connect(lambda: ValueCheck().Get("BASE64"))
sha256Value.triggered.connect(lambda: ValueCheck().Get("SHA256"))
sha512Value.triggered.connect(lambda: ValueCheck().Get("SHA512"))
checkValue.addAction(md5Value)
checkValue.addAction(sha1Value)
checkValue.addAction(base64Value)
checkValue.addAction(sha256Value)
checkValue.addAction(sha512Value)
safeWebsize = menu.addMenu(QtCore.QCoreApplication.translate("U", "云沙箱(&C)"))
s1 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "360 沙箱云"))
s2 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "微步云沙箱"))
@ -1876,4 +1990,6 @@ if o1.currentText() == "":
wine["没有识别到任何Wine请在菜单栏“程序”安装Wine或安装任意Wine应用"] = "没有识别到任何Wine请在菜单栏“程序”安装Wine或安装任意Wine应用"
canUseWine.append("没有识别到任何Wine请在菜单栏“程序”安装Wine或安装任意Wine应用")
o1.addItem("没有识别到任何Wine请在菜单栏“程序”安装Wine或安装任意Wine应用")
sys.exit(app.exec_())