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
|
# Création du dossier si inexistant
|
||||||
mkdir -p "$AUTOPOST_DIR"
|
mkdir -p "$AUTOPOST_DIR"
|
||||||
|
|
||||||
# Vérification et installation de NVM
|
# Définir le répertoire NVM
|
||||||
if ! command -v nvm &> /dev/null; then
|
export NVM_DIR="$HOME/.nvm"
|
||||||
log "nvm non trouvé, installation de nvm..."
|
|
||||||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
|
# Vérifier si nvm est déjà chargé dans la session actuelle
|
||||||
export NVM_DIR="$HOME/.nvm"
|
if [ -s "$NVM_DIR/nvm.sh" ]; then
|
||||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
log "nvm est déjà installé. Chargement de nvm..."
|
||||||
log "NVM installé."
|
\. "$NVM_DIR/nvm.sh"
|
||||||
else
|
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
|
fi
|
||||||
|
|
||||||
# Vérification de Node.js
|
# Vérification de Node.js
|
||||||
@ -188,6 +200,7 @@ else
|
|||||||
log "Node.js non trouvé, installation de Node.js 22..."
|
log "Node.js non trouvé, installation de Node.js 22..."
|
||||||
nvm install 22
|
nvm install 22
|
||||||
nvm use 22
|
nvm use 22
|
||||||
|
updated="1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Charger nvm après installation
|
# Charger nvm après installation
|
||||||
@ -216,18 +229,17 @@ fi
|
|||||||
# Vérification et téléchargement des fichiers de configuration
|
# Vérification et téléchargement des fichiers de configuration
|
||||||
log "Vérification 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
|
if [ ! -f "$AUTOPOST_DIR/server.js" ]; then
|
||||||
log "Téléchargement de server.js..."
|
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"
|
wget -q -O "$AUTOPOST_DIR/server.js" "https://tig.unfr.pw/UNFR/postauto/raw/branch/main/autopost/server.js"
|
||||||
|
updated="1"
|
||||||
fi
|
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
|
# Vérifier et installer 7z si manquant
|
||||||
if command -v 7z > /dev/null 2>&1; then
|
if command -v 7z > /dev/null 2>&1; then
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user