Skip to content

Commit

Permalink
feat: Suffix configuration files with '.conf'
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeglius committed Feb 8, 2025
1 parent fb9739a commit 951d622
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ in its correspondent upper dir.

### Filesystem specific

- `/etc/media-automount.d/<FSTYPE>`
- `/usr/local/lib/media-automount.d/<FSTYPE>`
- `/usr/lib/media-automount.d/<FSTYPE>`
- `/etc/media-automount.d/<FSTYPE>.conf`
- `/usr/local/lib/media-automount.d/<FSTYPE>.conf`
- `/usr/lib/media-automount.d/<FSTYPE>.conf`

```text
# /etc/media-automount.d/btrfs
# /etc/media-automount.d/btrfs.conf
FSOPTIONS=noatime,lazytime,commit=120,discard=async,compress-force=zstd:1,space_cache=v2
```

Expand All @@ -72,18 +72,18 @@ Add it to `/etc/fstab` with the `noauto` option.

#### ... exclude a type of filesystem?

Create a symbolic link pointing at `/dev/null` in `/etc/automounts.d/<FSTYPE>`
Create a symbolic link pointing at `/dev/null` in `/etc/automounts.d/<FSTYPE>.conf`

```shell
sudo ln -s /dev/null /etc/media-automount.d/ntfs
sudo ln -s /dev/null /etc/media-automount.d/ntfs.conf
```

#### ... deactivate it completely?

Create a symbolic link pointing at `/dev/null` in `/etc/automounts.d/_all`
Create a symbolic link pointing at `/dev/null` in `/etc/automounts.d/_all.conf`

```shell
sudo ln -s /dev/null /etc/media-automount.d/_all
sudo ln -s /dev/null /etc/media-automount.d/_all.conf
```

### Why my partition is not getting mounted?
Expand Down
8 changes: 4 additions & 4 deletions media-automount-generator
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ _on_err() {
#
# Returns:
# Path of the file. Empty string if none found
get_file_from_conf() {
get_filesystem_conf() {
local file_name=${1:?}
local result

for conf_dir in "${CONF_DIRS[@]}"; do
result=${conf_dir}/${file_name}
result=${conf_dir}/${file_name}.conf
if [[ -r "${result}" ]]; then
echo "$result"
return 0
Expand All @@ -76,7 +76,7 @@ fi
# WARNING: This only should be used by the system admin and not the vendor.
# WARNING: This file SHOULD NOT contain any configuration.
# It is meant to be a global /dev/null symlink.
global_conf_file=$(get_file_from_conf _all)
global_conf_file=$(get_filesystem_conf _all)

# Iterate in a list of partitions
for dev in $(lsblk -n --shell --output PATH --filter 'TYPE == "part"'); do
Expand All @@ -96,7 +96,7 @@ for dev in $(lsblk -n --shell --output PATH --filter 'TYPE == "part"'); do
# Check if we have a config for the partition type
fstype=$(lsblk -n --output FSTYPE "$dev")
[[ -z $fstype ]] && continue
conf_file=${global_conf_file:-$(get_file_from_conf "$fstype")}
conf_file=${global_conf_file:-$(get_filesystem_conf "$fstype")}
if [[ -z $conf_file ]]; then
log "$dev: Config for filesystem $fstype was not found"
continue
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 951d622

Please sign in to comment.