diff --git a/Makefile b/Makefile index 9e8d4320b1c1bb3f592110e32b69f377c49876f4..b47efe2b94f79a0c9b6df542f30cb060fd43f386 100644 --- a/Makefile +++ b/Makefile @@ -3,14 +3,33 @@ Version=0.9.15 PREFIX = /usr/local SYSCONFDIR = /etc -BIN = \ +SYSCONF = \ + data/manjaro-tools.conf + +BIN_BASE = \ bin/mkchroot \ bin/basestrap \ bin/manjaro-chroot \ bin/fstabgen \ - bin/buildset \ bin/chroot-run +LIBS_BASE = \ + lib/util.sh \ + lib/util-mount.sh \ + lib/util-msg.sh \ + lib/util-pac-conf.sh \ + lib/util-fstab.sh + +SHARED_BASE = \ + data/pacman-default.conf \ + data/pacman-multilib.conf \ + data/pacman-mirrors-stable.conf \ + data/pacman-mirrors-testing.conf \ + data/pacman-mirrors-unstable.conf + +SETS_PKG = \ + data/pkg.d/default.set + BIN_PKG = \ bin/checkpkg \ bin/lddd \ @@ -22,49 +41,25 @@ BIN_PKG = \ bin/buildpkg \ bin/buildtree -BIN_ISO = \ - bin/buildiso \ - bin/testiso \ - bin/deployiso - -SYSCONF = \ - conf/manjaro-tools.conf - -SETS_PKG = \ - sets/pkg.d/default.set - -SETS_ISO = \ - sets/iso.d/default.set \ - sets/iso.d/official.set \ - sets/iso.d/community.set \ - sets/iso.d/community-minimal.set - -SHARED = \ - conf/pacman-default.conf \ - conf/pacman-multilib.conf \ - conf/pacman-mirrors-stable.conf \ - conf/pacman-mirrors-testing.conf \ - conf/pacman-mirrors-unstable.conf +LIBS_PKG = \ + lib/util-pkg.sh \ + lib/util-pkgtree.sh SHARED_PKG = \ - conf/makepkg-i686.conf \ - conf/base-devel-udev \ - conf/makepkg-x86_64.conf - -SHARED_ISO = \ - conf/pacman-gfx.conf \ - conf/profile.conf.example + data/makepkg-i686.conf \ + data/base-devel-udev \ + data/makepkg-x86_64.conf -LIBS = \ - lib/util.sh \ - lib/util-mount.sh \ - lib/util-msg.sh \ - lib/util-pac-conf.sh \ - lib/util-fstab.sh +SETS_ISO = \ + data/iso.d/default.set \ + data/iso.d/official.set \ + data/iso.d/community.set \ + data/iso.d/community-minimal.set -LIBS_PKG = \ - lib/util-pkg.sh \ - lib/util-pkgtree.sh +BIN_ISO = \ + bin/buildiso \ + bin/testiso \ + bin/deployiso LIBS_ISO = \ lib/util-iso.sh \ @@ -75,9 +70,12 @@ LIBS_ISO = \ lib/util-livecd.sh \ lib/util-iso-boot.sh \ lib/util-publish.sh \ - lib/util-sets.sh \ lib/util-iso-log.sh +SHARED_ISO = \ + data/pacman-gfx.conf \ + data/profile.conf.example + CPIOHOOKS = \ initcpio/hooks/miso \ initcpio/hooks/miso_overlayfs \ @@ -94,12 +92,11 @@ CPIOINST = \ initcpio/inst/miso_kms SCRIPTS = \ - scripts/mhwd-live \ - scripts/livecd \ - scripts/kbd-model-map + data/scripts/mhwd-live \ + data/scripts/livecd \ + data/scripts/kbd-model-map MAN_XML = \ - buildset.xml \ buildpkg.xml \ buildtree.xml \ buildiso.xml \ @@ -107,10 +104,9 @@ MAN_XML = \ manjaro-tools.conf.xml \ profile.conf.xml -all: $(BIN) $(BIN_PKG) $(BIN_ISO) doc #bin/bash_completion bin/zsh_completion +all: $(BIN_BASE) $(BIN_PKG) $(BIN_ISO) doc -edit = sed -e "s|@pkgdatadir[@]|$(DESTDIR)$(PREFIX)/share/manjaro-tools|g" \ - -e "s|@bindir[@]|$(DESTDIR)$(PREFIX)/bin|g" \ +edit = sed -e "s|@datadir[@]|$(DESTDIR)$(PREFIX)/share/manjaro-tools|g" \ -e "s|@sysconfdir[@]|$(DESTDIR)$(SYSCONFDIR)/manjaro-tools|g" \ -e "s|@libdir[@]|$(DESTDIR)$(PREFIX)/lib/manjaro-tools|g" \ -e "s|@version@|${Version}|" @@ -127,7 +123,7 @@ doc: $(foreach var,$(MAN_XML),xsltproc /usr/share/docbook2X/xslt/man/docbook.xsl docbook/$(var) | db2x_manxml --output-dir man ;) clean: - rm -f $(BIN) ${BIN_PKG} ${BIN_ISO} #bin/bash_completion bin/zsh_completion + rm -f $(BIN_BASE) ${BIN_PKG} ${BIN_ISO} rm -rf man install_base: @@ -135,24 +131,17 @@ install_base: install -m0644 ${SYSCONF} $(DESTDIR)$(SYSCONFDIR)/manjaro-tools install -dm0755 $(DESTDIR)$(PREFIX)/bin - install -m0755 ${BIN} $(DESTDIR)$(PREFIX)/bin + install -m0755 ${BIN_BASE} $(DESTDIR)$(PREFIX)/bin install -dm0755 $(DESTDIR)$(PREFIX)/lib/manjaro-tools - install -m0644 ${LIBS} $(DESTDIR)$(PREFIX)/lib/manjaro-tools + install -m0644 ${LIBS_BASE} $(DESTDIR)$(PREFIX)/lib/manjaro-tools install -dm0755 $(DESTDIR)$(PREFIX)/share/manjaro-tools - install -m0644 ${SHARED} $(DESTDIR)$(PREFIX)/share/manjaro-tools - - install -dm0755 $(DESTDIR)$(PREFIX)/share/man/man1 - gzip -c man/buildset.1 > $(DESTDIR)$(PREFIX)/share/man/man1/buildset.1.gz - -# install -Dm0644 bin/bash_completion $(DESTDIR)/$(PREFIX)/share/bash-completion/completions/manjaro_tools -# install -Dm0644 bin/zsh_completion $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_manjaro_tools - + install -m0644 ${SHARED_BASE} $(DESTDIR)$(PREFIX)/share/manjaro-tools install_pkg: - install -dm0755 $(DESTDIR)$(SYSCONFDIR)/manjaro-tools/sets/pkg.d - install -m0644 ${SETS_PKG} $(DESTDIR)$(SYSCONFDIR)/manjaro-tools/sets/pkg.d + install -dm0755 $(DESTDIR)$(SYSCONFDIR)/manjaro-tools/pkg.d + install -m0644 ${SETS_PKG} $(DESTDIR)$(SYSCONFDIR)/manjaro-tools/pkg.d install -dm0755 $(DESTDIR)$(PREFIX)/bin install -m0755 ${BIN_PKG} $(DESTDIR)$(PREFIX)/bin @@ -169,10 +158,9 @@ install_pkg: gzip -c man/buildpkg.1 > $(DESTDIR)$(PREFIX)/share/man/man1/buildpkg.1.gz gzip -c man/buildtree.1 > $(DESTDIR)$(PREFIX)/share/man/man1/buildtree.1.gz - install_iso: - install -dm0755 $(DESTDIR)$(SYSCONFDIR)/manjaro-tools/sets/iso.d - install -m0644 ${SETS_ISO} $(DESTDIR)$(SYSCONFDIR)/manjaro-tools/sets/iso.d + install -dm0755 $(DESTDIR)$(SYSCONFDIR)/manjaro-tools/iso.d + install -m0644 ${SETS_ISO} $(DESTDIR)$(SYSCONFDIR)/manjaro-tools/iso.d install -dm0755 $(DESTDIR)$(PREFIX)/bin install -m0755 ${BIN_ISO} $(DESTDIR)$(PREFIX)/bin @@ -200,20 +188,14 @@ install_iso: gzip -c man/manjaro-tools.conf.5 > $(DESTDIR)$(PREFIX)/share/man/man5/manjaro-tools.conf.5.gz gzip -c man/profile.conf.5 > $(DESTDIR)$(PREFIX)/share/man/man5/profile.conf.5.gz - uninstall_base: for f in ${SYSCONF}; do rm -f $(DESTDIR)$(SYSCONFDIR)/manjaro-tools/$$f; done - for f in ${BIN}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$f; done - for f in ${SHARED}; do rm -f $(DESTDIR)$(PREFIX)/share/manjaro-tools/$$f; done - for f in ${LIBS}; do rm -f $(DESTDIR)$(PREFIX)/lib/manjaro-tools/$$f; done - rm -f $(DESTDIR)$(PREFIX)/share/man/man1/buildset.1.gz - -# rm $(DESTDIR)/$(PREFIX)/share/bash-completion/completions/manjaro_tools -# rm $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_manjaro_tools - + for f in ${BIN_BASE}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$f; done + for f in ${SHARED_BASE}; do rm -f $(DESTDIR)$(PREFIX)/share/manjaro-tools/$$f; done + for f in ${LIBS_BASE}; do rm -f $(DESTDIR)$(PREFIX)/lib/manjaro-tools/$$f; done uninstall_pkg: - for f in ${SETS_PKG}; do rm -f $(DESTDIR)$(SYSCONFDIR)/manjaro-tools/sets/pkg.d/$$f; done + for f in ${SETS_PKG}; do rm -f $(DESTDIR)$(SYSCONFDIR)/manjaro-tools/pkg.d/$$f; done for f in ${BIN_PKG}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$f; done rm -f $(DESTDIR)$(PREFIX)/bin/find-libprovides for f in ${SHARED_PKG}; do rm -f $(DESTDIR)$(PREFIX)/share/manjaro-tools/$$f; done @@ -221,9 +203,8 @@ uninstall_pkg: rm -f $(DESTDIR)$(PREFIX)/share/man/man1/buildpkg.1.gz rm -f $(DESTDIR)$(PREFIX)/share/man/man1/buildtree.1.gz - uninstall_iso: - for f in ${SETS_ISO}; do rm -f $(DESTDIR)$(SYSCONFDIR)/manjaro-tools/sets/iso.d/$$f; done + for f in ${SETS_ISO}; do rm -f $(DESTDIR)$(SYSCONFDIR)/manjaro-tools/iso.d/$$f; done for f in ${BIN_ISO}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$f; done for f in ${SHARED_ISO}; do rm -f $(DESTDIR)$(PREFIX)/share/manjaro-tools/$$f; done for f in ${LIBS_ISO}; do rm -f $(DESTDIR)$(PREFIX)/lib/manjaro-tools/$$f; done @@ -235,7 +216,6 @@ uninstall_iso: rm -f $(DESTDIR)$(PREFIX)/share/man/man5/manjaro-tools.conf.5.gz rm -f $(DESTDIR)$(PREFIX)/share/man/man5/profile.conf.5.gz - install: install_base install_pkg install_iso uninstall: uninstall_base uninstall_pkg uninstall_iso diff --git a/README.md b/README.md index 3a4d864c325fc10d302e11641e35cd5d1d71afa1..6009b9bd0da09820ef6fb28de11299a648279ff2 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ By default, the config is installed in A user manjaro-tools.conf can be placed in ~~~ -$HOME/.config/manjaro-tools.conf +$HOME/.config/manjaro-tools/manjaro-tools.conf ~~~ If the userconfig is present, manjaro-tools will load the userconfig values, however, if variables have been set in the systemwide @@ -33,6 +33,19 @@ By default it is commented and shows just initialization values done in code. Tools configuration is done in manjaro-tools.conf or by args. Specifying args will override manjaro-tools.conf settings. +User sets can be placed in + +~~~ +$HOME/.config/manjaro-tools/{pkg,iso}.d +~~~ + +overriding + +~~~ +/etc/manjaro-tools/{pkg,iso}.d +~~~ + + ~~~ ###################################################### ################ manjaro-tools.conf ################## @@ -50,9 +63,6 @@ Specifying args will override manjaro-tools.conf settings. # build dir where buildpkg or buildiso chroots are created # chroots_dir=/var/lib/manjaro-tools -# default path to sets -# sets_dir=/etc/manjaro-tools/sets - # custom build mirror server # build_mirror=http://mirror.netzspielplatz.de/manjaro/packages @@ -73,6 +83,9 @@ Specifying args will override manjaro-tools.conf settings. ################ buildiso ################ +# the iso-profiles directory name/git repo name +# profile_repo='manjaro-tools-iso-profiles' + # default iso buildset; name without .set extension # buildset_iso=default @@ -80,10 +93,10 @@ Specifying args will override manjaro-tools.conf settings. # dist_name="Manjaro" # unset defaults to given value -# dist_release=15.09 +# dist_release=15.12 # unset defaults to value sourced from /etc/lsb-release -# dist_codename="Bellatrix" +# dist_codename="Capella" # unset defaults to given value # dist_branding="MJRO" @@ -137,7 +150,7 @@ It it run in a abs/pkgbuilds directory which contains directories with PKGBUILD. ~~~ $ buildpkg -h -Usage: buildpkg [options] [--] [makepkg args] +Usage: buildpkg [options] -p <pkg> Buildset or pkg [default: default] -a <arch> Arch [default: auto] -b <branch> Branch [default: stable] @@ -242,60 +255,8 @@ The branch can be defined also in manjaro-tools.conf, but a manual parameter wil ######* -s * Use this to sqfs compress the chroots if you previously used -i. -###4. buildset - -buildpkg and buildiso support building from buildsets - -Default location of sets is: - -~~~ -/etc/manjaro-tools/manjaro-tools/sets/pkg.d -/etc/manjaro-tools/manjaro-tools/sets/iso.d -~~~ - -but it can be configured in the manjaro-tools.conf. - -buildset is a little helper tool to easily create buildsets. -It is run inside the abs/pkgbuilds or iso profiles directory. - -####Arguments - -~~~ -$ buildset -h -Usage: buildset [options] - -c <name> Create set - -r <name> Remove set - -s <name> Show set - -i Iso mode - -q Query sets - -h This help -~~~ - -######* create a pkg buildset for lxqt -~~~ -buildset -c lxqt-0.8 -~~~ - -######* create a iso buildset - -~~~ -buildset -ic manjaro-0.9.0 -~~~ - -The buildset name should not be a name of a package or profile! -Else buildpkg/buildiso won't recognize the build list and will only build the package/profile specified. The -p arg handles set and package/profile name. - -If you create a buildset manually, the buildset must have a .set extension. - -* Examples: - -~~~ -/etc/manjaro-tools/sets/pkg.d/lxqt-0.8.set -/etc/manjaro-tools/sets/iso.d/manjaro-0.9.0.set -~~~ - -###5. buildtree +###4. buildtree buildtree is a little tools to sync arch abs and manjaro PKGBUILD git repos. @@ -317,7 +278,7 @@ Usage: buildtree [options] buildtree -as ~~~ -###6. manjaro-chroot +###5. manjaro-chroot manjaro-chroot is a little tool to quickly chroot into a second system installed on the host. If the automount option is enabled, manjaro-chroot will detect installed systems with os-prober, and pops up a list with linux systems to select from. @@ -327,12 +288,15 @@ If there is only 1 system installed besides the host system, no list will pop up ~~~ $ manjaro-chroot -h -usage: ${0##*/} chroot-dir [command] +usage: manjaro-chroot -a [or] manjaro-chroot chroot-dir [command] -a Automount detected linux system -q Query settings and pretend -h Print this help message If 'command' is unspecified, manjaro-chroot will launch /bin/sh. + + If 'automount' is true, manjaro-chroot will launch /bin/bash + and /build/manjaro-tools/manjaro-chroot. ~~~ ######* automount @@ -347,7 +311,7 @@ manjaro-chroot -a manjaro-chroot /mnt /bin/bash ~~~ -###7. deployiso +###6. deployiso deployiso is a script to upload a specific iso or a buiildset to SF. It needs to be run inside the iso-profiles directory. @@ -360,10 +324,12 @@ Ideally, you have a running ssh agent on the host, and your key added, and your $ deployiso -h Usage: deployiso [options] -p Source folder to upload [default:default] + -a Arch to upload [default:x86_64] + -l Limit bandwidth in kB/s [default:80] -c Create new remote edition_type with subtree -u Update remote iso - -l Limit bandwidth in kB/s -q Query settings and pretend upload + -v Verbose output -h This help ~~~ diff --git a/bin/basestrap.in b/bin/basestrap.in index 4f9b7db2a31cea0f9ced8da5e404618c425bf7dc..8bccc60c66af4b63974ee09f209ec4f51e2c065a 100644 --- a/bin/basestrap.in +++ b/bin/basestrap.in @@ -12,7 +12,7 @@ version=@version@ shopt -s extglob -PKGDATADIR='@pkgdatadir@' +DATADIR='@datadir@' LIBDIR='@libdir@' [[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh diff --git a/bin/buildiso.in b/bin/buildiso.in index f30108a4203ed83837eac3b08a8eb09304c75124..aa0dd46d4739ae8286a4d751bfed43ced592fee9 100755 --- a/bin/buildiso.in +++ b/bin/buildiso.in @@ -11,9 +11,8 @@ version=@version@ -BINDIR='@bindir@' LIBDIR='@libdir@' -PKGDATADIR='@pkgdatadir@' +DATADIR='@datadir@' SYSCONFDIR='@sysconfdir@' [[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh @@ -21,46 +20,45 @@ SYSCONFDIR='@sysconfdir@' import ${LIBDIR}/util.sh show_profile(){ - cd $1 - load_profile "$1" - if ${verbose};then - msg2 "edition_type: ${edition_type}" - msg2 "work_dir: ${work_dir}" - msg2 "cache_dir_iso: ${cache_dir_iso}" - msg2 "iso_file: ${iso_file}" - msg2 "is_custom_pac_conf: ${is_custom_pac_conf}" - msg2 "initsys: ${initsys}" - if ${use_overlayfs};then - msg2 "mount system: overlayfs" - else - msg2 "mount system: aufs" - fi - [[ ${arch} == 'x86_64' ]] && msg2 "multilib: ${multilib}" - msg2 "displaymanager: ${displaymanager}" - msg2 "autologin: ${autologin}" - msg2 "nonfree_xorg: ${nonfree_xorg}" - msg2 "kernel: ${kernel}" - msg2 "efi_boot_loader: ${efi_boot_loader}" - msg2 "efi_part_size: ${efi_part_size}" - msg2 "pxe_boot: ${pxe_boot}" - msg2 "plymouth_boot: ${plymouth_boot}" - ${plymouth_boot} && msg2 "plymouth_theme: ${plymouth_theme}" - msg2 "hostname: ${hostname}" - msg2 "username: ${username}" - msg2 "password: ${password}" - msg2 "addgroups: ${addgroups}" - - if [[ ${initsys} == 'systemd' ]];then - msg2 "start_systemd: ${start_systemd[*]}" - msg2 "start_systemd_live: ${start_systemd_live[*]}" - msg2 "disable_systemd: ${disable_systemd[*]}" - else - msg2 "start_openrc: ${start_openrc[*]}" - msg2 "start_openrc_live: ${start_openrc_live[*]}" - msg2 "disable_openrc: ${disable_openrc[*]}" - fi + eval_edition "$1" + load_profile "${run_dir}/${edition}/$1" + msg2 "edition: ${edition}" + if ${verbose};then + msg2 "work_dir: ${work_dir}" + msg2 "iso_dir: ${iso_dir}" + msg2 "iso_file: ${iso_file}" + msg2 "is_custom_pac_conf: ${is_custom_pac_conf}" + msg2 "initsys: ${initsys}" + if ${use_overlayfs};then + msg2 "mount system: overlayfs" + else + msg2 "mount system: aufs" fi - cd .. + [[ ${arch} == 'x86_64' ]] && msg2 "multilib: ${multilib}" + msg2 "displaymanager: ${displaymanager}" + msg2 "autologin: ${autologin}" + msg2 "nonfree_xorg: ${nonfree_xorg}" + msg2 "kernel: ${kernel}" + msg2 "efi_boot_loader: ${efi_boot_loader}" + msg2 "efi_part_size: ${efi_part_size}" + msg2 "pxe_boot: ${pxe_boot}" + msg2 "plymouth_boot: ${plymouth_boot}" + ${plymouth_boot} && msg2 "plymouth_theme: ${plymouth_theme}" + msg2 "hostname: ${hostname}" + msg2 "username: ${username}" + msg2 "password: ${password}" + msg2 "addgroups: ${addgroups}" + + if [[ ${initsys} == 'systemd' ]];then + msg2 "start_systemd: ${start_systemd[*]}" + msg2 "start_systemd_live: ${start_systemd_live[*]}" + msg2 "disable_systemd: ${disable_systemd[*]}" + else + msg2 "start_openrc: ${start_openrc[*]}" + msg2 "start_openrc_live: ${start_openrc_live[*]}" + msg2 "disable_openrc: ${disable_openrc[*]}" + fi + fi } display_settings(){ @@ -69,9 +67,10 @@ display_settings(){ msg "PROFILE:" msg2 "sets_dir_iso: ${sets_dir_iso}" - msg2 "buildsets: $(load_sets ${sets_dir_iso})" + msg2 "buildsets: $(list_sets ${sets_dir_iso})" msg2 "buildset_iso: ${buildset_iso}" msg2 "is_buildset: ${is_buildset}" + msg2 "profile_repo: ${profile_repo}" msg "OPTIONS:" msg2 "arch: ${arch}" @@ -103,11 +102,15 @@ display_settings(){ load_user_info -load_config "${USER_CONFIG}/manjaro-tools.conf" +load_config "${USERCONFDIR}/manjaro-tools.conf" load_config "${SYSCONFDIR}/manjaro-tools.conf" -clean_first=true +# to force old way to have buildiso run in iso-profiles dir +# run_dir=$(pwd) +load_run_dir "${profile_repo}" + +clean_first=true pretend=false images_only=false iso_only=false @@ -164,15 +167,15 @@ timer_start=$(get_timer) [[ "${arch}" == 'x86_64' ]] && pacman_conf_arch='multilib' -mirrors_conf="${PKGDATADIR}/pacman-mirrors-${branch}.conf" +mirrors_conf="${DATADIR}/pacman-mirrors-${branch}.conf" check_root "$0" "${orig_argv[@]}" -eval_buildset "${buildset_iso}" "${sets_dir_iso}" +eval_buildset "${sets_dir_iso}" "${buildset_iso}" import ${LIBDIR}/util-iso.sh -check_requirements "${buildset_iso}" +check_requirements ${pretend} && display_settings && exit 1 diff --git a/bin/buildpkg.in b/bin/buildpkg.in index 26b224b8f44a04dc863bbe817f44f24ad3a5560e..8bba0aa0b6966829a3ae527830cf1aaaf8aa9f90 100644 --- a/bin/buildpkg.in +++ b/bin/buildpkg.in @@ -14,7 +14,7 @@ version=@version@ shopt -s nullglob LIBDIR='@libdir@' -PKGDATADIR='@pkgdatadir@' +DATADIR='@datadir@' SYSCONFDIR='@sysconfdir@' [[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh @@ -37,7 +37,7 @@ display_settings(){ msg "PROFILE:" msg2 "sets_dir_pkg: ${sets_dir_pkg}" - msg2 "buildsets: $(load_sets ${sets_dir_pkg})" + msg2 "buildsets: $(list_sets ${sets_dir_pkg})" msg2 "buildset_pkg: ${buildset_pkg}" msg2 "is_buildset: ${is_buildset}" @@ -56,7 +56,7 @@ display_settings(){ msg "PATHS:" msg2 "work_dir: ${work_dir}" - msg2 "cache_dir_pkg: ${cache_dir_pkg}" + msg2 "pkg_dir: ${pkg_dir}" msg2 "build_mirror: ${build_mirror}/${branch}" if ${clean_first};then @@ -70,7 +70,7 @@ display_settings(){ load_user_info -load_config "${USER_CONFIG}/manjaro-tools.conf" +load_config "${USERCONFDIR}/manjaro-tools.conf" load_config "${SYSCONFDIR}/manjaro-tools.conf" load_vars "$USER_HOME/.makepkg.conf" @@ -131,19 +131,19 @@ done if [[ "${arch}" == 'multilib' ]]; then pacman_conf_arch=${arch} work_dir=${chroots_pkg}/${branch}/${arch} - cache_dir_pkg=${cache_dir}/pkg/${branch}/${arch} + pkg_dir=${cache_dir_pkg}/${branch}/${arch} arch='x86_64' is_multilib=true else pacman_conf_arch='default' work_dir=${chroots_pkg}/${branch}/${arch} - cache_dir_pkg=${cache_dir}/pkg/${branch}/${arch} + pkg_dir=${cache_dir_pkg}/${branch}/${arch} is_multilib=false fi -pacman_conf="${PKGDATADIR}/pacman-${pacman_conf_arch}.conf" -makepkg_conf="${PKGDATADIR}/makepkg-${arch}.conf" -mirrors_conf="${PKGDATADIR}/pacman-mirrors-${branch}.conf" +pacman_conf="${DATADIR}/pacman-${pacman_conf_arch}.conf" +makepkg_conf="${DATADIR}/makepkg-${arch}.conf" +mirrors_conf="${DATADIR}/pacman-mirrors-${branch}.conf" mkchroot_args+=(-C ${pacman_conf} -M ${makepkg_conf} -S ${mirrors_conf} -B "${build_mirror}/${branch}") @@ -153,18 +153,20 @@ check_root "$0" "${orig_argv[@]}" timer_start=$(get_timer) -prepare_dir "${cache_dir_pkg}" - -eval_buildset "${buildset_pkg}" "${sets_dir_pkg}" +eval_buildset "${sets_dir_pkg}" "${buildset_pkg}" check_requirements +prepare_dir "${pkg_dir}" + init_base_devel ${pretend} && display_settings && exit ${wipe_clean} && clean_up -[[ -d ${work_dir}/root ]] && check_chroot_version "${work_dir}/root" +#[[ -d ${work_dir}/root ]] && check_chroot_version "${work_dir}/root" + +chroot_init run make_pkg "${buildset_pkg}" diff --git a/bin/buildset.in b/bin/buildset.in deleted file mode 100644 index 66cd382b1efb735d1fd146d903f1dc5a3665c6dd..0000000000000000000000000000000000000000 --- a/bin/buildset.in +++ /dev/null @@ -1,91 +0,0 @@ -#!/bin/bash -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -version=@version@ - -SYSCONFDIR='@sysconfdir@' -LIBDIR='@libdir@' - -[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh -import ${LIBDIR}/util.sh -import ${LIBDIR}/util-sets.sh - -load_user_info - -load_config "${USER_CONFIG}/manjaro-tools.conf" -load_config "${SYSCONFDIR}/manjaro-tools.conf" - -query=false -create=false -remove=false -show=false -iso_mode=false - -name='default' - -usage() { - echo "Usage: ${0##*/} [options]" - echo " -c <name> Create set" - echo " -r <name> Remove set" - echo " -s <name> Show set" - echo " -i Iso mode" - echo " -q Query sets" - echo ' -h This help' - echo '' - echo '' - exit $1 -} - -orig_argv=("$@") - -opts='c:r:s:qih' - -while getopts "${opts}" arg; do - case "${arg}" in - c) name="$OPTARG"; create=true ;; - r) name="$OPTARG"; remove=true ;; - s) name="$OPTARG"; show=true;; - i) iso_mode=true ;; - q) query=true ;; - h|?) usage 0 ;; - *) echo "invalid argument '${arg}'"; usage 1 ;; - esac -done - -shift $(($OPTIND - 1)) - -check_root "$0" "${orig_argv[@]}" - -if ${create};then - if ${iso_mode}; then - create_set "${sets_dir_iso}" "profile.conf" - else - create_set "${sets_dir_pkg}" "PKGBUILD" - fi -elif ${remove};then - if ${iso_mode}; then - remove_set "${sets_dir_iso}" - else - remove_set "${sets_dir_pkg}" - fi -elif ${show};then - if ${iso_mode}; then - show_set "${sets_dir_iso}" - else - show_set "${sets_dir_pkg}" - fi -else - if ${iso_mode}; then - msg "Available sets: $(load_sets ${sets_dir_iso})" - else - msg "Available sets: $(load_sets ${sets_dir_pkg})" - fi -fi diff --git a/bin/buildtree.in b/bin/buildtree.in index 33c4d3f6c4344d366c6683b033a627f49c98f0b1..c772250f3b42311525d4b8f0fcee73c572152ba9 100644 --- a/bin/buildtree.in +++ b/bin/buildtree.in @@ -36,7 +36,7 @@ display_settings(){ load_user_info -load_config "${USER_CONFIG}/manjaro-tools.conf" +load_config "${USERCONFDIR}/manjaro-tools.conf" load_config "${SYSCONFDIR}/manjaro-tools.conf" sync=false diff --git a/bin/deployiso.in b/bin/deployiso.in index 18cdef1141f85aaaee70a71d083b293e5452eca7..9c89cf19eb1f781140caa9c7d39fd5daec975114 100644 --- a/bin/deployiso.in +++ b/bin/deployiso.in @@ -17,15 +17,14 @@ SYSCONFDIR='@sysconfdir@' [[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh import ${LIBDIR}/util.sh -import ${LIBDIR}/util-iso.sh import ${LIBDIR}/util-publish.sh show_profile(){ - cd $1 - load_profile "$1" - msg2 "cache_dir_iso: ${cache_dir_iso}" - msg2 "remote_tree: ${remote_tree}" - cd .. + eval_edition "$1" + msg3 "Iso: [$1]" + prepare_transfer "$1" + msg2 "src_dir: ${src_dir}" + msg2 "remote_dir: ${remote_dir}" } display_settings(){ @@ -34,7 +33,7 @@ display_settings(){ msg "PROFILE:" msg2 "sets_dir_iso: ${sets_dir_iso}" - msg2 "buildsets: $(load_sets ${sets_dir_iso})" + msg2 "buildsets: $(list_sets ${sets_dir_iso})" msg2 "buildset_iso: ${buildset_iso}" msg2 "is_buildset: ${is_buildset}" @@ -63,9 +62,11 @@ display_settings(){ load_user_info -load_config "${USER_CONFIG}/manjaro-tools.conf" +load_config "${USERCONFDIR}/manjaro-tools.conf" load_config "${SYSCONFDIR}/manjaro-tools.conf" +run_dir=${cache_dir_iso} + pretend=false remote_create=false update=false @@ -108,7 +109,7 @@ shift $(($OPTIND - 1)) timer_start=$(get_timer) -eval_buildset "${buildset_iso}" "${sets_dir_iso}" +eval_buildset "${sets_dir_iso}" "${buildset_iso}" rsync_args+=(--bwlimit=${limit}) diff --git a/bin/manjaro-chroot.in b/bin/manjaro-chroot.in index 9eb35e8068728d59ab2d7b190c44136f674f1669..b00998a961cf1a5c8b7fe4e8e99050673a5d1ef1 100644 --- a/bin/manjaro-chroot.in +++ b/bin/manjaro-chroot.in @@ -14,6 +14,7 @@ version=@version@ shopt -s extglob LIBDIR='@libdir@' +SYSCONFDIR='@sysconfdir@' [[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh @@ -34,7 +35,7 @@ display_settings(){ load_user_info -load_config "${USER_CONFIG}/manjaro-tools.conf" +load_config "${USERCONFDIR}/manjaro-tools.conf" load_config "${SYSCONFDIR}/manjaro-tools.conf" automount=false diff --git a/conf/base-devel-udev b/data/base-devel-udev similarity index 100% rename from conf/base-devel-udev rename to data/base-devel-udev diff --git a/sets/iso.d/community-minimal.set b/data/iso.d/community-minimal.set similarity index 100% rename from sets/iso.d/community-minimal.set rename to data/iso.d/community-minimal.set index 34c3714279d48ad6ac685945b19a537ea70d1426..d8d95e858fa15e9d333fe43faa23ce0b6906d68c 100644 --- a/sets/iso.d/community-minimal.set +++ b/data/iso.d/community-minimal.set @@ -1,5 +1,5 @@ budgie-minimal -lxqt-minimal -xfce-minimal kde-minimal +lxqt-minimal net-minimal +xfce-minimal diff --git a/sets/iso.d/community.set b/data/iso.d/community.set similarity index 76% rename from sets/iso.d/community.set rename to data/iso.d/community.set index 9dc4ae2874570ce2d850ec91cbdaf9006c1aa121..0cc5b42812433ccec47c9f6ee2ec23e6e3bdcf4a 100644 --- a/sets/iso.d/community.set +++ b/data/iso.d/community.set @@ -1,13 +1,17 @@ +bspwm +budgie cinnamon -lxqt -openbox +deepin enlightenment -netbook +fluxbox gnome +i3 +jwm +kde-next lxde +lxqt mate +netbook +openbox pantheon -i3 -bspwm -budgie -deepin +sysmenu diff --git a/sets/iso.d/default.set b/data/iso.d/default.set similarity index 100% rename from sets/iso.d/default.set rename to data/iso.d/default.set diff --git a/sets/iso.d/official.set b/data/iso.d/official.set similarity index 100% rename from sets/iso.d/official.set rename to data/iso.d/official.set index 2004b6b1370267baad79fcfb001611a94cbe53f6..971aa05eece9251c8e491eebc5551649791efa7b 100644 --- a/sets/iso.d/official.set +++ b/data/iso.d/official.set @@ -1,3 +1,3 @@ -xfce kde net +xfce diff --git a/conf/makepkg-i686.conf b/data/makepkg-i686.conf similarity index 100% rename from conf/makepkg-i686.conf rename to data/makepkg-i686.conf diff --git a/conf/makepkg-x86_64.conf b/data/makepkg-x86_64.conf similarity index 100% rename from conf/makepkg-x86_64.conf rename to data/makepkg-x86_64.conf diff --git a/conf/manjaro-tools.conf b/data/manjaro-tools.conf similarity index 95% rename from conf/manjaro-tools.conf rename to data/manjaro-tools.conf index fbac5af6055bedd59371b6f071086ba67d9ed081..e685319a7eced783d9c3436926e97f3a7cad377a 100644 --- a/conf/manjaro-tools.conf +++ b/data/manjaro-tools.conf @@ -14,9 +14,6 @@ # build dir where buildpkg or buildiso chroots are created # chroots_dir=/var/lib/manjaro-tools -# default path to sets -# sets_dir=/etc/manjaro-tools/sets - # custom build mirror server # build_mirror=http://mirror.netzspielplatz.de/manjaro/packages @@ -37,6 +34,9 @@ ################ buildiso ################ +# the iso-profiles directory name/git repo name +# profile_repo='manjaro-tools-iso-profiles' + # default iso buildset; name without .set extension # buildset_iso=default diff --git a/conf/pacman-default.conf b/data/pacman-default.conf similarity index 100% rename from conf/pacman-default.conf rename to data/pacman-default.conf diff --git a/conf/pacman-gfx.conf b/data/pacman-gfx.conf similarity index 100% rename from conf/pacman-gfx.conf rename to data/pacman-gfx.conf diff --git a/conf/pacman-mirrors-stable.conf b/data/pacman-mirrors-stable.conf similarity index 100% rename from conf/pacman-mirrors-stable.conf rename to data/pacman-mirrors-stable.conf diff --git a/conf/pacman-mirrors-testing.conf b/data/pacman-mirrors-testing.conf similarity index 100% rename from conf/pacman-mirrors-testing.conf rename to data/pacman-mirrors-testing.conf diff --git a/conf/pacman-mirrors-unstable.conf b/data/pacman-mirrors-unstable.conf similarity index 100% rename from conf/pacman-mirrors-unstable.conf rename to data/pacman-mirrors-unstable.conf diff --git a/conf/pacman-multilib.conf b/data/pacman-multilib.conf similarity index 100% rename from conf/pacman-multilib.conf rename to data/pacman-multilib.conf diff --git a/sets/pkg.d/default.set b/data/pkg.d/default.set similarity index 100% rename from sets/pkg.d/default.set rename to data/pkg.d/default.set diff --git a/conf/profile.conf.example b/data/profile.conf.example similarity index 93% rename from conf/profile.conf.example rename to data/profile.conf.example index a477d0a11953f583fa493fa9e55f6bcbc3ea8466..61d141a73dc7f2c112f6a994fe8c1a5f2274dca8 100644 --- a/conf/profile.conf.example +++ b/data/profile.conf.example @@ -5,14 +5,11 @@ # possible values: openrc,systemd # initsys="systemd" -# edition type -# accepted value: official, community, sonar, netrunner -# edition_type="official" - # use multilib packages; x86_64 only # multilib="true" -# displaymanager="lightdm" +# default displaymanager +# displaymanager="none" # Set to false to disable autologin in the livecd # autologin="true" diff --git a/scripts/kbd-model-map b/data/scripts/kbd-model-map similarity index 100% rename from scripts/kbd-model-map rename to data/scripts/kbd-model-map diff --git a/scripts/livecd b/data/scripts/livecd similarity index 100% rename from scripts/livecd rename to data/scripts/livecd diff --git a/scripts/mhwd-live b/data/scripts/mhwd-live similarity index 100% rename from scripts/mhwd-live rename to data/scripts/mhwd-live diff --git a/docbook/buildset.xml b/docbook/buildset.xml deleted file mode 100644 index e9499443eed9ab2a09eaf6018e213559400be235..0000000000000000000000000000000000000000 --- a/docbook/buildset.xml +++ /dev/null @@ -1,117 +0,0 @@ -<?xml version='1.0'?> <!--*-nxml-*--> -<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" - "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> - -<!-- - This file is part of manjaro-tools. - - Copyright 2015 Manjaro Developers - - manjaro-tools is free software; you can redistribute it and/or modify it - under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 of the License, or - (at your option) any later version. - - manjaro-tools is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with systemd; If not, see <http://www.gnu.org/licenses/>. ---> - -<refentry id="buildset" xmlns:xi="http://www.w3.org/2001/XInclude"> - <refentryinfo> - <title>buildset-+</title> - <productname>manjaro-tools</productname> - <authorgroup> - <author> - <contrib></contrib> - <firstname></firstname> - <surname></surname> - <email></email> - </author> - </authorgroup> - </refentryinfo> - - <refmeta> - <refentrytitle>buildset</refentrytitle> - <manvolnum>1</manvolnum> - </refmeta> - - <refnamediv> - <refname>buildset</refname> - <refpurpose>buildset is used to iso or package build sets. </refpurpose> - </refnamediv> - - <refsynopsisdiv> - <cmdsynopsis> - <command>buildset</command> - <arg choice="opt" rep="repeat">OPTIONS</arg> - </cmdsynopsis> - </refsynopsisdiv> - - <refsect1> - <title>Description</title> - - <para><command>buildset</command> is used to manage build sets. </para> - - <para>With buildset you can manage iso and package build sets.</para> - - </refsect1> - - <refsect1> - <title>Options</title> - - <para>The following options are understood:</para> - - <variablelist> - - <varlistentry> - <term><option>-c [name]</option></term> - - <listitem><para>Create set.</para></listitem> - </varlistentry> - - <varlistentry> - <term><option>-r [name]</option></term> - - <listitem><para>Remove set.</para></listitem> - </varlistentry> - - <varlistentry> - <term><option>-s [name]</option></term> - - <listitem><para>Show set.</para></listitem> - </varlistentry> - - <varlistentry> - <term><option>-i</option></term> - - <listitem><para>Iso mode.</para></listitem> - </varlistentry> - - <varlistentry> - <term><option>-q</option></term> - - <listitem><para>Query sets.</para></listitem> - </varlistentry> - - <varlistentry> - <term><option>-h</option></term> - - <listitem><para>Help.</para></listitem> - </varlistentry> - </variablelist> - - </refsect1> - - <refsect1> - <title>See Also</title> - <para> - <citerefentry project='manjaro-tools'><refentrytitle>manjaro-tools.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>, - </para> - </refsect1> -</refentry> - diff --git a/lib/util-iso-boot.sh b/lib/util-iso-boot.sh index 9988f1aea2cb044a862ed0266e957ba06336de95..113d10d92c76bfab782c69c1d173cbf51f62951d 100644 --- a/lib/util-iso-boot.sh +++ b/lib/util-iso-boot.sh @@ -10,13 +10,13 @@ # GNU General Public License for more details. copy_efi_shells(){ - if [[ -f ${PKGDATADIR}/efi_shell/shellx64_v1.efi ]];then + if [[ -f ${DATADIR}/efi_shell/shellx64_v1.efi ]];then msg2 "Copying shellx64_v1.efi ..." - cp ${PKGDATADIR}/efi_shell/shellx64_v1.efi $1/ + cp ${DATADIR}/efi_shell/shellx64_v1.efi $1/ fi - if [[ -f ${PKGDATADIR}/efi_shell/shellx64_v2.efi ]];then + if [[ -f ${DATADIR}/efi_shell/shellx64_v2.efi ]];then msg2 "Copying shellx64_v2.efi ..." - cp ${PKGDATADIR}/efi_shell/shellx64_v2.efi $1/ + cp ${DATADIR}/efi_shell/shellx64_v2.efi $1/ fi } @@ -34,11 +34,11 @@ set_mkinicpio_hooks(){ copy_initcpio(){ msg2 "Copying initcpio ..." - cp /usr/lib/initcpio/hooks/miso* $1/usr/lib/initcpio/hooks - cp /usr/lib/initcpio/install/miso* $1/usr/lib/initcpio/install - cp mkinitcpio.conf $1/etc/mkinitcpio-${iso_name}.conf - set_mkinicpio_hooks "$1/etc/mkinitcpio-${iso_name}.conf" - sed -e 's|"$@"|"$@" >/dev/null 2>&1|' -i $1/usr/lib/initcpio/init + cp /usr/lib/initcpio/hooks/miso* $2/usr/lib/initcpio/hooks + cp /usr/lib/initcpio/install/miso* $2/usr/lib/initcpio/install + cp $1/mkinitcpio.conf $2/etc/mkinitcpio-${iso_name}.conf + set_mkinicpio_hooks "$2/etc/mkinitcpio-${iso_name}.conf" + sed -e 's|"$@"|"$@" >/dev/null 2>&1|' -i $2/usr/lib/initcpio/init } # $1: work_dir @@ -251,33 +251,34 @@ write_isolinux_msg(){ } update_isolinux_cfg(){ - local fn=isolinux.cfg + local fn=$1/isolinux.cfg msg2 "Updating ${fn} ..." sed -i "s|%ISO_LABEL%|${iso_label}|g; s|%ISO_NAME%|${iso_name}|g; - s|%ARCH%|${arch}|g" $1/${fn} + s|%ARCH%|${arch}|g" $2/${fn} } update_isolinux_msg(){ - local fn=isolinux.msg + local fn=$1/isolinux.msg msg2 "Updating ${fn} ..." - sed -i "s|%DIST_NAME%|${dist_name}|g" $1/${fn} + sed -i "s|%DIST_NAME%|${dist_name}|g" $2/${fn} } write_isomounts(){ - echo '# syntax: <img> <arch> <mount point> <type> <kernel argument>' > $1 - echo '# Sample kernel argument in syslinux: overlay=extra,extra2' >> $1 - echo '' >> $1 + local file=$2/isomounts + echo '# syntax: <img> <arch> <mount point> <type> <kernel argument>' > ${file} + echo '# Sample kernel argument in syslinux: overlay=extra,extra2' >> ${file} + echo '' >> ${file} msg2 "Writing livecd entry ..." - echo "${arch}/livecd-image.sqfs ${arch} / squashfs" >> $1 - if [[ -f Packages-Mhwd ]] ; then + echo "${arch}/livecd-image.sqfs ${arch} / squashfs" >> ${file} + if [[ -f $1/Packages-Mhwd ]] ; then msg2 "Writing mhwd entry ..." - echo "${arch}/mhwd-image.sqfs ${arch} / squashfs" >> $1 + echo "${arch}/mhwd-image.sqfs ${arch} / squashfs" >> ${file} fi if [[ -f "${packages_custom}" ]] ; then msg2 "Writing ${custom} entry ..." - echo "${arch}/${custom}-image.sqfs ${arch} / squashfs" >> $1 + echo "${arch}/${custom}-image.sqfs ${arch} / squashfs" >> ${file} fi msg2 "Writing root entry ..." - echo "${arch}/root-image.sqfs ${arch} / squashfs" >> $1 + echo "${arch}/root-image.sqfs ${arch} / squashfs" >> ${file} } diff --git a/lib/util-iso-image.sh b/lib/util-iso-image.sh index 34e6371c472f26f5fedadc642df3e189d3d63b9c..f960c39975a03979998b1cb2b3f237ee2ee4be60 100644 --- a/lib/util-iso-image.sh +++ b/lib/util-iso-image.sh @@ -9,6 +9,51 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. +copy_overlay(){ + msg2 "Copying ${1##*/} ..." + if [[ -L $1 ]];then + cp -a --no-preserve=ownership $1/* $2 + else + cp -LR $1/* $2 + fi +} + +copy_startup_scripts(){ + msg2 "Copying startup scripts ..." + cp ${DATADIR}/scripts/livecd $1 + cp ${DATADIR}/scripts/mhwd-live $1 + chmod +x $1/livecd + chmod +x $1/mhwd-live +} + +write_profile_conf_entries(){ + local conf=$1/profile.conf + echo '' >> ${conf} + echo '# custom image name' >> ${conf} + echo "custom=${custom}" >> ${conf} + echo '' >> ${conf} + echo '# iso_name' >> ${conf} + echo "iso_name=${iso_name}" >> ${conf} +} + +copy_livecd_helpers(){ + msg2 "Copying livecd helpers ..." + [[ ! -d $1 ]] && mkdir -p $1 + cp ${LIBDIR}/util-livecd.sh $1 + cp ${LIBDIR}/util-msg.sh $1 + cp ${LIBDIR}/util.sh $1 + cp ${DATADIR}/scripts/kbd-model-map $1 + + cp ${profile_conf} $1 + + write_profile_conf_entries $1 +} + +copy_cache_mhwd(){ + msg2 "Copying mhwd package cache ..." + rsync -v --files-from="$1/cache-packages.txt" /var/cache/pacman/pkg "$1/opt/livecd/pkgs" +} + gen_pw(){ echo $(perl -e 'print crypt($ARGV[0], "password")' ${password}) } @@ -89,7 +134,7 @@ configure_lsb(){ configure_services(){ case ${initsys} in 'openrc') - msg3 "Congiguring [${initsys}] ...." + msg3 "Configuring [${initsys}] ...." for svc in ${start_openrc[@]}; do msg2 "Setting $svc ..." chroot $1 rc-update add $svc default &> /dev/null @@ -97,7 +142,7 @@ configure_services(){ msg3 "Done configuring [${initsys}]" ;; 'systemd') - msg3 "Congiguring [${initsys}] ...." + msg3 "Configuring [${initsys}] ...." for svc in ${start_systemd[@]}; do msg2 "Setting $svc ..." chroot $1 systemctl enable $svc &> /dev/null @@ -412,7 +457,7 @@ configure_livecd_image(){ } make_repo(){ - repo-add ${work_dir}/mhwd-image/opt/livecd/pkgs/gfx-pkgs.db.tar.gz ${work_dir}/mhwd-image/opt/livecd/pkgs/*pkg*z + repo-add $1/opt/livecd/pkgs/gfx-pkgs.db.tar.gz $1/opt/livecd/pkgs/*pkg*z } # $1: work dir diff --git a/lib/util-iso.sh b/lib/util-iso.sh index 2639b33ef5d5b9d368f365abfaaff467bb7ae14f..71ce232814c93840bef6c139f9396b853abc2c96 100644 --- a/lib/util-iso.sh +++ b/lib/util-iso.sh @@ -22,105 +22,6 @@ import_util_iso_fs(){ fi } -find_profile(){ - local result=$(find . -maxdepth 1 -name "$1") - [[ -z $result ]] && die "${buildset_iso} is not a valid profile or buildset!" -} - -# $1: path -# $2: exit code -check_profile(){ - find_profile "$1" - local keyfiles=('profile.conf' 'mkinitcpio.conf' 'Packages' 'Packages-Livecd') - local keydirs=('overlay' 'overlay-livecd' 'isolinux') - local has_keyfiles=false has_keydirs=false - for f in ${keyfiles[@]}; do - if [[ -f $1/$f ]];then - has_keyfiles=true - else - has_keyfiles=false - break - fi - done - for d in ${keydirs[@]}; do - if [[ -d $1/$d ]];then - has_keydirs=true - else - has_keydirs=false - break - fi - done - if ! ${has_keyfiles} && ! ${has_keydirs};then - die "Profile [$1] sanity check failed!" - fi -} - -check_requirements(){ - run check_profile "${buildset_iso}" - if ! $(is_valid_arch_iso ${arch});then - die "${arch} is not a valid arch!" - fi - if ! $(is_valid_branch ${branch});then - die "${branch} is not a valid branch!" - fi -} - -copy_overlay_root(){ - msg2 "Copying overlay ..." - cp -a --no-preserve=ownership overlay/* $1 -} - -copy_overlay_custom(){ - msg2 "Copying ${custom}-overlay ..." - cp -a --no-preserve=ownership ${custom}-overlay/* ${work_dir}/${custom}-image -} - -copy_overlay_livecd(){ - msg2 "Copying overlay-livecd ..." - if [[ -L overlay-livecd ]];then - cp -a --no-preserve=ownership overlay-livecd/* $1 - else - msg2 "Copying custom overlay-livecd ..." - cp -LR overlay-livecd/* $1 - fi -} - -copy_startup_scripts(){ - msg2 "Copying startup scripts ..." - cp ${PKGDATADIR}/scripts/livecd $1 - cp ${PKGDATADIR}/scripts/mhwd-live $1 - chmod +x $1/livecd - chmod +x $1/mhwd-live -} - -write_profile_conf_entries(){ - local conf=$1/profile.conf - echo '' >> ${conf} - echo '# custom image name' >> ${conf} - echo "custom=${custom}" >> ${conf} - echo '' >> ${conf} - echo '# iso_name' >> ${conf} - echo "iso_name=${iso_name}" >> ${conf} -} - -copy_livecd_helpers(){ - msg2 "Copying livecd helpers ..." - [[ ! -d $1 ]] && mkdir -p $1 - cp ${LIBDIR}/util-livecd.sh $1 - cp ${LIBDIR}/util-msg.sh $1 - cp ${LIBDIR}/util.sh $1 - cp ${PKGDATADIR}/scripts/kbd-model-map $1 - - cp ${profile_conf} $1 - - write_profile_conf_entries $1 -} - -copy_cache_mhwd(){ - msg2 "Copying mhwd package cache ..." - rsync -v --files-from="${work_dir}/mhwd-image/cache-packages.txt" /var/cache/pacman/pkg "${work_dir}/mhwd-image/opt/livecd/pkgs" -} - # $1: image path squash_image_dir() { if [[ ! -d "$1" ]]; then @@ -161,27 +62,27 @@ run_xorriso(){ if [[ -f "${work_dir}/iso/EFI/miso/${iso_name}.img" ]]; then msg2 "Setting efi args. El Torito detected." efi_boot_args=("-eltorito-alt-boot" - "-e EFI/miso/${iso_name}.img" - "-isohybrid-gpt-basdat" - "-no-emul-boot") + "-e EFI/miso/${iso_name}.img" + "-isohybrid-gpt-basdat" + "-no-emul-boot") fi xorriso -as mkisofs \ - -iso-level 3 -rock -joliet \ - -max-iso9660-filenames -omit-period \ - -omit-version-number \ - -relaxed-filenames -allow-lowercase \ - -volid "${iso_label}" \ - -appid "${iso_app_id}" \ - -publisher "${iso_publisher}" \ - -preparer "Prepared by manjaro-tools/${0##*/}" \ - -eltorito-boot isolinux/isolinux.bin \ - -eltorito-catalog isolinux/boot.cat \ - -no-emul-boot -boot-load-size 4 -boot-info-table \ - -isohybrid-mbr "${work_dir}/iso/isolinux/isohdpfx.bin" \ - ${efi_boot_args[@]} \ - -output "${cache_dir_iso}/${iso_file}" \ - "${work_dir}/iso/" + -iso-level 3 -rock -joliet \ + -max-iso9660-filenames -omit-period \ + -omit-version-number \ + -relaxed-filenames -allow-lowercase \ + -volid "${iso_label}" \ + -appid "${iso_app_id}" \ + -publisher "${iso_publisher}" \ + -preparer "Prepared by manjaro-tools/${0##*/}" \ + -eltorito-boot isolinux/isolinux.bin \ + -eltorito-catalog isolinux/boot.cat \ + -no-emul-boot -boot-load-size 4 -boot-info-table \ + -isohybrid-mbr "${work_dir}/iso/isolinux/isohdpfx.bin" \ + ${efi_boot_args[@]} \ + -output "${iso_dir}/${iso_file}" \ + "${work_dir}/iso/" } # Build ISO @@ -200,19 +101,17 @@ make_iso() { msg "Making bootable image" # Sanity checks [[ ! -d "${work_dir}/iso" ]] && die "[${work_dir}/iso] doesn't exist. What did you do?!" - if [[ -f "${cache_dir_iso}/${iso_file}" ]]; then + if [[ -f "${iso_dir}/${iso_file}" ]]; then msg2 "Removing existing bootable image..." - rm -rf "${cache_dir_iso}/${iso_file}" + rm -rf "${iso_dir}/${iso_file}" fi - run_xorriso - msg "Done [Build ISO]" } # $1: file make_checksum(){ - cd ${cache_dir_iso} + cd ${iso_dir} msg "Creating [${iso_checksum}sum] ..." local cs=$(${iso_checksum}sum $1) msg2 "${iso_checksum}sum: ${cs}" @@ -233,16 +132,24 @@ make_image_root() { die "Exit ${FUNCNAME}" fi - clean_up_image "${path}" pacman -Qr "${path}" > "${path}/root-image-pkgs.txt" + copy_overlay "${profile_dir}/overlay" "${path}" configure_root_image "${path}" - copy_overlay_root "${path}" ${is_custom_pac_conf} && clean_pacman_conf "${path}" + clean_up_image "${path}" : > ${work_dir}/build.${FUNCNAME} msg "Done [Base installation] (root-image)" fi } +gen_iso_fn(){ + if [[ ${initsys} == 'openrc' ]];then + echo "${iso_name}-${custom}-${initsys}-${dist_release}-${arch}" + else + echo "${iso_name}-${custom}-${dist_release}-${arch}" + fi +} + make_image_custom() { if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then msg "Prepare [${custom} installation] (${custom}-image)" @@ -257,13 +164,8 @@ make_image_custom() { fi pacman -Qr "${path}" > "${path}/${custom}-image-pkgs.txt" - if [[ ${initsys} == 'openrc' ]];then - local pkgs_file="${iso_name}-${custom}-${initsys}-${dist_release}-${arch}-pkgs.txt" - else - local pkgs_file="${iso_name}-${custom}-${dist_release}-${arch}-pkgs.txt" - fi - cp "${path}/${custom}-image-pkgs.txt" ${cache_dir_iso}/${pkgs_file} - [[ -d ${custom}-overlay ]] && copy_overlay_custom + cp "${path}/${custom}-image-pkgs.txt" ${iso_dir}/$(gen_iso_fn)-pkgs.txt + [[ -e ${profile_dir}/${custom}-overlay ]] && copy_overlay "${profile_dir}/${custom}-overlay" "${path}" configure_custom_image "${path}" ${is_custom_pac_conf} && clean_pacman_conf "${path}" @@ -293,7 +195,7 @@ make_image_livecd() { fi pacman -Qr "${path}" > "${path}/livecd-image-pkgs.txt" - copy_overlay_livecd "${path}" + copy_overlay "${profile_dir}/overlay-livecd" "${path}" # copy over setup helpers and config loader copy_livecd_helpers "${path}/opt/livecd" copy_startup_scripts "${path}/usr/bin" @@ -312,7 +214,7 @@ make_image_livecd() { make_image_mhwd() { if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then - msg "Prepare [mhwd-image]" + msg "Prepare [drivers repository] (mhwd-image)" local path="${work_dir}/mhwd-image" mkdir -p ${path}/opt/livecd/pkgs @@ -329,15 +231,15 @@ make_image_mhwd() { die "Exit ${FUNCNAME}" fi - copy_cache_mhwd + copy_cache_mhwd "${work_dir}/mhwd-image" if [[ -n "${packages_cleanup}" ]]; then for mhwd_clean in ${packages_cleanup}; do rm ${path}/opt/livecd/pkgs/${mhwd_clean} done fi - cp ${PKGDATADIR}/pacman-gfx.conf ${path}/opt/livecd - make_repo "${path}/opt/livecd/pkgs/gfx-pkgs" "${path}/opt/livecd/pkgs" + cp ${DATADIR}/pacman-gfx.conf ${path}/opt/livecd + make_repo "${path}" configure_mhwd_drivers "${path}" umount_image "${path}" @@ -347,7 +249,7 @@ make_image_mhwd() { rm -f "${path}/cache-packages.txt" : > ${work_dir}/build.${FUNCNAME} - msg "Done [mhwd-image]" + msg "Done [drivers repository] (mhwd-image)" fi } @@ -367,7 +269,7 @@ make_image_boot() { mount_root_image "${path}" fi - copy_initcpio "${path}" || die "Failed to copy initcpio." + copy_initcpio "${profile_dir}" "${path}" || die "Failed to copy initcpio." if ! gen_boot_image "${path}"; then umount_image "${path}" @@ -440,14 +342,13 @@ make_isolinux() { msg "Prepare [${iso_name}/iso/isolinux]" local path=${work_dir}/iso/isolinux mkdir -p ${path} - cp -a --no-preserve=ownership isolinux/* ${path} + copy_overlay "${profile_dir}/isolinux" "${path}" write_isolinux_cfg "${path}" write_isolinux_msg "${path}" - if [[ -e isolinux-overlay ]]; then - msg2 "isolinux overlay found. Overwriting files ..." - cp -a --no-preserve=ownership isolinux-overlay/* ${path} - update_isolinux_cfg "${path}" - update_isolinux_msg "${path}" + if [[ -e ${profile_dir}/isolinux-overlay ]]; then + copy_overlay "${profile_dir}/isolinux-overlay" "${path}" + update_isolinux_cfg "${profile_dir}" "${path}" + update_isolinux_msg "${profile_dir}" "${path}" fi copy_isolinux_bin "${work_dir}/root-image" "${path}" : > ${work_dir}/build.${FUNCNAME} @@ -458,7 +359,7 @@ make_isolinux() { make_isomounts() { if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then msg "Creating [isomounts]" - write_isomounts "${work_dir}/iso/${iso_name}/isomounts" + write_isomounts "${profile_dir}" "${work_dir}/iso/${iso_name}" : > ${work_dir}/build.${FUNCNAME} msg "Done creating [isomounts]" fi @@ -466,7 +367,7 @@ make_isomounts() { # $1: file name load_pkgs(){ - msg3 "Loading Packages: [$1] ..." + msg3 "Loading Packages: [${1##*/}] ..." local _init _init_rm _multi _nonfree_default _nonfree_multi _arch _arch_rm _nonfree_i686 _nonfree_x86_64 @@ -530,8 +431,8 @@ load_pkgs(){ local list if [[ $1 == "${packages_custom}" ]];then - sort -u ../shared/Packages-Desktop ${packages_custom} > ${work_dir}/${packages_custom} - list=${work_dir}/${packages_custom} + sort -u ${run_dir}/shared/Packages-Desktop ${packages_custom} > ${work_dir}/pkgs_merged + list=${work_dir}/pkgs_merged else list=$1 fi @@ -552,7 +453,7 @@ load_pkgs(){ | sed "$_kernel" \ | sed "$_clean") - if [[ $1 == 'Packages-Mhwd' ]]; then + if [[ ${1##*/} == 'Packages-Mhwd' ]]; then packages_cleanup=$(sed "$_com_rm" "$1" \ | grep cleanup \ | sed "$_purge_rm" \ @@ -562,22 +463,55 @@ load_pkgs(){ } check_custom_pacman_conf(){ - if [[ -f pacman-${pacman_conf_arch}.conf ]]; then - pacman_conf="pacman-${pacman_conf_arch}.conf" + if [[ -f $1/pacman-${pacman_conf_arch}.conf ]]; then + pacman_conf="$1/pacman-${pacman_conf_arch}.conf" is_custom_pac_conf=true else - pacman_conf="${PKGDATADIR}/pacman-${pacman_conf_arch}.conf" + pacman_conf="${DATADIR}/pacman-${pacman_conf_arch}.conf" is_custom_pac_conf=false fi } -check_profile_conf(){ +# $1: profile +check_profile_sanity(){ + local keyfiles=("$1/profile.conf" "$1/mkinitcpio.conf" "$1/Packages" "$1/Packages-Livecd") + local keydirs=("$1/overlay" "$1/overlay-livecd" "$1/isolinux") + local has_keyfiles=false has_keydirs=false + for f in ${keyfiles[@]}; do + if [[ -f $f ]];then + has_keyfiles=true + else + has_keyfiles=false + break + fi + done + for d in ${keydirs[@]}; do + if [[ -d $d ]];then + has_keydirs=true + else + has_keydirs=false + break + fi + done + if ! ${has_keyfiles} && ! ${has_keydirs};then + die "Profile [$1] sanity check failed!" + fi +} + +check_requirements(){ + [[ -f ${run_dir}/.buildiso ]] || die "${run_dir} is not a valid iso profiles directory!" + if ! $(is_valid_arch_iso ${arch});then + die "${arch} is not a valid arch!" + fi + if ! $(is_valid_branch ${branch});then + die "${branch} is not a valid branch!" + fi +} + +check_profile_vars(){ if ! is_valid_init "${initsys}";then die "initsys only accepts openrc/systemd value!" fi - if ! is_valid_edition "${edition_type}";then - die "edition_type only accepts official/community/community-minimal/sonar/netrunner value!" - fi if ! is_valid_bool "${autologin}";then die "autologin only accepts true/false value!" fi @@ -595,61 +529,65 @@ check_profile_conf(){ fi } -# $1: profile -load_profile(){ - msg3 "Profile: [$1]" - load_profile_config 'profile.conf' - check_profile_conf - local files=$(ls Packages*) +eval_custom(){ + local files=$(ls $1/Packages*) name for f in ${files[@]};do case $f in - Packages|Packages-Livecd|Packages-Mhwd) continue ;; + $1/Packages|$1/Packages-Livecd|$1/Packages-Mhwd) continue ;; *) packages_custom="$f" ;; esac done - custom=${packages_custom#*-} - custom=${custom,,} - if [[ ${initsys} == 'openrc' ]];then - iso_file="${iso_name}-${custom}-${initsys}-${dist_release}-${arch}.iso" - else - iso_file="${iso_name}-${custom}-${dist_release}-${arch}.iso" - fi + name=${packages_custom##*/} + name=${name#*-} + custom=${name,,} +} - check_custom_pacman_conf +# $1: profile +load_profile(){ + profile_dir=$1 + local prof=${1##*/} + msg3 "Profile: [$prof]" + check_profile_sanity "${profile_dir}" + load_profile_config "${profile_dir}/profile.conf" || die "${profile_dir} is not a valid profile!" + check_profile_vars + eval_custom "${profile_dir}" + + iso_file=$(gen_iso_fn).iso + + check_custom_pacman_conf "${profile_dir}" mkchroot_args+=(-C ${pacman_conf} -S ${mirrors_conf} -B "${build_mirror}/${branch}" -K) - work_dir=${chroots_iso}/$1/${arch} + work_dir=${chroots_iso}/$prof/${arch} - [[ -d ${work_dir}/root-image ]] && check_chroot_version "${work_dir}/root-image" + #[[ -d ${work_dir}/root-image ]] && check_chroot_version "${work_dir}/root-image" - remote_tree="${edition_type}/$1/${dist_release}/${arch}" + iso_dir="${cache_dir_iso}/${edition}/$prof/${dist_release}/${arch}" - cache_dir_iso="${cache_dir}/iso/${remote_tree}" - prepare_dir "${cache_dir_iso}" + prepare_dir "${iso_dir}" } compress_images(){ local timer=$(get_timer) make_iso make_checksum "${iso_file}" - chown -R "${OWNER}:users" "${cache_dir_iso}" + chown -R "${OWNER}:users" "${iso_dir}" msg3 "Time ${FUNCNAME}: $(elapsed_time ${timer}) minutes" } build_images(){ local timer=$(get_timer) - load_pkgs "Packages" + load_pkgs "${profile_dir}/Packages" make_image_root if [[ -f "${packages_custom}" ]] ; then load_pkgs "${packages_custom}" make_image_custom fi - if [[ -f Packages-Livecd ]]; then - load_pkgs "Packages-Livecd" + if [[ -f ${profile_dir}/Packages-Livecd ]]; then + load_pkgs "${profile_dir}/Packages-Livecd" make_image_livecd fi - if [[ -f Packages-Mhwd ]] ; then - load_pkgs 'Packages-Mhwd' + if [[ -f ${profile_dir}/Packages-Mhwd ]] ; then + load_pkgs "${profile_dir}/Packages-Mhwd" make_image_mhwd fi make_image_boot @@ -663,26 +601,24 @@ build_images(){ } make_profile(){ + eval_edition "$1" msg "Start building [$1]" - cd $1 - load_profile "$1" - import_util_iso_fs - ${clean_first} && chroot_clean "${work_dir}" - if ${iso_only}; then - [[ ! -d ${work_dir} ]] && die "Create images: buildiso -p ${buildset_iso} -i" - compress_images - exit 1 - fi - if ${images_only}; then - build_images - warning "Continue compress: buildiso -p ${buildset_iso} -sc ..." - exit 1 - else - build_images - compress_images - fi - cd .. + load_profile "${run_dir}/${edition}/$1" + import_util_iso_fs + ${clean_first} && chroot_clean "${work_dir}" + if ${iso_only}; then + [[ ! -d ${work_dir} ]] && die "Create images: buildiso -p $1 -i" + compress_images + exit 1 + fi + if ${images_only}; then + build_images + warning "Continue compress: buildiso -p $1 -sc ..." + exit 1 + else + build_images + compress_images + fi msg "Finished building [$1]" msg3 "Time ${FUNCNAME}: $(elapsed_time ${timer_start}) minutes" } - diff --git a/lib/util-pkg.sh b/lib/util-pkg.sh index f9caf755131c36427879dad114beac6b6b33f31a..2733e8b082d9629b557d62216f526044bd7845cf 100644 --- a/lib/util-pkg.sh +++ b/lib/util-pkg.sh @@ -29,7 +29,7 @@ load_group(){ _clean=':a;N;$!ba;s/\n/ /g' \ _com_rm="s|#.*||g" \ devel_packages='' \ - file=${PKGDATADIR}/base-devel-udev + file=${DATADIR}/base-devel-udev msg3 "Loading Group [$file] ..." @@ -96,8 +96,8 @@ chroot_update(){ clean_up(){ msg "Cleaning up ..." - msg2 "Cleaning [${cache_dir_pkg}]" - find ${cache_dir_pkg} -maxdepth 1 -name "*.*" -delete #&> /dev/null + msg2 "Cleaning [${pkg_dir}]" + find ${pkg_dir} -maxdepth 1 -name "*.*" -delete #&> /dev/null if [[ -z $SRCDEST ]];then msg2 "Cleaning [source files]" find $PWD -maxdepth 1 -name '*.?z?' -delete #&> /dev/null @@ -105,7 +105,7 @@ clean_up(){ } sign_pkg(){ - su ${OWNER} -c "signpkg ${cache_dir_pkg}/$1" + su ${OWNER} -c "signpkg ${pkg_dir}/$1" } run_post_build(){ @@ -120,24 +120,24 @@ run_post_build(){ if [[ -n $PKGDEST ]];then if [[ -n ${pkgbase} ]];then for p in ${pkgname[@]};do - mv $PKGDEST/${p}-${pinfo}.${ext} ${cache_dir_pkg}/ + mv $PKGDEST/${p}-${pinfo}.${ext} ${pkg_dir}/ ${sign} && sign_pkg ${p}-${pinfo}.${ext} loglist+=("*$p*.log") lname=${pkgbase} done else - mv $PKGDEST/${pkgname}-${pinfo}.${ext} ${cache_dir_pkg}/ + mv $PKGDEST/${pkgname}-${pinfo}.${ext} ${pkg_dir}/ ${sign} && sign_pkg ${pkgname}-${pinfo}.${ext} loglist+=("*${pkgname}*.log") lname=${pkgname} fi else - mv *.${ext} ${cache_dir_pkg} + mv *.${ext} ${pkg_dir} ${sign} && sign_pkg ${pkgname}-${pinfo}.${ext} loglist+=("*${pkgname}*.log") lname=${pkgname} fi - chown -R "${OWNER}:users" "${cache_dir_pkg}" + chown -R "${OWNER}:users" "${pkg_dir}" if [[ -z $LOGDEST ]];then tar -cjf ${lname}-${pinfo}.log.tar.xz ${loglist[@]} find $PWD -maxdepth 1 -name '*.log' -delete #&> /dev/null @@ -159,11 +159,10 @@ chroot_init(){ } make_pkg(){ - chroot_init msg "Start building [$1]" cd $1 setarch "${arch}" \ - mkchrootpkg ${mkchrootpkg_args[*]} || eval "$2" + mkchrootpkg ${mkchrootpkg_args[*]} || abort run_post_build cd .. msg "Finished building [$1]" diff --git a/lib/util-publish.sh b/lib/util-publish.sh index 42637cc2eca3088a0e7bfd56c398c6a81ddc9278..3dd691c114c02215e4474716984b82795e6d9399 100644 --- a/lib/util-publish.sh +++ b/lib/util-publish.sh @@ -10,26 +10,30 @@ # GNU General Public License for more details. create_subtree_ssh(){ - local tree=${remote_target}/${remote_project}/${remote_tree} + local tree=${remote_target}/${remote_project}/${remote_dir} ssh !${remote_user}@${shell_url} [[ ! -d $tree ]] && mkdir -pv $tree } create_subtree(){ - msg2 "Create (${edition_type}/$1) ..." - rsync ${rsync_args[*]} /dev/null ${sf_url}/${edition_type}/ - rsync ${rsync_args[*]} /dev/null ${sf_url}/${edition_type}/$1/ - rsync ${rsync_args[*]} /dev/null ${sf_url}/${edition_type}/$1/${dist_release}/ + msg2 "Create (${edition}/$1/${dist_release}) ..." + rsync ${rsync_args[*]} /dev/null ${sf_url}/${edition}/ + rsync ${rsync_args[*]} /dev/null ${sf_url}/${edition}/$1/ + rsync ${rsync_args[*]} /dev/null ${sf_url}/${edition}/$1/${dist_release}/ msg2 "Done" msg3 "Time ${FUNCNAME}: $(elapsed_time ${timer_start}) minutes" } +prepare_transfer(){ + remote_dir="${edition}/$1/${dist_release}/${arch}" + src_dir="${run_dir}/${remote_dir}" +} + sync_dir(){ - cd $1 - load_profile "$1" - ${remote_create} && create_subtree "$1" - msg "Start upload [$1] ..." - rsync ${rsync_args[*]} ${cache_dir_iso}/ ${sf_url}/${remote_tree}/ - msg "Done upload [$1]" - msg3 "Time ${FUNCNAME}: $(elapsed_time ${timer_start}) minutes" - cd .. + eval_edition "$1" + prepare_transfer "$1" + ${remote_create} && create_subtree "$1" + msg "Start upload [$1] (${arch}) ..." + rsync ${rsync_args[*]} ${src_dir}/ ${sf_url}/${remote_dir}/ + msg "Done upload [$1]" + msg3 "Time ${FUNCNAME}: $(elapsed_time ${timer_start}) minutes" } diff --git a/lib/util-sets.sh b/lib/util-sets.sh deleted file mode 100644 index a179f63161088d8c0bbf9d347dd8adf999fccd44..0000000000000000000000000000000000000000 --- a/lib/util-sets.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -create_set(){ - msg "[$1/${name}.set]" - if [[ -f $1/${name}.set ]];then - msg3 "Backing up $1/${name}.set.orig" - mv "$1/${name}.set" "$1/${name}.set.orig" - fi - local list=$(find * -maxdepth 0 -type d | sort) - for item in ${list[@]};do - if [[ -f $item/$2 ]];then - cd $item - msg2 "Adding ${item##*/}" - echo ${item##*/} >> $1/${name}.set || break - cd .. - fi - done -} - -get_deps(){ - echo $(pactree -u $1) -} - -calculate_build_order(){ - msg3 "Calculating build order ..." - for pkg in $(read_set $1/${name}.set);do - cd $pkg - mksrcinfo - cd .. - done -} - -remove_set(){ - if [[ -f $1/${name}.set ]]; then - msg "Removing [$1/${name}.set] ..." - rm $1/${name}.set - fi -} - -show_set(){ - local list=$(read_set $1/${name}.set) - msg "Content of [$1/${name}.set] ..." - for item in ${list[@]}; do - msg2 "$item" - done -} - diff --git a/lib/util.sh b/lib/util.sh index fb3797fbbcaf22397a7323f592ba83977bd93d7d..95b084a3a1150b4876a54e152f4e965fea23ce49 100644 --- a/lib/util.sh +++ b/lib/util.sh @@ -13,13 +13,13 @@ read_set(){ _clean=':a;N;$!ba;s/\n/ /g' \ _com_rm="s|#.*||g" - stack=$(sed "$_com_rm" "$1" \ + stack=$(sed "$_com_rm" "$1.set" \ | sed "$_space" \ | sed "$_clean") } # $1: sets_dir -load_sets(){ +list_sets(){ local prof temp for item in $(ls $1/*.set); do temp=${item##*/} @@ -28,14 +28,22 @@ load_sets(){ echo $prof } -# $1: buildset -# $2: sets_dir + +# $1: sets_dir +# $2: buildset eval_buildset(){ - eval "case $1 in - $(load_sets $2)) is_buildset=true ;; + eval "case $2 in + $(list_sets $1)) is_buildset=true ;; *) is_buildset=false ;; esac" - ${is_buildset} && read_set $2/$1.set + ${is_buildset} && read_set $1/$2 +} + +eval_edition(){ + local result=$(find ${run_dir} -maxdepth 2 -name "$1") path + [[ -z $result ]] && die "$1 is not a valid profile or buildset!" + path=${result%/*} + edition=${path##*/} } get_timer(){ @@ -97,22 +105,12 @@ version_gen(){ } version_gen2(){ - local y=$(date +%Y) m=$(date +%m) - local release_versions=($y.03 $y.06 $y.09 $y.12) - - for ver in ${release_versions[@]};do - case $m in - 01) dist_release=${y:2}.12.1 ;; - 02) dist_release=${y:2}.12.2 ;; - 03|06|09|12) dist_release=${y:2}.${ver#.*} ;; - 04) dist_release=${y:2}.03.1 ;; - 05) dist_release=${y:2}.03.2 ;; - 07) dist_release=${y:2}.06.1 ;; - 08) dist_release=${y:2}.06.2 ;; - 10) dist_release=${y:2}.09.1 ;; - 11) dist_release=${y:2}.09.2 ;; - esac - done + local y=$(date +%Y) m=$(date +%m) + case $month in + 01|04|07|10) dist_release=${y:2}.$m.1 ;; + 02|05|08|11) dist_release=${y:2}.$m.2 ;; + *) dist_release=${y:2}.$m ;; + esac } init_common(){ @@ -124,8 +122,6 @@ init_common(){ [[ -z ${chroots_dir} ]] && chroots_dir='/var/lib/manjaro-tools' - [[ -z ${sets_dir} ]] && sets_dir="${SYSCONFDIR}/sets" - [[ -z ${build_mirror} ]] && build_mirror='http://mirror.netzspielplatz.de/manjaro/packages' } @@ -144,28 +140,36 @@ init_buildtree(){ init_buildpkg(){ chroots_pkg="${chroots_dir}/buildpkg" - sets_dir_pkg="${sets_dir}/pkg.d" + sets_dir_pkg="${SYSCONFDIR}/pkg.d" prepare_dir "${sets_dir_pkg}" + [[ -d ${USERCONFDIR}/pkg.d ]] && sets_dir_pkg=${USERCONFDIR}/pkg.d + [[ -z ${buildset_pkg} ]] && buildset_pkg='default' + + cache_dir_pkg=${cache_dir}/pkg } init_buildiso(){ chroots_iso="${chroots_dir}/buildiso" - sets_dir_iso="${sets_dir}/iso.d" + sets_dir_iso="${SYSCONFDIR}/iso.d" prepare_dir "${sets_dir_iso}" + [[ -d ${USERCONFDIR}/iso.d ]] && sets_dir_iso=${USERCONFDIR}/iso.d + [[ -z ${buildset_iso} ]] && buildset_iso='default' + cache_dir_iso="${cache_dir}/iso" + ##### iso settings ##### if [[ -z ${dist_release} ]];then # source /etc/lsb-release # dist_release=${DISTRIB_RELEASE} - version_gen2 + version_gen fi if [[ -z ${dist_codename} ]];then @@ -196,6 +200,8 @@ init_buildiso(){ [[ -z ${use_overlayfs} ]] && use_overlayfs='true' used_kernel=$(uname -r | cut -d . -f1) [[ ${used_kernel} -lt "4" ]] && use_overlayfs='false' + + [[ -z ${profile_repo} ]] && profile_repo='manjaro-tools-iso-profiles' } init_deployiso(){ @@ -302,8 +308,6 @@ load_profile_config(){ start_openrc_live=('livecd' 'mhwd-live' 'pacman-init') fi - [[ -z ${edition_type} ]] && edition_type="official" - return 0 } @@ -314,6 +318,17 @@ clean_dir(){ fi } +write_repo_conf(){ + local repos=$(find $USER_HOME -type f -name ".buildiso") + local path name + + for r in ${repos[@]}; do + path=${r%/.*} + name=${path##*/} + echo run_dir=$path > ${USERCONFDIR}/$name.conf + done +} + load_user_info(){ OWNER=${SUDO_USER:-$USER} @@ -323,7 +338,14 @@ load_user_info(){ USER_HOME=$HOME fi - USER_CONFIG="$USER_HOME/.config" + USERCONFDIR="$USER_HOME/.config/manjaro-tools" + prepare_dir "${USERCONFDIR}" +} + +load_run_dir(){ + [[ -f ${USERCONFDIR}/$1.conf ]] || write_repo_conf + [[ -r ${USERCONFDIR}/$1.conf ]] && source ${USERCONFDIR}/$1.conf + return 0 } show_version(){ @@ -332,8 +354,8 @@ show_version(){ } show_config(){ - if [[ -f ${USER_CONFIG}/manjaro-tools.conf ]]; then - msg2 "user_config: ${USER_CONFIG}/manjaro-tools.conf" + if [[ -f ${USERCONFDIR}/manjaro-tools.conf ]]; then + msg2 "user_config: ${USERCONFDIR}/manjaro-tools.conf" else msg2 "manjaro_tools_conf: ${manjaro_tools_conf}" fi @@ -388,13 +410,6 @@ is_valid_init(){ esac } -is_valid_edition(){ - case $1 in - 'official'|'community'|'community-minimal'|'sonar'|'netrunner') return 0 ;; - *) return 1 ;; - esac -} - is_valid_arch_pkg(){ case $1 in 'i686'|'x86_64'|'multilib') return 0 ;; @@ -425,11 +440,3 @@ run(){ $1 $2 fi } - -run_svc(){ - if [[ -d /run/systemd ]];then - $@ - else - $@ - fi -}