-
Notifications
You must be signed in to change notification settings - Fork 2
Aggiunto script per la creazione di AppImage. #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
demperor-music
wants to merge
3
commits into
USPAssets:main
Choose a base branch
from
demperor-music:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,138 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
| current_dir=$(pwd) | ||
|
|
||
| _download_dir="/tmp/SpaghettiProjectAppImage/download" | ||
| _pkgdir="/tmp/SpaghettiProjectAppImage/AppDir" | ||
| _debug_mode=false | ||
|
|
||
| readonly PATCHER_NAME="ItalianPatcherByUSPLinux" | ||
| readonly DOTNET="dotnet80" | ||
| readonly DOTNET_URL="https://builds.dotnet.microsoft.com/dotnet/aspnetcore/Runtime/8.0.19/aspnetcore-runtime-8.0.19-linux-x64.tar.gz" | ||
| readonly APPIMAGETOOL_URL="https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage" | ||
| readonly ICON="$current_dir/SpaghettiCh2/Assets/avalonia-logo.ico" | ||
| readonly ICON_INDEX=-1 | ||
|
|
||
| function debug_echo() { | ||
| if $_debug_mode; then | ||
| echo "${1:-$(cat -)}" | ||
| else | ||
| cat - > /dev/null | ||
| fi | ||
| } | ||
|
|
||
| function check_command() { | ||
| command -v "$1" >/dev/null 2>&1 || { | ||
| echo "Errore: comando \"$1\" non trovato." >&2 | ||
| exit 1 | ||
| } | ||
| } | ||
|
|
||
|
|
||
| function show_help() { | ||
| echo "Usage: $0 [OPTIONS]" | ||
| echo | ||
| echo "Opzioni:" | ||
| echo " -k Conserva i file temporanei alla fine." | ||
| echo " -d Mostra output di debug." | ||
| echo " -h Mostra questa guida ed esce." | ||
| } | ||
|
|
||
| keep_temp=false | ||
|
|
||
|
|
||
| echo -n "Controllo dipendenze... " | ||
| check_command curl | ||
| check_command tar | ||
| check_command magick | ||
| check_command dotnet | ||
| echo "OK" | ||
|
|
||
| while getopts "df:kch" opt; do | ||
| case $opt in | ||
| k) keep_temp=true ;; | ||
| h) show_help; exit 0 ;; | ||
| d) _debug_mode=true ;; | ||
| *) show_help; exit 1 ;; | ||
| esac | ||
| done | ||
|
|
||
| # Se $_pkgdir esiste già e non è vuota... | ||
| if [ -e "$_pkgdir" ] && [ -n "$(ls -A "$_pkgdir")" ]; then | ||
| echo -n "La directory $_pkgdir non è vuota e sarà necessario eliminarla. Vuoi continuare? (S/n) " | ||
| read -r confirmation | ||
| if [[ "$confirmation" =~ [nN] ]]; then | ||
| echo "Operazione annullata." | ||
| exit 1 | ||
| else | ||
| rm -rf "$_pkgdir" | ||
| echo "$_pkgdir è stato eliminato." | ||
| fi | ||
| fi | ||
|
|
||
|
|
||
| mkdir -p "$_download_dir" "$_pkgdir/usr/bin" "$_pkgdir/opt/spaghettiproject" | ||
| cd "$_download_dir" | ||
|
|
||
| echo "Scaricamento di $DOTNET..." | ||
| curl -L -# "$DOTNET_URL" -o "$DOTNET.tar.gz" | ||
|
|
||
| echo "Scaricamento di AppImageTool..." | ||
| curl -L -# "$APPIMAGETOOL_URL" -o "appimagetool.AppImage" | ||
| chmod +x appimagetool.AppImage | ||
|
|
||
| echo -n "Estrazione di dotnet 8.0..." | ||
| tar -xzf "$DOTNET.tar.gz" -C "$_pkgdir/usr/bin/" | ||
| echo " OK" | ||
|
|
||
| cd "$current_dir" | ||
|
|
||
| echo -n "Compilazione del patcher..." | ||
| dotnet build -c Release -o "$_pkgdir/opt/spaghettiproject" | ||
| echo " OK" | ||
|
|
||
| echo -n "Creazione script di avvio..." | ||
| echo "#!/bin/bash | ||
|
|
||
| \$APPDIR/usr/bin/dotnet \$APPDIR/opt/spaghettiproject/USPInstaller.dll" > "$_pkgdir/usr/bin/USPInstaller.sh" | ||
| chmod +x "$_pkgdir/usr/bin/USPInstaller.sh" | ||
| echo " OK" | ||
|
|
||
| echo -n "Creazione file .desktop..." | ||
| echo "[Desktop Entry] | ||
| Type=Application | ||
| Name=Undertale Spaghetti Project Installer | ||
| Exec=USPInstaller.sh | ||
| Icon=uspinstaller | ||
| Categories=Utility;" > "$_pkgdir/spaghetti-project.desktop" | ||
| echo " OK" | ||
|
|
||
| echo "Conversione icona in png..." | ||
| magick "$ICON[$ICON_INDEX]" "$_pkgdir/uspinstaller.png" | ||
|
|
||
| echo -n "Creazione script AppRun..." | ||
| cat << 'EOF' > "$_pkgdir/AppRun" | ||
| #!/bin/bash | ||
|
|
||
| if [ -z "$APPDIR" ]; then | ||
| APPDIR="$(dirname "$(readlink -f "$0")")" | ||
| fi | ||
|
|
||
| exec $APPDIR/usr/bin/USPInstaller.sh | ||
| EOF | ||
| chmod +x "$_pkgdir/AppRun" | ||
| echo " OK" | ||
|
|
||
| cd "$current_dir" | ||
| echo "Creazione AppImage..." | ||
| ARCH=x86_64 "$_download_dir/appimagetool.AppImage" "$_pkgdir" "$PATCHER_NAME.AppImage" | ||
|
|
||
| if ! $keep_temp; then | ||
| echo -n "Pulizia file temporanei..." | ||
| rm -rf "$_download_dir" | ||
| rm -rf "$_pkgdir" | ||
| echo " OK" | ||
| fi | ||
|
|
||
| echo "Build completata con successo!" | ||
| echo "Il file è: $(pwd)/$PATCHER_NAME.AppImage" | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Senza dover creare uno script di avvio - se cambi la generazione dell'eseguibile a
dotnet publish --self-containedcome da commento sopra hai tutto self contained per far partire tutto, senza dover anche avere il runtime e puoi runnare ./USPInstaller direttamente