bayasdev / envycontrol

Easy GPU switching for Nvidia Optimus laptops under Linux
MIT License
1.3k stars 61 forks source link

envycontrol shouldn't remove other packages' files #21

Open munzirtaha opened 2 years ago

munzirtaha commented 2 years ago

Hi and thanks for envycontrol.

> pacman -Qkk sddm
warning: sddm: /usr/share/sddm/scripts/Xsetup (No such file or directory)
sddm: 228 total files, 1 altered file

I wondered why this file is removed and finally suspected envycontrol. I checked the code and found

SDDM_SCRIPT_PATH = '/usr/share/sddm/scripts/Xsetup'
os.remove(SDDM_SCRIPT_PATH)

I think any file which belongs to other packages shouldn't be removed because it may include some user customizations, beside this breaks the package verification. envycontrol should just remove the lines it added to those files.

bayasdev commented 2 years ago

Will take a look, thanks.

bayasdev commented 2 years ago

Hello there,

I have made a few changes:

Let me know your feedback.

Greetings.

munzirtaha commented 2 years ago

Thanks. But can you please keep the original file metadata while copying? Currently, the .bak file modification time is changed which breaks validation even after copying it back.

> pacman -Qkk sddm
backup file: sddm: /usr/share/sddm/scripts/Xsetup (Modification time mismatch)