diff options
author | Esteban Carnevale <alfplayer@mailoo.org> | 2013-09-02 20:03:39 -0300 |
---|---|---|
committer | Esteban Carnevale <alfplayer@mailoo.org> | 2013-09-02 20:03:39 -0300 |
commit | 0e1f2cacab2f1f91ae0d5b10a1a97220de59e203 (patch) | |
tree | 77092756230aa3778b7168f6241fc94177ae8548 | |
parent | 44b3b1e9b1f3309d825b2dda897ba0dd13169ace (diff) | |
parent | 073ecf773ecc7e6112d091392063e99511b0139b (diff) |
Merge changes outside configs/ from branch 'master' into baseline
-rw-r--r-- | Makefile | 56 | ||||
-rw-r--r-- | docs/README.altbootmethods | 4 | ||||
-rw-r--r-- | docs/README.transfer | 2 | ||||
-rwxr-xr-x | expand | 181 | ||||
-rwxr-xr-x | parabolaiso/mkparabolaiso | 2 |
5 files changed, 221 insertions, 24 deletions
@@ -1,41 +1,57 @@ -V=11 +V=2013.08.12 -INSTALL_FILES=$(wildcard parabolaiso/initcpio/install/*) -HOOKS_FILES=$(wildcard parabolaiso/initcpio/hooks/*) -SCRIPT_FILES=$(wildcard parabolaiso/initcpio/script/*) +INSTALL_SRC_DIR=parabolaiso/initcpio/install +HOOKS_SRC_DIR=parabolaiso/initcpio/hooks +SCRIPT_SRC_DIR=parabolaiso/initcpio/script INSTALL_DIR=$(DESTDIR)/usr/lib/initcpio/install HOOKS_DIR=$(DESTDIR)/usr/lib/initcpio/hooks SCRIPT_DIR=$(DESTDIR)/usr/lib/initcpio - -DOC_FILES=$(wildcard docs/*) - DOC_DIR=$(DESTDIR)/usr/share/doc/parabolaiso -all: +all: install dist install: install-program install-initcpio install-examples install-doc install-program: - install -D -m 755 parabolaiso/mkparabolaiso $(DESTDIR)/usr/bin/mkparabolaiso + install -D -m 755 parabolaiso/mkparabolaiso "$(DESTDIR)/usr/bin/mkparabolaiso" install-initcpio: - install -d $(SCRIPT_DIR) $(HOOKS_DIR) $(INSTALL_DIR) - install -m 755 -t $(SCRIPT_DIR) $(SCRIPT_FILES) - install -m 644 -t $(HOOKS_DIR) $(HOOKS_FILES) - install -m 644 -t $(INSTALL_DIR) $(INSTALL_FILES) + install -d "$(SCRIPT_DIR)" "$(HOOKS_DIR)" "$(INSTALL_DIR)" + install -m 755 -t "$(SCRIPT_DIR)" $(wildcard $(SCRIPT_SRC_DIR)/*) + install -m 644 -t "$(HOOKS_DIR)" $(wildcard $(HOOKS_SRC_DIR)/*) + install -m 644 -t "$(INSTALL_DIR)" $(wildcard $(INSTALL_SRC_DIR)/*) install-examples: - install -d -m 755 $(DESTDIR)/usr/share/parabolaiso/ - cp -a --no-preserve=ownership configs $(DESTDIR)/usr/share/parabolaiso/ + install -d -m 755 "$(DESTDIR)/usr/share/parabolaiso/" + cp -a --no-preserve=ownership configs "$(DESTDIR)/usr/share/parabolaiso/" install-doc: - install -d $(DOC_DIR) - install -m 644 -t $(DOC_DIR) $(DOC_FILES) + install -d "$(DOC_DIR)" + install -m 644 -t "$(DOC_DIR)" $(wildcard docs/*) + +uninstall: uninstall-program uninstall-initcpio uninstall-examples uninstall-doc + +uninstall-program: + rm "$(DESTDIR)/usr/bin/mkparabolaiso" + +uninstall-initcpio: + $(foreach file,$(wildcard $(SCRIPT_SRC_DIR)/*),rm -r "$(subst $(SCRIPT_SRC_DIR),$(SCRIPT_DIR),$(file))";) + $(foreach file,$(wildcard $(HOOKS_SRC_DIR)/*),rm -r "$(subst $(HOOKS_SRC_DIR),$(HOOKS_DIR),$(file))";) + $(foreach file,$(wildcard $(INSTALL_SRC_DIR)/*),rm -r "$(subst $(INSTALL_SRC_DIR),$(INSTALL_DIR),$(file))";) + +uninstall-examples: + rm -rfd "$(DESTDIR)/usr/share/parabolaiso/configs" + rm -d "$(DESTDIR)/usr/share/parabolaiso" + +uninstall-doc: + rm -rf "$(DOC_DIR)" dist: - git archive --format=tar --prefix=parabolaiso-$(V)/ v$(V) | gzip -9 > parabolaiso-$(V).tar.gz - gpg --detach-sign --use-agent parabolaiso-$(V).tar.gz + ./expand $(V) dist + +dist-branches: + ./expand $(V) dist-branches -.PHONY: install install-program install-initcpio install-examples install-doc dist +.PHONY: install install-program install-initcpio install-examples install-doc dist dist-branches uninstall uninstall-program uninstall-initcpio uninstall-examples uninstall-doc diff --git a/docs/README.altbootmethods b/docs/README.altbootmethods index 77ff917..d9acc89 100644 --- a/docs/README.altbootmethods +++ b/docs/README.altbootmethods @@ -114,12 +114,12 @@ methods can be used to serve the rest of live-medium. * NBD -Note: Adjust PARABOLA_201302 as needed. +Note: Adjust PARA_201302 as needed. # cat << EOF > /tmp/nbd-server.conf [generic] [parabolaiso] readonly = true - exportname = /dev/disk/by-label/PARABOLA_201302 + exportname = /dev/disk/by-label/PARA_201302 EOF # nbd-server -C /tmp/nbd-server.conf diff --git a/docs/README.transfer b/docs/README.transfer index fd916fc..f6879e0 100644 --- a/docs/README.transfer +++ b/docs/README.transfer @@ -56,7 +56,7 @@ Nomeclature: <ISO-SOURCE>: Path to the ISO file parabola-<YYYY>.<MM>.<DD>-dual.iso (example: ~/parabola-2012.07.22-dual.iso) <FS-LABEL>: Represents the filesystem label of the <ISO-SOURCE> - (example: PARABOLA_201302) + (example: PARA_201302) * PC-BIOS (MBR): @@ -0,0 +1,181 @@ +#!/bin/bash + +set -e + +version="$1" + +type="$2" + +### CONFIGURATION OPTIONS + +# Profiles to package in addition to the profile releng for the make target "dist-branches" +branches_dist_branches=(baseline gnome toolkit) + +# Profiles to package in addition to the profile releng for the make target "dist" +branches_dist=(baseline) + +### END OF CONFIGURATION OPTIONS + +error() { + echo "${@}. Stop." >&2 + exit 1 +} + +dist_branches() { + branches="${branches_dist_branches}" + # Refs to package (the branches) + refs="${branches[@]}" + # Ref of the releng profile to package + releng="master" + # Release branch. This branch only has commits to prepare the package. + release_branch="release-branches" + # Release ref. It is a branch for dist_branches. The package is created from this ref. + release="${release_branch}" + # Refs that should exist for the make target dist-branches. This branches will be packaged. + allrefs=( ${releng} ${branches[@]} ) +} + +dist() { + branches="${branches_dist}" + # Refs to package (branch names appending the date, like "baseline/2013.08.12") + refs="${branches_dist[@]/%//${version}}" + # Ref of the releng profile to package + releng="master/${version}" + # Release branch. This branch only has commits to prepare the package. + release_branch="release" + # Release ref. Tag of commit in release_branch. The package is created from this ref. + release="release/${version}" + # These refs should exist to package for the make target dist. + allrefs=( ${releng} ${refs[@]} ) +} + +expand() { + ref="$1" + dir="$2" + + GIT_INDEX_FILE="${index}" git read-tree --empty + GIT_INDEX_FILE="${index}".release git read-tree --empty + + # Find the current head of ${ref} + head="$(git show-ref --hash "refs/${ref_type}/${ref}")" + # Find the current head of the release branch. + head_release="$(git show-ref --hash refs/heads/"${release_branch}")" + if [[ $dir == releng ]] ; then + # Read the tree of "$ref" with profile path rename into an index file. + git ls-tree -z -r "${head}" | sed -z "s|configs/profile|configs/${dir}|" | GIT_INDEX_FILE="${index}" git update-index -z --index-info + # Remove the master branch from the release index, that is, leave everything from configs/ excluding configs/releng + git ls-tree -z -r "${head_release}" | grep -zZP 'configs/(?!releng)' | GIT_INDEX_FILE="${index}".release git update-index -z --index-info + # This combines the two indexes (obtained in the last two commands). + GIT_INDEX_FILE="${index}".release git ls-files -z -s | GIT_INDEX_FILE="${index}" git update-index -z --add --index-info + else + # Read only paths configs/profile of "$ref" with profile path rename into an index file. + git ls-tree -z -r "${head}" -- configs/profile | sed -z "s|configs/profile|configs/${dir}|" | GIT_INDEX_FILE="${index}" git update-index -z --index-info + # Remove configs/${dir} from the release index. + git ls-tree -z -r "${head_release}" | grep -zZv configs/"${dir}" | GIT_INDEX_FILE="${index}".release git update-index -z --index-info + # This combines the two indexes (obtained in the last two commands). + GIT_INDEX_FILE="${index}".release git ls-files -z -s | GIT_INDEX_FILE="${index}" git update-index -z --add --index-info + fi + # Write the index file into the repo as a tree. + tree="$(GIT_INDEX_FILE="${index}" git write-tree)" + # Write a commit to the repo. + commit="$(echo "Update profile ${dir}" | git commit-tree "$tree" -p "${head_release}")" + # Update the head of the repository to be the new commit. + git update-ref refs/heads/"${release_branch}" "$commit" "${head_release}" +} + +expand_empty() { + ref="${releng}" + dir="releng" + + GIT_INDEX_FILE="${index}" git read-tree --empty + + # Find the current head of ${ref} + head="$(git show-ref --hash "refs/${ref_type}/${ref}")" + # Read the tree of "$ref" with profile path rename into an index file. + git ls-tree -z -r "${head}" | sed -z "s|configs/profile|configs/${dir}|" | GIT_INDEX_FILE="${index}" git update-index -z --index-info + # Write the index file into the repo as a tree. + tree="$(GIT_INDEX_FILE="${index}" git write-tree)" + # Write a commit to the repo. + commit="$(echo "Update profile ${dir}" | git commit-tree "$tree")" + # Update the head of the repository to be the new commit. + git update-ref refs/heads/"${release_branch}" "$commit" 0000000000000000000000000000000000000000 +} + +ref_test() { + es=0 + git show-ref --quiet "$1" || es=$? + + if [[ $es == 1 ]] ; then + error "$2" + elif [[ $es > 1 ]] ; then + error "$3" + fi +} + +ref_test_negative() { + es=0 + git show-ref --quiet "$1" || es=$? + + if [[ $es == 0 ]] ; then + error "$2" + elif [[ $es > 1 ]] ; then + error "$3" + fi +} + +release_prepare() { + ref_test_negative "refs/tags/${release}" "Release tag ${release} can not be created because it already exists" "Error testing the release tag" +} + +show_ref() { + for ref in ${allrefs[@]} ; do + ref_test "refs/${ref_type}/${ref}" "Git reference refs/${ref_type}/${ref} should exist" "Error testing git reference refs/${ref_type}/${ref}" + done +} + +archive_ref() { + git archive --format=tar.gz --prefix=parabolaiso-"${version}"/ "refs/${ref_type}/${release}" > parabolaiso-"${version}".tar.gz +} + +archive() { + git tag -s -m "tag ${release}" "${release}" "${release_branch}" + archive_ref + gpg --detach-sign --use-agent parabolaiso-"${version}".tar.gz +} + +dist_expand() { + index="$(mktemp)" + + es=0 + git show-ref --quiet "refs/heads/${release_branch}" || es=$? + + if [[ $es == 0 ]] ; then + expand "${releng}" releng + elif [[ $es == 1 ]] ; then + expand_empty + echo "Release branch created." + elif [[$es > 1 ]] ; then + error "Error testing the release branch" + fi + + for i in ${!branches[@]} ; do + expand ${refs[$i]} ${branches[$i]} + done +} + +if [[ ${type} == dist ]] ; then + ref_type="tags" + dist + release_prepare + show_ref + dist_expand + archive +elif [[ ${type} == dist-branches ]] ; then + ref_type="heads" + dist_branches + show_ref + dist_expand + archive_ref +else + error "Second argument is not correct" +fi diff --git a/parabolaiso/mkparabolaiso b/parabolaiso/mkparabolaiso index 02e5b95..93e6995 100755 --- a/parabolaiso/mkparabolaiso +++ b/parabolaiso/mkparabolaiso @@ -10,7 +10,7 @@ pkg_list="" run_cmd="" quiet="y" pacman_conf="/etc/pacman.conf" -export iso_label="PARABOLA_$(date +%Y%m)" +export iso_label="PARA_$(date +%Y%m)" iso_publisher="Parabola GNU/Linux-libre <https://parabolagnulinux.org>" iso_application="Parabola GNU/Linux-libre Live/Rescue CD" install_dir="parabola" |