mirror of
https://github.com/OpenListTeam/OpenList-Desktop.git
synced 2025-11-25 03:14:56 +08:00
Compare commits
5 Commits
4eaf89abbc
...
copilot/fi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f9c2cc3deb | ||
|
|
5923aa4e6e | ||
|
|
9c9b3e713f | ||
|
|
0ff3fee308 | ||
|
|
0dae544d54 |
@@ -1,4 +1,23 @@
|
||||
#!/bin/bash
|
||||
chmod +x /usr/bin/install-openlist-service
|
||||
chmod +x /usr/bin/uninstall-openlist-service
|
||||
chmod +x /usr/bin/openlist-desktop-service
|
||||
|
||||
# Migration: Clean up old installation in /usr/bin if it exists
|
||||
# This handles upgrades from previous versions that installed to /usr/bin
|
||||
if [ -f "/usr/bin/openlist-desktop" ] && [ ! -L "/usr/bin/openlist-desktop" ]; then
|
||||
echo "Migrating from old installation location (/usr/bin) to /opt/OpenList-Desktop"
|
||||
# Remove old binaries that are now in /opt
|
||||
rm -f /usr/bin/install-openlist-service
|
||||
rm -f /usr/bin/uninstall-openlist-service
|
||||
rm -f /usr/bin/openlist-desktop-service
|
||||
rm -f /usr/bin/openlist
|
||||
rm -f /usr/bin/rclone
|
||||
# Note: /usr/bin/openlist-desktop will be replaced with symlink below
|
||||
fi
|
||||
|
||||
# Set execute permissions for binaries in /opt
|
||||
chmod +x /opt/OpenList-Desktop/install-openlist-service
|
||||
chmod +x /opt/OpenList-Desktop/uninstall-openlist-service
|
||||
chmod +x /opt/OpenList-Desktop/openlist-desktop-service
|
||||
|
||||
# Create symlink for easy command-line access
|
||||
# Using -f flag to force creation even if file exists
|
||||
ln -sf /opt/OpenList-Desktop/openlist-desktop /usr/bin/openlist-desktop
|
||||
|
||||
@@ -1,2 +1,5 @@
|
||||
#!/bin/bash
|
||||
/usr/bin/uninstall-openlist-service
|
||||
/opt/OpenList-Desktop/uninstall-openlist-service
|
||||
|
||||
# Remove symlink
|
||||
rm -f /usr/bin/openlist-desktop
|
||||
|
||||
@@ -204,6 +204,23 @@ pub async fn create_rclone_mount_remote_process(
|
||||
let rclone_conf_path =
|
||||
get_rclone_config_path().map_err(|e| format!("Failed to get rclone config path: {e}"))?;
|
||||
|
||||
// Extract mount point from args and create directory if it doesn't exist.
|
||||
// The mount point is the second non-flag argument (first is remote:path).
|
||||
let args_vec = split_args_vec(config.args.clone());
|
||||
let mount_point_opt = args_vec.iter().filter(|arg| !arg.starts_with('-')).nth(1); // 0th is remote:path, 1st is mount_point
|
||||
|
||||
if let Some(mount_point) = mount_point_opt {
|
||||
let mount_path = Path::new(mount_point);
|
||||
if !mount_path.exists()
|
||||
&& let Err(e) = fs::create_dir_all(mount_path)
|
||||
{
|
||||
return Err(format!(
|
||||
"Failed to create mount point directory '{}': {}",
|
||||
mount_point, e
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
let api_key = get_api_key();
|
||||
let port = get_server_port();
|
||||
let mut args: Vec<String> = vec![
|
||||
@@ -211,7 +228,7 @@ pub async fn create_rclone_mount_remote_process(
|
||||
"--config".into(),
|
||||
rclone_conf_path.to_string_lossy().into_owned(),
|
||||
];
|
||||
args.extend(split_args_vec(config.args.clone()));
|
||||
args.extend(args_vec);
|
||||
|
||||
let config = ProcessConfig {
|
||||
id: config.id.clone(),
|
||||
@@ -311,9 +328,10 @@ pub async fn get_mount_info_list(
|
||||
Ok(is_mounted) => {
|
||||
if process.is_running {
|
||||
if is_mounted { "mounted" } else { "mounting" }
|
||||
} else if is_mounted {
|
||||
"unmounting"
|
||||
} else {
|
||||
// If process is not running, the mount point should be considered
|
||||
// unmounted regardless of whether
|
||||
// the directory exists or not
|
||||
"unmounted"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,15 @@
|
||||
"conflicts": ["openlist-desktop"],
|
||||
"replaces": ["openlist-desktop"],
|
||||
"postInstallScript": "./packages/linux/post-install.sh",
|
||||
"preRemoveScript": "./packages/linux/pre-remove.sh"
|
||||
"preRemoveScript": "./packages/linux/pre-remove.sh",
|
||||
"files": {
|
||||
"/opt/OpenList-Desktop/openlist-desktop": "usr/bin/openlist-desktop",
|
||||
"/opt/OpenList-Desktop/install-openlist-service": "usr/bin/install-openlist-service",
|
||||
"/opt/OpenList-Desktop/uninstall-openlist-service": "usr/bin/uninstall-openlist-service",
|
||||
"/opt/OpenList-Desktop/openlist-desktop-service": "usr/bin/openlist-desktop-service",
|
||||
"/opt/OpenList-Desktop/openlist": "usr/bin/openlist",
|
||||
"/opt/OpenList-Desktop/rclone": "usr/bin/rclone"
|
||||
}
|
||||
},
|
||||
"rpm": {
|
||||
"depends": ["openssl"],
|
||||
@@ -20,7 +28,15 @@
|
||||
"conflicts": ["openlist-desktop"],
|
||||
"obsoletes": ["openlist-desktop"],
|
||||
"postInstallScript": "./packages/linux/post-install.sh",
|
||||
"preRemoveScript": "./packages/linux/pre-remove.sh"
|
||||
"preRemoveScript": "./packages/linux/pre-remove.sh",
|
||||
"files": {
|
||||
"/opt/OpenList-Desktop/openlist-desktop": "usr/bin/openlist-desktop",
|
||||
"/opt/OpenList-Desktop/install-openlist-service": "usr/bin/install-openlist-service",
|
||||
"/opt/OpenList-Desktop/uninstall-openlist-service": "usr/bin/uninstall-openlist-service",
|
||||
"/opt/OpenList-Desktop/openlist-desktop-service": "usr/bin/openlist-desktop-service",
|
||||
"/opt/OpenList-Desktop/openlist": "usr/bin/openlist",
|
||||
"/opt/OpenList-Desktop/rclone": "usr/bin/rclone"
|
||||
}
|
||||
}
|
||||
},
|
||||
"externalBin": [
|
||||
|
||||
Reference in New Issue
Block a user