summarylogtreecommitdiffstats
path: root/idriveforlinux.install
blob: dd9c7879172f7db5c562d2e02eb53a653060a66a (plain)
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
post_install() {
  # Set SUID on chrome-sandbox
  chmod 4755 /opt/IDriveForLinux/chrome-sandbox

  # Create symlink if missing
  if [ ! -e /usr/bin/idriveforlinux ]; then
    ln -sf /opt/IDriveForLinux/idriveforlinux /usr/bin/idriveforlinux
  fi

  # Create version file
  echo "1.8.0" > /opt/IDriveForLinux/AppVersion

  # Create config directory
  mkdir -p /opt/IDriveForLinux/.config/cloud-drive
  echo -n 'aJF6Q4IP7IDO1moUhUHwVQ==:Y7B0vLir0nPK/saicnTvGldpsR8HoJWuc5/dVW0A0Xo=' > /opt/IDriveForLinux/.config/cloud-drive/.junk.txt
  chmod 644 /opt/IDriveForLinux/.config/cloud-drive/.junk.txt

  # Update desktop database
  update-desktop-database -q 2>/dev/null || true

  # Update icon cache
  gtk-update-icon-cache -q -f /usr/share/icons/hicolor 2>/dev/null || true

  # Run the IDrive installer to download Python deps and set up cron
  if [ -f /opt/IDriveForLinux/resources/app.asar.unpacked/IdriveForLinux/idriveforlinux.bin ]; then
    /opt/IDriveForLinux/resources/app.asar.unpacked/IdriveForLinux/idriveforlinux.bin --install > /opt/IDriveForLinux/installation.txt 2>&1 || true
    chown root:root /opt/IDriveForLinux/chrome-sandbox 2>/dev/null
    chmod 4755 /opt/IDriveForLinux/chrome-sandbox
  fi

  echo "IDrive For Linux installed. Run 'idriveforlinux' to start."
}

post_upgrade() {
  post_install
}

pre_remove() {
  # Run the uninstaller
  if [ -f /opt/IDriveForLinux/resources/app.asar.unpacked/IdriveForLinux/idriveforlinux.bin ]; then
    /opt/IDriveForLinux/resources/app.asar.unpacked/IdriveForLinux/idriveforlinux.bin --uninstall desktop-app >/dev/null 2>&1 || true
  fi
}

post_remove() {
  # Remove symlink
  rm -f /usr/bin/idriveforlinux /usr/local/bin/idriveforlinux

  # Clean up user overlay icon files
  for user_home in /home/*; do
    rm -f "$user_home/.local/share/nautilus-python/extensions/idrive_overlay.py" 2>/dev/null || true
    rm -f "$user_home/.local/share/nautilus-python/extensions/idrive_overlay_xattr.py" 2>/dev/null || true
    rm -f "$user_home/.local/share/nemo-python/extensions/idrive_overlay.py" 2>/dev/null || true
    rm -f "$user_home/.local/share/nemo-python/extensions/idrive_overlay_xattr.py" 2>/dev/null || true
    rm -f "$user_home/.local/share/caja-python/extensions/idrive_overlay.py" 2>/dev/null || true
    rm -f "$user_home/.local/share/caja-python/extensions/idrive_overlay_xattr.py" 2>/dev/null || true
  done

  # Remove config directory
  rm -rf /opt/IDriveForLinux/.config 2>/dev/null || true
}