-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpcloud.sh
More file actions
executable file
·89 lines (75 loc) · 2.97 KB
/
pcloud.sh
File metadata and controls
executable file
·89 lines (75 loc) · 2.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/bash
# Autor: Yordis Cujar
# Versión: 11.0 - Auto / URL Manual / Archivo Local
YELLOW=$(tput setaf 3)
GREEN=$(tput setaf 2)
RED=$(tput setaf 1)
NC=$(tput sgr0)
# 1. Validación de privilegios
if [ "$EUID" -ne 0 ]; then
echo "${RED}Error: Ejecuta con sudo.${NC}"
exit 1
fi
# 2. Corregir APT y dependencias (FUSE)
echo "${YELLOW}Verificando libfuse2...${NC}"
apt-get update -o Acquire::Check-Valid-Until=false -qq 2>/dev/null
apt-get install -y libfuse2 2>/dev/null
# 3. Limpieza profunda (Case-Insensitive)
echo "${YELLOW}Limpiando rastros anteriores...${NC}"
find /usr/share/applications/ -iname "*pcloud*.desktop" -delete 2>/dev/null
find /home/*/.local/share/applications/ -iname "*pcloud*.desktop" -delete 2>/dev/null
rm -f /opt/pcloud.appimage
# --- FUNCIÓN DE INSTALACIÓN ---
instalar_pcloud() {
local ORIGEN=$1
echo "${YELLOW}Procesando archivo desde: $ORIGEN${NC}"
cp "$ORIGEN" /opt/pcloud.appimage
chmod 755 /opt/pcloud.appimage
chown root:root /opt/pcloud.appimage
echo "${YELLOW}Configurando lanzador...${NC}"
cat > /usr/share/applications/pcloud.desktop <<EOF
[Desktop Entry]
Name=pCloud
Comment=Secure Cloud Storage
Exec=/opt/pcloud.appimage
Icon=pcloud
Terminal=false
Type=Application
Categories=Network;FileTransfer;
StartupNotify=false
EOF
echo "${GREEN}¡Instalación exitosa!${NC}"
REAL_USER=${SUDO_USER:-$USER}
sudo -u "$REAL_USER" nohup /opt/pcloud.appimage > /dev/null 2>&1 &
exit 0
}
# --- NIVEL 1: DESCARGA AUTOMÁTICA ---
echo "${YELLOW}Intentando descarga automática...${NC}"
AUTO_URL="https://www.pcloud.com/how-to-install-pcloud-drive-linux.html?download=electron-64"
wget -L --user-agent="Mozilla/5.0" -O /tmp/pcloud_temp.appimage "$AUTO_URL" --quiet --show-progress
if [ -f /tmp/pcloud_temp.appimage ] && [ $(stat -c%s "/tmp/pcloud_temp.appimage") -gt 10000000 ]; then
instalar_pcloud "/tmp/pcloud_temp.appimage"
else
echo "${RED}La descarga automática falló (archivo corrupto o bloqueado).${NC}"
# --- NIVEL 2: URL MANUAL ---
echo -n "${YELLOW}Pega aquí la URL de descarga directa (o presiona ENTER para buscar archivo local): ${NC}"
read MANUAL_URL
if [ ! -z "$MANUAL_URL" ]; then
wget -L --user-agent="Mozilla/5.0" -O /tmp/pcloud_manual.appimage "$MANUAL_URL" --show-progress
if [ -f /tmp/pcloud_manual.appimage ] && [ $(stat -c%s "/tmp/pcloud_manual.appimage") -gt 10000000 ]; then
instalar_pcloud "/tmp/pcloud_manual.appimage"
fi
fi
# --- NIVEL 3: ARCHIVO LOCAL ---
echo "${RED}No se pudo descargar de la red.${NC}"
echo -n "${YELLOW}Introduce la ruta completa del archivo pCloud que descargaste (ej: /home/usuario/Descargas/pCloud.AppImage): ${NC}"
read LOCAL_PATH
# Expandir tilde si existe
LOCAL_PATH="${LOCAL_PATH/#\~/$HOME}"
if [ -f "$LOCAL_PATH" ]; then
instalar_pcloud "$LOCAL_PATH"
else
echo "${RED}Error: No se encontró el archivo en $LOCAL_PATH. Abortando.${NC}"
exit 1
fi
fi