build windows install
Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
parent
2ced73cdda
commit
e2924f0d41
10
build.py
10
build.py
@ -189,7 +189,7 @@ def build_flutter_arch_manjaro():
|
|||||||
os.chdir('..')
|
os.chdir('..')
|
||||||
os.system('HBB=`pwd` FLUTTER=1 makepkg -f')
|
os.system('HBB=`pwd` FLUTTER=1 makepkg -f')
|
||||||
|
|
||||||
def build_flutter_windows_portable():
|
def build_flutter_windows(version):
|
||||||
os.system("cargo build --lib --features flutter --release")
|
os.system("cargo build --lib --features flutter --release")
|
||||||
os.chdir('flutter')
|
os.chdir('flutter')
|
||||||
os.system("flutter build windows --release")
|
os.system("flutter build windows --release")
|
||||||
@ -203,6 +203,8 @@ def build_flutter_windows_portable():
|
|||||||
else:
|
else:
|
||||||
os.rename("./target/release/rustdesk-portable-packer.exe", "./rustdesk_portable.exe")
|
os.rename("./target/release/rustdesk-portable-packer.exe", "./rustdesk_portable.exe")
|
||||||
print(f"output location: {os.path.abspath(os.curdir)}/rustdesk_portable.exe")
|
print(f"output location: {os.path.abspath(os.curdir)}/rustdesk_portable.exe")
|
||||||
|
os.system(f"cp -rf ./rustdesk_portable.exe ./rustdesk-{version}-install.exe")
|
||||||
|
print(f"output location: {os.path.abspath(os.curdir)}/rustdesk-{version}-install.exe")
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = make_parser()
|
parser = make_parser()
|
||||||
@ -227,8 +229,8 @@ def main():
|
|||||||
os.system('python3 res/inline-sciter.py')
|
os.system('python3 res/inline-sciter.py')
|
||||||
portable = args.portable
|
portable = args.portable
|
||||||
if windows:
|
if windows:
|
||||||
if portable:
|
if flutter:
|
||||||
build_flutter_windows_portable()
|
build_flutter_windows(version)
|
||||||
return
|
return
|
||||||
os.system('cargo build --release --features ' + features)
|
os.system('cargo build --release --features ' + features)
|
||||||
# os.system('upx.exe target/release/rustdesk.exe')
|
# os.system('upx.exe target/release/rustdesk.exe')
|
||||||
@ -239,7 +241,7 @@ def main():
|
|||||||
'target\\release\\rustdesk.exe')
|
'target\\release\\rustdesk.exe')
|
||||||
else:
|
else:
|
||||||
print('Not signed')
|
print('Not signed')
|
||||||
os.system(f'cp -rf target/release/RustDesk.exe rustdesk-{version}-setdown.exe')
|
os.system(f'cp -rf target/release/RustDesk.exe rustdesk-{version}-win7-install.exe')
|
||||||
elif os.path.isfile('/usr/bin/pacman'):
|
elif os.path.isfile('/usr/bin/pacman'):
|
||||||
# pacman -S -needed base-devel
|
# pacman -S -needed base-devel
|
||||||
os.system("sed -i 's/pkgver=.*/pkgver=%s/g' PKGBUILD" % version)
|
os.system("sed -i 's/pkgver=.*/pkgver=%s/g' PKGBUILD" % version)
|
||||||
|
@ -181,9 +181,9 @@ class _InstallPageState extends State<InstallPage> with WindowListener {
|
|||||||
void install() {
|
void install() {
|
||||||
btnEnabled.value = false;
|
btnEnabled.value = false;
|
||||||
showProgress.value = true;
|
showProgress.value = true;
|
||||||
String args = '';
|
String args = '--flutter';
|
||||||
if (startmenu.value) args += 'startmenu ';
|
if (startmenu.value) args += ' startmenu';
|
||||||
if (desktopicon.value) args += 'desktopicon ';
|
if (desktopicon.value) args += ' desktopicon';
|
||||||
bind.installInstallMe(options: args, path: controller.text);
|
bind.installInstallMe(options: args, path: controller.text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,29 +12,37 @@ pub mod bin_reader;
|
|||||||
const APP_PREFIX: &str = "rustdesk";
|
const APP_PREFIX: &str = "rustdesk";
|
||||||
const APPNAME_RUNTIME_ENV_KEY: &str = "RUSTDESK_APPNAME";
|
const APPNAME_RUNTIME_ENV_KEY: &str = "RUSTDESK_APPNAME";
|
||||||
|
|
||||||
fn setup(reader: BinaryReader) -> Option<PathBuf> {
|
fn setup(reader: BinaryReader, dir: Option<PathBuf>, clear: bool) -> Option<PathBuf> {
|
||||||
|
let dir = if let Some(dir) = dir {
|
||||||
|
dir
|
||||||
|
} else {
|
||||||
// home dir
|
// home dir
|
||||||
if let Some(dir) = dirs::data_local_dir() {
|
if let Some(dir) = dirs::data_local_dir() {
|
||||||
let dir = dir.join(APP_PREFIX);
|
dir.join(APP_PREFIX)
|
||||||
|
} else {
|
||||||
|
eprintln!("not found data local dir");
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if clear {
|
||||||
|
std::fs::remove_dir_all(&dir).ok();
|
||||||
|
}
|
||||||
for file in reader.files.iter() {
|
for file in reader.files.iter() {
|
||||||
file.write_to_file(&dir);
|
file.write_to_file(&dir);
|
||||||
}
|
}
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
reader.configure_permission(&dir);
|
reader.configure_permission(&dir);
|
||||||
Some(dir.join(&reader.exe))
|
Some(dir.join(&reader.exe))
|
||||||
} else {
|
|
||||||
eprintln!("not found data local dir");
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn execute(path: PathBuf) {
|
fn execute(path: PathBuf, args: Vec<String>) {
|
||||||
println!("executing {}", path.display());
|
println!("executing {}", path.display());
|
||||||
// setup env
|
// setup env
|
||||||
let exe = std::env::current_exe().unwrap();
|
let exe = std::env::current_exe().unwrap();
|
||||||
let exe_name = exe.file_name().unwrap();
|
let exe_name = exe.file_name().unwrap();
|
||||||
// run executable
|
// run executable
|
||||||
Command::new(path)
|
Command::new(path)
|
||||||
|
.args(args)
|
||||||
.env(APPNAME_RUNTIME_ENV_KEY, exe_name)
|
.env(APPNAME_RUNTIME_ENV_KEY, exe_name)
|
||||||
.stdin(Stdio::inherit())
|
.stdin(Stdio::inherit())
|
||||||
.stdout(Stdio::inherit())
|
.stdout(Stdio::inherit())
|
||||||
@ -43,9 +51,24 @@ fn execute(path: PathBuf) {
|
|||||||
.expect(&format!("failed to execute {:?}", exe_name));
|
.expect(&format!("failed to execute {:?}", exe_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn is_setup(name: &str) -> bool {
|
||||||
|
name.to_lowercase().ends_with("install.exe") || name.to_lowercase().ends_with("安装.exe")
|
||||||
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
let is_setup = is_setup(
|
||||||
|
&std::env::current_exe()
|
||||||
|
.unwrap()
|
||||||
|
.to_string_lossy()
|
||||||
|
.to_string(),
|
||||||
|
);
|
||||||
let reader = BinaryReader::default();
|
let reader = BinaryReader::default();
|
||||||
if let Some(exe) = setup(reader) {
|
if let Some(exe) = setup(reader, None, is_setup) {
|
||||||
execute(exe);
|
let args = if is_setup {
|
||||||
|
vec!["--install".to_owned()]
|
||||||
|
} else {
|
||||||
|
vec![]
|
||||||
|
};
|
||||||
|
execute(exe, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -544,7 +544,7 @@ pub fn is_ip(id: &str) -> bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_setup(name: &str) -> bool {
|
pub fn is_setup(name: &str) -> bool {
|
||||||
name.to_lowercase().ends_with("setdown.exe") || name.to_lowercase().ends_with("安装.exe")
|
name.to_lowercase().ends_with("install.exe") || name.to_lowercase().ends_with("安装.exe")
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_custom_rendezvous_server(custom: String) -> String {
|
pub fn get_custom_rendezvous_server(custom: String) -> String {
|
||||||
|
@ -6,6 +6,7 @@ pub fn core_main() -> Option<Vec<String>> {
|
|||||||
// though async logger more efficient, but it also causes more problems, disable it for now
|
// though async logger more efficient, but it also causes more problems, disable it for now
|
||||||
// let mut _async_logger_holder: Option<flexi_logger::LoggerHandle> = None;
|
// let mut _async_logger_holder: Option<flexi_logger::LoggerHandle> = None;
|
||||||
let mut args = Vec::new();
|
let mut args = Vec::new();
|
||||||
|
let mut flutter_args = Vec::new();
|
||||||
let mut i = 0;
|
let mut i = 0;
|
||||||
let mut is_setup = false;
|
let mut is_setup = false;
|
||||||
let mut _is_elevate = false;
|
let mut _is_elevate = false;
|
||||||
@ -25,13 +26,18 @@ pub fn core_main() -> Option<Vec<String>> {
|
|||||||
}
|
}
|
||||||
i += 1;
|
i += 1;
|
||||||
}
|
}
|
||||||
|
if args.contains(&"--install".to_string()) {
|
||||||
|
is_setup = true;
|
||||||
|
}
|
||||||
if is_setup {
|
if is_setup {
|
||||||
if args.is_empty() {
|
if args.is_empty() {
|
||||||
args.push("--install".to_owned());
|
args.push("--install".to_owned());
|
||||||
} else if args[0] == "--noinstall" {
|
flutter_args.push("--install".to_string());
|
||||||
args.clear();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if args.contains(&"--noinstall".to_string()) {
|
||||||
|
args.clear();
|
||||||
|
}
|
||||||
if args.len() > 0 && args[0] == "--version" {
|
if args.len() > 0 && args[0] == "--version" {
|
||||||
println!("{}", crate::VERSION);
|
println!("{}", crate::VERSION);
|
||||||
return None;
|
return None;
|
||||||
@ -171,7 +177,10 @@ pub fn core_main() -> Option<Vec<String>> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//_async_logger_holder.map(|x| x.flush());
|
//_async_logger_holder.map(|x| x.flush());
|
||||||
Some(args)
|
#[cfg(feature = "flutter")]
|
||||||
|
return Some(flutter_args);
|
||||||
|
#[cfg(not(feature = "flutter"))]
|
||||||
|
return Some(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn import_config(path: &str) {
|
fn import_config(path: &str) {
|
||||||
|
@ -1025,6 +1025,18 @@ copy /Y \"{tmp_path}\\Uninstall {app_name}.lnk\" \"{start_menu}\\\"
|
|||||||
app_name = crate::get_app_name(),
|
app_name = crate::get_app_name(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
let mut flutter_copy = Default::default();
|
||||||
|
if options.contains("--flutter") {
|
||||||
|
flutter_copy = format!(
|
||||||
|
"XCOPY \"{}\" \"{}\" /Y /E /H /C /I /K /R /Z",
|
||||||
|
std::env::current_exe()?
|
||||||
|
.parent()
|
||||||
|
.unwrap()
|
||||||
|
.to_string_lossy()
|
||||||
|
.to_string(),
|
||||||
|
path
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
let meta = std::fs::symlink_metadata(std::env::current_exe()?)?;
|
let meta = std::fs::symlink_metadata(std::env::current_exe()?)?;
|
||||||
let size = meta.len() / 1024;
|
let size = meta.len() / 1024;
|
||||||
@ -1052,6 +1064,7 @@ if exist \"{tmp_path}\\{app_name} Tray.lnk\" del /f /q \"{tmp_path}\\{app_name}
|
|||||||
{uninstall_str}
|
{uninstall_str}
|
||||||
chcp 65001
|
chcp 65001
|
||||||
md \"{path}\"
|
md \"{path}\"
|
||||||
|
{flutter_copy}
|
||||||
copy /Y \"{src_exe}\" \"{exe}\"
|
copy /Y \"{src_exe}\" \"{exe}\"
|
||||||
copy /Y \"{ORIGIN_PROCESS_EXE}\" \"{path}\\{broker_exe}\"
|
copy /Y \"{ORIGIN_PROCESS_EXE}\" \"{path}\\{broker_exe}\"
|
||||||
\"{src_exe}\" --extract \"{path}\"
|
\"{src_exe}\" --extract \"{path}\"
|
||||||
@ -1114,6 +1127,7 @@ sc delete {app_name}
|
|||||||
} else {
|
} else {
|
||||||
&dels
|
&dels
|
||||||
},
|
},
|
||||||
|
flutter_copy = flutter_copy,
|
||||||
);
|
);
|
||||||
run_cmds(cmds, debug, "install")?;
|
run_cmds(cmds, debug, "install")?;
|
||||||
std::thread::sleep(std::time::Duration::from_millis(2000));
|
std::thread::sleep(std::time::Duration::from_millis(2000));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user