From 50531391d3484808935be1570cb5aef1eee488fa Mon Sep 17 00:00:00 2001 From: sigseg5 <36568961+sigseg5@users.noreply.github.com> Date: Sun, 26 Jun 2022 00:10:14 +0300 Subject: [PATCH 1/3] Add iter instead of cycle --- build.sh | 0 install.sh | 0 semap.service | 2 +- src/main.rs | 8 ++++---- uninstall.sh | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) mode change 100644 => 100755 build.sh mode change 100644 => 100755 install.sh mode change 100644 => 100755 uninstall.sh diff --git a/build.sh b/build.sh old mode 100644 new mode 100755 diff --git a/install.sh b/install.sh old mode 100644 new mode 100755 diff --git a/semap.service b/semap.service index 5c7009c..e8294db 100644 --- a/semap.service +++ b/semap.service @@ -6,4 +6,4 @@ Type=simple ExecStart=/usr/bin/semap [Install] -WantedBy=multi-user.target \ No newline at end of file +WantedBy=multi-user.target diff --git a/src/main.rs b/src/main.rs index a22f562..962c155 100644 --- a/src/main.rs +++ b/src/main.rs @@ -26,11 +26,11 @@ fn main() { thread::sleep(five_secs); let after_connect_devices = cli::get_devices(); let mut difference = vec![]; - for i in after_connect_devices { - if !pre_connect_devices.contains(&i) { - difference.push(i); + after_connect_devices.iter().for_each(|i| { + if !pre_connect_devices.contains(i) { + difference.push(&*i); } - } + }); println!( "You fingerprint is {:#X?}\n Put this data to 50 line in main.rs, after that rebuild and reinstall service.\n diff --git a/uninstall.sh b/uninstall.sh old mode 100644 new mode 100755 index ecbc56c..33a2a35 --- a/uninstall.sh +++ b/uninstall.sh @@ -11,4 +11,4 @@ sudo systemctl disable semap sudo rm -f /lib/systemd/system/semap.service sudo rm -f /usr/bin/semap -echo "Done." \ No newline at end of file +echo "Done." From 76ee6a618071ad69408f424c92bdadfd67ddba81 Mon Sep 17 00:00:00 2001 From: sigseg5 <36568961+sigseg5@users.noreply.github.com> Date: Sun, 26 Jun 2022 10:43:06 +0300 Subject: [PATCH 2/3] Add panic info msgs --- src/main.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index 962c155..1b623b1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -50,16 +50,21 @@ fn main() { loop { for i in cli::get_devices() { if i == kb_fingerprint { - if dconf::get(xkb_opt).unwrap() == model_m_settings { + if dconf::get(xkb_opt).expect("Can't get xkb-options from dconf.") + == model_m_settings + { break; }; - dconf::set(xkb_opt, model_m_settings).unwrap(); + dconf::set(xkb_opt, model_m_settings).expect("Can't set xkb-options for Model M."); break; } else { - if dconf::get(xkb_opt).unwrap() == default_settings { + if dconf::get(xkb_opt).expect("Can't get xkb-options from dconf.") + == default_settings + { break; } else { - dconf::set(xkb_opt, default_settings).unwrap(); + dconf::set(xkb_opt, default_settings) + .expect("Can't set xkb-options for standart keyboard."); break; } } From 26f4003714b8ae22eed580ab75ec8b86d11411fa Mon Sep 17 00:00:00 2001 From: sigseg5 <36568961+sigseg5@users.noreply.github.com> Date: Sun, 26 Jun 2022 13:07:36 +0300 Subject: [PATCH 3/3] Add upgrading info --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0210f80..872acbb 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,11 @@ You fingerprint is [ * Run `bash build.sh` and `sudo bash install.sh` to build app and install `systemd` service. +# Upgrading + +* Run `sudo bash uninstall.sh` +* Continue normal installation + # Uninstall -* Run `sudo bash uninstall.sh` \ No newline at end of file +* Run `sudo bash uninstall.sh`