sekaijin Posted October 22, 2021 Posted October 22, 2021 Bonjour Les AppImage on l'avantage de s'exécuter facilement et l’inconvénient de ne pas s'installer. pourtant le packaging inclus (parfois) un fichier desktop voici un script pour installer une telle application placer le fichier appimage_install.sh dans votre dossier ${HOME}/.local/bin/ avec le droit "execute" pour le user téléchargé une application AppImage (avec un fichier desktop inclus) https://s3.mongobooster.com/download/releasesv7/nosqlbooster4mongo-7.0.3.AppImage > appimage_install ~/download/nosqlbooster4mongo-7.0.3.AppImage Installing nosqlbooster4mongo-7.0.3 extract desktop file squashfs-root/nosqlbooster4mongo.desktop extract icon file squashfs-root/nosqlbooster4mongo.png squashfs-root/usr/share/icons/hicolor/512x512/apps/nosqlbooster4mongo.png copy nosqlbooster4mongo-7.0.3 to /home/jeanyves/.local/share/nosqlbooster4mongo-7.0.3 nosqlbooster4mongo-7.0.3: NoSQLBooster for MongoDB installed > le script : #!/usr/bin/sh #set -x #terminal colors red=$(tput setaf 1) green=$(tput setaf 2) blue=$(tput setaf 6) reset=$(tput sgr0) #application to install app_dir=$(dirname ${1}) app_name=$(basename ${1} .AppImage) app_image_name="${app_name}.AppImage" app_image_path=$(realpath "${app_dir}/${app_image_name}") #only install .appImage file if [ ! -f "${app_image_path}" ] then echo "${red}usage${reset}: $(basename ${0}) my_app.AppImage" exit 1 fi echo "Installing ${green}${app_name}${reset}" #work in tmp folder tmp_dir=$(mktemp -d -t appimage-XXXXXXXXXX) cp ${app_image_path} ${tmp_dir}/ cd ${tmp_dir} #Change permission AppImage file to be executed chmod u+x ./${app_image_name} #find desktop file for installation echo "extract desktop file${green}" ./${app_image_name} --appimage-extract *.desktop desktop_file=$(basename $(ls -1 squashfs-root/*.desktop) .desktop)".desktop" if [ -f "squashfs-root/${desktop_file}" ] then #find app icon icon_file=$(grep Icon= "squashfs-root/${desktop_file}"|cut -f2 -d=).png echo "${reset}extract icon file${green}" ./${app_image_name} --appimage-extract ${icon_file} #the icon file could be an symbolic link if [ -L "squashfs-root/${icon_file}" ] then link=$(readlink -- "squashfs-root/${icon_file}") ./${app_image_name} --appimage-extract ${link} mv "squashfs-root/${link}" "squashfs-root/${icon_file}" fi #define the target folder target=$(realpath "${HOME}/.local/share/${app_name}") echo "${reset}copy ${app_name} to ${target}" #populate desktop file sed -e "s|Icon=.*|Icon=${target}/${icon_file}|g" -e "s|Exec=.*|Exec=${target}/${app_image_name}|g" "squashfs-root/${desktop_file}" > "${desktop_file}" #install files mkdir -p ${target} cp "squashfs-root/${icon_file}" "${target}/" cp "${app_image_name}" "${target}/" cp "${desktop_file}" $(realpath "${HOME}/.local/share/applications/") echo "${app_name}: ${blue}$(grep Name= "squashfs-root/${desktop_file}"|cut -f2 -d=) ${green}installed${reset}" else echo "${reset}${desktop_file} ${red}file not found${reset}" fi #cleanup rm -rf ${tmp_dir} A+JYT
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now