summarylogtreecommitdiffstats
path: root/auto-cpufreq.install
blob: 13c06e1cb20665e1d37e43b5a1d71c5f4668b783 (plain)
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
post_install() {
    # This is needed on SELinux enabled systems (see also ConditionPathExists in .service)
    touch /var/log/auto-cpufreq.log

	DIR="/opt/auto-cpufreq/"
	
	echo -e "\nInstalling necessary Python packages\n"
	
	python -m venv $DIR/venv
	source $DIR/venv/bin/activate
	echo $(which python)
	python3 -m pip install --upgrade pip wheel
	
	echo -e "\nBuilding auto-cpufreq\n"

	git config --global --add safe.directory $DIR
	POETRY_DYNAMIC_VERSIONING_BYPASS=1 python3 -m pip install $DIR/src

    echo -e "\nauto-cpufreq $1 installed\n"

    echo -e 'Important notice: the daemon installer provided does not work, instead run the following command:\n'
    echo -e 'systemctl enable --now auto-cpufreq\n'

    echo -e 'To view live log, run:\n'
    echo -e 'auto-cpufreq --stats\n'

    echo -e 'If the GNOME Power Profiles daemon is installed, it must be masked manually as it conflicts with auto-cpufreq.service:\n'
    echo -e 'sudo systemctl mask power-profiles-daemon.service\n'
}

post_upgrade() {
    DIR="/opt/auto-cpufreq/"
	
	echo -e "\nInstalling necessary Python packages\n"
	
	python -m venv $DIR/venv
	source $DIR/venv/bin/activate
	echo $(which python)
	python3 -m pip install --upgrade pip wheel
	
	echo -e "\nBuilding auto-cpufreq\n"

	git config --global --add safe.directory $DIR
	POETRY_DYNAMIC_VERSIONING_BYPASS=1 python3 -m pip install $DIR/src

    echo -e "\nauto-cpufreq $1 installed\n"

    echo -e 'Reload systemd manager configuration:\n'
    echo -e 'systemctl daemon-reload\n'

    echo -e 'Restart auto-cpufreq daemon service:\n'
    echo -e 'systemctl restart auto-cpufreq\n'
}

post_remove() {
    # Remove auto-cpufreq log file
    rm /var/log/auto-cpufreq.log

    rm -R /opt/cpu-autofreq/
}