The officially official Devuan Forum!

You are not logged in.

#1 2024-05-07 09:14:51

lavenderu
Member
Registered: 2024-05-05
Posts: 2  

Seeking feedback on scripts

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 smile

Last edited by lavenderu (2024-05-07 09:15:08)

Offline

#2 2024-05-07 14:45:19

boughtonp
Member
From: UK
Registered: 2023-01-19
Posts: 212  
Website

Re: Seeking feedback on scripts

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

#3 2024-05-07 18:03:33

delgado
Member
Registered: 2022-07-14
Posts: 206  

Re: Seeking feedback on scripts

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

#4 2024-05-07 20:10:07

lavenderu
Member
Registered: 2024-05-05
Posts: 2  

Re: Seeking feedback on scripts

Thank you for the advice! Much appreciated.

Offline

#5 2024-05-07 21:34:05

boughtonp
Member
From: UK
Registered: 2023-01-19
Posts: 212  
Website

Re: Seeking feedback on scripts

delgado wrote:

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.

man apt_preferences wrote:

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.

man apt.conf wrote:

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

#6 2024-05-13 19:04:06

EDX-0
Member
Registered: 2020-12-12
Posts: 76  

Re: Seeking feedback on scripts

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

Board footer