shell的appimg
1#!/bin/bash
2
3set -xv
4
5basePath="$( cd "$(dirname "$0")"&& pwd )"
6echo ${basePath}
7
8dirName=${basePath##*/}
9
10
11topAppImage=`ls | grep AppImage | grep -v ${dirName}-linux-x64.AppImage`
12echo ${topAppImage}
13pngHome=${basePath}/squashfs-root/usr/share/icons/hicolor/256x256/apps
14
15if [ -d "${pngHome}" ];then
16 echo "文件夹存在"
17 else
18 chmod +x ${basePath}/${topAppImage}
19 ${basePath}/${topAppImage} --appimage-extract
20 echo "文件夹不存在"
21fi
22
23outDesktop=${basePath}/${dirName}-linux-x64.desktop
24if [ -f "${outDesktop}" ];then
25 echo "文件夹存在"
26 ${basePath}/${dirName}-linux-x64.AppImage "$@"
27 else
28 pngFile=${basePath}/squashfs-root/usr/share/icons/hicolor/256x256/apps/`ls ${basePath}/squashfs-root/usr/share/icons/hicolor/256x256/apps`
29 echo ${pngFile}
30 topDesktop=`ls ${basePath}/squashfs-root | grep '.desktop'`
31 echo ${topDesktop}
32 cp ${basePath}/squashfs-root/${topDesktop} ${dirName}-linux-x64.desktop
33 sed -i 's#Exec=.*#Exec='${basePath}'/appimg --no-sandbox %U#g' ${basePath}/${dirName}-linux-x64.desktop
34 sed -i 's#Icon=.*#Icon='${pngFile}'#g' ${basePath}/${dirName}-linux-x64.desktop
35 cp ${basePath}/${dirName}-linux-x64.desktop ${HOME}/.local/share/applications
36 cp ${topAppImage} ${basePath}/${dirName}-linux-x64.AppImage
37 chmod +x ${basePath}/${dirName}-linux-x64.AppImage
38 echo "文件夹不存在"
39fi
40
41
42
43
44
45