You are not logged in.
Pages: 1
Hi! I've used GNU/Linux for about three years and never really done much programming - I've used command-line programs, but never really coded or anything. I have always loved the operating system for the freedom it has brought me.
I was looking for some feedback on some shell scripts - they're rather short. I've written two - one to make Mullvad VPN work on Devuan through OpenRC or SysVInit and one that automatically installs Pipewire and blocks Pulseaudio installation.
I know people might not be familiar (esp. with Mullvad), but I was wondering if anyone could have a quick look over them and give me their opinion.
https://github.com/arkhiwarkhi/Pipewire … ipewire.sh
https://github.com/arkhiwarkhi/Mullvad- … mullvad.sh
Thanks for any commentary
Last edited by lavenderu (2024-05-07 09:15:08)
Offline
Line 3 of the first script has a syntax error.
ShellCheck is an essential tool for people writing shell scripts.
Comments are easier to read when there's a space after the hash.
Don't assume you know where the script is running from.
Don't use "../.config/whatever" - use "$XDG_CONFIG_HOME/whatever". (If the variable might not be defined, you can use : ${XDG_CONFIG_HOME:=$HOME/.config} to fix that.)
iptables is deprecated. I'm pretty certain Devuan comes with nftables pre-installed.
Blindly downloading and executing an online script is never a great idea, but you don't even check if it works before continuing.
Actually, there's several examples in both scripts where you assume previous commands will work, but do not verify that they have.
Last edited by boughtonp (2024-05-07 14:48:02)
3.1415P265E589T932E846R64338
Offline
Welcome!
I saw a little something: Files in "/etc/apt/preferences.d/" need to have the extension ".pref". Otherwise apt ignores them and complains.
Offline
Thank you for the advice! Much appreciated.
Offline
I saw a little something: Files in "/etc/apt/preferences.d/" need to have the extension ".pref". Otherwise apt ignores them and complains.
Inaccurate.
Files only need to end in .pref if there is another . in the filename, but it is acceptable to have no extension.
Also, it is not guaranteed Apt will complain - if a file is called something.disabled or something.bak it will be ignored without complaint.
Note that the files in the /etc/apt/preferences.d directory are parsed in alphanumeric ascending order and need to obey the following naming convention: The files have either no or "pref" as filename extension and only contain alphanumeric, hyphen (-), underscore (_) and period (.) characters. Otherwise APT will print a notice that it has ignored a file, unless that file matches a pattern in the Dir::Ignore-Files-Silently configuration list - in which case it will be silently ignored.
The Ignore-Files-Silently list can be used to specify which files APT should silently ignore while parsing the files in the fragment directories. Per default a file which ends with .disabled, ~, .bak or .dpkg-[a-z]+ is silently ignored. As seen in the last default value these patterns can use regular expression syntax.
Last edited by boughtonp (2024-05-07 21:37:13)
3.1415P265E589T932E846R64338
Offline
took a look at the pipewire setup, left a suggestion in an issue.
honestly as sad as it may seem the devuan forum is not a good place to get feedback on software you are writing on principle of barely getting feedback for one reason or another.
Offline
Pages: 1