Skip to content

Commit

Permalink
Merge branch 'master' into users_mandatory_step
Browse files Browse the repository at this point in the history
  • Loading branch information
dgdavid committed Nov 29, 2024
2 parents 0e61251 + f83484b commit 62a8a1c
Show file tree
Hide file tree
Showing 69 changed files with 21,402 additions and 57,845 deletions.
58 changes: 32 additions & 26 deletions .github/workflows/weblate-merge-po.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
zypper --non-interactive ref
- name: Install tools
run: zypper --non-interactive install --no-recommends git gettext-tools python3-langtable
run: zypper --non-interactive install --no-recommends nodejs npm git gettext-tools python3-langtable

- name: Configure Git
run: |
Expand All @@ -53,61 +53,67 @@ jobs:
path: agama-weblate
repository: ${{ github.repository_owner }}/agama-weblate

- name: Update PO files
- name: Install NPM packages
working-directory: ./agama/web/share/po
run: npm ci

- name: Validate the PO files
working-directory: ./agama-weblate
run: ls web/*.po | xargs -n1 msgfmt --check-format -o /dev/null

- name: Update JS translations
working-directory: ./agama
run: |
mkdir -p web/po
mkdir -p web/src/po
# delete the current translations
find web/po -name '*.po' -exec git rm '{}' ';'
find web/src/po -name '*.js' -exec git rm '{}' ';'
# copy the new ones
mkdir -p web/po
cp -a ../agama-weblate/web/*.po web/po
git add web/po/*.po
# update the list of supported languages, it is used by the PO->JS converter in the next step
web/share/update-languages.py --po-directory ../agama-weblate/web > web/src/languages.json
- name: Validate the PO files
working-directory: ./agama
run: ls web/po/*.po | xargs -n1 msgfmt --check-format -o /dev/null
# rebuild the JS files
(cd web/src/po && SRCDIR=../../../../agama-weblate/web ../../share/po/po-converter.js)
# stage the changes
git add web/src/po/*.js web/src/languages.json
# any changes besides the timestamps in the PO files?
# any changes detected?
- name: Check changes
id: check_changes
working-directory: ./agama
run: |
git diff --staged --ignore-matching-lines="POT-Creation-Date:" \
--ignore-matching-lines="PO-Revision-Date:" web/po > po.diff
git diff --staged web | tee tr.diff
if [ -s po.diff ]; then
echo "PO files updated"
if [ -s tr.diff ]; then
echo "Translations updated"
# this is an Output Parameter
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-output-parameter
echo "po_updated=true" >> $GITHUB_OUTPUT
echo "updated=true" >> $GITHUB_OUTPUT
else
echo "PO files unchanged"
echo "po_updated=false" >> $GITHUB_OUTPUT
echo "Translations not changed"
echo "updated=false" >> $GITHUB_OUTPUT
fi
rm po.diff
rm tr.diff
- name: Push updated PO files
# run only when a PO file has been updated
if: steps.check_changes.outputs.po_updated == 'true'
if: steps.check_changes.outputs.updated == 'true'
working-directory: ./agama
run: |
web/share/update-languages.py > web/src/languages.json
# use a unique branch to avoid possible conflicts with already existing branches
# use an unique branch to avoid possible conflicts with already existing branches
git checkout -b "po_merge_${GITHUB_RUN_ID}"
git commit -a -m "Update web PO files"$'\n\n'"Agama-weblate commit: `git -C ../agama-weblate rev-parse HEAD`"
git commit -a -m "Update web translation files"$'\n\n'"Agama-weblate commit: `git -C ../agama-weblate rev-parse HEAD`"
git push origin "po_merge_${GITHUB_RUN_ID}"
- name: Create pull request
# run only when a PO file has been updated
if: steps.check_changes.outputs.po_updated == 'true'
if: steps.check_changes.outputs.updated == 'true'
working-directory: ./agama
run: |
gh pr create -B master -H "po_merge_${GITHUB_RUN_ID}" \
--label translations --label bot \
--title "Update web PO files" \
--title "Update web translation files" \
--body "Updating the web translation files from the agama-weblate repository"
env:
GH_TOKEN: ${{ github.token }}
3 changes: 2 additions & 1 deletion live/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ FLAVOR = openSUSE
# the default OBS project,
# to use a different project run "make build OBS_PROJECT=<project>"
OBS_PROJECT = "systemsmanagement:Agama:Devel"
OBS_PACKAGE = "agama-installer"

# files to copy from src/
COPY_FILES = $(patsubst $(SRCDIR)/%,$(DESTDIR)/%,$(wildcard $(SRCDIR)/*))
Expand Down Expand Up @@ -52,7 +53,7 @@ $(DESTDIR)/%.tar.xz: % $$(shell find % -type f,l)

# build the ISO locally
build: $(DESTDIR)
if [ ! -e $(DESTDIR)/.osc ]; then make clean; osc co -o $(DESTDIR) $(OBS_PROJECT) agama-installer-openSUSE; fi
if [ ! -e $(DESTDIR)/.osc ]; then make clean; osc co -o $(DESTDIR) $(OBS_PROJECT) $(OBS_PACKAGE); fi
$(MAKE) all
(cd $(DESTDIR) && osc build -M $(FLAVOR) images)

Expand Down
93 changes: 93 additions & 0 deletions live/root/tmp/driver_cleanup.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
#! /usr/bin/env ruby

# This script removes not needed multimedia drivers (sound cards, TV cards,...).
#
# By default the script runs in safe mode and only lists the drivers to delete,
# use the "--delete" argument to really delete the drivers.

require "find"
require "shellwords"

# class holding the kernel driver data
class Driver
# the driver name, full file path, dependencies
attr_reader :name, :path, :deps

def initialize(name, path, deps)
@name = name
@path = path
@deps = deps
end

# load the kernel driver data from the given path recursively
def self.find(dir)
drivers = []
puts "Scanning kernel modules in #{dir}..."

return drivers unless File.directory?(dir)

Find.find(dir) do |path|
if File.file?(path) && path.end_with?(".ko", ".ko.xz", ".ko.zst")
name = File.basename(path).sub(/\.ko(\.xz|\.zst|)\z/, "")
deps = `/usr/sbin/modinfo -F depends #{path.shellescape}`.chomp.split(",")
drivers << Driver.new(name, path, deps)
end
end

return drivers
end
end

# delete the kernel drivers in these subdirectories, but keep the drivers used by
# dependencies from other drivers
delete = [
"kernel/sound",
"kernel/drivers/media",
"kernel/drivers/staging/media"
]

# in the Live ISO there should be just one kernel installed
dir = Dir["/lib/modules/*"].first

# drivers to delete
delete_drivers = []

# scan the drivers in the delete subdirectories
delete.each do |d|
delete_drivers += Driver.find(File.join(dir, d))
end

all_drivers = Driver.find(dir)

# remove the possibly deleted drivers
all_drivers.reject!{|a| delete_drivers.any?{|d| d.name == a.name}}

puts "Skipping dependent drivers:"

# iteratively find the dependant drivers (dependencies of dependencies...)
loop do
referenced = delete_drivers.select do |dd|
all_drivers.any?{|ad| ad.deps.include?(dd.name)}
end

# no more new dependencies, end of the dependency chain reached
break if referenced.empty?

puts referenced.map(&:path).sort.join("\n")

# move the referenced drivers from the "delete" list to the "keep" list
all_drivers += referenced
delete_drivers.reject!{|a| referenced.any?{|d| d.name == a.name}}
end

puts "Drivers to delete:"
delete = ARGV[0] == "--delete"

delete_drivers.each do |d|
if (delete)
puts "Deleting #{d.path}"
File.delete(d.path)
else
puts d.path
end
end
7 changes: 7 additions & 0 deletions live/src/agama-installer.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu Nov 28 08:58:21 UTC 2024 - Ladislav Slezák <[email protected]>

- Less aggressive kernel driver cleanup, keep the multimedia
drivers which are needed as dependencies of other drivers
(usually graphic card drivers) (gh#agama-project/agama#1665)

-------------------------------------------------------------------
Wed Nov 13 12:20:23 UTC 2024 - Lubos Kocman <[email protected]>

Expand Down
9 changes: 5 additions & 4 deletions live/src/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,11 @@ rpm -e --nodeps alsa alsa-utils alsa-ucm-conf || true
# and remove the drivers for sound cards and TV cards instead. Those do not
# make sense on a server.
du -h -s /lib/modules /lib/firmware
# delete sound drivers
rm -rfv /lib/modules/*/kernel/sound
# delete TV cards and radio cards
rm -rfv /lib/modules/*/kernel/drivers/media/

# remove the multimedia drivers
/tmp/driver_cleanup.rb --delete
# remove the script, not needed anymore
rm /tmp/driver_cleanup.rb

# remove the unused firmware (not referenced by kernel drivers)
/tmp/fw_cleanup.rb --delete
Expand Down
51 changes: 13 additions & 38 deletions rust/agama-lib/share/profile.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@
"items": {
"$ref": "#/$defs/script"
}
},
"init": {
"title": "Init scripts",
"description": "User-defined scripts to run booting the installed system",
"type": "array",
"items": {
"$ref": "#/$defs/script"
}
}
}
},
Expand Down Expand Up @@ -298,30 +306,13 @@
"items": {
"title": "List of EAP methods used",
"type": "string",
"enum": [
"leap",
"md5",
"tls",
"peap",
"ttls",
"pwd",
"fast"
]
"enum": ["leap", "md5", "tls", "peap", "ttls", "pwd", "fast"]
}
},
"phase2Auth": {
"title": "Phase 2 inner auth method",
"type": "string",
"enum": [
"pap",
"chap",
"mschap",
"mschapv2",
"gtc",
"otp",
"md5",
"tls"
]
"enum": ["pap", "chap", "mschap", "mschapv2", "gtc", "otp", "md5", "tls"]
},
"identity": {
"title": "Identity string, often for example the user's login name",
Expand Down Expand Up @@ -977,10 +968,7 @@
"examples": [1024, 2048]
},
"sizeValue": {
"anyOf": [
{ "$ref": "#/$defs/sizeString" },
{ "$ref": "#/$defs/sizeInteger" }
]
"anyOf": [{ "$ref": "#/$defs/sizeString" }, { "$ref": "#/$defs/sizeInteger" }]
},
"sizeValueWithCurrent": {
"anyOf": [
Expand All @@ -1007,12 +995,7 @@
},
"minItems": 1,
"maxItems": 2,
"examples": [
[1024, "current"],
["1 GiB", "5 GiB"],
[1024, "2 GiB"],
["2 GiB"]
]
"examples": [[1024, "current"], ["1 GiB", "5 GiB"], [1024, "2 GiB"], ["2 GiB"]]
},
{
"title": "Size range",
Expand Down Expand Up @@ -1370,15 +1353,7 @@
},
"id": {
"title": "Partition ID",
"enum": [
"linux",
"swap",
"lvm",
"raid",
"esp",
"prep",
"bios_boot"
]
"enum": ["linux", "swap", "lvm", "raid", "esp", "prep", "bios_boot"]
},
"size": {
"title": "Partition size",
Expand Down
Loading

0 comments on commit 62a8a1c

Please sign in to comment.