Install compat bash completion too
diff --git a/src/amd_debug/installer.py b/src/amd_debug/installer.py index 4e573fb..8ebfde8 100644 --- a/src/amd_debug/installer.py +++ b/src/amd_debug/installer.py
@@ -389,6 +389,10 @@ if os.path.exists(t): os.remove(t) print_color(f"Removed {f} from {d}", "✅") + s = os.path.join(d, "s2idle") + if os.path.islink(s) or os.path.exists(s): + os.remove(s) + print_color(f"Removed s2idle from {d}", "✅") return True def install(self) -> bool: @@ -429,6 +433,10 @@ os.makedirs(t, exist_ok=True) shutil.copy(s, t) print_color(f"Installed {f} to {t}", "✅") + symlink = os.path.join(t, "s2idle") + if not os.path.exists(symlink): + os.symlink(f, symlink) + print_color(f"Installed s2idle -> {f}", "✅") return True
diff --git a/src/test_installer.py b/src/test_installer.py index e6b370b..4d9b5a5 100644 --- a/src/test_installer.py +++ b/src/test_installer.py
@@ -38,8 +38,10 @@ @patch("builtins.open") @patch("subprocess.call", return_value=0) @patch("os.makedirs", return_value=None) + @patch("os.symlink", return_value=None) def test_install_hook( self, + _mock_symlink, _mock_mkdir, _mock_call, _mock_open, @@ -56,8 +58,10 @@ @patch("builtins.open") @patch("subprocess.call", return_value=0) @patch("os.makedirs", return_value=None) + @patch("os.symlink", return_value=None) def test_install_hook_missing_path( self, + _mock_symlink, _mock_mkdir, _mock_call, _mock_open, @@ -438,9 +442,7 @@ @patch("amd_debug.installer.print_color") @patch("amd_debug.installer.get_distro", return_value="ubuntu") @patch("amd_debug.installer.relaunch_sudo") - def test_distro_package_no_deb_returns_false( - self, _sudo, _distro, _print - ): + def test_distro_package_no_deb_returns_false(self, _sudo, _distro, _print): """Ubuntu install path returns False when deb name is missing""" pkg = DistroPackage(deb=None, rpm="x", arch="x", message="msg") self.assertFalse(pkg.install()) @@ -449,9 +451,7 @@ @patch("amd_debug.installer.read_file", return_value="VARIANT_ID=workstation\n") @patch("amd_debug.installer.get_distro", return_value="fedora") @patch("amd_debug.installer.relaunch_sudo") - def test_distro_package_no_rpm_returns_false( - self, _sudo, _distro, _read, _print - ): + def test_distro_package_no_rpm_returns_false(self, _sudo, _distro, _read, _print): """Fedora install path returns False when rpm name is missing""" pkg = DistroPackage(deb="x", rpm=None, arch="x", message="msg") self.assertFalse(pkg.install()) @@ -460,9 +460,7 @@ @patch("amd_debug.installer.read_file", return_value="VARIANT_ID=server\n") @patch("amd_debug.installer.get_distro", return_value="fedora") @patch("amd_debug.installer.relaunch_sudo") - def test_distro_package_fedora_wrong_variant( - self, _sudo, _distro, _read, _print - ): + def test_distro_package_fedora_wrong_variant(self, _sudo, _distro, _read, _print): """Fedora install path returns False when variant isn't workstation/kde""" pkg = DistroPackage(deb="x", rpm="x", arch="x", message="msg") self.assertFalse(pkg.install())