about summary refs log tree commit diff
path: root/pkgs/tools/system/auto-cpufreq/prevent-install-and-copy.patch
blob: 9b5bffb5591ee93a108b8a373afd440b1d460037 (plain) (blame)
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
diff --git a/auto_cpufreq/core.py b/auto_cpufreq/core.py
index 99397a9..48a377a 100755
--- a/auto_cpufreq/core.py
+++ b/auto_cpufreq/core.py
@@ -350,30 +334,13 @@ def get_current_gov():
 
 
 def cpufreqctl():
-    """
-    deploy cpufreqctl script
-    """
-
-    # detect if running on a SNAP
-    if os.getenv("PKG_MARKER") == "SNAP":
-        pass
-    else:
-        # deploy cpufreqctl.auto-cpufreq script
-        if not os.path.isfile("/usr/local/bin/cpufreqctl.auto-cpufreq"):
-            shutil.copy(SCRIPTS_DIR / "cpufreqctl.sh", "/usr/local/bin/cpufreqctl.auto-cpufreq")
+    # scripts are already in the correct place
+    pass
 
 
 def cpufreqctl_restore():
-    """
-    remove cpufreqctl.auto-cpufreq script
-    """
-    # detect if running on a SNAP
-    if os.getenv("PKG_MARKER") == "SNAP":
-        pass
-    else:
-        if os.path.isfile("/usr/local/bin/cpufreqctl.auto-cpufreq"):
-            os.remove("/usr/local/bin/cpufreqctl.auto-cpufreq")
-
+    # no need to restore
+    pass
 
 def footer(l=79):
     print("\n" + "-" * l + "\n")
@@ -400,30 +367,8 @@ def remove_complete_msg():
 
 
 def deploy_daemon():
-    print("\n" + "-" * 21 + " Deploying auto-cpufreq as a daemon " + "-" * 22 + "\n")
-
-    # deploy cpufreqctl script func call
-    cpufreqctl()
-
-    # turn off bluetooth on boot
-    bluetooth_disable()
-
-    auto_cpufreq_stats_path.touch(exist_ok=True)
-
-    print("\n* Deploy auto-cpufreq install script")
-    shutil.copy(SCRIPTS_DIR / "auto-cpufreq-install.sh", "/usr/local/bin/auto-cpufreq-install")
-
-    print("\n* Deploy auto-cpufreq remove script")
-    shutil.copy(SCRIPTS_DIR / "auto-cpufreq-remove.sh", "/usr/local/bin/auto-cpufreq-remove")
-
-    # output warning if gnome power profile is running
-    gnome_power_detect_install()
-    gnome_power_svc_disable()
-
-    # output warning if TLP service is detected
-    tlp_service_detect()
-
-    call("/usr/local/bin/auto-cpufreq-install", shell=True)
+    # prevent needless copying and system changes
+    pass
 
 
 def deploy_daemon_performance():
@@ -463,40 +408,7 @@ def deploy_daemon_performance():
 
 # remove auto-cpufreq daemon
 def remove_daemon():
-
-    # check if auto-cpufreq is installed
-    if not os.path.exists("/usr/local/bin/auto-cpufreq-remove"):
-        print("\nauto-cpufreq daemon is not installed.\n")
-        sys.exit(1)
-
-    print("\n" + "-" * 21 + " Removing auto-cpufreq daemon " + "-" * 22 + "\n")
-
-    # turn on bluetooth on boot
-    bluetooth_enable()
-
-    # output warning if gnome power profile is stopped
-    gnome_power_rm_reminder()
-    gnome_power_svc_enable()
-
-    # run auto-cpufreq daemon remove script
-    call("/usr/local/bin/auto-cpufreq-remove", shell=True)
-
-    # remove auto-cpufreq-remove
-    os.remove("/usr/local/bin/auto-cpufreq-remove")
-
-    # delete override pickle if it exists
-    if os.path.exists(governor_override_state):
-        os.remove(governor_override_state)
-
-    # delete stats file
-    if auto_cpufreq_stats_path.exists():
-        if auto_cpufreq_stats_file is not None:
-            auto_cpufreq_stats_file.close()
-
-        auto_cpufreq_stats_path.unlink()
-
-    # restore original cpufrectl script
-    cpufreqctl_restore()
+    pass
 
 
 def gov_check():

diff --git a/bin/auto-cpufreq b/bin/auto-cpufreq
index b89d925..b73974c 100755
--- a/bin/auto-cpufreq
+++ b/bin/auto-cpufreq
@@ -189,41 +189,9 @@
             print("https://github.com/AdnanHodzic/auto-cpufreq/#donate")
             footer()
         elif install:
-            if os.getenv("PKG_MARKER") == "SNAP":
-                root_check()
-                running_daemon_check()
-                gnome_power_detect_snap()
-                tlp_service_detect_snap()
-                bluetooth_notif_snap()
-                gov_check()
-                run("snapctl set daemon=enabled", shell=True)
-                run("snapctl start --enable auto-cpufreq", shell=True)
-                deploy_complete_msg()
-            else:
-                root_check()
-                running_daemon_check()
-                gov_check()
-                deploy_daemon()
-                deploy_complete_msg()
+            print("install is disabled in the nix package")
         elif remove:
-            if os.getenv("PKG_MARKER") == "SNAP":
-                root_check()
-                run("snapctl set daemon=disabled", shell=True)
-                run("snapctl stop --disable auto-cpufreq", shell=True)
-                if auto_cpufreq_stats_path.exists():
-                    if auto_cpufreq_stats_file is not None:
-                        auto_cpufreq_stats_file.close()
-
-                    auto_cpufreq_stats_path.unlink()
-                # ToDo: 
-                # {the following snippet also used in --update, update it there too(if required)}
-                # * undo bluetooth boot disable
-                gnome_power_rm_reminder_snap()
-                remove_complete_msg()
-            else:
-                root_check()
-                remove_daemon()
-                remove_complete_msg()
+            print("remove is disabled in the nix package")
         elif update:
             root_check()
             if os.getenv("PKG_MARKER") == "SNAP":