mirror of
https://github.com/TermoraDev/termora.git
synced 2026-01-16 02:12:58 +08:00
fix: AppImage not working
This commit is contained in:
@@ -395,26 +395,30 @@ tasks.register("dist") {
|
|||||||
// AppImage
|
// AppImage
|
||||||
if (os.isLinux) {
|
if (os.isLinux) {
|
||||||
|
|
||||||
|
// Download AppImageKit
|
||||||
|
val appimagetool = FileUtils.getFile(projectDir, ".gradle", "appimagetool")
|
||||||
|
if (!appimagetool.exists()) {
|
||||||
exec {
|
exec {
|
||||||
commandLine(
|
commandLine(
|
||||||
"wget",
|
"wget",
|
||||||
"-O", "appimagetool",
|
"-O", appimagetool.absolutePath,
|
||||||
"https://github.com/AppImage/AppImageKit/releases/download/13/appimagetool-${if (arch.isArm) "aarch64" else "x86_64"}.AppImage"
|
"https://github.com/AppImage/AppImageKit/releases/download/13/appimagetool-${if (arch.isArm) "aarch64" else "x86_64"}.AppImage"
|
||||||
)
|
)
|
||||||
workingDir = distributionDir.asFile
|
workingDir = distributionDir.asFile
|
||||||
}
|
}
|
||||||
|
|
||||||
exec {
|
// AppImageKit chmod
|
||||||
commandLine("chmod", "+x", distributionDir.file("appimagetool"))
|
exec { commandLine("chmod", "+x", appimagetool.absolutePath) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Desktop file
|
||||||
val termoraName = project.name.uppercaseFirstChar()
|
val termoraName = project.name.uppercaseFirstChar()
|
||||||
val desktopFile = distributionDir.file(termoraName + File.separator + termoraName + ".desktop").asFile
|
val desktopFile = distributionDir.file(termoraName + File.separator + termoraName + ".desktop").asFile
|
||||||
desktopFile.writeText(
|
desktopFile.writeText(
|
||||||
"""[Desktop Entry]
|
"""[Desktop Entry]
|
||||||
Type=Application
|
Type=Application
|
||||||
Name=${termoraName}
|
Name=${termoraName}
|
||||||
Exec=bin/${termoraName}
|
|
||||||
Comment=Terminal emulator and SSH client
|
Comment=Terminal emulator and SSH client
|
||||||
Icon=/lib/${termoraName}
|
Icon=/lib/${termoraName}
|
||||||
Categories=Development;
|
Categories=Development;
|
||||||
@@ -422,8 +426,18 @@ Terminal=false
|
|||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// AppRun file
|
||||||
|
val appRun = File(desktopFile.parentFile, "AppRun")
|
||||||
|
val sb = StringBuilder()
|
||||||
|
sb.append("#!/bin/sh").appendLine()
|
||||||
|
sb.append("SELF=$(readlink -f \"$0\")").appendLine()
|
||||||
|
sb.append("HERE=\${SELF%/*}").appendLine()
|
||||||
|
sb.append("exec \"\${HERE}/bin/${termoraName}\" \"$@\"")
|
||||||
|
appRun.writeText(sb.toString())
|
||||||
|
appRun.setExecutable(true)
|
||||||
|
|
||||||
exec {
|
exec {
|
||||||
commandLine("./appimagetool", termoraName, "${finalFilenameWithoutExtension}.AppImage")
|
commandLine(appimagetool.absolutePath, termoraName, "${finalFilenameWithoutExtension}.AppImage")
|
||||||
workingDir = distributionDir.asFile
|
workingDir = distributionDir.asFile
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user