Compare commits
11 Commits
0.36.4
...
zsh-autoco
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
405a4501fc | ||
|
|
c2bc4ee01c | ||
| e17b84f4a0 | |||
| 4718c88229 | |||
|
d1ddaaf06a
|
|||
| 9484fff9f8 | |||
|
1e2e5f44e1
|
|||
|
764d47ad8f
|
|||
| 9e67c31d61 | |||
|
41c90f8d49
|
|||
|
c97a0cdd59
|
2
Makefile
2
Makefile
@@ -1,6 +1,6 @@
|
|||||||
SHELL=/bin/bash
|
SHELL=/bin/bash
|
||||||
|
|
||||||
V=0.36
|
V=0.37
|
||||||
BUILDTOOLVER ?= $(V)
|
BUILDTOOLVER ?= $(V)
|
||||||
|
|
||||||
CHROOTVER=0.12
|
CHROOTVER=0.12
|
||||||
|
|||||||
@@ -1,205 +1,748 @@
|
|||||||
#compdef artixpkg
|
#compdef _artixpkg artixpkg
|
||||||
|
|
||||||
local -a addcmd admincmd cicmd clonecmd configcmd createcmd gitcmd importcmd \
|
LIBDIR=${LIBDIR:-'@libdir@'}
|
||||||
initialcmd maintainercmd movecmd querycmd pullcmd pushcmd removecmd \
|
# LIBDIR='/usr/share/artools/lib'
|
||||||
repocmd showcmd teamcmd topiccmd transfercmd versioncmd
|
|
||||||
_regex_words maintainer '' \
|
|
||||||
'-a' \
|
|
||||||
'--adopt' \
|
|
||||||
'-h' \
|
|
||||||
'--help' \
|
|
||||||
'-o' \
|
|
||||||
'--orphan'
|
|
||||||
maintainercmd=("$reply[@]")
|
|
||||||
|
|
||||||
_regex_words query '' \
|
ARTIX_DB=(
|
||||||
'-h' \
|
"system-goblins"
|
||||||
'--help' \
|
"system-gremlins"
|
||||||
'-m' \
|
"system"
|
||||||
'-t'
|
"world-goblins"
|
||||||
querycmd=("$reply[@]")
|
"world-gremlins"
|
||||||
|
"world"
|
||||||
|
"lib32-goblins"
|
||||||
|
"lib32-gremlins"
|
||||||
|
"lib32"
|
||||||
|
"galaxy-goblins"
|
||||||
|
"galaxy-gremlins"
|
||||||
|
"galaxy"
|
||||||
|
)
|
||||||
|
|
||||||
_regex_words team '' \
|
ARTIX_DB_MAP=(
|
||||||
'-a' \
|
"goblins"
|
||||||
'--add' \
|
"gremlins"
|
||||||
'-c' \
|
"stable"
|
||||||
'--check' \
|
)
|
||||||
'-h' \
|
|
||||||
'--help' \
|
|
||||||
'-r' \
|
|
||||||
'--remove'
|
|
||||||
teamcmd=("$reply[@]")
|
|
||||||
|
|
||||||
_regex_words topic '' \
|
AGENTS=(
|
||||||
'-a' \
|
"orion"
|
||||||
'--add' \
|
"taurus"
|
||||||
'-d' \
|
)
|
||||||
'--delete' \
|
|
||||||
'-h' \
|
|
||||||
'--help' \
|
|
||||||
'-j' \
|
|
||||||
'--jobs' \
|
|
||||||
'-r' \
|
|
||||||
'--remove'
|
|
||||||
topiccmd=("$reply[@]")
|
|
||||||
|
|
||||||
_regex_words transfer '' \
|
ARTIX_TEAMS=(
|
||||||
'-h' \
|
"system"
|
||||||
'--help'
|
"world"
|
||||||
transfercmd=("$reply[@]")
|
"lib32"
|
||||||
|
"galaxy"
|
||||||
|
)
|
||||||
|
|
||||||
|
_artixpkg_remotepkgbase() {
|
||||||
|
curl -s "https://checkupdates.artixlinux.org/api/1.0/packages?startswith=$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
_artixpkg_maintainers() {
|
||||||
|
curl -s "https://checkupdates.artixlinux.org/api/1.0/maintainers"
|
||||||
|
}
|
||||||
|
|
||||||
|
_artixpkg_pkgbase() {
|
||||||
|
source "${LIBDIR}/pkg/util.sh"
|
||||||
|
ls -1 "${TREE_DIR_ARTIX}" | tr '\n' ' '
|
||||||
|
}
|
||||||
|
|
||||||
|
function _artixpkg { # DONE
|
||||||
|
_arguments -C \
|
||||||
|
'1:command:->subcmd' \
|
||||||
|
'*::args:->args'
|
||||||
|
|
||||||
|
case $state in
|
||||||
|
subcmd)
|
||||||
|
local -a subcmds
|
||||||
|
subcmds=(
|
||||||
|
"--help:Show help text"
|
||||||
|
"-h:Show help text"
|
||||||
|
"admin:Manage topics, teams and obsolete repos"
|
||||||
|
"git:Manage Git packaging repositories and their configuration"
|
||||||
|
"repo:Pacman database modification for package updates, moves, etc."
|
||||||
|
"version:Show artixpkg version information"
|
||||||
|
)
|
||||||
|
_describe 'command' subcmds
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
args)
|
||||||
|
case $words[1] in
|
||||||
|
admin)
|
||||||
|
_admin
|
||||||
|
;;
|
||||||
|
git)
|
||||||
|
_git
|
||||||
|
;;
|
||||||
|
repo)
|
||||||
|
_repo
|
||||||
|
;;
|
||||||
|
version)
|
||||||
|
_arguments \
|
||||||
|
'-h[Show help text]' \
|
||||||
|
'--help[Show help text]'
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
_admin() { #DONE
|
||||||
|
local state
|
||||||
|
|
||||||
|
_arguments -C \
|
||||||
|
'1:admin-cmd:->admin-subcmd' \
|
||||||
|
'*::admin-arg:->admin-args'
|
||||||
|
|
||||||
|
case $state in
|
||||||
|
admin-subcmd)
|
||||||
|
local -a admin_subcommands
|
||||||
|
admin_subcommands=(
|
||||||
|
"-h:Show this help text"
|
||||||
|
"--help:Show this help text"
|
||||||
|
"maintainer:Manage repo maintainer"
|
||||||
|
"query:Query maintainers and topics"
|
||||||
|
"team:Manage repo team"
|
||||||
|
"topic:Manage topics"
|
||||||
|
"transfer:Transfer obsolete repository to landfill"
|
||||||
|
)
|
||||||
|
_describe 'admin-cmd' admin_subcommands
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
admin-args)
|
||||||
|
case $words[1] in
|
||||||
|
maintainer)
|
||||||
|
_admin_maintainer
|
||||||
|
;;
|
||||||
|
query)
|
||||||
|
_admin_query
|
||||||
|
;;
|
||||||
|
team)
|
||||||
|
_admin_team
|
||||||
|
;;
|
||||||
|
topic)
|
||||||
|
_admin_topic
|
||||||
|
;;
|
||||||
|
transfer)
|
||||||
|
admin_transfer
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
_git() { # DONE
|
||||||
|
local state
|
||||||
|
_arguments \
|
||||||
|
'1:git-cmd:->git-subcmd' \
|
||||||
|
'*::git-arg:->git-args'
|
||||||
|
|
||||||
|
case $state in
|
||||||
|
git-subcmd)
|
||||||
|
local -a git_subcommands
|
||||||
|
git_subcommands=(
|
||||||
|
"-h:Show this help text"
|
||||||
|
"--help:Show this help text"
|
||||||
|
"clone:Clone a package repository"
|
||||||
|
"config:Configure a clone according to artix specs"
|
||||||
|
"create:Create a new Gitea package repository"
|
||||||
|
"pull:Pull a package repository"
|
||||||
|
"push:Push a package repository"
|
||||||
|
)
|
||||||
|
_describe 'git-cmd' git_subcommands
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
git-args)
|
||||||
|
case $words[1] in
|
||||||
|
clone)
|
||||||
|
_git_clone
|
||||||
|
;;
|
||||||
|
config)
|
||||||
|
_git_config
|
||||||
|
;;
|
||||||
|
create)
|
||||||
|
_git_create
|
||||||
|
;;
|
||||||
|
pull)
|
||||||
|
_git_pull
|
||||||
|
;;
|
||||||
|
push)
|
||||||
|
_git_push
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
_repo() { # DONE
|
||||||
|
local state
|
||||||
|
_arguments \
|
||||||
|
'1:repo-cmd:->repo-subcmd' \
|
||||||
|
'*::repo-arg:->repo-args'
|
||||||
|
|
||||||
|
case $state in
|
||||||
|
repo-subcmd)
|
||||||
|
local -a repo_subcommands
|
||||||
|
repo_subcommands=(
|
||||||
|
"-h:Show this help text"
|
||||||
|
"--help:Show this help text"
|
||||||
|
"add:Add built pkgbase to repo"
|
||||||
|
"move:Move built pkgbase between repos"
|
||||||
|
"remove:Remove built pkgbase from repo"
|
||||||
|
"import:Import latest tag from arch upstream"
|
||||||
|
"show:Show the pkgbase's repo db"
|
||||||
|
)
|
||||||
|
_describe 'repo-cmd' repo_subcommands
|
||||||
|
;;
|
||||||
|
|
||||||
|
repo-args)
|
||||||
|
case $words[1] in
|
||||||
|
add)
|
||||||
|
_repo_add
|
||||||
|
;;
|
||||||
|
move)
|
||||||
|
_repo_move
|
||||||
|
;;
|
||||||
|
remove)
|
||||||
|
_repo_remove
|
||||||
|
;;
|
||||||
|
import)
|
||||||
|
_repo_import
|
||||||
|
;;
|
||||||
|
show)
|
||||||
|
_repo_show
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
_admin_maintainer() { # DONE
|
||||||
|
local state
|
||||||
|
_arguments \
|
||||||
|
'1:maintainer-cmd:->maintainer-subcmd' \
|
||||||
|
'*::maintainer-arg:->maintainer-args'
|
||||||
|
|
||||||
|
case $state in
|
||||||
|
maintainer-subcmd)
|
||||||
|
local -a maintainer_subcommands
|
||||||
|
maintainer_subcommands=(
|
||||||
|
"-h:Show this help text"
|
||||||
|
"--help:Show this help text"
|
||||||
|
"--adopt:Adopt repo"
|
||||||
|
"-a:Adopt repo"
|
||||||
|
"--orphan:Orphan repo"
|
||||||
|
"-o:Orphan repo"
|
||||||
|
)
|
||||||
|
_describe 'maintainer-cmd' maintainer_subcommands
|
||||||
|
;;
|
||||||
|
maintainer-args)
|
||||||
|
local -a localpkgs
|
||||||
|
localpkgs=(${(z)$(_artixpkg_pkgbase)})
|
||||||
|
case $words[1] in
|
||||||
|
--adopt|-a|--orphan|-o)
|
||||||
|
_describe 'locals-cmd' localpkgs
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
_admin_query() { # DONE
|
||||||
|
local state
|
||||||
|
local -a localpkgs
|
||||||
|
localpkgs=(${(z)$(_artixpkg_pkgbase)})
|
||||||
|
local -a query_subcommands
|
||||||
|
query_subcommands=(
|
||||||
|
"-h:Show this help text"
|
||||||
|
"--help:Show this help text"
|
||||||
|
"--maintainer:Query for packages of the named maintainer"
|
||||||
|
"-m:Query for packages of the named maintainer"
|
||||||
|
"--topic:Query for packages of the named topic"
|
||||||
|
"-t:Query for packages of the named topic"
|
||||||
|
)
|
||||||
|
|
||||||
|
_arguments \
|
||||||
|
'1:query-cmd:->query-subcmd' \
|
||||||
|
'*::query-arg:->query-args'
|
||||||
|
|
||||||
|
case $state in
|
||||||
|
query-subcmd)
|
||||||
|
_describe 'query-cmd' query_subcommands -- localpkgs
|
||||||
|
;;
|
||||||
|
query-args)
|
||||||
|
local -a maintainers
|
||||||
|
maintainers=("${(z)$(_artixpkg_maintainers)}")
|
||||||
|
if [[ ${words[CURRENT-1]} == "-m" || ${words[CURRENT-1]} == "--maintainer" ]] then
|
||||||
|
_describe 'maintainers-cmd' maintainers
|
||||||
|
elif [[ ${words[CURRENT-1]} == "-t" || ${words[CURRENT-1]} == "--topic" ]] then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
_describe 'query-cmd' query_subcommands -- localpkgs
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac;
|
||||||
|
}
|
||||||
|
|
||||||
|
_admin_team() { # DONE
|
||||||
|
local -a localpkgs
|
||||||
|
localpkgs=(${(z)$(_artixpkg_pkgbase)})
|
||||||
|
local state
|
||||||
|
local -a team_subcommands
|
||||||
|
team_subcommands=(
|
||||||
|
"-h:Show this help text"
|
||||||
|
"--help:Show this help text"
|
||||||
|
"--check:Check if team is assigned"
|
||||||
|
"-c:Check if team is assigned"
|
||||||
|
"--list:List repo teams"
|
||||||
|
"-l:List repo teams"
|
||||||
|
"--add:Add team to repo"
|
||||||
|
"-a:Add team to repo"
|
||||||
|
"--remove:Remove team from repo"
|
||||||
|
"-r:Remove team from repo"
|
||||||
|
)
|
||||||
|
|
||||||
|
_arguments \
|
||||||
|
'1:team-cmd:->team-subcmd' \
|
||||||
|
'*::team-arg:->team-args'
|
||||||
|
|
||||||
|
case $state in
|
||||||
|
team-subcmd)
|
||||||
|
_describe 'team-cmd' team_subcommands -- localpkgs
|
||||||
|
;;
|
||||||
|
team-args)
|
||||||
|
local -a maintainers
|
||||||
|
maintainers=("${(z)$(_artixpkg_maintainers)}")
|
||||||
|
if [[ ${words[CURRENT-1]} == "-a" || ${words[CURRENT-1]} == "--add" || ${words[CURRENT-1]} == "-r" || ${words[CURRENT-1]} == "--remove" ]] then
|
||||||
|
_describe 'elses cmd' ARTIX_TEAMS
|
||||||
|
else
|
||||||
|
_describe 'query-cmd' team_subcommands -- localpkgs
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
_admin_topic() { # DONE
|
||||||
|
local state
|
||||||
|
local -a localpkgs
|
||||||
|
local -a topic_subcommands
|
||||||
|
topic_subcommands=(
|
||||||
|
"-h:Show this help text"
|
||||||
|
"--help:Show this help text"
|
||||||
|
"--add:Add a topic to repo"
|
||||||
|
"-a:Add a topic to repo"
|
||||||
|
"--remove:Remove a topic from repo"
|
||||||
|
"-r:Remove a topic from repo"
|
||||||
|
"--delete:Delete all topics from repo"
|
||||||
|
"-d:Delete all topics from repo"
|
||||||
|
"--jobs:Run up to N jobs in parallel (default: 4)"
|
||||||
|
"-j:Run up to N jobs in parallel (default: 4)"
|
||||||
|
)
|
||||||
|
localpkgs=(${(z)$(_artixpkg_pkgbase)})
|
||||||
|
|
||||||
|
_arguments \
|
||||||
|
'1:topic-cmd:->topic-subcmd' \
|
||||||
|
'*::topic-arg:->topic-args'
|
||||||
|
|
||||||
|
case $state in
|
||||||
|
topic-subcmd)
|
||||||
|
_describe 'topic-cmd' topic_subcommands -- localpkgs
|
||||||
|
;;
|
||||||
|
topic-args)
|
||||||
|
if [[ ${words[CURRENT-1]} == "-j" || ${words[CURRENT-1]} == "--jobs" || ${words[CURRENT-1]} == "-h" || ${words[CURRENT-1]} == "--help" || ${words[CURRENT-1]} == "-a" || ${words[CURRENT-1]} == "--add" || ${words[CURRENT-1]} == "-r" || ${words[CURRENT-1]} == "--remove" || ${words[CURRENT-1]} == "-d" || ${words[CURRENT-1]} == "--delete" ]] then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
_describe 'topic-cmd' topic_subcommands -- localpkgs
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
_regex_words admin '' \
|
admin_transfer() { # DONE
|
||||||
'-h:Help text' \
|
local state
|
||||||
'--help:Help text' \
|
local -a transfer_subcommands
|
||||||
'maintainer:Manage repo maintainer:$maintainercmd' \
|
transfer_subcommands=(
|
||||||
'query:Query maintainers and topics:$querycmd' \
|
"-h:Show this help text"
|
||||||
'team:Manage repo team:$teamcmd' \
|
"--help:Show this help text"
|
||||||
'topic:Manage topics:$topiccmd' \
|
)
|
||||||
'transfer:Transfer obsolete repositories to landfill:$transfercmd'
|
local -a localpkgs
|
||||||
admincmd=("$reply[@]")
|
localpkgs=(${(z)$(_artixpkg_pkgbase)})
|
||||||
|
|
||||||
_regex_words ci '' \
|
_arguments \
|
||||||
'-a' \
|
'1:transfer-cmd:->transfer-subcmd' \
|
||||||
'--agent' \
|
'*::transfer-arg:->transfer-args'
|
||||||
'-h' \
|
|
||||||
'--help'
|
|
||||||
cicmd=("$reply[@]")
|
|
||||||
|
|
||||||
_regex_words clone '' \
|
case $state in
|
||||||
'-a' \
|
transfer-subcmd)
|
||||||
'--agent' \
|
_describe 'transfer-cmd' transfer_subcommands -- localpkgs
|
||||||
'--all' \
|
;;
|
||||||
'-h' \
|
transfer-args)
|
||||||
'--help' \
|
case $words[@] in
|
||||||
'-j' \
|
*)
|
||||||
'--jobs' \
|
_describe 'transfer_else-cmd' transfer_subcommands -- localpkgs
|
||||||
'-m' \
|
;;
|
||||||
'--maintainer' \
|
esac
|
||||||
'--protocol' \
|
;;
|
||||||
'-s' \
|
esac
|
||||||
'--search' \
|
}
|
||||||
'-t' \
|
|
||||||
'--team'
|
|
||||||
clonecmd=("$reply[@]")
|
|
||||||
|
|
||||||
_regex_words config '' \
|
_git_clone() { # DONE
|
||||||
'-h' \
|
local state
|
||||||
'--help' \
|
local -a remotepkgs
|
||||||
'-j' \
|
local -a clone_subcommands
|
||||||
'--jobs' \
|
clone_subcommands=(
|
||||||
'--protocol'
|
"-h:Show this help text"
|
||||||
configcmd=("$reply[@]")
|
"--help:Show this help text"
|
||||||
|
"--maintainer:Clone all packages of the named maintainer"
|
||||||
|
"-m:Clone all packages of the named maintainer"
|
||||||
|
"--search:Clone all packages of the named topic"
|
||||||
|
"-s:Clone all packages of the named topic"
|
||||||
|
"--team:Assign team name (default: world)"
|
||||||
|
"-t:Assign team name (default: world)"
|
||||||
|
"--jobs:Run up to N jobs in parallel (default: 4)"
|
||||||
|
"-j:Run up to N jobs in parallel (default: 4)"
|
||||||
|
"--protocol https:Clone the repository over https"
|
||||||
|
"--all:Clone all existing packages, useful for cache warming"
|
||||||
|
)
|
||||||
|
|
||||||
_regex_words create '' \
|
_arguments \
|
||||||
'-a' \
|
'1:clone-cmd:->clone-subcmd' \
|
||||||
'--agent' \
|
'*::clone-arg:->clone-args'
|
||||||
'-c' \
|
|
||||||
'--create' \
|
|
||||||
'-h' \
|
|
||||||
'--help' \
|
|
||||||
'-t' \
|
|
||||||
'--team'
|
|
||||||
createcmd=("$reply[@]")
|
|
||||||
|
|
||||||
_regex_words pull '' \
|
case $state in
|
||||||
'--all' \
|
clone-subcmd)
|
||||||
'-h' \
|
remotepkgs=(${(z)$(_artixpkg_remotepkgbase)})
|
||||||
'--help' \
|
|
||||||
'-j' \
|
|
||||||
'--jobs' \
|
|
||||||
'-m' \
|
|
||||||
'--maintainer' \
|
|
||||||
'-t' \
|
|
||||||
'--topic'
|
|
||||||
pullcmd=("$reply[@]")
|
|
||||||
|
|
||||||
_regex_words push '' \
|
_describe 'clone-cmd' clone_subcommands -- remotepkgs
|
||||||
'-h' \
|
;;
|
||||||
'--help' \
|
clone-args)
|
||||||
'-j' \
|
case $words[@] in
|
||||||
'--jobs' \
|
*)
|
||||||
'-m' \
|
remotepkgs=(${(z)$(_artixpkg_remotepkgbase)})
|
||||||
'--maintainer' \
|
_describe 'cloneall-cmd' clone_subcommands -- remotepkgs
|
||||||
'-t' \
|
;;
|
||||||
'--topic'
|
esac
|
||||||
pushcmd=("$reply[@]")
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
_regex_words git '' \
|
_git_config() { # DONE
|
||||||
'ci:Configure CI agent:$cicmd' \
|
local state
|
||||||
'clone:Clone a package:$clonecmd' \
|
local -a localpkgs
|
||||||
'config:Configure a clone:$configcmd' \
|
localpkgs=(${(z)$(_artixpkg_pkgbase)})
|
||||||
'create:Create a new gitea package repository:$createcmd' \
|
local -a config_subcommands
|
||||||
'-h:Help text' \
|
config_subcommands=(
|
||||||
'--help:Help text' \
|
"-h:Show this help text"
|
||||||
'pull:Pull a package repository:$pullcmd' \
|
"--help:Show this help text"
|
||||||
'push:Push a package repository:$pushcmd'
|
"--jobs:Run up to N jobs in parallel (default: 4)"
|
||||||
gitcmd=("$reply[@]")
|
"-j:Run up to N jobs in parallel (default: 4)"
|
||||||
|
"--protocol:Configure remote url to use https"
|
||||||
|
)
|
||||||
|
|
||||||
_regex_words add '' \
|
_arguments \
|
||||||
'-h' \
|
'1:config-cmd:->config-subcmd' \
|
||||||
'--help' \
|
'*::config-arg:->config-args'
|
||||||
'-n' \
|
|
||||||
'--nocheck' \
|
|
||||||
'-p' \
|
|
||||||
'--push' \
|
|
||||||
'-r' \
|
|
||||||
'--rebuild'
|
|
||||||
addcmd=("$reply[@]")
|
|
||||||
|
|
||||||
_regex_words import '' \
|
case $state in
|
||||||
'--del' \
|
config-subcmd)
|
||||||
'-h' \
|
_describe 'config-cmd' config_subcommands -- localpkgs
|
||||||
'--help' \
|
;;
|
||||||
'--tag'
|
config-args)
|
||||||
importcmd=("$reply[@]")
|
if [[ ${words[CURRENT-1]} == "--protocol" ]] then
|
||||||
|
all_completions=(
|
||||||
|
'https:HTTPS protocol'
|
||||||
|
)
|
||||||
|
_describe 'protocl val' all_completions
|
||||||
|
elif [[ ${words[CURRENT-1]} == "-j" || ${words[CURRENT-1]} == "--jobs" ]] then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
_describe 'localpkgs-cmd' config_subcommands -- localpkgs
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
_regex_words move '' \
|
_git_create() { # DONE
|
||||||
'-h' \
|
local state
|
||||||
'--help' \
|
local -a create_subcommands
|
||||||
'-p' \
|
create_subcommands=(
|
||||||
'--push'
|
"-h:Show this help text"
|
||||||
movecmd=("$reply[@]")
|
"--help:Show this help text"
|
||||||
|
"--clone:Clone the Git repository after creation"
|
||||||
|
"-c:Clone the Git repository after creation"
|
||||||
|
"--team:Assign team name (default: world)"
|
||||||
|
"-t:Assign team name (default: world)"
|
||||||
|
)
|
||||||
|
|
||||||
_regex_words remove '' \
|
_arguments \
|
||||||
'-h' \
|
'1:create-cmd:->create-subcmd' \
|
||||||
'--help' \
|
'*::create-arg:->create-args'
|
||||||
'-p' \
|
|
||||||
'--push'
|
|
||||||
removecmd=("$reply[@]")
|
|
||||||
|
|
||||||
_regex_words show '' \
|
case $state in
|
||||||
'-b' \
|
create-subcmd)
|
||||||
'--base' \
|
_describe 'create-cmd' create_subcommands
|
||||||
'-h' \
|
;;
|
||||||
'--help' \
|
create-args)
|
||||||
'-p' \
|
if [[ ${words[CURRENT-1]} == "-t" || ${words[CURRENT-1]} == "--topic" ]] then
|
||||||
'--pkgs'
|
_describe 'teams-cmd' ARTIX_TEAMS
|
||||||
showcmd=("$reply[@]")
|
else
|
||||||
|
_describe 'create-cmd' create_subcommands
|
||||||
|
fi
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
_regex_words repo '' \
|
_git_pull() { # DONE
|
||||||
'add:Add pkgbase to repo:$addcmd' \
|
local state
|
||||||
'-h:Help text' \
|
local -a localpkgs
|
||||||
'--help:Help text' \
|
localpkgs=(${(z)$(_artixpkg_pkgbase)})
|
||||||
'import:Import latest tag from arch upstream:$importcmd' \
|
local -a pull_subcommands
|
||||||
'move:Move pkgbase between repos:$movecmd' \
|
pull_subcommands=(
|
||||||
'remove:Remove pkgbase from repo:$removecmd' \
|
"-h:Show this help text"
|
||||||
'show:Show pkgbase repo db:$showcmd'
|
"--help:Show this help text"
|
||||||
repocmd=("$reply[@]")
|
"--maintainer:Pull all packages of the named maintainer"
|
||||||
|
"-m:Pull all packages of the named maintainer"
|
||||||
|
"--topic:Pull all packages of the named topic"
|
||||||
|
"-t:Pull all packages of the named topic"
|
||||||
|
"--jobs:Run up to N jobs in parallel (default: 4)"
|
||||||
|
"-j:Run up to N jobs in parallel (default: 4)"
|
||||||
|
"--all:Pull all existing packages"
|
||||||
|
)
|
||||||
|
|
||||||
_regex_words version '' \
|
_arguments \
|
||||||
'-h' \
|
'1:pull-cmd:->pull-subcmd' \
|
||||||
'--help'
|
'*::pull-arg:->pull-args'
|
||||||
versioncmd=("$reply[@]")
|
|
||||||
|
|
||||||
_regex_words initial '' \
|
case $state in
|
||||||
'admin:Manage topics:$admincmd' \
|
pull-subcmd)
|
||||||
'git:Manage git:$gitcmd' \
|
_describe 'pull-cmd' pull_subcommands -- localpkgs
|
||||||
'-h:Help text' \
|
;;
|
||||||
'--help:Help text' \
|
pull-args)
|
||||||
'repo:Pacman database modification:$repocmd' \
|
if [[ ${words[CURRENT-1]} == "--all" ]] then
|
||||||
'version:Show artixpkg version:$versioncmd'
|
return 0
|
||||||
initialcmd=("$reply[@]")
|
elif [[ ${words[CURRENT-1]} == "-m" || ${words[CURRENT-1]} == "--maintainer" ]] then
|
||||||
|
local -a maintainers
|
||||||
|
maintainers=("${(z)$(_artixpkg_maintainers)}")
|
||||||
|
_describe 'maintainers-cmd' maintainers
|
||||||
|
elif [[ ${words[CURRENT-1]} == "-j" || ${words[CURRENT-1]} == "--jobs" || ${words[CURRENT-1]} == "-t" || ${words[CURRENT-1]} == "--topic" ]] then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
_describe 'pull-cmd' pull_subcommands -- localpkgs
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
_git_push() {
|
||||||
|
local state
|
||||||
|
local -a push_subcommands
|
||||||
|
push_subcommands=(
|
||||||
|
"-h:Show this help text"
|
||||||
|
"--help:Show this help text"
|
||||||
|
"--maintainer:Push all packages of the named maintainer"
|
||||||
|
"-m:Push all packages of the named maintainer"
|
||||||
|
"--topic:Push all packages of the named topic"
|
||||||
|
"-t:Push all packages of the named topic"
|
||||||
|
)
|
||||||
|
local -a localpkgs
|
||||||
|
localpkgs=(${(z)$(_artixpkg_pkgbase)})
|
||||||
|
_arguments \
|
||||||
|
'1:push-cmd:->push-subcmd' \
|
||||||
|
'*::push-arg:->push-args'
|
||||||
|
|
||||||
|
case $state in
|
||||||
|
push-subcmd)
|
||||||
|
_describe 'push-cmd' push_subcommands -- localpkgs
|
||||||
|
;;
|
||||||
|
push-args)
|
||||||
|
if [[ ${words[CURRENT-1]} == "-m" || ${words[CURRENT-1]} == "--maintainer" ]] then
|
||||||
|
local -a maintainers
|
||||||
|
maintainers=("${(z)$(_artixpkg_maintainers)}")
|
||||||
|
_describe 'maintainers-cmd' maintainers
|
||||||
|
elif [[ ${words[CURRENT-1]} == "-t" || ${words[CURRENT-1]} == "--topic" ]] then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
_describe 'push-cmd' push_subcommands -- localpkgs
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
_repo_add() { # DONE
|
||||||
|
local state
|
||||||
|
local -a add_subcommands
|
||||||
|
local -a localpkgs
|
||||||
|
localpkgs=(${(z)$(_artixpkg_pkgbase)})
|
||||||
|
local -a combined_db
|
||||||
|
combined_db=("${ARTIX_DB[@]}" "${ARTIX_DB_MAP[@]}")
|
||||||
|
|
||||||
|
add_subcommands=(
|
||||||
|
"-h:Show this help text"
|
||||||
|
"--help:Show this help text"
|
||||||
|
"--push:Push pkgbase"
|
||||||
|
"-p:Push pkgbase"
|
||||||
|
"--rebuild:Triggers a rebuild"
|
||||||
|
"-r:Triggers a rebuild"
|
||||||
|
"--nocheck:Disable the check function"
|
||||||
|
"-n:Disable the check function"
|
||||||
|
"--agent:Set the CI agent"
|
||||||
|
"-a:Set the CI agent"
|
||||||
|
)
|
||||||
|
|
||||||
|
_arguments \
|
||||||
|
'1:add-cmd:->add-subcmd' \
|
||||||
|
'*::add-arg:->add-args'
|
||||||
|
|
||||||
|
case $state in
|
||||||
|
add-subcmd)
|
||||||
|
_describe 'add_cmd' add_subcommands -- ARTIX_DB -- ARTIX_DB_MAP
|
||||||
|
;;
|
||||||
|
add-args)
|
||||||
|
intersections=(${words:*combined_db})
|
||||||
|
if [[ ${words[CURRENT-1]} == "-a" || ${words[CURRENT-1]} == "--agent" ]] then
|
||||||
|
_describe 'add_cmd' AGENTS
|
||||||
|
elif [[ ${#intersections} > 0 ]] then
|
||||||
|
_describe 'push-cmd' add_subcommands -- localpkgs
|
||||||
|
else
|
||||||
|
_describe 'add_cmd' add_subcommands -- combined_db
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
_repo_move() { # DONE
|
||||||
|
local state
|
||||||
|
local -a move_subcommands
|
||||||
|
local -a intersections
|
||||||
|
local -a localpkgs
|
||||||
|
localpkgs=(${(z)$(_artixpkg_pkgbase)})
|
||||||
|
|
||||||
|
move_subcommands=(
|
||||||
|
"-h:Show this help text"
|
||||||
|
"--help:Show this help text"
|
||||||
|
"--push:Push pkgbase"
|
||||||
|
"-p:Push pkgbase"
|
||||||
|
"--agent:Set the CI agent"
|
||||||
|
"-a:Set the CI agent"
|
||||||
|
)
|
||||||
|
local -a combined_db
|
||||||
|
combined_db=("${ARTIX_DB[@]}" "${ARTIX_DB_MAP[@]}")
|
||||||
|
|
||||||
|
_arguments \
|
||||||
|
'1:move-cmd:->move-subcmd' \
|
||||||
|
'*::move-arg:->move-args'
|
||||||
|
|
||||||
|
case $state in
|
||||||
|
move-subcmd)
|
||||||
|
_describe 'move_cmd' move_subcommands -- ARTIX_DB -- ARTIX_DB_MAP
|
||||||
|
;;
|
||||||
|
move-args)
|
||||||
|
intersections=(${words:*combined_db})
|
||||||
|
if [[ ${words[CURRENT-1]} == "-a" || ${words[CURRENT-1]} == "--agent" ]] then
|
||||||
|
_describe 'add_cmd' AGENTS
|
||||||
|
elif (( ${#intersections} > 1 )) then
|
||||||
|
_describe 'push-cmd' move_subcommands -- localpkgs
|
||||||
|
else
|
||||||
|
_describe 'add_cmd' move_subcommands -- ARTIX_DB -- ARTIX_DB_MAP
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
_repo_remove() { # DONE
|
||||||
|
local state
|
||||||
|
local -a remove_subcommands
|
||||||
|
local -a intersections
|
||||||
|
|
||||||
|
remove_subcommands=(
|
||||||
|
"-h:Show this help text"
|
||||||
|
"--help:Show this help text"
|
||||||
|
"--push:Push pkgbase"
|
||||||
|
"-p:Push pkgbase"
|
||||||
|
"--agent:Set the CI agent"
|
||||||
|
"-a:Set the CI agent"
|
||||||
|
)
|
||||||
|
local -a localpkgs
|
||||||
|
localpkgs=(${(z)$(_artixpkg_pkgbase)})
|
||||||
|
local -a combined_db
|
||||||
|
combined_db=("${ARTIX_DB[@]}" "${ARTIX_DB_MAP[@]}")
|
||||||
|
|
||||||
|
_arguments \
|
||||||
|
'1:remove-cmd:->remove-subcmd' \
|
||||||
|
'*::remove-arg:->remove-args'
|
||||||
|
|
||||||
|
case $state in
|
||||||
|
remove-subcmd)
|
||||||
|
_describe 'remove_cmd' remove_subcommands -- combined_db
|
||||||
|
;;
|
||||||
|
remove-args)
|
||||||
|
intersections=(${words:*combined_db})
|
||||||
|
if [[ ${words[CURRENT-1]} == "-a" || ${words[CURRENT-1]} == "--agent" ]] then
|
||||||
|
_describe 'add_cmd' AGENTS
|
||||||
|
elif [[ ${#intersections} > 0 ]] then
|
||||||
|
_describe 'push-cmd' remove_subcommands -- localpkgs
|
||||||
|
else
|
||||||
|
_describe 'add_cmd' remove_subcommands -- combined_db
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
_repo_import() {
|
||||||
|
local state
|
||||||
|
local -a import_subcommands
|
||||||
|
import_subcommands=(
|
||||||
|
"-h:Show this help text"
|
||||||
|
"--help:Show this help text"
|
||||||
|
"--tag:Switch the current workspace to a specified version tag"
|
||||||
|
"--del:Delete files before rsync import"
|
||||||
|
"--no-patch:No patch import"
|
||||||
|
"-n:No patch import"
|
||||||
|
)
|
||||||
|
local -a localpkgs
|
||||||
|
localpkgs=(${(z)$(_artixpkg_pkgbase)})
|
||||||
|
|
||||||
|
_arguments \
|
||||||
|
'1:import-cmd:->import-subcmd' \
|
||||||
|
'*::import-arg:->import-args'
|
||||||
|
|
||||||
|
case $state in
|
||||||
|
import-subcmd)
|
||||||
|
_describe 'import-cmd' import_subcommands -- localpkgs
|
||||||
|
;;
|
||||||
|
import-args)
|
||||||
|
if [[ ${words[CURRENT-1]} == "--tag" || ${words[CURRENT-1]} == "-tag" ]] then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
_describe 'import-cmd' import_subcommands -- localpkgs
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
_repo_show() {
|
||||||
|
local state
|
||||||
|
_arguments \
|
||||||
|
'1:show-cmd:->show-subcmd' \
|
||||||
|
'*::show-arg:->show-args'
|
||||||
|
|
||||||
|
case $state in
|
||||||
|
*)
|
||||||
|
local -a show_subcommands
|
||||||
|
show_subcommands=(
|
||||||
|
"-h:Show this help text"
|
||||||
|
"--help:Show this help text"
|
||||||
|
"--base:Show srcinfo base"
|
||||||
|
"-b:Show srcinfo base"
|
||||||
|
"--pkgs:Show srcinfo pkgs"
|
||||||
|
"-p:Show srcinfo pkgs"
|
||||||
|
)
|
||||||
|
_describe 'show-cmd' show_subcommands
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
_regex_arguments _artixpkg /$'[^\0]##\0'/ "${initialcmd[@]}"
|
|
||||||
_artixpkg "$@"
|
_artixpkg "$@"
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
################ install ################
|
|
||||||
|
|
||||||
# start services
|
|
||||||
# bluetoothd, cupsd, DM are added to the pkglist dynamicly
|
|
||||||
# metalog or syslog-ng is added to the pkglist dynamicly
|
|
||||||
# connmand or NetworkManager is added to the pkglist dynamicly
|
|
||||||
# only added if in array, these pkgs have no list entry
|
|
||||||
|
|
||||||
SERVICES=('acpid' 'bluetoothd' 'cronie' 'cupsd' 'metalog' 'connmand')
|
|
||||||
|
|
||||||
################# live-session #################
|
|
||||||
|
|
||||||
# default value
|
|
||||||
# PASSWORD="artix"
|
|
||||||
|
|
||||||
# Set to false to disable autologin in the live session
|
|
||||||
AUTOLOGIN="false"
|
|
||||||
30
contrib/iso/profile.yaml.example
Normal file
30
contrib/iso/profile.yaml.example
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
# required
|
||||||
|
live-session:
|
||||||
|
user: "artix"
|
||||||
|
password: "artix"
|
||||||
|
autologin: true
|
||||||
|
use-xlibre: false
|
||||||
|
services: []
|
||||||
|
user-services: []
|
||||||
|
|
||||||
|
# required
|
||||||
|
rootfs:
|
||||||
|
packages: []
|
||||||
|
packages-init:
|
||||||
|
dinit: []
|
||||||
|
openrc: []
|
||||||
|
runit: []
|
||||||
|
s6: []
|
||||||
|
|
||||||
|
# optional
|
||||||
|
livefs:
|
||||||
|
packages: []
|
||||||
|
# optional
|
||||||
|
packages-init:
|
||||||
|
dinit: []
|
||||||
|
openrc: []
|
||||||
|
runit: []
|
||||||
|
s6: []
|
||||||
|
|
||||||
@@ -88,7 +88,7 @@ make_rootfs() {
|
|||||||
msg "Prepare [Base installation] (rootfs)"
|
msg "Prepare [Base installation] (rootfs)"
|
||||||
local rootfs="${work_dir}/rootfs"
|
local rootfs="${work_dir}/rootfs"
|
||||||
|
|
||||||
load_pkgs "${root_list}"
|
load_pkgs "rootfs"
|
||||||
|
|
||||||
prepare_dir "${rootfs}"
|
prepare_dir "${rootfs}"
|
||||||
|
|
||||||
@@ -100,7 +100,9 @@ make_rootfs() {
|
|||||||
|
|
||||||
copy_overlay "${root_overlay}" "${rootfs}"
|
copy_overlay "${root_overlay}" "${rootfs}"
|
||||||
|
|
||||||
[[ -z ${live_list} ]] && configure_chroot "${rootfs}"
|
if ! "${HAS_LIVE}"; then
|
||||||
|
configure_chroot "${rootfs}"
|
||||||
|
fi
|
||||||
|
|
||||||
clean_up_chroot "${rootfs}"
|
clean_up_chroot "${rootfs}"
|
||||||
|
|
||||||
@@ -115,7 +117,7 @@ make_livefs() {
|
|||||||
msg "Prepare [Live installation] (livefs)"
|
msg "Prepare [Live installation] (livefs)"
|
||||||
local livefs="${work_dir}/livefs"
|
local livefs="${work_dir}/livefs"
|
||||||
|
|
||||||
load_pkgs "${live_list}"
|
load_pkgs "livefs"
|
||||||
|
|
||||||
prepare_dir "${livefs}"
|
prepare_dir "${livefs}"
|
||||||
|
|
||||||
@@ -141,7 +143,7 @@ make_bootfs() {
|
|||||||
if [[ ! -e ${work_dir}/bootfs.lock ]]; then
|
if [[ ! -e ${work_dir}/bootfs.lock ]]; then
|
||||||
msg "Prepare [/iso/boot]"
|
msg "Prepare [/iso/boot]"
|
||||||
|
|
||||||
load_pkgs "${common_dir}/Packages-boot"
|
load_pkgs "bootfs"
|
||||||
|
|
||||||
prepare_dir "${iso_root}/boot"
|
prepare_dir "${iso_root}/boot"
|
||||||
|
|
||||||
@@ -171,7 +173,9 @@ make_grub(){
|
|||||||
msg "Prepare [/iso/boot/grub]"
|
msg "Prepare [/iso/boot/grub]"
|
||||||
|
|
||||||
local layer=${work_dir}/rootfs
|
local layer=${work_dir}/rootfs
|
||||||
[[ -n ${live_list} ]] && layer=${work_dir}/livefs
|
if "${HAS_LIVE}"; then
|
||||||
|
layer=${work_dir}/livefs
|
||||||
|
fi
|
||||||
|
|
||||||
prepare_grub "${work_dir}/rootfs" "$layer"
|
prepare_grub "${work_dir}/rootfs" "$layer"
|
||||||
|
|
||||||
@@ -280,7 +284,7 @@ mk_boot(){
|
|||||||
|
|
||||||
mk_chroots(){
|
mk_chroots(){
|
||||||
run_safe "make_rootfs"
|
run_safe "make_rootfs"
|
||||||
if [[ -n ${live_list} ]]; then
|
if "${HAS_LIVE}"; then
|
||||||
run_safe "make_livefs"
|
run_safe "make_livefs"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,13 +21,22 @@ configure_calamares(){
|
|||||||
msg2 "Configuring: Calamares %s" "$config"
|
msg2 "Configuring: Calamares %s" "$config"
|
||||||
|
|
||||||
if [[ -f "$mods"/services-artix.conf ]]; then
|
if [[ -f "$mods"/services-artix.conf ]]; then
|
||||||
local svc
|
local svc usvc
|
||||||
svc=$(yaml_array "${SERVICES[@]}") \
|
svc=$(yaml_array "${SERVICES[@]}") \
|
||||||
yq -P 'with(.;
|
yq -P 'with(.;
|
||||||
.command = "artix-service" |
|
.command = "artix-service" |
|
||||||
.services = env(svc) )' \
|
.services = env(svc) )' \
|
||||||
-i "$mods"/services-artix.conf
|
-i "$mods"/services-artix.conf
|
||||||
fi
|
fi
|
||||||
|
if [[ -f "$mods"/postcfg.conf ]]; then
|
||||||
|
local usvc initsys
|
||||||
|
initsys="${INITSYS}" \
|
||||||
|
usvc=$(yaml_array "${USER_SERVICES[@]}") \
|
||||||
|
yq -P 'with(.;
|
||||||
|
.initsys = env(initsys) |
|
||||||
|
.user-services = env(usvc) )' \
|
||||||
|
-i "$mods"/postcfg.conf
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if [[ -d "$1"/etc/calamares-offline ]]; then
|
if [[ -d "$1"/etc/calamares-offline ]]; then
|
||||||
|
|||||||
@@ -4,9 +4,21 @@
|
|||||||
|
|
||||||
#{{{ session
|
#{{{ session
|
||||||
|
|
||||||
|
configure_user(){
|
||||||
|
local -r grps="users,lp,video,network,storage,wheel,audio,power,log,optical,network,scanner"
|
||||||
|
|
||||||
|
chroot "$1" useradd -m -G "$grps" -s /bin/bash "${LIVEUSER}"
|
||||||
|
echo "${LIVEUSER}:${PASSWORD}" | chroot "$1" chpasswd
|
||||||
|
echo "root:${PASSWORD}" | chroot "$1" chpasswd
|
||||||
|
}
|
||||||
|
|
||||||
configure_services(){
|
configure_services(){
|
||||||
local mnt="$1"
|
local mnt="$1"
|
||||||
add_svc_"${INITSYS}" "$mnt" "${SERVICES[*]}"
|
add_svc_"${INITSYS}" "$mnt"
|
||||||
|
|
||||||
|
if [[ "${INITSYS}" == "openrc" ]] || [[ "${INITSYS}" == "dinit" ]]; then
|
||||||
|
add_user_svc_"${INITSYS}" "$mnt"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -14,13 +26,14 @@ write_live_session_conf(){
|
|||||||
local conf=''
|
local conf=''
|
||||||
conf+=$(printf '%s\n' '# live session configuration')
|
conf+=$(printf '%s\n' '# live session configuration')
|
||||||
conf+=$(printf "\nAUTOLOGIN=%s\n" "${AUTOLOGIN}")
|
conf+=$(printf "\nAUTOLOGIN=%s\n" "${AUTOLOGIN}")
|
||||||
conf+=$(printf "\nPASSWORD=%s\n" "${PASSWORD}")
|
conf+=$(printf "\nLIVEUSER=%s\n" "${LIVEUSER}")
|
||||||
printf '%s' "$conf"
|
printf '%s' "$conf"
|
||||||
}
|
}
|
||||||
|
|
||||||
configure_chroot(){
|
configure_chroot(){
|
||||||
local fs="$1"
|
local fs="$1"
|
||||||
msg "Configuring [%s]" "${fs##*/}"
|
msg "Configuring [%s]" "${fs##*/}"
|
||||||
|
configure_user "$fs"
|
||||||
configure_services "$fs"
|
configure_services "$fs"
|
||||||
configure_calamares "$fs"
|
configure_calamares "$fs"
|
||||||
[[ ! -d "$fs/etc/artools" ]] && mkdir -p "$fs/etc/artools"
|
[[ ! -d "$fs/etc/artools" ]] && mkdir -p "$fs/etc/artools"
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
show_profile(){
|
show_profile(){
|
||||||
msg2 "iso_file: %s" "${iso_file}"
|
msg2 "iso_file: %s" "${iso_file}"
|
||||||
msg2 "AUTOLOGIN: %s" "${AUTOLOGIN}"
|
msg2 "AUTOLOGIN: %s" "${AUTOLOGIN}"
|
||||||
|
msg2 "LIVEUSER: %s" "${LIVEUSER}"
|
||||||
msg2 "PASSWORD: %s" "${PASSWORD}"
|
msg2 "PASSWORD: %s" "${PASSWORD}"
|
||||||
msg2 "SERVICES: %s" "${SERVICES[*]}"
|
msg2 "SERVICES: %s" "${SERVICES[*]}"
|
||||||
}
|
}
|
||||||
@@ -15,79 +16,121 @@ load_profile(){
|
|||||||
local profile_dir="${DATADIR}/iso-profiles"
|
local profile_dir="${DATADIR}/iso-profiles"
|
||||||
[[ -d "${WORKSPACE_DIR}"/iso-profiles ]] && profile_dir="${WORKSPACE_DIR}"/iso-profiles
|
[[ -d "${WORKSPACE_DIR}"/iso-profiles ]] && profile_dir="${WORKSPACE_DIR}"/iso-profiles
|
||||||
|
|
||||||
root_list="$profile_dir/${profile}/Packages-Root"
|
|
||||||
root_overlay="$profile_dir/${profile}/root-overlay"
|
root_overlay="$profile_dir/${profile}/root-overlay"
|
||||||
|
|
||||||
[[ -f "$profile_dir/${profile}/Packages-Live" ]] && live_list="$profile_dir/${profile}/Packages-Live"
|
|
||||||
[[ -d "$profile_dir/${profile}/live-overlay" ]] && live_overlay="$profile_dir/${profile}/live-overlay"
|
[[ -d "$profile_dir/${profile}/live-overlay" ]] && live_overlay="$profile_dir/${profile}/live-overlay"
|
||||||
|
|
||||||
common_dir="${DATADIR}/iso-profiles/common"
|
common_dir="${DATADIR}/iso-profiles/common"
|
||||||
[[ -d "$profile_dir"/common ]] && common_dir="${profile_dir}"/common
|
[[ -d "$profile_dir"/common ]] && common_dir="${profile_dir}"/common
|
||||||
|
|
||||||
[[ -f $profile_dir/${profile}/profile.conf ]] || return 1
|
profile_yaml=$profile_dir/${profile}/profile.yaml
|
||||||
|
|
||||||
# shellcheck source=contrib/iso/profile.conf.example
|
common_yaml="${common_dir}/common.yaml"
|
||||||
[[ -r "$profile_dir/${profile}"/profile.conf ]] && . "$profile_dir/${profile}"/profile.conf
|
|
||||||
|
|
||||||
AUTOLOGIN=${AUTOLOGIN:-true}
|
[[ -f $profile_yaml ]] || return 1
|
||||||
|
|
||||||
PASSWORD=${PASSWORD:-'artix'}
|
LIVEUSER=$(yq -P '.live-session.user' "$profile_yaml")
|
||||||
|
|
||||||
if [[ -z "${SERVICES[*]}" ]];then
|
PASSWORD=$(yq -P '.live-session.password' "$profile_yaml")
|
||||||
SERVICES=('acpid' 'bluetoothd' 'cronie' 'cupsd' 'syslog-ng' 'connmand')
|
|
||||||
fi
|
AUTOLOGIN=$(yq -P '.live-session.autologin' "$profile_yaml")
|
||||||
|
|
||||||
|
USE_XLIBRE=$(yq -P '.live-session.use-xlibre' "$profile_yaml")
|
||||||
|
|
||||||
|
mapfile -t SERVICES < <(yq -P '.live-session.services[]' "$profile_yaml")
|
||||||
|
|
||||||
|
mapfile -t USER_SERVICES < <(yq -P '.live-session.user-services[]' "$profile_yaml")
|
||||||
|
|
||||||
|
HAS_LIVE=$(yq -P '. | has("livefs")' "$profile_yaml")
|
||||||
|
|
||||||
|
HAS_LIVE_INIT=$(yq -P '.livefs | has("packages-init")' "$profile_yaml")
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
read_from_list() {
|
|
||||||
local list="$1"
|
|
||||||
local _space="s| ||g"
|
|
||||||
#local _clean=':a;N;$!ba;s/\n/ /g'
|
|
||||||
local _clean='/^$/d'
|
|
||||||
local _com_rm="s|#.*||g"
|
|
||||||
local _init="s|@initsys@|${INITSYS}|g"
|
|
||||||
|
|
||||||
mapfile -t pkgs < <(sed "$_com_rm" "$list" \
|
|
||||||
| sed "$_space" \
|
|
||||||
| sed "$_init" \
|
|
||||||
| sed "$_clean" | sort -u)
|
|
||||||
}
|
|
||||||
|
|
||||||
load_pkgs(){
|
load_pkgs(){
|
||||||
local pkglist="$1"
|
local list="$1"
|
||||||
|
|
||||||
|
local common_base
|
||||||
|
local common_apps
|
||||||
|
local common_misc
|
||||||
|
local common_xorg
|
||||||
|
local common_boot
|
||||||
|
local common_init
|
||||||
|
local packages_root
|
||||||
|
local packages_live
|
||||||
|
local packages_root_init
|
||||||
|
local packages_live_init
|
||||||
|
|
||||||
|
local common_key_init=".packages-init.${INITSYS}[]"
|
||||||
|
local root_key_init=".rootfs.packages-init.${INITSYS}[]"
|
||||||
|
local live_key_init=".livefs.packages-init.${INITSYS}[]"
|
||||||
|
|
||||||
packages=()
|
packages=()
|
||||||
|
|
||||||
if [[ "${pkglist##*/}" == "Packages-Root" ]]; then
|
case "$list" in
|
||||||
for l in base apps "${INITSYS}"; do
|
rootfs)
|
||||||
msg2 "Loading Packages: [%s] ..." "Packages-${l}"
|
msg2 "Loading Packages: [%s] ..." "common.packages-base"
|
||||||
read_from_list "${common_dir}/Packages-${l}"
|
mapfile -t common_base < <(yq -P '.packages-base[]' "$common_yaml")
|
||||||
packages+=("${pkgs[@]}")
|
|
||||||
|
|
||||||
done
|
msg2 "Loading Packages: [%s] ..." "common.packages-init.${INITSYS}"
|
||||||
|
mapfile -t common_init < <(common_key_init="$common_key_init" yq -P 'eval(strenv(common_key_init))' "$common_yaml")
|
||||||
|
|
||||||
if [[ -n "${live_list}" ]]; then
|
msg2 "Loading Packages: [%s] ..." "common.packages-apps"
|
||||||
msg2 "Loading Packages: [Packages-xorg] ..."
|
mapfile -t common_apps < <(yq -P '.packages-apps[]' "$common_yaml")
|
||||||
read_from_list "${common_dir}/Packages-xorg"
|
|
||||||
packages+=("${pkgs[@]}")
|
|
||||||
fi
|
|
||||||
|
|
||||||
for svc in "${SERVICES[@]}"; do
|
if "${HAS_LIVE}"; then
|
||||||
case "$svc" in
|
if ${USE_XLIBRE}; then
|
||||||
sddm|gdm|lightdm|mdm|greetd|lxdm|xdm)
|
msg2 "Loading Packages: [%s] ..." "common.packages-xlibre"
|
||||||
packages+=("$svc-${INITSYS}"); display_manager="$svc" ;;
|
mapfile -t common_xorg < <(yq -P '.packages-xlibre[]' "$common_yaml")
|
||||||
NetworkManager) packages+=("networkmanager-${INITSYS}") ;;
|
else
|
||||||
connmand) packages+=("connman-${INITSYS}") ;;
|
msg2 "Loading Packages: [%s] ..." "common.packages-xorg"
|
||||||
cupsd) packages+=("cups-${INITSYS}") ;;
|
mapfile -t common_xorg < <(yq -P '.packages-xorg[]' "$common_yaml")
|
||||||
bluetoothd) packages+=("bluez-${INITSYS}") ;;
|
fi
|
||||||
syslog-ng|metalog) packages+=("$svc-${INITSYS}") ;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
fi
|
msg2 "Loading Packages: [%s] ..." "common.packages-misc"
|
||||||
msg2 "Loading Packages: [%s] ..." "${pkglist##*/}"
|
mapfile -t common_misc < <(yq -P '.packages-misc[]' "$common_yaml")
|
||||||
read_from_list "${pkglist}"
|
fi
|
||||||
packages+=("${pkgs[@]}")
|
|
||||||
|
msg2 "Loading Packages: [%s] ..." "rootfs.packages"
|
||||||
|
mapfile -t packages_root < <(yq -P '.rootfs.packages[]' "$profile_yaml")
|
||||||
|
|
||||||
|
msg2 "Loading Packages: [%s] ..." "rootfs.packages-init.${INITSYS}"
|
||||||
|
mapfile -t packages_root_init < <(root_key_init="$root_key_init" yq -P 'eval(strenv(root_key_init))' "$profile_yaml")
|
||||||
|
|
||||||
|
packages+=(
|
||||||
|
"${common_base[@]}"
|
||||||
|
"${common_init[@]}"
|
||||||
|
"${common_apps[@]}"
|
||||||
|
"${packages_root[@]}"
|
||||||
|
"${packages_root_init[@]}"
|
||||||
|
"${common_xorg[@]}"
|
||||||
|
"${common_misc[@]}"
|
||||||
|
)
|
||||||
|
;;
|
||||||
|
livefs)
|
||||||
|
msg2 "Loading Packages: [%s] ..." "livefs.packages"
|
||||||
|
mapfile -t packages_live < <(yq -P '.livefs.packages[]' "$profile_yaml")
|
||||||
|
|
||||||
|
if "${HAS_LIVE_INIT}"; then
|
||||||
|
msg2 "Loading Packages: [%s] ..." "livefs.packages-init.${INITSYS}"
|
||||||
|
mapfile -t packages_live_init < <(live_key_init="$live_key_init" yq -P 'eval(strenv(live_key_init))' "$profile_yaml")
|
||||||
|
fi
|
||||||
|
|
||||||
|
packages+=(
|
||||||
|
"${packages_live[@]}"
|
||||||
|
"${packages_live_init[@]}"
|
||||||
|
)
|
||||||
|
;;
|
||||||
|
bootfs)
|
||||||
|
msg2 "Loading Packages: [%s] ..." "common.packages-boot"
|
||||||
|
mapfile -t common_boot < <(yq -P '.packages-boot[]' "$common_yaml")
|
||||||
|
|
||||||
|
packages+=(
|
||||||
|
"${common_boot[@]}"
|
||||||
|
)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
#}}}
|
#}}}
|
||||||
|
|||||||
@@ -5,35 +5,68 @@
|
|||||||
#{{{ services
|
#{{{ services
|
||||||
|
|
||||||
add_svc_openrc(){
|
add_svc_openrc(){
|
||||||
local mnt="$1" names="$2" rlvl="${3:-default}"
|
local mnt="$1" rlvl="${2:-default}"
|
||||||
for svc in $names; do
|
for svc in "${SERVICES[@]}"; do
|
||||||
if [[ -f $mnt/etc/init.d/$svc ]];then
|
if [[ -f $mnt/etc/init.d/$svc ]];then
|
||||||
msg2 "Setting %s: [%s]" "${INITSYS}" "$svc"
|
msg2 "Setting %s: [%s]" "${INITSYS}" "$svc"
|
||||||
chroot "$mnt" rc-update add "$svc" "$rlvl" &>/dev/null
|
chroot "$mnt" rc-update add "$svc" "$rlvl" &>/dev/null
|
||||||
|
else
|
||||||
|
warning "Service %s not found. Skipping." "$svc"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
add_user_svc_openrc(){
|
||||||
|
local mnt="$1" rlvl="${2:-default}"
|
||||||
|
for svc in "${USER_SERVICES[@]}"; do
|
||||||
|
if [[ -f "$mnt"/etc/user/init.d/"$svc" ]];then
|
||||||
|
msg2 "Setting user %s: [%s]" "${INITSYS}" "$svc"
|
||||||
|
local rc=".config/rc/runlevels/default"
|
||||||
|
chroot "$mnt" mkdir -p /home/"${LIVEUSER}/$rc"
|
||||||
|
chroot "$mnt" ln -s /etc/user/init.d/"$svc" /home/"${LIVEUSER}/$rc/$svc"
|
||||||
|
chroot "$mnt" chown -R "${LIVEUSER}:${LIVEUSER}" /home/"${LIVEUSER}"/.config/rc
|
||||||
|
else
|
||||||
|
warning "Service %s not found. Skipping." "$svc"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
add_svc_runit(){
|
add_svc_runit(){
|
||||||
local mnt="$1" names="$2" rlvl="${3:-default}"
|
local mnt="$1" rlvl="${2:-default}"
|
||||||
for svc in $names; do
|
for svc in "${SERVICES[@]}"; do
|
||||||
if [[ -d $mnt/etc/runit/sv/$svc ]]; then
|
if [[ -d $mnt/etc/runit/sv/$svc ]]; then
|
||||||
msg2 "Setting %s: [%s]" "${INITSYS}" "$svc"
|
msg2 "Setting %s: [%s]" "${INITSYS}" "$svc"
|
||||||
chroot "$mnt" ln -s /etc/runit/sv/"$svc" /etc/runit/runsvdir/"$rlvl" &>/dev/null
|
chroot "$mnt" ln -s /etc/runit/sv/"$svc" /etc/runit/runsvdir/"$rlvl" &>/dev/null
|
||||||
|
else
|
||||||
|
warning "Service %s not found. Skipping." "$svc"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
add_svc_s6(){
|
add_svc_s6(){
|
||||||
local mnt="$1" names="$2" rlvl="${3:-default}" dep
|
local mnt="$1" rlvl="${2:-default}" dep
|
||||||
|
local display_manager
|
||||||
|
local supported_dms=(sddm gdm lightdm mdm greetd lxdm xdm)
|
||||||
|
|
||||||
|
for dm in "${supported_dms[@]}"; do
|
||||||
|
if in_array "$dm" "${SERVICES[@]}"; then
|
||||||
|
display_manager="$dm"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
dep="$mnt"/etc/s6/sv/"$display_manager"-srv/dependencies.d
|
dep="$mnt"/etc/s6/sv/"$display_manager"-srv/dependencies.d
|
||||||
for svc in $names; do
|
|
||||||
|
for svc in "${SERVICES[@]}"; do
|
||||||
msg2 "Setting %s: [%s]" "${INITSYS}" "$svc"
|
msg2 "Setting %s: [%s]" "${INITSYS}" "$svc"
|
||||||
chroot "$mnt" s6-service add "$rlvl" "$svc"
|
if [[ -d "$mnt"/etc/s6/sv/"$svc" ]] || [[ -d "$mnt"/etc/s6/sv/"$svc"-srv ]]; then
|
||||||
if [[ "$svc" == "$display_manager" ]]; then
|
chroot "$mnt" s6-service add "$rlvl" "$svc"
|
||||||
if [[ -d "$dep" ]]; then
|
if [[ "$svc" == "$display_manager" ]]; then
|
||||||
touch "$dep"/artix-live
|
if [[ -d "$dep" ]]; then
|
||||||
|
touch "$dep"/artix-live
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
warning "Service %s not found. Skipping." "$svc"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -47,22 +80,29 @@ add_svc_s6(){
|
|||||||
chroot "$mnt" cp -a "$src"/bin /usr
|
chroot "$mnt" cp -a "$src"/bin /usr
|
||||||
}
|
}
|
||||||
|
|
||||||
add_svc_suite66(){
|
add_svc_dinit(){
|
||||||
local mnt="$1" names="$2"
|
local mnt="$1"
|
||||||
for svc in $names; do
|
for svc in "${SERVICES[@]}"; do
|
||||||
if [[ -f "$mnt"/etc/66/service/"$svc" ]]; then
|
if [[ -f "$mnt"/etc/dinit.d/"$svc" ]]; then
|
||||||
msg2 "Setting %s: [%s]" "${INITSYS}" "$svc"
|
msg2 "Setting %s: [%s]" "${INITSYS}" "$svc"
|
||||||
chroot "$mnt" 66-enable -t default "$svc" &>/dev/null
|
chroot "$mnt" dinitctl enable -o "$svc" &>/dev/null
|
||||||
|
else
|
||||||
|
warning "Service %s not found. Skipping." "$svc"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
add_svc_dinit(){
|
add_user_svc_dinit(){
|
||||||
local mnt="$1" names="$2"
|
local mnt="$1"
|
||||||
for svc in $names; do
|
for svc in "${USER_SERVICES[@]}"; do
|
||||||
if [[ -d $mnt/etc/dinit.d/boot.d ]]; then
|
if [[ -f "$mnt"/etc/dinit.d/user/"$svc" ]]; then
|
||||||
msg2 "Setting %s: [%s]" "${INITSYS}" "$svc"
|
msg2 "Setting user %s: [%s]" "${INITSYS}" "$svc"
|
||||||
chroot "$mnt" ln -s ../"$svc" /etc/dinit.d/boot.d/"$svc" &>/dev/null
|
local usr_sv="/home/${LIVEUSER}/.config/dinit.d"
|
||||||
|
chroot "$mnt" mkdir -p "$usr_sv"/boot.d
|
||||||
|
chroot "$mnt" ln -s /etc/dinit.d/user/"$svc" "$usr_sv"/boot.d/"$svc"
|
||||||
|
chroot "$mnt" chown -R "${LIVEUSER}:${LIVEUSER}" "$usr_sv"
|
||||||
|
else
|
||||||
|
warning "Service %s not found. Skipping." "$svc"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,8 +61,6 @@ patch_pkgbase(){
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
git --no-pager diff PKGBUILD
|
|
||||||
}
|
}
|
||||||
|
|
||||||
artixpkg_repo_import_usage() {
|
artixpkg_repo_import_usage() {
|
||||||
@@ -199,6 +197,7 @@ artixpkg_repo_import() {
|
|||||||
msg2 "Patching ${pkgbase} ..."
|
msg2 "Patching ${pkgbase} ..."
|
||||||
patch_pkgbase "${pkgbase}"
|
patch_pkgbase "${pkgbase}"
|
||||||
fi
|
fi
|
||||||
|
git --no-pager diff PKGBUILD
|
||||||
fi
|
fi
|
||||||
)
|
)
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user