Skip to content

Commit

Permalink
scripts/chwd: Prevent removal of base mesa packages (#82)
Browse files Browse the repository at this point in the history
* scripts/chwd: Simplify split function

* scripts/chwd: Prevent removal of base mesa packages
  • Loading branch information
ventureoo authored Feb 29, 2024
1 parent aae2337 commit 30b005f
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions scripts/chwd
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,9 @@ local function check_on_multilib()
end
end

-- https://stackoverflow.com/questions/1426954/split-string-in-lua
local function split(str, sep)
local function split(str)
local t = {}
for found in str:gmatch("([^".. sep .."]+)") do
for found in str:gmatch("([^%s]+)") do
t[#t+1] = found
end
return t
Expand Down Expand Up @@ -89,11 +88,11 @@ local function install(packages)
end

local function remove(packages)
packages = split(packages, " ")
packages = split(packages)

local pkgs = ""
for _, pkg in ipairs(packages) do
if is_installed(pkg) then
if is_installed(pkg) and (pkg ~= "mesa" or pkg ~= "lib32-mesa") then
pkgs = pkgs .. " " .. pkg
end
end
Expand Down

0 comments on commit 30b005f

Please sign in to comment.