correction installation nodejs
This commit is contained in:
parent
44c043fd5a
commit
bd558e4447
43
install.sh
43
install.sh
@ -227,15 +227,27 @@ AUTOPOST_DIR="$HOME/autopost"
|
||||
# Création du dossier si inexistant
|
||||
mkdir -p "$AUTOPOST_DIR"
|
||||
|
||||
# Vérification et installation de NVM
|
||||
if ! command -v nvm &> /dev/null; then
|
||||
log "nvm non trouvé, installation de nvm..."
|
||||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
||||
log "NVM installé."
|
||||
# Définir le répertoire NVM
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
|
||||
# Vérifier si nvm est déjà chargé dans la session actuelle
|
||||
if [ -s "$NVM_DIR/nvm.sh" ]; then
|
||||
log "nvm est déjà installé. Chargement de nvm..."
|
||||
\. "$NVM_DIR/nvm.sh"
|
||||
else
|
||||
log "nvm est déjà installé."
|
||||
log "nvm non trouvé, installation de nvm..."
|
||||
# Installer nvm
|
||||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
|
||||
|
||||
# Après l'installation, sourcer nvm pour la session courante
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
if [ -s "$NVM_DIR/nvm.sh" ]; then
|
||||
\. "$NVM_DIR/nvm.sh"
|
||||
log "NVM installé et chargé."
|
||||
else
|
||||
log "Erreur : nvm n'a pas pu être chargé."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Vérification de Node.js
|
||||
@ -253,6 +265,7 @@ else
|
||||
log "Node.js non trouvé, installation de Node.js 22..."
|
||||
nvm install 22
|
||||
nvm use 22
|
||||
updated="1"
|
||||
fi
|
||||
|
||||
# Charger nvm après installation
|
||||
@ -266,7 +279,7 @@ modules=("express" "express-session" "sqlite3" "ansi-to-html")
|
||||
missing_modules=()
|
||||
|
||||
for module in "${modules[@]}"; do
|
||||
if ! npm list -g "$module" &> /dev/null; then
|
||||
if ! npm list "$module" &> /dev/null; then
|
||||
missing_modules+=("$module")
|
||||
fi
|
||||
done
|
||||
@ -281,17 +294,17 @@ fi
|
||||
# Vérification et téléchargement des fichiers de configuration
|
||||
log "Vérification des fichiers de configuration..."
|
||||
|
||||
if [ ! -f "$AUTOPOST_DIR/config.js" ]; then
|
||||
log "Téléchargement de config.js..."
|
||||
wget -q -O "$AUTOPOST_DIR/config.js" "https://tig.unfr.pw/UNFR/postauto/raw/branch/main/autopost/config.js"
|
||||
fi
|
||||
|
||||
if [ ! -f "$AUTOPOST_DIR/server.js" ]; then
|
||||
log "Téléchargement de server.js..."
|
||||
wget -q -O "$AUTOPOST_DIR/server.js" "https://tig.unfr.pw/UNFR/postauto/raw/branch/main/autopost/server.js"
|
||||
updated="1"
|
||||
fi
|
||||
|
||||
log "Installation terminée. Vous pouvez maintenant configurer $AUTOPOST_DIR/config.js."
|
||||
if [ ! -f "$AUTOPOST_DIR/config.js" ]; then
|
||||
log "Téléchargement de config.js..."
|
||||
wget -q -O "$AUTOPOST_DIR/config.js" "https://tig.unfr.pw/UNFR/postauto/raw/branch/main/autopost/config.js"
|
||||
echo -e "${BLEU}Installation terminée. Vous pouvez maintenant configurer $AUTOPOST_DIR/config.js.${NORMAL}"
|
||||
fi
|
||||
|
||||
echo "Suppression du script après exécution..."
|
||||
rm -- "$0"
|
||||
|
||||
@ -258,7 +258,7 @@ else
|
||||
LISTE_APPLIS+=("$BIN_DIR/7z")
|
||||
fi
|
||||
|
||||
echo "Merci d'aller lire le readme pour compresser vos anciens NZB"
|
||||
echo -e "${ROUGE}Merci d'aller lire le readme pour compresser vos anciens NZB${NORMAL}"
|
||||
|
||||
if [ $updated = "1" ]; then
|
||||
echo -e "${ROUGE}Mise à jour effectué merci de relancer la commande 'postauto restart'${NORMAL}"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user