final
This commit is contained in:
@@ -29,9 +29,10 @@ prismlocal_path="$HOME/.local/share/PrismLauncher"
|
|||||||
appimage="$minecraft_path/PrismLauncher-Linux-x86_64.AppImage" #Dossier sense contenir le .appimage du launcher
|
appimage="$minecraft_path/PrismLauncher-Linux-x86_64.AppImage" #Dossier sense contenir le .appimage du launcher
|
||||||
url="https://github.com/PrismLauncher/PrismLauncher/releases/download/9.4/PrismLauncher-Linux-x86_64.AppImage" #URL du github pour telecharger le launcher
|
url="https://github.com/PrismLauncher/PrismLauncher/releases/download/9.4/PrismLauncher-Linux-x86_64.AppImage" #URL du github pour telecharger le launcher
|
||||||
|
|
||||||
total=$(($used_storage+$minecraft_storage+$margin_storage))
|
total_storage=$(($used_storage+$minecraft_storage+$margin_storage))
|
||||||
check_storage(){ #VALIDE
|
check_storage(){
|
||||||
if [ $total-gt$max_storage ]; then
|
#verification si l'AFS peut installer minecraft en plus de garder un marge pour les autre fichiers
|
||||||
|
if [ $total_storage -gt $max_storage ]; then
|
||||||
printf "Impossible d'installer minecraft, il n'y a pas assez de place."
|
printf "Impossible d'installer minecraft, il n'y a pas assez de place."
|
||||||
printf "\n\tEssayez de supprimer quelques fichiers, regardez dans les configuration (du -h --max-depth=1 ~/.confs) pour connaitre la taille des differentes configuration"
|
printf "\n\tEssayez de supprimer quelques fichiers, regardez dans les configuration (du -h --max-depth=1 ~/.confs) pour connaitre la taille des differentes configuration"
|
||||||
printf "\n\tNote: Chez moi la configuration de Discord faisait plus de 700Mo et celle de Firefox plus de 600Mo"
|
printf "\n\tNote: Chez moi la configuration de Discord faisait plus de 700Mo et celle de Firefox plus de 600Mo"
|
||||||
@@ -41,36 +42,37 @@ if [ $total-gt$max_storage ]; then
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
check_path(){ #VALIDE
|
check_path(){
|
||||||
#Verfication de l'arbo du dossier minecraft
|
#Verfication de l'arbo du dossier minecraft
|
||||||
if [ ! -f "$minecraft_path" ]; then
|
if [ ! -d "$minecraft_path" ]; then
|
||||||
mkdir $minecraft_path $launcher_config_path $instances_path $mods_path $java_path
|
mkdir $minecraft_path $launcher_config_path $instances_path $mods_path $java_path
|
||||||
|
|
||||||
else
|
else
|
||||||
if [ ! -f "$instances_path" ]; then
|
if [ ! -d "$instances_path" ]; then
|
||||||
mkdir $instances_path
|
mkdir $instances_path
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f "$mods_path" ]; then
|
if [ ! -d "$mods_path" ]; then
|
||||||
mkdir $mods_path
|
mkdir $mods_path
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f "$java_path" ]; then
|
if [ ! -d "$java_path" ]; then
|
||||||
mkdir $java_path
|
mkdir $java_path
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f "$launcher_config_path" ]; then
|
if [ ! -d "$launcher_config_path" ]; then
|
||||||
mkdir $launcher_config_path
|
mkdir $launcher_config_path
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f "$downloads_path" ]; then
|
if [ ! -d "$downloads_path" ]; then
|
||||||
mkdir $downloads_path
|
mkdir $downloads_path
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
check_config(){ #VALIDE
|
check_config(){
|
||||||
if [ ! -f "launcher_config_path/prismlauncher.cfg" ]; then
|
#telechargement et modification de la config
|
||||||
|
if [ ! -f "$launcher_config_path/prismlauncher.cfg" ]; then
|
||||||
wget -P "$launcher_config_path/" "https://raw.githubusercontent.com/PixPix20/Minecraft-Installer/refs/heads/main/prismlauncher.cfg"
|
wget -P "$launcher_config_path/" "https://raw.githubusercontent.com/PixPix20/Minecraft-Installer/refs/heads/main/prismlauncher.cfg"
|
||||||
sed -i "s|DownloadsDir=|DownloadsDir=$downloads_path|" $launcher_config_path/prismlauncher.cfg
|
sed -i "s|DownloadsDir=|DownloadsDir=$downloads_path|" $launcher_config_path/prismlauncher.cfg
|
||||||
sed -i "s|InstanceDir=|InstanceDir=$instances_path|" $launcher_config_path/prismlauncher.cfg
|
sed -i "s|InstanceDir=|InstanceDir=$instances_path|" $launcher_config_path/prismlauncher.cfg
|
||||||
@@ -80,23 +82,25 @@ fi
|
|||||||
}
|
}
|
||||||
|
|
||||||
check_account(){
|
check_account(){
|
||||||
#TODO: A voir
|
#enregistrement du compte une fois connecte
|
||||||
while [ ! -f "$launcher_config_path/accounts.sh" ]; do
|
while [ ! -f "$prismlocal_path/accounts.json" ]; do
|
||||||
sleep 2
|
sleep 2
|
||||||
done
|
done
|
||||||
cp $HOME/.local/share/PrismLauncher/accounts.json $launcher_config_path
|
cp $prismlocal_path/accounts.json $launcher_config_path
|
||||||
}
|
}
|
||||||
|
|
||||||
check_launcher(){ #VALIDE
|
check_launcher(){
|
||||||
|
#telechargement du launcher si inexistant
|
||||||
if [ ! -f "$appimage" ]; then
|
if [ ! -f "$appimage" ]; then
|
||||||
echo "Téléchargement de PrismLauncher..."
|
echo "Téléchargement de PrismLauncher..."
|
||||||
mkdir -p "$(dirname "$appimage")"
|
mkdir -p "$(dirname "$appimage")"
|
||||||
#curl -L -o "$appimage" "$url"
|
#curl -L -o "$appimage" "$url"
|
||||||
wget -P "$appimage" "$url"
|
wget -O "$appimage" "$url"
|
||||||
chmod +x "$appimage"
|
chmod +x "$appimage"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
cop_files(){ #VALIDE
|
cop_files(){
|
||||||
|
#deplacement des fichers de config et du compte dans le .local du launcher
|
||||||
if [ ! -f "$prismlocal_path" ]; then
|
if [ ! -f "$prismlocal_path" ]; then
|
||||||
mkdir -p $prismlocal_path
|
mkdir -p $prismlocal_path
|
||||||
fi
|
fi
|
||||||
@@ -108,10 +112,10 @@ start_launcher(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
#installation
|
#installation
|
||||||
#check_storage
|
check_storage
|
||||||
check_path
|
check_path
|
||||||
check_config
|
check_config
|
||||||
cop_files
|
cop_files
|
||||||
check_launcher
|
check_launcher
|
||||||
echo fin
|
echo fin
|
||||||
start_launcher && check_account # doit se faire en para
|
start_launcher & check_account # doit se faire en para
|
||||||
|
|||||||
Reference in New Issue
Block a user