diff --git a/Makefile b/Makefile index 0d14b22..46af44a 100644 --- a/Makefile +++ b/Makefile @@ -24,25 +24,21 @@ ifndef IMAGE $(error IMAGE is not set. Please specify IMAGE= when running make build or make build-dev) endif -.PHONY: all build build-dev setup measure clean check-perms check-module +.PHONY: all build build-dev setup measure clean check-module # Default target all: build -# Ensure repo was cloned with correct permissions -check-perms: ## Check repository permissions - @scripts/check_perms.sh - # Setup dependencies (Linux only) setup: ## Install dependencies (Linux only) @scripts/setup_deps.sh # Build module -build: check-perms setup ## Build the specified module +build: setup ## Build the specified module $(WRAPPER) mkosi --force --image-id $(IMAGE) -I $(IMAGE).conf # Build module with devtools profile -build-dev: check-perms setup ## Build module with development tools +build-dev: setup ## Build module with development tools $(WRAPPER) mkosi --force --image-id $(IMAGE)-dev --profile=devtools -I $(IMAGE).conf ##@ Utilities diff --git a/base/mkosi.conf b/base/mkosi.conf index 9d4c1fe..c39f851 100644 --- a/base/mkosi.conf +++ b/base/mkosi.conf @@ -25,6 +25,7 @@ PostInstallationScripts=base/efi-stub.sh SyncScripts=base/add-backports.sh FinalizeScripts=base/debloat.sh FinalizeScripts=base/remove-image-version.sh +SyncScripts=base/normalize-umask.sh CleanPackageMetadata=true Packages=kmod diff --git a/base/normalize-umask.sh b/base/normalize-umask.sh new file mode 100755 index 0000000..b5d13b1 --- /dev/null +++ b/base/normalize-umask.sh @@ -0,0 +1,3 @@ +#!/bin/bash +set -euo pipefail +chmod -cR go-w "$SRCDIR" diff --git a/scripts/check_perms.sh b/scripts/check_perms.sh deleted file mode 100755 index 2826d1c..0000000 --- a/scripts/check_perms.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env bash - -check_perms() { - local path="$1" - local expected_perms="$2" - - if [ ! -e "$path" ]; then - echo "Error: $path not found" - return 1 - fi - - # Cross-platform way to get octal permissions - perms=$(stat -c "%a" "$path" 2>/dev/null || stat -f "%OLp" "$path" 2>/dev/null) - - if [ "$perms" = "$expected_perms" ]; then - return 0 - else - echo "$path has incorrect permissions ($perms), expected $expected_perms" - return 1 - fi -} - -err=0 - -check_perms "base/mkosi.skeleton/init" "755" || err=1 -check_perms "base/mkosi.skeleton/etc" "755" || err=1 -check_perms "base/mkosi.skeleton/etc/resolv.conf" "644" || err=1 - -if [ $err -eq 1 ]; then - echo "Permission check failed!" - echo "Please run umask 0022 and re-clone the repository." - exit 1 -fi