Skip to content

B1-4: Rewrite postinstall.sh for idempotency and FUSE detection #137

Closed

Description

@scttfrdmn

Context

scripts/postinstall.sh is not idempotent — running it twice on an already-configured system may overwrite config or re-create directories incorrectly. It also does not check for critical FUSE prerequisites: user_allow_other in /etc/fuse.conf and open file limits. Operators frequently run into silent failures from missing FUSE config.

What to implement

Rewrite scripts/postinstall.sh with:

Idempotency pattern — use guard checks throughout:

[ -f /etc/objectfs/config.yaml ] || cp /usr/share/objectfs/configs/example.yaml /etc/objectfs/config.yaml
[ -d /var/cache/objectfs ] || mkdir -p /var/cache/objectfs

check_fuse_module function:

check_fuse_module() {
    modprobe fuse 2>/dev/null || true
    if ! grep -q "^user_allow_other" /etc/fuse.conf 2>/dev/null; then
        echo "WARNING: /etc/fuse.conf missing 'user_allow_other'" >&2
        echo "  Fix: echo 'user_allow_other' >> /etc/fuse.conf" >&2
    fi
}

check_system_limits function — check ulimit -n vs 65536, print hint to add DefaultLimitNOFILE=65536 to /etc/systemd/system.conf if needed.

Script must exit 0 in all cases. Warnings go to stderr, not stdout. Installation must succeed even on systems without FUSE (e.g., build servers).

Add shellcheck lint to CI via .pre-commit-config.yaml.

Acceptance criteria

  • Running postinstall twice produces identical filesystem state as running once
  • Missing /etc/fuse.conf or missing user_allow_other prints a clear warning with exact remediation command
  • Script exits 0 whether FUSE is present or not
  • shellcheck scripts/postinstall.sh passes in CI

Sequencing

Independent — can land any time in v0.11.0.

Activity

  1. added
    type: enhancement
    priority: high
    area: config
    on Apr 7, 2026
  2. added
    effort: medium
    on Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: configeffort: mediumpriority: hightype: enhancement

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions