diff options
author | Unit 193 <unit193@ubuntu.com> | 2019-07-03 05:08:20 -0400 |
---|---|---|
committer | Unit 193 <unit193@ubuntu.com> | 2019-07-03 05:08:20 -0400 |
commit | 0d2edecb2be14c0ed92a33c7508358d648cd3d2f (patch) | |
tree | 0d4a3d9906a7c6996d63d1eceb2df145e2a633c0 | |
parent | cc216920a0867905b9110ef51bf29e576364b175 (diff) | |
download | arch-install-scripts-0d2edecb2be14c0ed92a33c7508358d648cd3d2f.tar.bz2 arch-install-scripts-0d2edecb2be14c0ed92a33c7508358d648cd3d2f.tar.xz arch-install-scripts-0d2edecb2be14c0ed92a33c7508358d648cd3d2f.tar.zst |
New upstream version 22upstream/22
-rw-r--r-- | Makefile | 23 | ||||
-rw-r--r-- | completion/_archinstallscripts.zsh (renamed from zsh-completion) | 1 | ||||
-rw-r--r-- | completion/arch-chroot.bash | 27 | ||||
-rw-r--r-- | completion/genfstab.bash | 31 | ||||
-rw-r--r-- | completion/pacstrap.bash | 38 | ||||
-rw-r--r-- | doc/arch-chroot.8.asciidoc | 46 | ||||
-rw-r--r-- | doc/asciidoc.conf | 37 | ||||
-rw-r--r-- | doc/footer.asciidoc | 18 | ||||
-rw-r--r-- | doc/genfstab.8.asciidoc | 50 | ||||
-rw-r--r-- | doc/pacstrap.8.asciidoc | 47 | ||||
-rw-r--r-- | genfstab.in | 4 | ||||
-rw-r--r-- | pacstrap.in | 14 |
12 files changed, 322 insertions, 14 deletions
@@ -1,4 +1,4 @@ -VER=21 +VER=22 PREFIX = /usr/local @@ -7,9 +7,15 @@ BINPROGS = \ genfstab \ pacstrap +MANS = \ + doc/arch-chroot.8 \ + doc/genfstab.8 \ + doc/pacstrap.8 + BASH = bash -all: $(BINPROGS) +all: $(BINPROGS) man +man: $(MANS) V_GEN = $(_v_GEN_$(V)) _v_GEN_ = $(_v_GEN_0) @@ -20,8 +26,11 @@ edit = $(V_GEN) m4 -P $@.in >$@ && chmod go-w,+x $@ %: %.in common $(edit) +doc/%: doc/%.asciidoc doc/asciidoc.conf doc/footer.asciidoc + $(V_GEN) a2x --no-xmllint --asciidoc-opts="-f doc/asciidoc.conf" -d manpage -f manpage -D doc $< + clean: - $(RM) $(BINPROGS) + $(RM) $(BINPROGS) $(MANS) check: all @for f in $(BINPROGS); do bash -O extglob -n $$f; done @@ -30,6 +39,12 @@ check: all install: all install -dm755 $(DESTDIR)$(PREFIX)/bin install -m755 $(BINPROGS) $(DESTDIR)$(PREFIX)/bin - install -Dm644 zsh-completion $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_archinstallscripts + install -Dm644 completion/_archinstallscripts.zsh $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_archinstallscripts + cd completion; for comp in *.bash; do \ + install -Dm644 $$comp $(DESTDIR)$(PREFIX)/share/bash-completion/completions/$${comp%%.*}; \ + done; + for manfile in $(MANS); do \ + install -Dm644 $$manfile -t $(DESTDIR)$(PREFIX)/share/man/man$${manfile##*.}; \ + done; .PHONY: all clean install uninstall diff --git a/zsh-completion b/completion/_archinstallscripts.zsh index bc4e4d3..d2c8c7b 100644 --- a/zsh-completion +++ b/completion/_archinstallscripts.zsh @@ -6,7 +6,6 @@ _pacstrap_args=( _pacstrap_args_nonh=( '(-h --help)-c[Use the package cache on the host, rather than the target]' - '(-h --help)-d[Allow installation to a non-mountpoint directory]' '(--help -h)-i[Avoid auto-confirmation of package selections]' ) diff --git a/completion/arch-chroot.bash b/completion/arch-chroot.bash new file mode 100644 index 0000000..37fbf7c --- /dev/null +++ b/completion/arch-chroot.bash @@ -0,0 +1,27 @@ +_arch_chroot() { + compopt +o dirnames + local cur prev opts + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + opts="-u -h" + + for i in "${COMP_WORDS[@]:1:COMP_CWORD-1}"; do + if [[ -d ${i} ]]; then + return 0 + fi + done + + if [[ ${prev} = -u ]]; then + _usergroup -u + return 0 + fi + + if [[ ${cur} = -* ]]; then + COMPREPLY=($(compgen -W "${opts}" -- "${cur}")) + return 0 + fi + compopt -o dirnames +} + +complete -F _arch_chroot arch-chroot diff --git a/completion/genfstab.bash b/completion/genfstab.bash new file mode 100644 index 0000000..69506d9 --- /dev/null +++ b/completion/genfstab.bash @@ -0,0 +1,31 @@ +_genfstab() { + compopt -o dirnames + local cur prev words cword + _init_completion || return + + local opts="-f -L -p -P -t -U -h" + + case ${prev} in + -f) + return 0 + ;; + -t) + COMPREPLY=($(compgen -W "LABEL UUID PARTLABEL PARTUUID" -- "${cur}")) + return 0 + ;; + esac + + if [[ ${cur} = -* ]]; then + COMPREPLY=($(compgen -W "${opts}" -- "${cur}")) + return 0 + fi + + for i in "${COMP_WORDS[@]:1:COMP_CWORD-1}"; do + if [[ -d ${i} ]]; then + compopt +o dirnames + return 0 + fi + done +} + +complete -F _genfstab genfstab diff --git a/completion/pacstrap.bash b/completion/pacstrap.bash new file mode 100644 index 0000000..fb948f0 --- /dev/null +++ b/completion/pacstrap.bash @@ -0,0 +1,38 @@ +if ! declare -F _pacman_pkg > /dev/null; then + _completion_loader pacman +fi + +_pacstrap() { + compopt +o dirnames +o default + local cur prev opts + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + opts="-C -c -G -i -M -h" + + for i in "${COMP_WORDS[@]:1:COMP_CWORD-1}"; do + if [[ -d ${i} ]]; then + _pacman_pkg Slq + return 0 + fi + done + + case ${prev} in + -h) + return 0 + ;; + -C) + compopt -o default + return 0 + ;; + esac + + if [[ ${cur} = -* ]]; then + COMPREPLY=($(compgen -W "${opts}" -- "${cur}")) + return 0 + fi + + compopt -o dirnames +} + +complete -F _pacstrap pacstrap diff --git a/doc/arch-chroot.8.asciidoc b/doc/arch-chroot.8.asciidoc new file mode 100644 index 0000000..ada7d40 --- /dev/null +++ b/doc/arch-chroot.8.asciidoc @@ -0,0 +1,46 @@ +arch-chroot(8) +============== + +Name +---- +arch-chroot - enhanced chroot command + +Synopsis +-------- +arch-chroot [options] chroot-dir [command] + +Description +----------- +arch-chroot wraps the linkman:chroot[1] command while ensuring that important +functionality is available, e.g. mounting '/dev/', '/proc' and other API +filesystems, or exposing linkman:resolv.conf[5] to the chroot. + +If 'command' is unspecified, arch-chroot will launch */bin/bash*. + +[NOTE] +====== +The target chroot-dir *should* be a mountpoint. This ensures that tools such as +linkman:pacman[8] or linkman:findmnt[8] have an accurate hierarchy of the +mounted filesystems within the chroot. If your chroot target is not a +mountpoint, you can bind mount the directory on itself to make it a mountpoint, +i.e.: + +'mount --bind /your/chroot /your/chroot' +====== + + +Options +------- + +*-u <user>[:group]*:: + Specify non-root user and optional group to use. + +*-h*:: + Output syntax and command line options. + +See Also +-------- + +linkman:pacman[1] + +include::footer.asciidoc[] diff --git a/doc/asciidoc.conf b/doc/asciidoc.conf new file mode 100644 index 0000000..c675a20 --- /dev/null +++ b/doc/asciidoc.conf @@ -0,0 +1,37 @@ +## linkman: macro +# Inspired by/borrowed from the GIT source tree at Documentation/asciidoc.conf +# +# Usage: linkman:command[manpage-section] +# +# Note, {0} is the manpage section, while {target} is the command. +# +# Show man link as: <command>(<section>); if section is defined, else just show +# the command. + +[macros] +(?su)[\\]?(?P<name>linkman):(?P<target>\S*?)\[(?P<attrlist>.*?)\]= + +[attributes] +asterisk=* +plus=+ +caret=^ +startsb=[ +endsb=] +backslash=\ +tilde=~ +apostrophe=' +backtick=` +litdd=-- + +ifdef::backend-docbook[] +[linkman-inlinemacro] +{0%{target}} +{0#<citerefentry>} +{0#<refentrytitle>{target}</refentrytitle><manvolnum>{0}</manvolnum>} +{0#</citerefentry>} +endif::backend-docbook[] + +ifdef::backend-xhtml11[] +[linkman-inlinemacro] +<a href="{target}.{0}.html">{target}{0?({0})}</a> +endif::backend-xhtml11[] diff --git a/doc/footer.asciidoc b/doc/footer.asciidoc new file mode 100644 index 0000000..4445b0c --- /dev/null +++ b/doc/footer.asciidoc @@ -0,0 +1,18 @@ + +Bugs +---- +Bugs can be reported on the bug tracker 'https://bugs.archlinux.org' in the Arch +Linux category and title prefixed with [arch-install-scripts] or via +mailto:arch-projects@archlinux.org[]. + + +Authors +------- + +Maintainers: + +* Dave Reisner <dreisner@archlinux.org> +* Eli Schwartz <eschwartz@archlinux.org> + +For additional contributors, use `git shortlog -s` on the arch-install-scripts.git +repository. diff --git a/doc/genfstab.8.asciidoc b/doc/genfstab.8.asciidoc new file mode 100644 index 0000000..73faa4e --- /dev/null +++ b/doc/genfstab.8.asciidoc @@ -0,0 +1,50 @@ +genfstab(8) +=========== + +Name +---- +genfstab - generate output suitable for addition to an fstab file + +Synopsis +-------- +genfstab [options] root + +Description +----------- +genfstab helps fill in an fstab file by autodetecting all the current mounts +below a given mountpoint and printing them in fstab-compatible format to +standard output. It can be used to persist a manually mounted filesystem +hierarchy and is often used during the initial install and configuration of an +OS. + +Options +------- + +*-f* <filter>:: + Restrict output to mountpoints matching the prefix 'filter'. + +*-L*:: + Use labels for source identifiers (shortcut for '-t LABEL'). + +*-p*:: + Exclude pseudofs mounts (default behavior). + +*-P*:: + Include pseudofs mounts. + +*-t* <tag>:: + Use 'tag' for source identifiers (should be one of: 'LABEL', 'UUID', + 'PARTLABEL', 'PARTUUID'). + +*-U*:: + Use UUIDs for source identifiers (shortcut for '-t UUID'). + +*-h*:: + Output syntax and command line options. + +See Also +-------- + +linkman:pacman[1] + +include::footer.asciidoc[] diff --git a/doc/pacstrap.8.asciidoc b/doc/pacstrap.8.asciidoc new file mode 100644 index 0000000..9f25792 --- /dev/null +++ b/doc/pacstrap.8.asciidoc @@ -0,0 +1,47 @@ +pacstrap(8) +=========== + +Name +---- +pacstrap - install packages to the specified new root directory + +Synopsis +-------- +pacstrap [options] root [packages...] + +Description +----------- +pacstrap is designed to create a new system installation from scratch. The +specified packages will be installed into a given directory after setting up +some basic mountpoints. By default, the host system's pacman signing keys +and mirrorlist will be used to seed the chroot. + +If no packages are specified to be installed, the 'base' group will be installed. + +Options +------- + +*-C* <config>:: + Use an alternate config file for pacman. + +*-c*:: + Use the package cache on the host, rather than the target. + +*-G*:: + Avoid copying the host's pacman keyring to the target. + +*-i*:: + Prompt for package confirmation when needed (run interactively). + +*-M*:: + Avoid copying the host's mirrorlist to the target. + +*-h*:: + Output syntax and command line options. + +See Also +-------- + +linkman:pacman[1] + +include::footer.asciidoc[] diff --git a/genfstab.in b/genfstab.in index 3ff7a14..b8220ea 100644 --- a/genfstab.in +++ b/genfstab.in @@ -79,11 +79,11 @@ usage() { usage: ${0##*/} [options] root Options: - -f FILTER Restrict output to mountpoints matching the prefix FILTER + -f <filter> Restrict output to mountpoints matching the prefix FILTER -L Use labels for source identifiers (shortcut for -t LABEL) -p Exclude pseudofs mounts (default behavior) -P Include pseudofs mounts - -t TAG Use TAG for source identifiers (TAG should be one of: LABEL, + -t <tag> Use TAG for source identifiers (TAG should be one of: LABEL, UUID, PARTLABEL, PARTUUID) -U Use UUIDs for source identifiers (shortcut for -t UUID) diff --git a/pacstrap.in b/pacstrap.in index b0db8ce..231a154 100644 --- a/pacstrap.in +++ b/pacstrap.in @@ -21,7 +21,7 @@ usage() { usage: ${0##*/} [options] root [packages...] Options: - -C config Use an alternate config file for pacman + -C <config> Use an alternate config file for pacman -c Use the package cache on the host, rather than the target -G Avoid copying the host's pacman keyring to the target -i Prompt for package confirmation when needed (run interactively) @@ -92,18 +92,13 @@ fi # create obligatory directories msg 'Creating install root at %s' "$newroot" -mkdir -m 0755 -p "$newroot"/var/{cache/pacman/pkg,lib/pacman,log} "$newroot"/{dev,run,etc} +mkdir -m 0755 -p "$newroot"/var/{cache/pacman/pkg,lib/pacman,log} "$newroot"/{dev,run,etc/pacman.d} mkdir -m 1777 -p "$newroot"/tmp mkdir -m 0555 -p "$newroot"/{sys,proc} # mount API filesystems chroot_setup "$newroot" || die "failed to setup chroot %s" "$newroot" -msg 'Installing packages to %s' "$newroot" -if ! pacman -r "$newroot" -Sy "${pacman_args[@]}"; then - die 'Failed to install packages to new root' -fi - if (( copykeyring )); then # if there's a keyring on the host, copy it into the new root, unless it exists already if [[ -d /etc/pacman.d/gnupg && ! -d $newroot/etc/pacman.d/gnupg ]]; then @@ -111,6 +106,11 @@ if (( copykeyring )); then fi fi +msg 'Installing packages to %s' "$newroot" +if ! pacman -r "$newroot" -Sy "${pacman_args[@]}"; then + die 'Failed to install packages to new root' +fi + if (( copymirrorlist )); then # install the host's mirrorlist onto the new root cp -a /etc/pacman.d/mirrorlist "$newroot/etc/pacman.d/" |