97 lines
2.2 KiB
Lua
97 lines
2.2 KiB
Lua
-- This script will look for extra packages to be installed
|
|
-- according to the current system lang ($LANG) and mark them for install
|
|
--
|
|
-- Author: Silvan Calarco <silvan.calarco@qilinux.it> Copyright (c) 2005, 2006
|
|
--
|
|
|
|
-- Allow someone to disable this without removing the script.
|
|
if confget("APT::Get::install-extras/b", "true") == "false" then
|
|
return
|
|
end
|
|
|
|
function findLangPkg(name)
|
|
pkg = pkgfind(name..LANG2)
|
|
if not pkg then
|
|
pkg = pkgfind(name..LANG1)
|
|
end
|
|
if not pkg then
|
|
pkg = pkgfind(name..LANG)
|
|
end
|
|
end
|
|
|
|
function findAndMarkExtra(basepkg,name)
|
|
--newpkg = pkgfind(name);
|
|
findLangPkg(name)
|
|
|
|
if pkg then
|
|
basename=pkgname(basepkg)
|
|
|
|
-- is basepkg installed?
|
|
basever=pkgverinst(basepkg)
|
|
if (not basever) then
|
|
-- no, is base selected for install ?
|
|
basever=pkgvercur(basepkg)
|
|
end
|
|
newpkgver=pkgvercand(pkg)
|
|
|
|
if newpkgver and basever then
|
|
if verstrcmp(verstr(newpkgver),verstr(basever)) <= 0 then
|
|
--print ( "installing " .. name)
|
|
markinstall(pkg)
|
|
end
|
|
end
|
|
end
|
|
return 0
|
|
end
|
|
|
|
-- print ("i18n: working with "..argument)
|
|
-- markinstall("OpenOffice")
|
|
|
|
-- Don't fiddle with filenames.
|
|
-- if string.sub(argument, 1, 1) == "/" then
|
|
-- return
|
|
-- end
|
|
|
|
LANG = os.getenv "LANG"
|
|
LANG1 = string.sub(LANG,1,2)
|
|
LANG2 = string.sub(LANG,1,5)
|
|
|
|
-- install by default kde-i18n language package
|
|
-- findLangPkg("kde-i18n-")
|
|
-- if pkg then
|
|
-- markinstall(pkg)
|
|
-- end
|
|
|
|
for i, pkg in ipairs(pkglist()) do
|
|
--idx = string.find(pkgname(pkg), "#")
|
|
ver=pkgvercur(pkg)
|
|
if statinstall(pkg) or ver then
|
|
argument = pkgname(pkg)
|
|
|
|
-- KDE3 and KDE4 langauge packages have both kde- prefix
|
|
if (argument == "kdelibs" or argument == "kdelibs4") then
|
|
--|| (argument == "kdelibs4")) then
|
|
argument="kde"
|
|
end
|
|
|
|
-- check for <name>-i18n-<LANG>
|
|
name = argument.."-i18n-"
|
|
findAndMarkExtra(pkg,name);
|
|
|
|
-- check for <name>-i18n-<LANG>
|
|
name = argument.."-l10n-"
|
|
findAndMarkExtra(pkg,name);
|
|
|
|
-- check for <name>-<LANG>
|
|
name = argument.."-"
|
|
findAndMarkExtra(pkg,name);
|
|
|
|
-- check for <name>-help-<LANG>
|
|
if confget("APT::Get::install-extras::installHelp/b", "true") == "true" then
|
|
name = argument.."-help-"
|
|
findAndMarkExtra(pkg,name);
|
|
end
|
|
end
|
|
end
|
|
return
|