correction update.sh
This commit is contained in:
parent
b2b1656eae
commit
44c043fd5a
42
update.sh
42
update.sh
@ -162,15 +162,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
|
||||
@ -188,6 +200,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
|
||||
@ -216,18 +229,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
|
||||
|
||||
# Vérifier et installer 7z si manquant
|
||||
if command -v 7z > /dev/null 2>&1; then
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user