Compare commits

..

79 commits

Author SHA1 Message Date
Stefano Capitani
d25fc42c5e
Revert "Now it works as expected" 2018-03-18 19:03:15 +01:00
Stefano Capitani
2612c97ed2
Merge pull request #284 from fhdk/master
Now it works as expected
2018-03-18 19:02:23 +01:00
Frede H
c390da8e34
Update util.sh 2018-03-18 19:01:26 +01:00
Frede H
2bc40b009e
Update util-iso.sh 2018-03-18 18:50:49 +01:00
Frede H
3aecbad7dc
Update util.sh 2018-03-18 18:48:58 +01:00
Stefano Capitani
59e04fc4d1
Merge pull request #282 from fhdk/master
Option to override `extra` option in profile
2018-03-18 18:24:07 +01:00
fhdk
266b8db157 -f build full_iso instead of -n no_extra 2018-03-18 18:11:17 +01:00
Frede H
c2933bb143
Update util-iso.sh
moved the minimal addition xxx-${dist_release}-unstable-minimal-${arch}
2018-03-18 14:12:46 +01:00
Frede H
610a63117e
Update util-iso.sh
fix : to ;
2018-03-18 14:09:22 +01:00
Frede H
acb144f1e3
Update buildiso.in
removed extra from verbose
2018-03-18 13:48:45 +01:00
fhdk
50f39a3b23 no_extra option added 2018-03-18 13:42:00 +01:00
Bernhard Landauer
369cb4b3e5 workaround locale errors 2017-09-04 04:52:45 +02:00
Philip Müller
d902379ade Merge pull request #274 from elishl/patch-1
Allow for site redirection
2017-08-25 12:44:19 +01:00
elishl
0a2f73993d Allow for site redirection
Sites (like sourceforge.com) use redirection.
The added parameter will take that into account.
2017-08-24 23:10:27 +03:00
Philip Müller
e85da8518c Merge pull request #272 from elishl/master
Reduce RAM usage for HTTP PXE boot
2017-07-03 10:48:31 +02:00
elishl
71e948ded2 Update miso 2017-07-02 17:20:22 +03:00
Bernhard Landauer
5f5b541a3c rm existing .sig file to avoid corrupted signature
https://forum.manjaro.org/t/troubleshooting-signature-errors-with-boxit/26178/
2017-06-24 03:09:39 +02:00
Philip Müller
5704e623e0 Merge pull request #271 from manjaro/revert-269-patch-2
Revert "Update pacman-multilib.conf"
2017-06-11 09:32:28 +02:00
Philip Müller
1c357b69ce Revert "Update pacman-multilib.conf" 2017-06-11 09:32:21 +02:00
Philip Müller
b5b6000852 Merge pull request #269 from Ste74/patch-2
Adjust pacman-multilib.conf
2017-06-11 09:27:15 +02:00
Philip
470773a9ce [util.sh] update os-release path 2017-06-09 09:43:48 +02:00
Stefano Capitani
620fe0655a Update pacman-multilib.conf
Same
2017-06-06 17:32:30 +02:00
udeved
22a3c4221b util-iso-chroot: clean up copy_from_cache() 2017-05-10 14:49:36 +02:00
udeved
e1b82cec3a util-iso-chroot: fix copy_from_cache(); fix svc config 2017-05-10 12:17:44 +02:00
udeved
913b9d874c util-iso-mount: clean up 2017-05-09 22:54:50 +02:00
udeved
1702ed7aea util-iso-chroot: fix typo 2017-05-09 22:54:30 +02:00
udeved
5f06a4dd5d util-iso-mount: use only one overlay mount function 2017-05-09 22:22:01 +02:00
udeved
bb34a7f6d0 util-iso-chroot: use local vars for params 2017-05-09 22:21:28 +02:00
udeved
8046b1f4b1 buildiso: unify chroot locking 2017-05-08 18:19:36 +02:00
udeved
984d5adde4 doc: update buildpkg 2017-05-08 01:18:52 +02:00
udeved
3278c1df91 buildiso: reestore default error handling 2017-05-08 01:09:47 +02:00
udeved
ab5d0deb47 Merge branch 'master' of github.com:manjaro/manjaro-tools 2017-05-08 00:48:22 +02:00
udeved
d734e5457c remove buildlist display 2017-05-08 00:47:29 +02:00
Philip
1648288c9f [util-yaml] work on CAL#695
- see also: https://github.com/calamares/calamares/issues/695
2017-05-07 22:08:33 +02:00
udeved
94fcd520c5 util-iso: rename local vars to be more descriptive 2017-05-07 16:59:58 +02:00
udeved
aef651518a buildpkg & buildiso: move mkchroot_args 2017-05-07 13:46:13 +02:00
udeved
15cfc351e8 util-iso-chroot: rm obsolete lock 2017-05-06 15:56:45 +02:00
udeved
59294cf2a7 update mt.conf
update readme
2017-05-06 15:56:15 +02:00
udeved
95f296acde lib: set tmp_dir=/tmp 2017-05-06 15:49:39 +02:00
elishl
aa84e639a3 Corrections for PXE boot (#266)
* Correction for a faulty condition

The current condition works for checking existence of the .sfs files on the local file system.
The proposed condition checks for the existence of the .sfs files on a remote server.

* Correction for NFS & NBD & HTTP boot

By default, Calamares searches for the .sfs files in the "bootmnt" directory.
When "copytoram==y" (relevant for NFS & NBD & HTTP boot), the .sfs files are stored in the "copytoram" directory.
The proposed code binds the "copytoram" dir with "bootmnt" so Calamares can "see" the .sfs. files.
2017-05-06 14:38:13 +02:00
udeved
1b50455b51 Merge branch 'master' of github.com:manjaro/manjaro-tools 2017-05-06 09:57:25 +02:00
udeved
254bcfd10f check-yaml: move tmp_dir creation 2017-05-06 09:57:01 +02:00
Nate
0b5482f7f0 Added spaces between hashes and the text (#265)
Most (if not all) of the headers in this document were missing a space between the text and the hashes. This was causing problems. By adding these spaces, the headers will get rendered correctly.
2017-05-05 10:39:36 +02:00
udeved
6f00ee26bb update readme 2017-05-04 18:24:41 +02:00
udeved
21d5a1a0d6 buildpkg: clean proper dir 2017-05-04 18:10:06 +02:00
udeved
1d3003ecd9 buildpkg & buildiso: several fixes 2017-04-30 09:13:19 +02:00
udeved
a8c3d88d8c use shared create_chroot() and delete_chroot code in mkchrootpkg, buildpkg and buildiso 2017-04-29 22:19:23 +02:00
udeved
333d307a44 buildiso: remove obsolete load_profile() 2017-04-28 11:29:40 +02:00
udeved
ad7715c3b6 buildiso: add prepare_build() 2017-04-28 10:30:34 +02:00
udeved
7fdcb0fcb3 util-pkg-chroot: shorten group loading 2017-04-28 02:39:11 +02:00
udeved
7aa3c071eb buildpkg: simplfy devel group loading
util-*-chroot: small fixes
2017-04-28 00:30:12 +02:00
udeved
711397a74c update readme 2017-04-27 18:42:42 +02:00
udeved
952f516389 util-*-chroot: minor changes 2017-04-27 15:13:22 +02:00
udeved
28c6d649aa util-iso: import util-chroot 2017-04-27 12:01:26 +02:00
udeved
d84f30aa08 buildpkg: make chroot creation and handling more convenient 2017-04-27 10:55:47 +02:00
udeved
69445b01f5 util-*-chroot: update chroot_clean() 2017-04-26 22:56:49 +02:00
udeved
3828892808 signfile, checkpkg: add load_user_info() 2017-04-20 15:24:23 +02:00
udeved
17b8b418ab mt: reorganize libs 2017-04-19 21:55:43 +02:00
udeved
ecf8a998dc start mt-0.16 2017-04-19 21:30:01 +02:00
udeved
470e64b563 mt: use xdg_config_home for mt.conf and makepkg.conf 2017-04-19 20:37:01 +02:00
udeved
ad13419fbe fstabgen: correct help msg 2017-04-19 19:02:58 +02:00
udeved
c225d41f87 fstabgen, basestrap: backport minor arch changes 2017-04-19 15:29:12 +02:00
artoo
ed8de0f88d Arch patch (#264)
* initial arch backport

* fix args

* chroot-run: remove commented code
mkchrootpkg: update help

* lib: nove lock functions to util-msg

* mkchrootpkg: fix namcap, should go upstream
2017-04-19 08:58:04 +02:00
udeved
bf2ddc1e1d util-iso-boot: fix param 2017-04-02 17:56:23 +02:00
udeved
d455564eb6 util-iso-boot: make the copy paths more structured 2017-04-02 16:56:52 +02:00
Philip
a4fc8325df [util-iso-boot] really proper last commit 2017-04-02 15:00:12 +02:00
Philip
b121fe7490 [util-iso-boot] proper last commit 2017-04-02 14:53:35 +02:00
Philip
518992d723 [util-iso-boot] fix issue with i686 build on x86_64 host 2017-04-02 14:47:21 +02:00
udeved
a1492e8d1e util-iso: set the grub theme by $iso_name 2017-03-31 17:45:16 +02:00
udeved
25ddeb1593 doc: remove obsolete entry from deployiso
util-yaml: formating fix
2017-03-30 23:21:17 +02:00
udeved
37b9feb061 util-iso: clean up assemble_iso() 2017-03-30 23:07:09 +02:00
udeved
93626731c7 util-iso-boot: remove grub video dir 2017-03-30 15:51:44 +02:00
Philip
9533b8ce93 [util-iso] try to fix issue with efi.img 2017-03-30 00:34:24 +02:00
udeved
ed95e249a2 util-iso: don't create mod_dte file for now 2017-03-29 22:19:44 +02:00
udeved
8a5fc4e0b0 util-iso: fox mod_date length 2017-03-29 21:53:47 +02:00
udeved
734ea24b57 util-iso: readd xorriso args 2017-03-29 21:48:38 +02:00
udeved
d477c42ecb util-iso-boot: reduce efi.img size 2017-03-29 21:48:00 +02:00
udeved
92aaea7694 util-iso-*: put grub-theme in livefs 2017-03-29 20:47:17 +02:00
udeved
187aac2a35 util-iso: try to fix uefi usb boot 2017-03-29 19:03:29 +02:00
60 changed files with 2025 additions and 3287 deletions

1
.gitignore vendored
View file

@ -1,4 +1,3 @@
.idea
*~
*.tar.gz
*.tar.xz

View file

@ -1,11 +1,10 @@
Version=0.15.14
Version=0.16.0
PREFIX = /usr/local
SYSCONFDIR = /etc
SYSCONF = \
data/manjaro-tools.conf \
data/branding.desc.d
data/manjaro-tools.conf
BIN_BASE = \
bin/mkchroot \
@ -13,13 +12,13 @@ BIN_BASE = \
bin/manjaro-chroot \
bin/fstabgen \
bin/signfile \
bin/chroot-run \
bin/check-yaml
bin/chroot-run
LIBS_BASE = \
lib/util.sh \
lib/util-mount.sh \
lib/util-msg.sh \
lib/util-chroot.sh \
lib/util-fstab.sh
SHARED_BASE = \
@ -47,7 +46,8 @@ LIBS_PKG = \
$(wildcard lib/util-pkg*.sh)
SHARED_PKG = \
data/makepkg.conf
data/makepkg.conf \
data/base-devel-udev
LIST_ISO = \
$(wildcard data/iso.list.d/*.list)
@ -55,8 +55,7 @@ LIST_ISO = \
BIN_ISO = \
bin/buildiso \
bin/testiso \
bin/deployiso \
bin/signiso
bin/deployiso
LIBS_ISO = \
$(wildcard lib/util-iso*.sh) \

174
README.md
View file

@ -1,8 +1,6 @@
manjaro-tools
=============
Manjaro-tools-0.15
User manual
### 1. manjaro-tools.conf
@ -56,7 +54,7 @@ overriding
# default target branch
# target_branch=stable
# default target arch: auto detect
# default taget arch: auto detect
# target_arch=$(uname -m)
# cache dir where buildpkg, buildtree cache packages/pkgbuild, builiso iso files
@ -65,16 +63,13 @@ overriding
# build dir where buildpkg or buildiso chroots are created
# chroots_dir=/var/lib/manjaro-tools
# log dir where log files are created
# log_dir='/var/log/manjaro-tools'
# custom build mirror server
# build_mirror=https://manjaro.moson.eu
# build_mirror=http://mirror.netzspielplatz.de/manjaro/packages
################ buildtree ###############
# manjaro package tree
# repo_tree=('core' 'extra' 'community' 'multilib')
# repo_tree=('core' 'extra' 'community' 'multilib' 'openrc')
# host_tree=https://github.com/manjaro
@ -88,77 +83,40 @@ overriding
################ buildiso ################
#default branch for iso-profiles repo: v17.1>current release | master>development release
# branch=v17.1
# default iso build list; name without .list extension
# build_list_iso=default
# the dist release; default: auto
# dist_release=auto
# dist_release=17.0
# the branding; default: auto
# dist_branding="MANJARO"
# dist_branding="MJRO"
# possible values: openrc,systemd
# initsys="systemd"
# unset defaults to given value
# kernel="linux54"
# kernel="linux49"
# gpg key; leave empty or commented to skip sfs signing
# gpgkey=""
########## calamares preferences ##########
#See branding.desc.d for reference
# welcome style for calamares: true="Welcome to the %1 installer." ; false="Welcome to the Calamares installer for %1." (default)
# welcomestyle=false
# welcome image scaled (productWelcome)
# welcomelogo=true
# size and expansion policy for Calamares (possible value: normal,fullscreen,noexpand)
# windowexp=noexpand
# size of Calamares window, expressed as w,h.
# (possible units: pixel (px) or font-units (em))
# windowsize="800px,520px"
# colors for text and background components:
# background of the sidebar
# sidebarbackground=#454948
# text color
# sidebartext=#efefef
# background of the selected step
# sidebartextselect=#4d915e
# text color of the selected step
# sidebartexthighlight=#1a1c1b
################ deployiso ################
# the server user
# account=[SetUser]
# Set to 'true' to use ssh-agent to store passphrase.
# ssh_agent=false
# use alternative storage server (one or the other might be more stable)
# alt_storage=false
# the server project: manjaro|manjaro-community
# determined automatically based on profile if unset
# project="[SetProject]"
# set upload bandwidth limit in kB/s
# limit=
# limit=100
# the torrent tracker urls, comma separated
# tracker_url='udp://mirror.strits.dk:6969'
# Piece size, 2^n
# piece_size=21
# iso mirrors
# iso_mirrors=('heanet' 'jaist' 'netcologne' 'iweb' 'kent')
~~~
### 2. buildpkg
@ -173,18 +131,22 @@ It it run in a abs/pkgbuilds directory which contains directories with PKGBUILD.
~~~
$ buildpkg -h
Usage: buildpkg [options]
-p <pkg> Build list or pkg [default: default]
-a <arch> Arch [default: auto]
-b <branch> Branch [default: stable]
-c Recreate chroot
-h This help
-i <pkg> Install a package into the working copy of the chroot
-n Install and run namcap check
-p <pkg> Buildset or pkg [default: default]
-q Query settings and pretend build
-r <dir> Chroots directory
[default: /var/lib/manjaro-tools/buildpkg]
-s Sign packages
-i <pkgs> Install packages into the working copy of the chroot
-o Create chroot
-d Delete chroot
-c Clean chroot copy
-u Update chroot copy
-w Clean up cache and sources
-n Install and run namcap check
-s Sign packages
-x Udev base-devel group (no systemd)
-q Query settings and pretend build
-h This help
~~~
###### * build sysvinit package for both arches and branch testing:
@ -208,14 +170,17 @@ The arch can also be set in manjaro-tools.conf, but under normal conditions, it
* Removes the chroot dir
* If the -c parameter is not used, buildpkg will update the existing chroot or create a new one if none is present.
###### * -n
* Installs the built package in the chroot and runs a namcap check
###### * -w
* Cleans pkgcache, and logfiles
###### * -s
* Signs the package when built
###### * -w
* Cleans pkgcache, and logfiles
###### * -n
* Installs the built package in the chroot and runs a namcap check
###### * -u
* Create udev build root (for eudev builds)
### 3. buildiso
@ -223,6 +188,7 @@ buildiso is used to build manjaro-iso-profiles. It is run insde the profiles fol
##### Packages for livecd only:
* manjaro-livecd-openrc
* manjaro-livecd-systemd
#### Arguments
@ -230,41 +196,31 @@ buildiso is used to build manjaro-iso-profiles. It is run insde the profiles fol
~~~
$ buildiso -h
Usage: buildiso [options]
-i Initialize iso-profiles repo [default: v17.1]"
-p <profile> Buildset or profile [default: default]
-a <arch> Arch [default: auto]
-b <branch> Branch [default: stable]
-c Disable clean work dir
-f Build full ISO (extra=true)
-g <key> The gpg key for sfs signing
[default: empty]
-h This help
-k <name> Kernel to use
[default: linux49]
-l Create permalink
-m Set SquashFS image mode to persistence
-o Enable office installer
-p <profile> Buildset or profile [default: default]
-q Query settings and pretend build
-r <dir> Chroots directory
[default: /var/lib/manjaro-tools/buildiso]
-t <dir> Target directory
[default: /var/cache/manjaro-tools/iso]
-v Verbose output to log file, show profile detail (-q)
-k <name> Kernel to use
[default: linux49]
-i <name> Init system to use
[default: systemd]
-g <key> The gpg key for sfs signing
[default: empty]
-m Set SquashFS image mode to persistence
-c Disable clean work dir
-x Build images only
-z Generate iso only
Requires pre built images (-x)
-v Verbose output to log file, show profile detail (-q)
-q Query settings and pretend build
-h This help
~~~
###### * build xfce iso profile for both arches and branch testing on x86_64 build system
* Remember: if you run buildiso for the first time you need to do:
~~~
buildiso -i
~~~
for download in /usr/share/manjaro-tools/iso-profiles our manjaro profiles. You can override in manjaro-tools.conf what branch use with buildiso: v17.1 or master ( development profiles ). The previous command can be used to refresh the profiles as needed in your local.
* i686 (buildsystem is x86_64)
~~~
@ -297,14 +253,15 @@ yaml files are used by calamares netinstall option from a specified url(netgroup
~~~
$ check-yaml -h
Usage: check-yaml [options]
-p <profile> Buildset or profile [default: default]
-a <arch> Arch [default: auto]
-k <name> Kernel to use[default: linux44]
-i <name> Init system to use [default: systemd]
-c Check also calamares yaml files generated for the profile
-g Enable pacman group accepted for -p
-h This help
-k <name> Kernel to use[default: linux44]
-p <profile> Buildset or profile [default: default]
-q Query settings
-v Validate by schema
-q Query settings
-h This help
~~~
###### * build xfce iso profile for both arches and branch testing on x86_64 build system
@ -343,11 +300,11 @@ buildtree is a little tools to sync arch abs and manjaro PKGBUILD git repos.
~~~
$ buildtree -h
Usage: buildtree [options]
-s Sync manjaro tree
-a Sync arch abs
-c Clean package tree
-h This help
-q Query settings
-s Sync manjaro tree
-h This help
~~~
###### * sync arch and manjaro trees
@ -368,8 +325,8 @@ If there is only 1 system installed besides the host system, no list will pop up
$ manjaro-chroot -h
usage: manjaro-chroot -a [or] manjaro-chroot chroot-dir [command]
-a Automount detected linux system
-h Print this help message
-q Query settings and pretend
-h Print this help message
If 'command' is unspecified, manjaro-chroot will launch /bin/sh.
@ -391,37 +348,34 @@ manjaro-chroot /mnt /bin/bash
### 7. deployiso
deployiso is a script to upload a specific iso or a buiildset to OSDN.
deployiso is a script to upload a specific iso or a buiildset to SF.
It needs to be run inside the iso-profiles directory.
Ideally, you have a running ssh agent on the host, and your key added, and your public key provided to your SF account. You can then upload without being asked for ssh password.
#### Arguments
~~~
$ deployiso -h
Usage: deployiso [options]
-d Use hidden remote directory
-h This help
-l Limit bandwidth in kB/s [default:]
-p Source folder to upload [default:default]
-q Query settings and pretend upload
-s Sign ISO and create checksums
-t Create ISO torrent
-l Limit bandwidth in kB/s [default:80]
-c Create new remote release directory
-u Update remote directory
-t Create iso torrent
-q Query settings and pretend upload
-v Verbose output
-z Upload permalinks (shell.osdn.net)
-h This help
~~~
###### * upload official build list, ie all built iso defined in a build list
~~~
deployiso -p official
deployiso -p official -c
~~~
###### * upload sign xfce ISO file, create checksums, create torrent and upload to hidden directory
###### * upload xfce
~~~
deployiso -p xfce -std
deployiso -p xfce -c
~~~
##### Fast compression
Lz4 Is very fast but not a good compression ratio, good for testing

View file

@ -19,6 +19,7 @@ LIBDIR='@libdir@'
import ${LIBDIR}/util.sh
import ${LIBDIR}/util-mount.sh
import ${LIBDIR}/util-chroot.sh
newroot=/mnt
@ -44,22 +45,21 @@ usage() {
}
# if [[ -z $1 || $1 = @(-h|--help) ]]; then
# usage
# exit $(( $# ? 0 : 1 ))
# usage
# exit $(( $# ? 0 : 1 ))
# fi
#
orig_argv=("$@")
orig_argv=("$0" "$@")
opts=':C:cdGiM'
while getopts ${opts} arg; do
case "${arg}" in
c) hostcache=true ;;
C) pacman_config=$OPTARG ;;
d) directory=true ;;
G) copykeyring=false ;;
c) hostcache=true ;;
i) interactive=true ;;
G) copykeyring=false ;;
M) copymirrorlist=false ;;
:) echo "invalid argument ${arg}:$OPTARG"; usage 1;;
?) usage 0 ;;
@ -67,7 +67,7 @@ while getopts ${opts} arg; do
done
shift $(( OPTIND - 1 ))
check_root "$0" "${orig_argv[@]}"
check_root
(( $# )) || die "No root directory specified"
newroot=$1; shift
@ -82,7 +82,7 @@ ${interactive} && pacman_args+=(--noconfirm)
[[ -d $newroot ]] || die "%s is not a directory" "$newroot"
if ! mountpoint -q "$newroot" && ! ${directory}; then
die '%s is not a mountpoint!' "$newroot"
die '%s is not a mountpoint!' "$newroot"
fi
# create obligatory directories
@ -97,13 +97,13 @@ if ! pacman -r "$newroot" -Sy "${pacman_args[@]}"; then
fi
# kill chroot process if needed (TODO: check if needed at all)
kill_chroot_process "$newroot"
# kill_chroot_process "$newroot"
if ${copykeyring}; then
if ${copykeyring};then
copy_keyring "$newroot"
fi
if ${copymirrorlist}; then
if ${copymirrorlist};then
copy_mirrorlist "$newroot"
fi

165
bin/buildiso.in Normal file → Executable file
View file

@ -16,47 +16,76 @@ DATADIR='@datadir@'
SYSCONFDIR='@sysconfdir@'
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
import ${LIBDIR}/util.sh
import ${LIBDIR}/util-iso.sh
import ${LIBDIR}/util-iso-mount.sh
prepare_build(){
timer_start=$(get_timer)
profile=$1
edition=$(get_edition "${profile}")
profile_dir=${run_dir}/${edition}/${profile}
check_profile "${profile_dir}"
load_profile_config "${profile_dir}/profile.conf"
local pacman_conf=$(get_pacman_conf)
local mirrors_conf=$(get_pac_mirrors_conf "${target_branch}")
iso_file=$(gen_iso_fn).iso
local mirror="${build_mirror}/${target_branch}"
mkchroot_args+=(-C ${pacman_conf} -S ${mirrors_conf} -B "${mirror}" -K)
work_dir=${chroots_iso}/${profile}/${target_arch}
iso_dir="${cache_dir_iso}/${edition}/${profile}/${dist_release}"
iso_root=${chroots_iso}/${profile}/iso
mnt_dir=${chroots_iso}/${profile}/mnt
prepare_dir "${mnt_dir}"
prepare_dir "${iso_dir}"
user_own "${iso_dir}"
}
show_profile(){
prepare_profile "$1"
local prof="$1"
prepare_build "$prof"
msg2 "iso_file: %s" "${iso_file}"
msg2 "iso_label: %s" "${iso_label}"
if ${verbose}; then
if ${verbose};then
msg2 "autologin: %s" "${autologin}"
msg2 "nonfree_mhwd: %s" "${nonfree_mhwd}"
[[ ${target_arch} == 'x86_64' ]] && msg2 "multilib: %s" "${multilib}"
msg2 "extra: %s" "${extra}"
msg2 "office_installer: %s" "${office_installer}"
msg2 "permalink: %s" "${permalink}"
msg2 "netinstall: %s" "${netinstall}"
msg2 "chrootcfg: %s" "${chrootcfg}"
${netinstall} && msg2 "netgroups: %s" "$(get_yaml)"
msg2 "geoip: %s" "${geoip}"
msg2 "oem_used: %s" "${oem_used}"
msg2 "efi_boot_loader: %s" "${efi_boot_loader}"
msg2 "custom_boot_args: %s" "${custom_boot_args}"
msg2 "hostname: %s" "${hostname}"
msg2 "username: %s" "${username}"
msg2 "password: %s" "${password}"
msg2 "user_shell: %s" "${user_shell}"
msg2 "login_shell: %s" "${login_shell}"
msg2 "addgroups: %s" "${addgroups}"
[[ -n ${smb_workgroup} ]] && msg2 "smb_workgroup: %s" "${smb_workgroup}"
msg2 "enable_systemd: %s" "${enable_systemd[*]}"
msg2 "enable_systemd_timers: %s" "${enable_systemd_timers[*]}"
msg2 "enable_systemd_live: %s" "${enable_systemd_live[*]}"
[[ -n ${disable_systemd[*]} ]] && msg2 "disable_systemd: %s" "${disable_systemd[*]}"
msg2 "strict_snaps: %s" "${strict_snaps}"
msg2 "classic_snaps: %s" "${classic_snaps}"
msg2 "snap_channel: %s" "${snap_channel}"
if [[ ${initsys} == 'systemd' ]];then
msg2 "enable_systemd: %s" "${enable_systemd[*]}"
msg2 "enable_systemd_live: %s" "${enable_systemd_live[*]}"
[[ -n ${disable_systemd[*]} ]] && msg2 "disable_systemd: %s" "${disable_systemd[*]}"
else
msg2 "enable_openrc: %s" "${enable_openrc[*]}"
msg2 "enable_openrc_live: %s" "${enable_openrc_live[*]}"
[[ -n ${disable_openrc[*]} ]] && msg2 "disable_openrc: %s" "${disable_openrc[*]}"
fi
fi
reset_profile
}
@ -65,15 +94,15 @@ display_settings(){
show_version
show_config
msg "PROFILE:"
msg2 "gitlab branch: %s" "${branch}"
msg2 "build_lists: %s" "$(show_build_lists ${list_dir_iso})"
msg2 "build_list_iso: %s" "${build_list_iso}"
# msg "PROFILE:"
# msg2 "build_lists: %s" "$(show_build_lists ${list_dir_iso})"
# msg2 "build_list_iso: %s" "${build_list_iso}"
msg2 "is_build_list: %s" "${is_build_list}"
msg "OPTIONS:"
msg2 "arch: %s" "${target_arch}"
msg2 "branch: %s" "${target_branch}"
msg2 "initsys: %s" "${initsys}"
msg2 "kernel: %s" "${kernel}"
[[ -n ${gpgkey} ]] && msg2 "gpgkey: %s" "${gpgkey}"
@ -82,9 +111,6 @@ display_settings(){
msg2 "images_only: %s" "${images_only}"
msg2 "iso_only: %s" "${iso_only}"
msg2 "persist: %s" "${persist}"
msg2 "extra: %s" "${full_iso}"
msg2 "permalink: %s" "${permalink}"
msg2 "office_installer: %s" "${office_installer}"
msg "DIST SETTINGS:"
msg2 "dist_name: %s" "${dist_name}"
@ -92,7 +118,7 @@ display_settings(){
msg2 "dist_codename: %s" "${dist_codename}"
msg "ISO INFO:"
msg2 "iso_compression: %s" "${iso_compression}"
msg2 "iso_label: %s" "${iso_label}"
msg "BUILD QUEUE:"
run show_profile "${build_list_iso}"
@ -100,10 +126,7 @@ display_settings(){
load_user_info
load_config "${USERCONFDIR}/manjaro-tools.conf" || load_config "${SYSCONFDIR}/manjaro-tools.conf"
# to force old way to have buildiso run in iso-profiles dir
# run_dir=$(pwd)
load_config "${MT_USERCONFDIR}/manjaro-tools.conf" || load_config "${SYSCONFDIR}/manjaro-tools.conf"
load_run_dir "${profile_repo}"
@ -113,67 +136,59 @@ images_only=false
iso_only=false
verbose=false
persist=false
initialize=false
permalink=false
mkchroot_args=(-L)
usage() {
echo "Usage: ${0##*/} [options]"
echo " -p <profile> Buildset or profile [default: ${build_list_iso}]"
echo " -a <arch> Arch [default: ${target_arch}]"
echo " -b <branch> Branch [default: ${target_branch}]"
echo ' -c Disable clean work dir'
echo ' -d <comp> Compression used for build ISO: gzip, lzma, lz4, lzo, xz, zstd'
echo " [default: ${iso_compression}]"
echo ' -f Build full ISO (extra=true)'
echo ' -g <key> The gpg key for sfs signing'
echo " [default: ${gpgkey}]"
echo " -i Initialize iso-profiles repo [default: ${branch}]"
echo ' -k <name> Kernel to use'
echo " [default: ${kernel}]"
echo ' -l Create permalink'
echo ' -m Set SquashFS image mode to persistence'
echo ' -n Disable multilib'
echo " -p <profile> Buildset or profile [default: ${build_list_iso}]"
echo ' -o Enable office installer module'
echo ' -q Query settings and pretend build'
echo ' -r <dir> Chroots directory'
echo " [default: ${chroots_iso}]"
echo ' -t <dir> Target directory'
echo " [default: ${cache_dir_iso}]"
echo ' -v Verbose output to log file, show profile detail (-q)'
echo ' -k <name> Kernel to use'
echo " [default: ${kernel}]"
echo ' -i <name> Init system to use'
echo " [default: ${initsys}]"
echo ' -g <key> The gpg key for sfs signing'
echo " [default: ${gpgkey}]"
echo ' -m Set SquashFS image mode to persistence'
echo ' -c Disable clean work dir'
echo ' -f Build full iso (extra=true)'
echo ' -x Build images only'
echo ' -z Generate iso only'
echo ' Requires pre built images (-x)'
echo ' -v Verbose output to log file, show profile detail (-q)'
echo ' -q Query settings and pretend build'
echo ' -h This help'
echo ''
echo ''
exit $1
}
orig_argv=("$@")
orig_argv=("$0" "$@")
opts='p:a:b:r:t:k:g:d:cfzxmnvqhilo'
opts='p:a:b:r:t:k:i:g:cfzxmvqh'
while getopts "${opts}" arg; do
case "${arg}" in
i) initialize=true ;;
p) build_list_iso="$OPTARG" ;;
a) target_arch="$OPTARG" ;;
b) target_branch="$OPTARG" ;;
c) clean_first=false ;;
f) full_iso=true ;;
d) iso_compression="$OPTARG" ;;
g) gpgkey="$OPTARG" ;;
k) kernel="$OPTARG" ;;
m) persist=true ;;
n) no_multilib=true ;; # only exist if set here
p) build_list_iso="$OPTARG" ;;
q) pretend=true ;;
r) chroots_iso="$OPTARG" ;;
t) cache_dir_iso="$OPTARG" ;;
v) verbose=true ;;
k) kernel="$OPTARG" ;;
i) initsys="$OPTARG" ;;
g) gpgkey="$OPTARG" ;;
c) clean_first=false ;;
f) full_iso=true ;;
x) images_only=true ;;
z) iso_only=true ;;
l) permalink=true ;;
o) office_installer=true ;;
m) persist=true ;;
v) verbose=true ;;
q) pretend=true ;;
h|?) usage 0 ;;
*) echo "invalid argument '${arg}'"; usage 1 ;;
esac
@ -181,36 +196,10 @@ done
shift $(($OPTIND - 1))
if ${initialize}; then
msg "Initialize iso profiles ${branch}"
init_profiles
msg2 "Done: iso profiles are stored in /usr/share/manjaro-tools/iso-profiles"
exit 1
fi
timer_start=$(get_timer)
check_root "$0" "${orig_argv[@]}"
prepare_dir "${log_dir}"
user_own "${log_dir}"
prepare_dir "${tmp_dir}"
eval_build_list "${list_dir_iso}" "${build_list_iso}"
import ${LIBDIR}/util-iso.sh
import ${LIBDIR}/util-iso-mount.sh
check_root
check_requirements
for sig in TERM HUP QUIT; do
trap "trap_exit $sig \"$(gettext "%s signal caught. Exiting...")\" \"$sig\"" "$sig"
done
trap 'trap_exit INT "$(gettext "Aborted by user! Exiting...")"' INT
trap 'trap_exit USR1 "$(gettext "An unknown error has occurred. Exiting...")"' ERR
${pretend} && display_settings && exit 1
run build "${build_list_iso}"

View file

@ -20,6 +20,7 @@ SYSCONFDIR='@sysconfdir@'
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
import ${LIBDIR}/util.sh
import ${LIBDIR}/util-chroot.sh
import ${LIBDIR}/util-pkg.sh
import ${LIBDIR}/util-pkg-chroot.sh
@ -37,9 +38,9 @@ display_settings(){
show_version
show_config
msg "PROFILE:"
msg2 "build_lists: %s" "$(show_build_lists ${list_dir_pkg})"
msg2 "build_list_pkg: %s" "${build_list_pkg}"
# msg "PROFILE:"
# msg2 "build_lists: %s" "$(show_build_lists ${list_dir_pkg})"
# msg2 "build_list_pkg: %s" "${build_list_pkg}"
msg2 "is_build_list: %s" "${is_build_list}"
msg "OPTIONS:"
@ -49,17 +50,21 @@ display_settings(){
msg "ARGS:"
msg2 "create_first: %s" "${create_first}"
msg2 "delete_first: %s" "${delete_first}"
msg2 "clean_first: %s" "${clean_first}"
msg2 "wipe_clean: %s" "${wipe_clean}"
msg2 "update_first: %s" "${update_first}"
msg2 "purge: %s" "${purge}"
msg2 "namcap: %s" "${namcap}"
msg2 "sign: %s" "${sign}"
msg2 "udev_root: %s" "${udev_root}"
msg "PATHS:"
msg2 "pkg_dir: %s" "${pkg_dir}"
if ${clean_first}; then
if ${create_first};then
msg "PKG:"
msg2 "base_packages: %s" "${base_packages[*]}"
msg2 "packages: %s" "${packages[*]}"
fi
msg "BUILD QUEUE:"
@ -68,89 +73,117 @@ display_settings(){
load_user_info
load_config "${USERCONFDIR}/manjaro-tools.conf" || load_config "${SYSCONFDIR}/manjaro-tools.conf"
load_vars "$USER_HOME/.makepkg.conf" || load_vars /etc/makepkg.conf
load_config "${MT_USERCONFDIR}/manjaro-tools.conf" || load_config "${SYSCONFDIR}/manjaro-tools.conf"
load_vars "${PAC_USERCONFDIR}/makepkg.conf" || load_vars "$USER_HOME/.makepkg.conf"
load_vars /etc/makepkg.conf
create_first=false
delete_first=false
clean_first=false
wipe_clean=false
update_first=false
purge=false
namcap=false
pretend=false
is_build_list=false
sign=false
udev_root=false
is_multilib=false
mkchroot_args=(-L)
mkchrootpkg_args=()
install_pkgs=()
prepare_build(){
local pac_arch='default'
if [[ "${target_arch}" == 'multilib' ]];then
pac_arch='multilib'
is_multilib=true
fi
local pacman_conf="${DATADIR}/pacman-$pac_arch.conf"
work_dir="${chroots_pkg}/${target_branch}/${target_arch}"
pkg_dir="${cache_dir_pkg}/${target_branch}/${target_arch}"
local makepkg_conf=$(get_makepkg_conf "${target_arch}")
[[ "$pac_arch" == 'multilib' ]] && target_arch='x86_64'
local mirror="${build_mirror}/${target_branch}"
local mirrors_conf=$(get_pac_mirrors_conf "${target_branch}")
mkchroot_args+=(-C ${pacman_conf} -M ${makepkg_conf} -S ${mirrors_conf} -B ${mirror})
mkchrootpkg_args+=(-r ${work_dir})
eval_build_list "${list_dir_pkg}" "${build_list_pkg}"
init_base_devel
timer_start=$(get_timer)
}
usage() {
echo "Usage: ${0##*/} [options]"
echo " -p <pkg> Build list or pkg [default: ${build_list_pkg}]"
echo " -a <arch> Arch [default: ${target_arch}]"
echo " -b <branch> Branch [default: ${target_branch}]"
echo ' -c Recreate chroot'
echo ' -h This help'
echo ' -i <pkg> Install a package into the working copy of the chroot'
echo ' -n Install and run namcap check'
echo " -p <pkg> Build list or pkg [default: ${build_list_pkg}]"
echo ' -q Query settings and pretend build'
echo ' -r <dir> Chroots directory'
echo " [default: ${chroots_pkg}]"
echo ' -s Sign packages'
echo ' -i <pkgs> Install packages into the working copy of the chroot'
echo ' -o Create chroot'
echo ' -d Delete chroot'
echo ' -c Clean chroot copy'
echo ' -u Update chroot copy'
echo ' -w Clean up cache and sources'
echo ' -n Install and run namcap check'
echo ' -s Sign packages'
echo ' -x Udev base-devel group (no systemd)'
echo ' -q Query settings and pretend build'
echo ' -h This help'
echo ''
echo ''
exit $1
}
orig_argv=("$@")
orig_argv=("$0" "$@")
opts='p:a:b:r:i:cwnsuqh'
opts='p:a:b:r:i:odcuwnsxqh'
while getopts "${opts}" arg; do
case "${arg}" in
p) build_list_pkg="$OPTARG" ;;
a) target_arch="$OPTARG" ;;
b) target_branch="$OPTARG" ;;
c) clean_first=true ;;
i) mkchrootpkg_args+=(-I "$OPTARG") ;;
n) namcap=true; mkchrootpkg_args+=(-n) ;;
p) build_list_pkg="${OPTARG%/}" ;;
q) pretend=true ;;
r) chroots_pkg="$OPTARG" ;;
i) install_pkgs+=("$OPTARG"); mkchrootpkg_args+=(-I "${install_pkgs[*]}") ;;
o) create_first=true ;;
d) delete_first=true ;;
c) clean_first=true ; mkchrootpkg_args+=(-c) ;;
u) update_first=true ; mkchrootpkg_args+=(-u) ;;
w) purge=true ;;
n) namcap=true; mkchrootpkg_args+=(-n) ;;
s) sign=true ;;
w) wipe_clean=true ;;
x) udev_root=true ;;
q) pretend=true ;;
h|?) usage 0 ;;
*) echo "invalid argument '${arg}'"; usage 1 ;;
*) echo "invalid argument '%s'" "${arg}"; usage 1 ;;
esac
done
shift $(($OPTIND - 1))
check_root "$0" "${orig_argv[@]}"
check_root
prepare_dir "${log_dir}"
user_own "${log_dir}"
prepare_dir "${tmp_dir}"
prepare_conf "${target_arch}"
mirrors_conf=$(get_pac_mirrors_conf "${target_branch}")
mkchroot_args+=(-C ${pacman_conf} -M ${makepkg_conf} -S ${mirrors_conf} -B "${build_mirror}/${target_branch}")
mkchrootpkg_args+=(-r ${work_dir})
timer_start=$(get_timer)
eval_build_list "${list_dir_pkg}" "${build_list_pkg}"
prepare_dir "${pkg_dir}"
user_own "${pkg_dir}"
init_base_devel
prepare_build
${pretend} && display_settings && exit
${wipe_clean} && clean_up
${delete_first} && delete_chroot "${work_dir}/root" "${work_dir}"
chroot_init
${create_first} && create_chroot "${mkchroot_args[@]}" "${work_dir}/root" "${packages[@]}"
run make_pkg "${build_list_pkg}"

View file

@ -16,14 +16,14 @@ SYSCONFDIR='@sysconfdir@'
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
import ${LIBDIR}/util.sh
import ${LIBDIR}/util-pkgtree.sh
import ${LIBDIR}/util-pkg-tree.sh
display_settings(){
show_version
show_config
msg "ARGS:"
# msg2 "sync: %s" "${sync}"
msg2 "sync: %s" "${sync}"
msg2 "abs: %s" "${abs}"
msg2 "clean: %s" "${clean}"
@ -36,16 +36,16 @@ display_settings(){
load_user_info
load_config "${USERCONFDIR}/manjaro-tools.conf" || load_config "${SYSCONFDIR}/manjaro-tools.conf"
load_config "${MT_USERCONFDIR}/manjaro-tools.conf" || load_config "${SYSCONFDIR}/manjaro-tools.conf"
#sync=false
sync=false
pretend=false
abs=false
clean=false
usage() {
echo "Usage: ${0##*/} [options]"
#echo " -s Sync manjaro tree"
echo " -s Sync manjaro tree"
echo " -a Sync arch abs"
echo ' -c Clean package tree'
echo ' -q Query settings'
@ -55,16 +55,16 @@ usage() {
exit $1
}
orig_argv=("$@")
orig_argv=("$0" "$@")
opts='acqh'
opts='sacqh'
while getopts "${opts}" arg; do
case "${arg}" in
s) sync=true ;;
a) abs=true ;;
c) clean=true ;;
q) pretend=true ;;
#s) sync=true ;;
h|?) usage 0 ;;
*) echo "invalid argument '${arg}'"; usage 1 ;;
esac
@ -72,7 +72,7 @@ done
shift $(($OPTIND - 1))
check_root "$0" "${orig_argv[@]}"
check_root
prepare_dir "${tree_dir_abs}"
@ -80,6 +80,6 @@ ${pretend} && display_settings && exit 1
${clean} && clean_dir "${tree_dir}"
#${sync} && sync_tree_manjaro
${sync} && sync_tree_manjaro
${abs} && sync_tree_abs

View file

@ -44,9 +44,15 @@ show_profile(){
msg2 "login_shell: %s" "${login_shell}"
msg2 "addgroups: %s" "${addgroups}"
msg2 "enable_systemd: %s" "${enable_systemd[*]}"
msg2 "enable_systemd_live: %s" "${enable_systemd_live[*]}"
[[ -n ${disable_systemd[*]} ]] && msg2 "disable_systemd: %s" "${disable_systemd[*]}"
if [[ ${initsys} == 'systemd' ]];then
msg2 "enable_systemd: %s" "${enable_systemd[*]}"
msg2 "enable_systemd_live: %s" "${enable_systemd_live[*]}"
[[ -n ${disable_systemd[*]} ]] && msg2 "disable_systemd: %s" "${disable_systemd[*]}"
else
msg2 "enable_openrc: %s" "${enable_openrc[*]}"
msg2 "enable_openrc_live: %s" "${enable_openrc_live[*]}"
[[ -n ${disable_openrc[*]} ]] && msg2 "disable_openrc: %s" "${disable_openrc[*]}"
fi
reset_profile
unset yaml_dir
@ -56,13 +62,14 @@ display_settings(){
show_version
show_config
msg "PROFILE:"
msg2 "build_lists: %s" "$(show_build_lists ${list_dir_iso})"
msg2 "build_list_iso: %s" "${build_list_iso}"
# msg "PROFILE:"
# msg2 "build_lists: %s" "$(show_build_lists ${list_dir_iso})"
# msg2 "build_list_iso: %s" "${build_list_iso}"
msg2 "is_build_list: %s" "${is_build_list}"
msg "OPTIONS:"
msg2 "arch: %s" "${target_arch}"
msg2 "initsys: %s" "${initsys}"
msg2 "kernel: %s" "${kernel}"
msg "ARGS:"
@ -76,7 +83,7 @@ display_settings(){
load_user_info
load_config "${USERCONFDIR}/manjaro-tools.conf" || load_config "${SYSCONFDIR}/manjaro-tools.conf"
load_config "${MT_USERCONFDIR}/manjaro-tools.conf" || load_config "${SYSCONFDIR}/manjaro-tools.conf"
# to force old way to have buildiso run in iso-profiles dir
# run_dir=$(pwd)
@ -91,32 +98,34 @@ cache_dir_netinstall="${cache_dir}/netinstall"
usage() {
echo "Usage: ${0##*/} [options]"
echo " -p <profile> Buildset or profile [default: ${build_list_iso}]"
echo " -a <arch> Arch [default: ${target_arch}]"
echo " -k <name> Kernel to use[default: ${kernel}]"
echo " -i <name> Init system to use [default: ${initsys}]"
echo ' -c Check also calamares yaml files generated for the profile'
echo ' -g Enable pacman group accepted for -p'
echo ' -h This help'
echo " -k <name> Kernel to use[default: ${kernel}]"
echo " -p <profile> Buildset or profile [default: ${build_list_iso}]"
echo ' -q Query settings'
echo ' -v Validate by schema'
echo ' -q Query settings'
echo ' -h This help'
echo ''
echo ''
exit $1
}
orig_argv=("$@")
orig_argv=("$0" "$@")
opts='p:a:i:k:gcvqh'
while getopts "${opts}" arg; do
case "${arg}" in
p) build_list_iso="$OPTARG" ;;
a) target_arch="$OPTARG" ;;
i) initsys="$OPTARG" ;;
k) kernel="$OPTARG" ;;
c) calamares=true ;;
g) group=true ;;
k) kernel="$OPTARG" ;;
p) build_list_iso="$OPTARG" ;;
q) pretend=true ;;
v) validate=true ;;
q) pretend=true ;;
h|?) usage 0 ;;
*) echo "invalid argument '${arg}'"; usage 1 ;;
esac
@ -124,9 +133,7 @@ done
shift $(($OPTIND - 1))
check_root "$0" "${orig_argv[@]}"
prepare_dir "${tmp_dir}"
check_root
eval_build_list "${list_dir_iso}" "${build_list_iso}"

View file

@ -19,7 +19,9 @@ import ${LIBDIR}/util-pkg.sh
shopt -s extglob
load_vars "$HOME/.makepkg.conf"
load_user_info
load_vars "${PAC_USERCONFDIR}/makepkg.conf" || load_vars "$USER_HOME/.makepkg.conf"
load_vars /etc/makepkg.conf
if [[ ! -f PKGBUILD ]]; then

View file

@ -19,7 +19,9 @@ import ${LIBDIR}/util.sh
import ${LIBDIR}/util-mount.sh
working_dir=''
files=()
keep_mirrors=false
nosetarch=false
usage() {
echo "Usage: ${0##*/} [options] working-dir [run arguments]"
@ -30,18 +32,20 @@ usage() {
echo ' -M <file> Location of a makepkg config file'
echo ' -S <file> Location of a pacman-mirrors config file'
echo ' -c <dir> Set pacman cache'
echo ' -f <file> Copy file from the host to the chroot'
echo ' -s Do not run setarch'
echo ' -r <list> Bind mountargs ro'
echo ' -w <list> Bind mountargs rw'
echo ' List format [src1:target1,...,srcN:targetN]'
echo ' List format [src1:target1 ... srcN:targetN]'
echo ' -B Use custom build mirror'
echo ' -K Keep mirrorlist (-B)'
echo ' -h This message'
exit 1
}
orig_argv=("$@")
orig_argv=("$0" "$@")
opts='hKC:M:S:c:r:w:B:'
opts='hKC:M:S:c:r:w:B:f:s'
while getopts ${opts} arg; do
case "${arg}" in
@ -49,8 +53,10 @@ while getopts ${opts} arg; do
M) makepkg_conf="$OPTARG" ;;
S) mirrors_conf="$OPTARG" ;;
c) cache_dir="$OPTARG" ;;
r) mountargs_ro="$OPTARG" ;;
w) mountargs_rw="$OPTARG" ;;
f) files+=("$OPTARG") ;;
s) nosetarch=true ;;
r) bindmounts_ro=("$OPTARG") ;;
w) bindmounts_rw=("$OPTARG") ;;
B) build_mirror="$OPTARG" ;;
K) keep_mirrors=true ;;
h|?) usage ;;
@ -60,7 +66,8 @@ done
shift $(($OPTIND - 1))
(( $# < 1 )) && die 'You must specify a directory.'
check_root "$0" "${orig_argv[@]}"
check_root
working_dir=$(readlink -f "$1")
shift 1
@ -81,7 +88,13 @@ copy_hostconf () {
[[ -n $makepkg_conf ]] && cp $makepkg_conf "$1/etc/makepkg.conf"
[[ -n $mirrors_conf ]] && cp ${mirrors_conf} "$1/etc/pacman-mirrors.conf"
if [[ -n ${build_mirror} ]]; then
local file
for file in "${files[@]}"; do
mkdir -p "$(dirname "$working_dir$file")"
cp -T "$file" "$working_dir$file"
done
if [[ -n ${build_mirror} ]];then
build_mirror=${build_mirror}'/$repo/$arch'
if ${keep_mirrors}; then
set_branch "$1" "$(get_branch $1)"
@ -95,7 +108,7 @@ copy_hostconf () {
sed -r "s|^#?\\s*CacheDir.+|CacheDir = $(echo -n ${cache_dirs[@]})|g" -i "$1/etc/pacman.conf"
}
chroot_extra_umount() {
chroot_extra_mount() {
chroot_mount "/etc/resolv.conf" "$1/etc/resolv.conf" -B
chroot_mount "${cache_dirs[0]}" "$1${cache_dirs[0]}" -B
@ -103,21 +116,13 @@ chroot_extra_umount() {
chroot_mount "$cache_dir" "$1${cache_dir}" -Br
done
if [[ -n ${mountargs_ro[@]} ]]; then
local IFS=','
for m in ${mountargs_ro[@]}; do
chroot_mount "${m%%:*}" "$1${m##*:}" -Br
done
unset IFS
fi
for m in ${bindmounts_ro[@]}; do
chroot_mount "${m%%:*}" "$1${m##*:}" -Br
done
if [[ -n ${mountargs_rw[@]} ]]; then
local IFS=','
for m in ${mountargs_rw[@]}; do
chroot_mount "${m%%:*}" "$1${m##*:}" -B
done
unset IFS
fi
for m in ${bindmounts_rw[@]}; do
chroot_mount "${m%%:*}" "$1${m##*:}" -B
done
}
umask 0022
@ -131,12 +136,14 @@ fi
chroot_api_mount "${working_dir}" || die "failed to setup API filesystems in chroot %s" "${working_dir}"
chroot_extra_umount "${working_dir}"
chroot_extra_mount "${working_dir}"
copy_hostconf "${working_dir}"
eval $(grep '^CARCH=' "$working_dir/etc/makepkg.conf")
${nosetarch} && unset CARCH
${CARCH:+setarch "$CARCH"} chroot "${working_dir}" "$@"
kill_chroot_process "${working_dir}"
# kill_chroot_process "${working_dir}"

View file

@ -20,45 +20,41 @@ import ${LIBDIR}/util.sh
import ${LIBDIR}/util-publish.sh
show_profile(){
prepare_transfer "$1" "${hidden}"
prepare_transfer "$1"
info "Profile: [$1]"
msg2 "project: %s" "${project}"
msg2 "src_dir: ${src_dir}"
msg2 "remote dir: ${url}/${target_dir}"
msg2 "target_dir: ${target_dir}"
}
display_settings(){
show_version
show_config
msg "PROFILE:"
msg2 "build_lists: %s" "$(show_build_lists ${list_dir_iso})"
msg2 "build_list_iso: %s" "${build_list_iso}"
# msg "PROFILE:"
# msg2 "build_lists: %s" "$(show_build_lists ${list_dir_iso})"
# msg2 "build_list_iso: %s" "${build_list_iso}"
msg2 "is_build_list: %s" "${is_build_list}"
msg "OPTIONS:"
[[ -z ${limit} ]] && msg2 "bandwidth limit: no" || msg2 "bandwidth limit: %s kB/s" "${limit}"
msg2 "limit: %s kB/s" "${limit}"
msg2 "dist_release: %s" "${dist_release}"
msg "ARGS:"
msg2 "update: %s" "${update}"
msg2 "verbose: %s" "${verbose}"
msg2 "signiso: %s" "${sign}"
msg2 "torrent: %s" "${torrent}"
msg2 "shell_upload: %s" "${shell_upload}"
msg2 "upd_homepage: %s" "${upd_homepage}"
if ${torrent}; then
if ${torrent};then
msg2 "tracker_url: %s" "${tracker_url}"
msg2 "piece_size: %s" "${piece_size}"
msg2 "iso_mirrors: %s" "${iso_mirrors[*]}"
msg2 "torrent_meta: %s" "${torrent_meta}"
fi
msg "REMOTE:"
msg2 "account: %s" "${account}"
msg2 "host: %s" "${host}"
msg2 "alt_storage: %s" "${alt_storage}"
msg2 "ssh_agent: %s" "${ssh_agent}"
msg2 "project: %s" "${project}"
msg "UPLOAD QUEUE:"
run show_profile "${build_list_iso}"
@ -66,56 +62,41 @@ display_settings(){
load_user_info
load_config "${USERCONFDIR}/manjaro-tools.conf" || load_config "${SYSCONFDIR}/manjaro-tools.conf"
load_config "${MT_USERCONFDIR}/manjaro-tools.conf" || load_config "${SYSCONFDIR}/manjaro-tools.conf"
run_dir=${cache_dir_iso}
hidden=false
pretend=false
torrent=false
update=false
verbose=false
sign=false
alt_storage=false
shell_upload=false
upd_homepage=false
torrent=false
rsync_args=(-aP -e ssh)
rsync_args=(-aP --progress -e ssh)
usage() {
echo "Usage: ${0##*/} [options]"
echo ' -a Use alternate storage server'
echo ' -d Use hidden remote directory'
echo ' -h This help'
echo " -l Limit bandwidth in kB/s [default: ${limit}]"
echo " -p Source folder to upload [default: ${build_list_iso}]"
echo ' -q Query settings and pretend upload'
echo ' -s Sign ISO and create checksums'
echo ' -t Create ISO torrent'
echo " -p Source folder to upload [default:${build_list_iso}]"
echo " -l Limit bandwidth in kB/s [default:${limit}]"
echo ' -u Update remote directory'
echo ' -t Create iso torrent'
echo ' -q Query settings and pretend upload'
echo ' -v Verbose output'
echo ' -w Update download page on manjaro.org'
echo ' -z Upload permalinks (shell.osdn.net)'
echo ' -h This help'
echo ''
echo ''
exit $1
}
opts='adhl:p:qstuvwz'
opts='p:l:uvtqh'
while getopts "${opts}" arg; do
case "${arg}" in
a) alt_storage=true ;;
d) hidden=true ;;
l) limit="$OPTARG"; rsync_args+=(--bwlimit=${limit}) ;;
p) build_list_iso="$OPTARG" ;;
p) build_list_iso="$OPTARG" ;;
l) limit="$OPTARG" ;;
u) update=true; rsync_args+=(-u) ;;
t) torrent=true ;;
v) verbose=true; rsync_args+=(-v --stats) ;;
q) pretend=true; rsync_args+=(-n) ;;
s) sign=true ;;
t) torrent=true ;;
u) update=true; rsync_args+=(-u) ;;
v) verbose=true; rsync_args+=(-v --stats) ;;
w) upd_homepage=true; shell_upload=true ;;
z) shell_upload=true ;;
h|?) usage 0 ;;
*) echo "invalid argument '${arg}'"; usage 1 ;;
esac
@ -127,6 +108,8 @@ timer_start=$(get_timer)
eval_build_list "${list_dir_iso}" "${build_list_iso}"
rsync_args+=(--bwlimit=${limit})
${pretend} && display_settings && exit 1
run sync_dir "${build_list_iso}"

View file

@ -20,73 +20,73 @@ LIBDIR='@libdir@'
import ${LIBDIR}/util-fstab.sh
write_source() {
local src=$1 spec= label= uuid= comment=()
local src=$1 spec= label= uuid= comment=()
label=$(lsblk -rno LABEL "$1" 2>/dev/null)
uuid=$(lsblk -rno UUID "$1" 2>/dev/null)
label=$(lsblk -rno LABEL "$1" 2>/dev/null)
uuid=$(lsblk -rno UUID "$1" 2>/dev/null)
# bind mounts do not have a UUID!
# bind mounts do not have a UUID!
case $bytag in
'')
[[ $uuid ]] && comment=("UUID=$uuid")
[[ $label ]] && comment+=("LABEL=$(mangle "$label")")
;;
LABEL)
spec=$label
[[ $uuid ]] && comment=("$src" "UUID=$uuid")
;;
UUID)
spec=$uuid
comment=("$src")
[[ $label ]] && comment+=("LABEL=$(mangle "$label")")
;;
*)
[[ $uuid ]] && comment=("$1" "UUID=$uuid")
[[ $label ]] && comment+=("LABEL=$(mangle "$label")")
[[ $bytag ]] && spec=$(lsblk -rno "$bytag" "$1" 2>/dev/null)
;;
esac
case $bytag in
'')
[[ $uuid ]] && comment=("UUID=$uuid")
[[ $label ]] && comment+=("LABEL=$(mangle "$label")")
;;
LABEL)
spec=$label
[[ $uuid ]] && comment=("$src" "UUID=$uuid")
;;
UUID)
spec=$uuid
comment=("$src")
[[ $label ]] && comment+=("LABEL=$(mangle "$label")")
;;
*)
[[ $uuid ]] && comment=("$1" "UUID=$uuid")
[[ $label ]] && comment+=("LABEL=$(mangle "$label")")
[[ $bytag ]] && spec=$(lsblk -rno "$bytag" "$1" 2>/dev/null)
;;
esac
[[ $comment ]] && printf '# %s\n' "${comment[*]}"
[[ $comment ]] && printf '# %s\n' "${comment[*]}"
if [[ $spec ]]; then
printf '%-20s' "$bytag=$(mangle "$spec")"
else
printf '%-20s' "$(mangle "$src")"
fi
if [[ $spec ]]; then
printf '%-20s' "$bytag=$(mangle "$spec")"
else
printf '%-20s' "$(mangle "$src")"
fi
}
optstring_apply_quirks() {
local varname=$1 fstype=$2
local varname=$1 fstype=$2
# SELinux displays a 'seclabel' option in /proc/self/mountinfo. We can't know
# if the system we're generating the fstab for has any support for SELinux (as
# one might install Arch from a Fedora environment), so let's remove it.
optstring_remove_option "$varname" seclabel
# SELinux displays a 'seclabel' option in /proc/self/mountinfo. We can't know
# if the system we're generating the fstab for has any support for SELinux (as
# one might install Arch from a Fedora environment), so let's remove it.
optstring_remove_option "$varname" seclabel
case $fstype in
f2fs)
# These are Kconfig options for f2fs. Kernels supporting the options will
# only provide the negative versions of these (e.g. noacl), and vice versa
# for kernels without support.
optstring_remove_option "$varname" noacl,acl,nouser_xattr,user_xattr
;;
vfat)
# Before Linux v3.8, "cp" is prepended to the value of the codepage.
if optstring_get_option "$varname" codepage && [[ $codepage = cp* ]]; then
optstring_remove_option "$varname" codepage
optstring_append_option "$varname" "codepage=${codepage#cp}"
fi
;;
esac
case $fstype in
f2fs)
# These are Kconfig options for f2fs. Kernels supporting the options will
# only provide the negative versions of these (e.g. noacl), and vice versa
# for kernels without support.
optstring_remove_option "$varname" noacl,acl,nouser_xattr,user_xattr
;;
vfat)
# Before Linux v3.8, "cp" is prepended to the value of the codepage.
if optstring_get_option "$varname" codepage && [[ $codepage = cp* ]]; then
optstring_remove_option "$varname" codepage
optstring_append_option "$varname" "codepage=${codepage#cp}"
fi
;;
esac
}
usage() {
cat <<EOF
cat <<EOF
usage: ${0##*/} [options] root
Options:
Options:
-L Use labels for source identifiers (shortcut for -t LABEL)
-p Exclude pseudofs mounts (default behavior)
-P Include printing mounts
@ -102,135 +102,121 @@ EOF
}
if [[ -z $1 || $1 = @(-h|--help) ]]; then
usage
exit $(( $# ? 0 : 1 ))
usage
exit $(( $# ? 0 : 1 ))
fi
while getopts ':LPpt:U' flag; do
case $flag in
L)
bytag=LABEL
;;
U)
bytag=UUID
;;
P)
pseudofs=1
;;
p)
pseudofs=0
;;
t)
bytag=${OPTARG^^}
;;
:)
die '%s: option requires an argument -- '\''%s'\' "${0##*/}" "$OPTARG"
;;
?)
die '%s: invalid option -- '\''%s'\' "${0##*/}" "$OPTARG"
;;
esac
case $flag in
L) bytag=LABEL ;;
U) bytag=UUID ;;
P) pseudofs=1 ;;
p) pseudofs=0 ;;
t) bytag=${OPTARG^^} ;;
:) die '%s: option requires an argument -- '\''%s'\' "${0##*/}" "$OPTARG" ;;
?) die '%s: invalid option -- '\''%s'\' "${0##*/}" "$OPTARG" ;;
esac
done
shift $(( OPTIND - 1 ))
(( $# )) || die "No root directory specified"
root=$1; shift
root=$(realpath -mL "$1"); shift
if ! mountpoint -q "$root"; then
die "$root is not a mountpoint"
die "$root is not a mountpoint"
fi
# handle block devices
findmnt -Recvruno SOURCE,TARGET,FSTYPE,OPTIONS,FSROOT "$root" |
while read -r src target fstype opts fsroot; do
if (( !pseudofs )) && fstype_is_pseudofs "$fstype"; then
continue
fi
# default 5th and 6th columns
dump=0 pass=2
src=$(unmangle "$src")
target=$(unmangle "$target")
target=${target#$root}
if (( !foundroot )) && findmnt "$src" "$root" >/dev/null; then
# this is root. we can't possibly have more than one...
pass=1 foundroot=1
fi
# if there's no fsck tool available, then only pass=0 makes sense.
if ! fstype_has_fsck "$fstype"; then
pass=0
fi
if [[ $fsroot != / ]]; then
if [[ $fstype = btrfs ]]; then
opts+=,subvol=${fsroot#/}
else
# it's a bind mount
src=$(findmnt -funcevo TARGET "$src")$fsroot
if [[ $src -ef $target ]]; then
# hrmm, this is weird. we're probably looking at a file or directory
# that was bound into a chroot from the host machine. Ignore it,
# because this won't actually be a valid mount. Worst case, the user
# just re-adds it.
while read -r src target fstype opts fsroot; do
if (( !pseudofs )) && fstype_is_pseudofs "$fstype"; then
continue
fi
fstype=none
opts+=,bind
pass=0
# default 5th and 6th columns
dump=0 pass=2
src=$(unmangle "$src")
target=$(unmangle "$target")
target=${target#$root}
if (( !foundroot )) && findmnt "$src" "$root" >/dev/null; then
# this is root. we can't possibly have more than one...
pass=1 foundroot=1
fi
fi
# filesystem quirks
case $fstype in
fuseblk)
# well-behaved FUSE filesystems will report themselves as fuse.$fstype.
# this is probably NTFS-3g, but let's just make sure.
if ! newtype=$(lsblk -no FSTYPE "$src") || [[ -z $newtype ]]; then
# avoid blanking out fstype, leading to an invalid fstab
error 'Failed to derive real filesystem type for FUSE device on %s' "$target"
else
fstype=$newtype
# if there's no fsck tool available, then only pass=0 makes sense.
if ! fstype_has_fsck "$fstype"; then
pass=0
fi
;;
esac
optstring_apply_quirks "opts" "$fstype"
if [[ $fsroot != / ]]; then
if [[ $fstype = btrfs ]]; then
opts+=,subvol=${fsroot#/}
else
# it's a bind mount
src=$(findmnt -funcevo TARGET "$src")$fsroot
if [[ $src -ef $target ]]; then
# hrmm, this is weird. we're probably looking at a file or directory
# that was bound into a chroot from the host machine. Ignore it,
# because this won't actually be a valid mount. Worst case, the user
# just re-adds it.
continue
fi
fstype=none
opts+=,bind
pass=0
fi
fi
# write one line
write_source "$src"
printf '\t%-10s' "/$(mangle "${target#/}")" "$fstype" "$opts"
printf '\t%s %s' "$dump" "$pass"
printf '\n\n'
# filesystem quirks
case $fstype in
fuseblk)
# well-behaved FUSE filesystems will report themselves as fuse.$fstype.
# this is probably NTFS-3g, but let's just make sure.
if ! newtype=$(lsblk -no FSTYPE "$src") || [[ -z $newtype ]]; then
# avoid blanking out fstype, leading to an invalid fstab
error 'Failed to derive real filesystem type for FUSE device on %s' "$target"
else
fstype=$newtype
fi
;;
esac
optstring_apply_quirks "opts" "$fstype"
# write one line
write_source "$src"
printf '\t%-10s' "/$(mangle "${target#/}")" "$fstype" "$opts"
printf '\t%s %s' "$dump" "$pass"
printf '\n\n'
done
# handle swaps devices
{
# ignore header
read
# ignore header
read
while read -r device type _ _ prio; do
options=defaults
if [[ $prio != -1 ]]; then
options+=,pri=$prio
fi
while read -r device type _ _ prio; do
options=defaults
if [[ $prio != -1 ]]; then
options+=,pri=$prio
fi
# skip files marked deleted by the kernel
[[ $device = *'\040(deleted)' ]] && continue
# skip files marked deleted by the kernel
[[ $device = *'\040(deleted)' ]] && continue
if [[ $type = file ]]; then
printf '%-20s' "$device"
elif [[ $device = /dev/dm-+([0-9]) ]]; then
# device mapper doesn't allow characters we need to worry
# about being mangled, and it does the escaping of dashes
# for us in sysfs.
write_source "$(dm_name_for_devnode "$device")"
else
write_source "$(unmangle "$device")"
fi
if [[ $type = file ]]; then
printf '%-20s' "$device"
elif [[ $device = /dev/dm-+([0-9]) ]]; then
# device mapper doesn't allow characters we need to worry
# about being mangled, and it does the escaping of dashes
# for us in sysfs.
write_source "$(dm_name_for_devnode "$device")"
else
write_source "$(unmangle "$device")"
fi
printf '\t%-10s\t%-10s\t%-10s\t0 0\n\n' 'none' 'swap' "$options"
done
printf '\t%-10s\t%-10s\t%-10s\t0 0\n\n' 'none' 'swap' "$options"
done
} </proc/swaps

View file

@ -35,7 +35,7 @@ display_settings(){
load_user_info
load_config "${USERCONFDIR}/manjaro-tools.conf" || load_config "${SYSCONFDIR}/manjaro-tools.conf"
load_config "${MT_USERCONFDIR}/manjaro-tools.conf" || load_config "${SYSCONFDIR}/manjaro-tools.conf"
automount=false
pretend=false
@ -43,8 +43,8 @@ pretend=false
usage() {
echo "usage: ${0##*/} -a [or] ${0##*/} chroot-dir [command]"
echo ' -a Automount detected linux system'
echo ' -h Print this help message'
echo ' -q Query settings and pretend'
echo ' -h Print this help message'
echo ''
echo " If 'command' is unspecified, ${0##*/} will launch /bin/sh."
echo ''
@ -55,7 +55,7 @@ usage() {
exit $1
}
orig_argv=("$@")
orig_argv=("$0" "$@")
opts=':haq'
@ -69,9 +69,9 @@ while getopts ${opts} arg; do
done
shift $(( OPTIND - 1 ))
check_root "$0" "${orig_argv[@]}"
check_root
if ${automount}; then
if ${automount};then
chrootdir=/mnt
run_args=/bin/bash

View file

@ -16,11 +16,15 @@ LIBDIR='@libdir@'
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
import ${LIBDIR}/util.sh
import ${LIBDIR}/util-chroot.sh
working_dir=''
files=()
build_locales=false
keep_mirrors=false
keep_flag=''
nosetarch=false
usage() {
echo "Usage: ${0##*/} [options] working-dir package-list..."
@ -29,6 +33,8 @@ usage() {
echo ' -M <file> Location of a makepkg config file'
echo ' -S <file> Location of a pacman-mirrors config file'
echo ' -c <dir> Set pacman cache'
echo ' -f <file> Copy file from the host to the chroot'
echo ' -s Do not run setarch'
echo ' -L Use build locale.gen en/de'
echo ' -B Use custom build mirror'
echo ' -K Keep mirrorlist (-B)'
@ -37,9 +43,9 @@ usage() {
exit 1
}
orig_argv=("$@")
orig_argv=("$0" "$@")
opts='hLKC:M:S:c:B:'
opts='hLKC:M:S:c:B:f:s'
while getopts ${opts} arg; do
case "${arg}" in
@ -47,18 +53,20 @@ while getopts ${opts} arg; do
M) makepkg_conf="$OPTARG" ;;
S) mirrors_conf="$OPTARG" ;;
c) cache_dir="$OPTARG" ;;
f) files+=("$OPTARG") ;;
s) nosetarch=true ;;
L) build_locales=true ;;
B) build_mirror="$OPTARG" ;;
K) keep_mirrors=true; keep_flag='-K' ;;
h|?) usage ;;
*) error "invalid argument '$arg'"; usage ;;
*) error "invalid argument '%s'" "$arg"; usage ;;
esac
done
shift $(($OPTIND - 1))
(( $# < 2 )) && die 'You must specify a directory and one or more packages.'
check_root "$0" "${orig_argv[@]}"
check_root
working_dir="$(readlink -f $1)"
shift 1
@ -82,45 +90,59 @@ umask 0022
lock 9 "${working_dir}.lock" "Locking chroot"
if is_btrfs "$working_dir"; then
rmdir "$working_dir"
if ! btrfs subvolume create "$working_dir"; then
die "Couldn't create subvolume for '%s'" "$working_dir"
fi
chmod 0755 "$working_dir"
rmdir "$working_dir"
if ! btrfs subvolume create "$working_dir"; then
die "Couldn't create subvolume for '%s'" "$working_dir"
fi
chmod 0755 "$working_dir"
fi
for file in "${files[@]}"; do
mkdir -p "$(dirname "$working_dir$file")"
cp "$file" "$working_dir$file"
done
# Workaround when creating a chroot in a branch different of the host
if [[ -n $pac_conf ]] && [[ -n $mirrors_conf ]] && [[ -n ${build_mirror} ]]; then
url=${build_mirror}'/$repo/$arch'
[[ ${build_mirror} = *ftp*repo.manjaro.org* ]] && show_mirror=repo.manjaro.org'/$repo/$arch' || show_mirror=$url
info "mirror: %s" "$show_mirror"
info "mirror: %s" "$url"
pac_base="$working_dir/pacman-basestrap.conf"
sed "s#Include = /etc/pacman.d/mirrorlist#Server = ${url}#g" $pac_conf > $pac_base
_env=()
while read -r varname; do
_env+=("$varname=${!varname}")
done < <(declare -x | sed -r 's/^declare -x ([^=]*)=.*/\1/' | grep -i '_proxy$')
env -i "${_env[@]}" \
basestrap -GMcd ${pac_base:+-C "$pac_base"} "$working_dir" \
"${cache_dirs[@]/#/--cachedir=}" "$@" || die 'Failed to install all packages'
[[ -f "$pac_base" ]] && rm "$pac_base"
else
_env=()
while read -r varname; do
_env+=("$varname=${!varname}")
done < <(declare -x | sed -r 's/^declare -x ([^=]*)=.*/\1/' | grep -i '_proxy$')
env -i "${_env[@]}" \
basestrap -GMcd ${pac_conf:+-C "$pac_conf"} "$working_dir" \
"${cache_dirs[@]/#/--cachedir=}" "$@" || die 'Failed to install all packages'
fi
echo "$version" > "$working_dir/.manjaro-tools"
if ${build_locales}; then
if ${build_locales};then
info "Using build locales ..."
mv "$working_dir/etc/locale.gen" "$working_dir/etc/locale.gen.bak"
mv "$working_dir/etc/locale.conf" "$working_dir/etc/locale.conf.bak"
printf '%s.UTF-8 UTF-8\n' en_US > "$working_dir/etc/locale.gen"
printf 'LANG=%s.UTF-8\n' en_US > "$working_dir/etc/locale.conf"
printf 'LC_MESSAGES=C\n' >> "$working_dir/etc/locale.conf"
chroot_args=(${pac_conf:+-C "$pac_conf"} ${makepkg_conf:+-M "$makepkg_conf"} \
${mirrors_conf:+-S "$mirrors_conf"} ${build_mirror:+-B "$build_mirror"} \
${cache_dir:+-c "$cache_dir"} ${keep_flag})
exec chroot-run \
${chroot_args[*]} \
"$working_dir" locale-gen
fi
chroot_args=(${pac_conf:+-C "$pac_conf"} ${makepkg_conf:+-M "$makepkg_conf"} ${mirrors_conf:+-S "$mirrors_conf"} ${build_mirror:+-B "$build_mirror"} ${cache_dir:+-c "$cache_dir"} ${keep_flag})
${nosetarch} && chroot_args+=(${nosetarch:+-s})
exec chroot-run \
${chroot_args[*]} \
"$working_dir" locale-gen

View file

@ -16,171 +16,160 @@ LIBDIR='@libdir@'
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
import ${LIBDIR}/util.sh
import ${LIBDIR}/util-chroot.sh
shopt -s nullglob
makepkg_args=(-s --noconfirm -L)
repack=false
update_first=false
clean_first=false
install_pkg=
run_namcap=false
temp_chroot=false
chrootdir=
passeddir=
declare -a install_pkgs
declare -i ret=0
init_variables() {
default_makepkg_args=(-s --noconfirm -L --holdver)
makepkg_args=("${default_makepkg_args[@]}")
repack=false
update_first=false
clean_first=false
run_namcap=false
temp_chroot=false
chrootdir=
passeddir=
makepkg_user=
declare -ga install_pkgs
declare -gi ret=0
copy=$USER
[[ -n $SUDO_USER ]] && copy=$SUDO_USER
[[ -z "$copy" || $copy = root ]] && copy=copy
src_owner=${SUDO_USER:-$USER}
bindmounts_ro=()
bindmounts_rw=()
copy=$USER
[[ -n ${SUDO_USER:-} ]] && copy=$SUDO_USER
[[ -z "$copy" || $copy = root ]] && copy=copy
src_owner=${SUDO_USER:-$USER}
}
usage() {
echo "Usage: ${0##*/} [options] -r <chrootdir> [--] [makepkg args]"
echo ' Run this script in a PKGBUILD dir to build a package inside a'
echo ' clean chroot. Arguments passed to this script after the'
echo ' end-of-options marker (--) will be passed to makepkg.'
echo ' Run this script in a PKGBUILD dir to build a package inside a'
echo ' clean chroot. Arguments passed to this script after the'
echo ' end-of-options marker (--) will be passed to makepkg.'
echo ''
echo ' The chroot dir consists of the following directories:'
echo ' <chrootdir>/{root, copy} but only "root" is required'
echo ' by default. The working copy will be created as needed'
echo ' The chroot dir consists of the following directories:'
echo ' <chrootdir>/{root, copy} but only "root" is required'
echo ' by default. The working copy will be created as needed'
echo ''
echo ' The chroot "root" directory must be created via the following'
echo ' command:'
echo ' mkchroot <chrootdir>/root base-devel'
echo 'The chroot "root" directory must be created via the following'
echo 'command:'
echo ' mkchroot <chrootdir>/root base-devel'
echo ''
echo " Default makepkg args: ${makepkg_args[*]}"
echo 'This script reads {SRC,SRCPKG,PKG,LOG}DEST, MAKEFLAGS and PACKAGER'
echo 'from makepkg.conf(5), if those variables are not part of the'
echo 'environment.'
echo ''
echo ' Flags:'
echo ' -h This help'
echo ' -c Clean the chroot before building'
echo ' -u Update the working copy of the chroot before building'
echo ' This is useful for rebuilds without dirtying the pristine'
echo ' chroot'
echo ' -r <dir> The chroot dir to use'
echo ' -I <pkg> Install a package into the working copy of the chroot'
echo ' -l <copy> The directory to use as the working copy of the chroot'
echo ' Useful for maintaining multiple copies'
echo " Default: $copy"
echo ' -n Run namcap on the package'
echo ' -T Build in a temporary directory'
echo "Default makepkg args: ${default_makepkg_args[*]}"
echo ''
echo 'Flags:'
echo '-h This help'
echo '-c Clean the chroot before building'
echo '-d <dir> Bind directory into build chroot as read-write'
echo '-D <dir> Bind directory into build chroot as read-only'
echo '-u Update the working copy of the chroot before building'
echo ' This is useful for rebuilds without dirtying the pristine'
echo ' chroot'
echo '-r <dir> The chroot dir to use'
echo '-I <pkg> Install a package into the working copy of the chroot'
echo '-l <copy> The directory to use as the working copy of the chroot'
echo ' Useful for maintaining multiple copies'
echo " Default: $copy"
echo '-n Run namcap on the package'
echo '-T Build in a temporary directory'
echo '-U Run makepkg as a specified user'
exit 1
}
orig_argv=("$@")
while getopts 'hcur:I:l:nT' arg; do
case "$arg" in
c) clean_first=true ;;
u) update_first=true ;;
r) passeddir="$OPTARG" ;;
I) install_pkgs+=("$OPTARG") ;;
l) copy="$OPTARG" ;;
n) run_namcap=true; makepkg_args+=(-i) ;;
T) temp_chroot=true; copy+="-$$" ;;
h|*) usage ;;
esac
done
[[ ! -f PKGBUILD && -z "${install_pkgs[*]}" ]] && die 'This must be run in a directory containing a PKGBUILD.'
check_root "$0" "${orig_argv[@]}"
# Canonicalize chrootdir, getting rid of trailing /
chrootdir=$(readlink -e "$passeddir")
[[ ! -d $chrootdir ]] && die "No chroot dir defined, or invalid path '%s'" "$passeddir"
[[ ! -d $chrootdir/root ]] && die "Missing chroot dir root directory. Try using: mkchroot %s/root base-devel" "$chrootdir"
# Detect chrootdir filesystem type
chroottype=$(stat -f -c %T "$chrootdir")
if [[ ${copy:0:1} = / ]]; then
copydir=$copy
else
copydir="$chrootdir/$copy"
fi
# Pass all arguments after -- right to makepkg
makepkg_args+=("${@:$OPTIND}")
# See if -R was passed to makepkg
for arg in "${@:OPTIND}"; do
case ${arg%%=*} in
-*R*|--repackage)
repack=true
break 2
;;
esac
done
load_user_info
# {{{ functions
create_chroot() {
# Lock the chroot we want to use. We'll keep this lock until we exit.
lock 9 "$copydir.lock" "Locking chroot copy [$copy]"
if [[ ! -d $copydir ]] || $clean_first; then
# Get a read lock on the root chroot to make
# sure we don't clone a half-updated chroot
slock 8 "$chrootdir/root.lock" "Locking clean chroot"
stat_busy "Creating clean working copy [$copy]"
if is_btrfs "$chrootdir" && ! mountpoint -q "$copydir"; then
subvolume_delete_recursive "$copydir" ||
die "Unable to delete subvolume %s" "$copydir"
btrfs subvolume snapshot "$chrootdir/root" "$copydir" >/dev/null ||
die "Unable to create subvolume %s" "$copydir"
else
mkdir -p "$copydir"
rsync -a --delete -q -W -x "$chrootdir/root/" "$copydir"
fi
stat_done
# Drop the read lock again
exec 8>&-
sync_chroot() {
local chrootdir=$1
local copy=$2
local copydir=''
if [[ ${copy:0:1} = / ]]; then
copydir=$copy
else
copydir="$chrootdir/$copy"
fi
if [[ "$chrootdir/root" -ef "$copydir" ]]; then
error 'Cannot sync copy with itself: %s' "$copydir"
return 1
fi
# Get a read lock on the root chroot to make
# sure we don't clone a half-updated chroot
slock 8 "$chrootdir/root.lock" \
"Locking clean chroot [%s]" "$chrootdir/root"
stat_busy "Synchronizing chroot copy [%s] -> [%s]" "$chrootdir/root" "$copydir"
if is_btrfs "$chrootdir" && ! mountpoint -q "$copydir"; then
subvolume_delete_recursive "$copydir" ||
die "Unable to delete subvolume %s" "$copydir"
btrfs subvolume snapshot "$chrootdir/root" "$copydir" >/dev/null ||
die "Unable to create subvolume %s" "$copydir"
else
mkdir -p "$copydir"
rsync -a --delete -q -W -x "$chrootdir/root/" "$copydir"
fi
stat_done
# Drop the read lock again
lock_close 8
# Update mtime
touch "$copydir"
}
clean_temporary() {
stat_busy "Removing temporary copy [$copy]"
if is_btrfs "$chrootdir" && ! mountpoint -q "$copydir"; then
btrfs subvolume delete "$copydir" >/dev/null ||
die "Unable to delete subvolume %s" "$copydir"
else
# avoid change of filesystem in case of an umount failure
rm --recursive --force --one-file-system "$copydir" ||
die "Unable to delete %s" "$copydir"
fi
# remove lock file
rm -f "$copydir.lock"
stat_done
}
# Usage: delete_chroot $copydir [$copy]
# delete_chroot() {
# local copydir=$1
# local copy=${1:-$2}
#
# stat_busy "Removing chroot copy [%s]" "$copy"
# if is_btrfs "$chrootdir" && ! mountpoint -q "$copydir"; then
# subvolume_delete_recursive "$copydir" ||
# die "Unable to delete subvolume %s" "$copydir"
# else
# # avoid change of filesystem in case of an umount failure
# rm --recursive --force --one-file-system "$copydir" ||
# die "Unable to delete %s" "$copydir"
# fi
#
# # remove lock file
# rm -f "$copydir.lock"
# stat_done
# }
# Usage: install_packages $copydir $pkgs...
install_packages() {
local copydir=$1
local install_pkgs=("${@:2}")
local -a pkgnames
local ret
pkgnames=("${install_pkgs[@]##*/}")
cp -- "${install_pkgs[@]}" "$copydir/root/"
chroot-run "$copydir" \
pacman -U --noconfirm -- "${pkgnames[@]/#//root/}"
chroot-run -r "${bindmounts_ro[*]}" -w "${bindmounts_rw[*]}" "$copydir" \
pacman -U --noconfirm -- "${pkgnames[@]/#//root/}"
ret=$?
rm -- "${pkgnames[@]/#/$copydir/root/}"
# If there is no PKGBUILD we are done
[[ -f PKGBUILD ]] || exit $ret
return $ret
}
# Usage: prepare_chroot $copydir $HOME $repack $run_namcap
# Globals:
# - MAKEFLAGS
# - PACKAGER
prepare_chroot() {
local copydir=$1
local USER_HOME=$2
local repack=$3
local run_namcap=$4
$repack || rm -rf "$copydir/build"
local builduser_uid="${SUDO_UID:-$UID}"
@ -191,10 +180,9 @@ prepare_chroot() {
# We can't use useradd without chrooting, otherwise it invokes PAM modules
# which we might not be able to load (i.e. when building i686 packages on
# an x86_64 host).
sed -e '/^builduser:/d' -i "$copydir"/etc/{passwd,shadow,group}
sed -e '/^builduser:/d' -i "$copydir"/etc/{passwd,group}
printf >>"$copydir/etc/group" 'builduser:x:%d:\n' $builduser_gid
printf >>"$copydir/etc/passwd" 'builduser:x:%d:%d:builduser:/build:/bin/bash\n' $builduser_uid $builduser_gid
printf >>"$copydir/etc/shadow" 'builduser:!!:%d::::::\n' "$(( $(date -u +%s) / 86400 ))"
$install -d "$copydir"/{build,build/.gnupg,startdir,{pkg,srcpkg,src,log}dest}
@ -205,7 +193,7 @@ prepare_chroot() {
sed -e '/^MAKEFLAGS=/d' -e '/^PACKAGER=/d' -i "$copydir/etc/makepkg.conf"
for x in BUILDDIR=/build PKGDEST=/pkgdest SRCPKGDEST=/srcpkgdest SRCDEST=/srcdest LOGDEST=/logdest \
"MAKEFLAGS='$MAKEFLAGS'" "PACKAGER='$PACKAGER'"
"MAKEFLAGS='${MAKEFLAGS:-}'" "PACKAGER='${PACKAGER:-}'"
do
grep -q "^$x" "$copydir/etc/makepkg.conf" && continue
echo "$x" >>"$copydir/etc/makepkg.conf"
@ -221,9 +209,7 @@ EOF
{
printf '#!/bin/bash\n'
declare -f _chrootbuild
printf '_chrootbuild'
printf ' %q' "${makepkg_args[@]}"
printf ' || exit\n'
printf '_chrootbuild "$@" || exit\n'
if $run_namcap; then
declare -f _chrootnamcap
@ -236,18 +222,9 @@ EOF
# These functions aren't run in makechrootpkg,
# so no global variables
_chrootbuild() {
export LC_ALL=en_US.UTF-8
export LC_ALL=C
. /etc/profile
# export HOME=/build
# cd /startdir
# sudo -u builduser makepkg "$@"
sudo -iu builduser bash -c 'cd /startdir; makepkg "$@"' -bash "$@"
ret=$?
case $ret in
0|14) return 0;;
*) return $ret;;
esac
}
_chrootnamcap() {
@ -258,37 +235,52 @@ _chrootnamcap() {
done
}
# Usage: download_sources $copydir $src_owner
# Globals:
# - SRCDEST
# - USER
download_sources() {
local copydir=$1
local src_owner=$2
local builddir="$(mktemp -d)"
chown $SUDO_USER: "$builddir"
chmod 1777 "$builddir"
# Ensure sources are downloaded
if [[ -n $SUDO_USER ]]; then
sudo -u $SUDO_USER env SRCDEST="$SRCDEST" BUILDDIR="$builddir" \
makepkg_user=${makepkg_user:-$SUDO_USER}
if [[ -n $makepkg_user ]]; then
sudo -u "$makepkg_user" env SRCDEST="$SRCDEST" BUILDDIR="$builddir" \
makepkg --config="$copydir/etc/makepkg.conf" --verifysource -o
else
( export SRCDEST BUILDDIR="$builddir"
makepkg --asroot --config="$copydir/etc/makepkg.conf" --verifysource -o
)
error "Running makepkg as root is not allowed."
exit 1
fi
(( $? != 0 )) && die "Could not download sources."
# Clean up garbage from verifysource
rm -rf $builddir
rm -rf "$builddir"
}
# Usage: move_products $copydir $owner
# Globals:
# - PKGDEST
# - LOGDEST
move_products() {
local copydir=$1
local src_owner=$2
local pkgfile
for pkgfile in "$copydir"/pkgdest/*; do
chown "$src_owner" "$pkgfile"
mv "$pkgfile" "$PKGDEST"
# Fix broken symlink because of temporary chroot PKGDEST /pkgdest
if [[ "$PWD" != "$PKGDEST" && -L "$PWD/${pkgfile##*/}" ]]; then
rm "$PWD/${pkgfile##*/}"
ln -sf "$PKGDEST/${pkgfile##*/}"
fi
done
local l
for l in "$copydir"/logdest/*; do
[[ $l == */logpipe.* ]] && continue
chown "$src_owner" "$l"
@ -302,49 +294,112 @@ move_products() {
}
# }}}
umask 0022
orig_argv=("$0" "$@")
load_vars "$USER_HOME/.makepkg.conf" || load_vars /etc/makepkg.conf
main() {
init_variables
# Use PKGBUILD directory if these don't exist
[[ -d $PKGDEST ]] || PKGDEST=$PWD
[[ -d $SRCDEST ]] || SRCDEST=$PWD
[[ -d $SRCPKGDEST ]] || SRCPKGDEST=$PWD
[[ -d $LOGDEST ]] || LOGDEST=$PWD
local opts='hcur:I:l:nTD:d:U:'
create_chroot
while getopts ${opts} arg; do
case "$arg" in
c) clean_first=true ;;
D) bindmounts_ro+=("$OPTARG") ;;
d) bindmounts_rw+=("$OPTARG") ;;
u) update_first=true ;;
r) passeddir="$OPTARG" ;;
I) install_pkgs+=("$OPTARG") ;;
l) copy="$OPTARG" ;;
n) run_namcap=true; makepkg_args+=(-i) ;;
T) temp_chroot=true; copy+="-$$" ;;
U) makepkg_user="$OPTARG" ;;
h|*) usage ;;
esac
done
$update_first && chroot-run \
-r "${mountargs_ro}" \
-w "${mountargs_rw}" \
"$copydir" \
[[ ! -f PKGBUILD && -z "${install_pkgs[*]}" ]] && die 'This must be run in a directory containing a PKGBUILD.'
[[ -n $makepkg_user && -z $(id -u "$makepkg_user") ]] && die 'Invalid makepkg user.'
check_root
# Canonicalize chrootdir, getting rid of trailing /
chrootdir=$(readlink -e "$passeddir")
[[ ! -d $chrootdir ]] && die "No chroot dir defined, or invalid path '%s'" "$passeddir"
[[ ! -d $chrootdir/root ]] && die "Missing chroot dir root directory. Try using: mkchroot %s/root base-devel" "$chrootdir"
if [[ ${copy:0:1} = / ]]; then
copydir=$copy
else
copydir="$chrootdir/$copy"
fi
# Pass all arguments after -- right to makepkg
makepkg_args+=("${@:$OPTIND}")
# See if -R was passed to makepkg
for arg in "${@:OPTIND}"; do
case ${arg%%=*} in
-*R*|--repackage)
repack=true
break 2
;;
esac
done
load_user_info
umask 0022
load_vars "${PAC_USERCONFDIR}/makepkg.conf" || load_vars "$USER_HOME/.makepkg.conf"
load_vars /etc/makepkg.conf
# Use PKGBUILD directory if these don't exist
[[ -d $PKGDEST ]] || PKGDEST=$PWD
[[ -d $SRCDEST ]] || SRCDEST=$PWD
[[ -d $SRCPKGDEST ]] || SRCPKGDEST=$PWD
[[ -d $LOGDEST ]] || LOGDEST=$PWD
# Lock the chroot we want to use. We'll keep this lock until we exit.
lock 9 "$copydir.lock" "Locking chroot copy [%s]" "$copy"
if [[ ! -d $copydir ]] || $clean_first; then
sync_chroot "$chrootdir" "$copy"
fi
$update_first && chroot-run -r "${bindmounts_ro[*]}" -w "${bindmounts_rw[*]}" "$copydir" \
pacman -Syu --noconfirm
[[ -n ${install_pkgs[*]} ]] && install_packages
download_sources
prepare_chroot
mountargs_rw="${PWD}:/startdir,${SRCDEST}:/srcdest"
if chroot-run -r "${mountargs_ro}" \
-w "${mountargs_rw}" \
"$copydir" \
/chrootbuild; then
move_products
else
(( ret += 1 ))
fi
$temp_chroot && clean_temporary
if (( ret != 0 )); then
if $temp_chroot; then
die "Build failed"
else
die "Build failed, check %s/build" "$copydir"
if [[ -n ${install_pkgs[*]:-} ]]; then
install_packages "$copydir" "${install_pkgs[@]}"
ret=$?
# If there is no PKGBUILD we have done
[[ -f PKGBUILD ]] || return $ret
fi
else
true
fi
download_sources "$copydir" "$src_owner"
prepare_chroot "$copydir" "$USER_HOME" "$repack" "$run_namcap"
bindmounts_rw+=("${PWD}:/startdir" "${SRCDEST}:/srcdest")
if chroot-run -r "${bindmounts_ro[*]}" -w "${bindmounts_rw[*]}" "$copydir" \
/chrootbuild "${makepkg_args[@]}"; then
move_products "$copydir" "$src_owner"
else
(( ret += 1 ))
fi
$temp_chroot && delete_chroot "$copydir" "$copy"
if (( ret != 0 )); then
if $temp_chroot; then
die "Build failed"
else
die "Build failed, check %s/build" "$copydir"
fi
else
true
fi
}
main "$@"

View file

@ -17,7 +17,9 @@ LIBDIR='@libdir@'
import ${LIBDIR}/util.sh
load_vars "$HOME/.makepkg.conf"
load_user_info
load_vars "${PAC_USERCONFDIR}/makepkg.conf" || load_vars "$USER_HOME/.makepkg.conf"
load_vars /etc/makepkg.conf
if [ ! -e "$1" ]; then

View file

@ -1,27 +0,0 @@
#!/bin/bash
LIBDIR='/usr/lib/manjaro-tools'
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
import ${LIBDIR}/util.sh
[[ ! -z "$1" ]] && cd "$1"
for f in $(find . -maxdepth 1 -name '*.iso' | cut -d'/' -f2); do
if [[ ! -e $f.sha256 ]]; then
create_chksums $f
elif [[ $f -nt $f.sha256 ]]; then
create_chksums $f
else
info "checksums for [$f] already created"
fi
if [[ ! -e $f.sig ]]; then
signfile $f
elif [[ $f -nt $f.sig ]]; then
rm $f.sig
signfile $f
else
info "signature file for [$f] already created"
fi
done

View file

@ -11,4 +11,4 @@
version=@version@
find $PWD -maxdepth 1 -regex '.*\.pkg\.tar\.\(xz\|zst\)' -exec signfile {} \;
find $PWD -maxdepth 1 -name '*.pkg.tar.xz' -exec signfile {} \;

136
bin/testiso.in Normal file → Executable file
View file

@ -11,123 +11,29 @@
version=@version@
LIBDIR='@libdir@'
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
import ${LIBDIR}/util.sh
if [ $# -eq 0 ]; then
msg "No <profile>"
msg2 "Usage: testiso <profile>"
echo "
usage: testiso <isofile> [id|ic|sd|sc|vd|vc]
id boot iso as IDE disk
ic boot iso as IDE cd-rom
sd boot iso as SCSI disk
sc boot iso as SCSI cd-rom
vd boot iso as virtio disk
vc boot iso as virtio cd-rom
"
exit 1
fi
vdi_size=10240 # 10GB size
#Check if already exist virtual disk and in case create it
if [[ -e ~/VirtualBox\ VMs/Manjaro/Manjaro.vbox ]]; then
msg "Manjaro Virtual Machine Found"
else
msg "We create a new VirtualBox Machine called Manjaro"
msg2 "We create a new Virtual Disk Image ( vdi ) with ${vdi_size}GB"
VBoxManage createmedium disk --filename ~/VirtualBox\ VMs/Manjaro/Manjaro.vdi --size ${vdi_size} --format VDI --variant Fixed
UUID=$(VBoxManage showhdinfo ~/VirtualBox\ VMs/Manjaro/Manjaro.vdi | awk 'NR == 1 {print $2}') #uuid of vdi disk
gui_lang=$(awk -F'[.=]' '/LANG/ {print $2}' /etc/locale.conf)
echo '<?xml version="1.0"?>
<!--
** DO NOT EDIT THIS FILE.
** If you make changes to this file while any VirtualBox related application
** is running, your changes will be overwritten later, without taking effect.
** Use VBoxManage or the VirtualBox Manager GUI to make changes.
-->
<VirtualBox xmlns="http://www.virtualbox.org/" version="1.16-linux">
<Machine uuid="{d5d29291-32e4-4c8e-9633-ecc0511966da}" name="Manjaro" OSType="ArchLinux_64" snapshotFolder="Snapshots" lastStateChange="2019-08-17T15:20:11Z">
<MediaRegistry>
<HardDisks>
<HardDisk uuid="{UUID}" location="Manjaro.vdi" format="VDI" type="Normal"/>
</HardDisks>
</MediaRegistry>
<Hardware>
<CPU>
<PAE enabled="false"/>
<LongMode enabled="true"/>
<X2APIC enabled="true"/>
<HardwareVirtExLargePages enabled="false"/>
</CPU>
<Memory RAMSize="2048"/>
<Firmware type="EFI"/>
<HID Pointing="USBTablet"/>
<Display VRAMSize="16" accelerate3D="true"/>
<VideoCapture file="." fps="25"/>
<BIOS>
<IOAPIC enabled="true"/>
</BIOS>
<USB>
<Controllers>
<Controller name="OHCI" type="OHCI"/>
</Controllers>
</USB>
<Network>
<Adapter slot="0" enabled="true" MACAddress="080027967634" type="82540EM">
<NAT/>
</Adapter>
</Network>
<AudioAdapter codec="AD1980" driver="Pulse" enabled="true" enabledIn="false"/>
<RTC localOrUTC="UTC"/>
<GuestProperties>
<GuestProperty name="/VirtualBox/HostInfo/GUI/LanguageID" value="gui_lang" timestamp="1566055357633717000" flags=""/>
</GuestProperties>
</Hardware>
<StorageControllers>
<StorageController name="IDE" type="PIIX4" PortCount="2" useHostIOCache="true" Bootable="true">
<AttachedDevice passthrough="false" type="DVD" hotpluggable="false" port="1" device="0"/>
</StorageController>
<StorageController name="SATA" type="AHCI" PortCount="1" useHostIOCache="false" Bootable="true" IDE0MasterEmulationPort="0" IDE0SlaveEmulationPort="1" IDE1MasterEmulationPort="2" IDE1SlaveEmulationPort="3">
<AttachedDevice type="HardDisk" hotpluggable="false" port="0" device="0">
<Image uuid="{UUID}"/>
</AttachedDevice>
</StorageController>
</StorageControllers>
</Machine>
</VirtualBox>' > ~/VirtualBox\ VMs/Manjaro/Manjaro.vbox
sed -i "s/UUID/$UUID/g" ~/VirtualBox\ VMs/Manjaro/Manjaro.vbox
sed -i "s/gui_lang/$gui_lang/g" ~/VirtualBox\ VMs/Manjaro/Manjaro.vbox
VBoxManage registervm ~/VirtualBox\ VMs/Manjaro/Manjaro.vbox #register the manjaro vbox machine
fi
VBoxManage storageattach Manjaro --storagectl IDE --port 1 --device 0 --medium emptydrive #empty the dvd drive
sleep 1
load_user_info
load_config "${USERCONFDIR}/manjaro-tools.conf" || load_config "${SYSCONFDIR}/manjaro-tools.conf"
run_dir=${cache_dir_iso}
dist_number=${dist_release}
iso_dir=$(find ${run_dir} -type d -iname $1)
iso=${iso_dir}/${dist_number}
if [[ -e $(ls ${iso}/*.iso) ]]; then
iso_name=$(ls ${iso}/*.iso)
else msg "No ISO to load present"
exit 1
fi
VBoxManage storageattach Manjaro --storagectl IDE --port 1 --device 0 --type dvddrive --medium $iso_name #attach dvd manjaro iso
sleep 1
msg2 "Run Vbox Manjaro with ${iso_name}"
sleep 2
VBoxManage startvm Manjaro #run vbox machine
case "${2}" in
id) IF="ide"; MEDIA="disk";;
ic) IF="ide"; MEDIA="cdrom";;
sd) IF="scsi"; MEDIA="disk";;
sc) IF="scsi"; MEDIA="cdrom";;
vd) IF="virtio"; MEDIA="disk";;
vc) IF="virtio"; MEDIA="cdrom";;
*) IF="scsi"; MEDIA="cdrom";;
esac
echo qemu -m 256 -drive file=${1},if=${IF},media=${MEDIA},boot=on
qemu -m 256 -drive file=${1},if=${IF},media=${MEDIA},boot=on

29
data/base-devel-udev Normal file
View file

@ -0,0 +1,29 @@
autoconf
automake
binutils
bison
libeudev
fakeroot
file
findutils
flex
gawk
gcc
gettext
grep
groff
gzip
libtool
m4
make
pacman
patch
pkg-config
sed
sudo
texinfo
util-linux-nosystemd
which
>multilib gcc-multilib
>multilib lib32-fakeroot
>multilib lib32-libltdl

View file

@ -1,93 +0,0 @@
---
componentName: manjaro
# This selects between different welcome texts. When false, uses
# the traditional "Welcome to the %1 installer.", and when true,
# uses "Welcome to the Calamares installer for %1." This allows
# to distinguish this installer from other installers for the
# same distribution.
welcomeStyleCalamares: ${welcomestyle}
# Should the welcome image (productWelcome, below) be scaled
# up beyond its natural size? If false, the image does not grow
# with the window but remains the same size throughout (this
# may have surprising effects on HiDPI monitors).
welcomeExpandingLogo: ${welcomelogo}
# Size and expansion policy for Calamares.
# - "normal" or unset, expand as needed, use *windowSize*
# - "fullscreen", start as large as possible, ignore *windowSize*
# - "noexpand", never expand, use *windowSize*
windowExpanding: ${windowexp}
# Size of Calamares window, expressed as w,h. Both w and h
# may be either pixels (suffix px) or font-units (suffix em).
# e.g. "800px,600px"
# "60em,480px"
# This setting is ignored if "fullscreen" is selected for
# *windowExpanding*, above. If not set, use constants defined
# in CalamaresUtilsGui, 800x520.
windowSize: ${windowsize}
# Placement of Calamares window. Either "center" or "free".
# Whether "center" actually works does depend on the window
# manager in use (and only makes sense if you're not using
# *windowExpanding* set to "fullscreen").
windowPlacement: ${windowplacement}
# These are strings shown to the user in the user interface.
# There is no provision for translating them -- since they
# are names, the string is included as-is.
#
# The four Url strings are the Urls used by the buttons in
# the welcome screen, and are not shown to the user. Clicking
# on the "Support" button, for instance, opens the link supportUrl.
# If a Url is empty, the corresponding button is not shown.
#
# bootloaderEntryName is how this installation / distro is named
# in the boot loader (e.g. in the GRUB menu).
strings:
productName: ${dist_name} Linux
shortProductName: ${dist_name}
version: ${dist_release}
shortVersion: ${dist_release}
versionedName: ${dist_name} Linux ${dist_release} "${dist_codename}"
shortVersionedName: ${dist_name} ${dist_release}
bootloaderEntryName: ${dist_name}
# These images are loaded from the branding module directory.
#
# productIcon is used as the window icon, and will (usually) be used
# by the window manager to represent the application. This image
# should be square, and may be displayed by the window manager
# as small as 16x16 (but possibly larger).
# productLogo is used as the logo at the top of the left-hand column
# which shows the steps to be taken. The image should be square,
# and is displayed at 80x80 pixels (also on HiDPI).
# productWelcome is shown on the welcome page of the application in
# the middle of the window, below the welcome text. It can be
# any size and proportion, and will be scaled to fit inside
# the window. Use `welcomeExpandingLogo` to make it non-scaled.
# Recommended size is 320x150.
images:
productLogo: "logo.png"
productIcon: "logo.png"
productWelcome: "languages.png"
# The slideshow is displayed during execution steps (e.g. when the
# installer is actually writing to disk and doing other slow things).
slideshow: "show.qml"
# Colors for text and background components.
#
# - sidebarBackground is the background of the sidebar
# - sidebarText is the (foreground) text color
# - sidebarTextHighlight sets the background of the selected (current) step.
# Optional, and defaults to the application palette.
# - sidebarSelect is the text color of the selected step.
#
style:
sidebarBackground: "${sidebackground}"
sidebarText: "${sidebartext}"
sidebarTextSelect: "${sidebartextselect}"
sidebarTextHighlight: "${sidebartexthighlight}"

View file

@ -1,12 +1,6 @@
awesome
bspwm
bspwm-mate
budgie
cinnamon
deepin
i3
lxde
lxqt
mate
openbox
webdad

View file

@ -1,5 +1,5 @@
architect
gnome
kde
netinstall
xfce
gnome
lxqt
netinstall

View file

@ -0,0 +1,2 @@
gnome-edition
mate-edition

View file

@ -1,3 +1,3 @@
carch="i686"
chost="i686-pc-linux-gnu"
cflags="-march=i686 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt"
cflags="-march=i686 -mtune=generic -O2 -pipe -fstack-protector-strong"

View file

@ -1,3 +1,3 @@
carch="x86_64"
chost="x86_64-pc-linux-gnu"
cflags="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt"
cflags="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong"

View file

@ -1,3 +1,3 @@
carch="x86_64"
chost="x86_64-pc-linux-gnu"
cflags="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt"
cflags="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong"

View file

@ -1,4 +1,3 @@
#!/hint/bash
#
# /etc/makepkg.conf
#
@ -9,10 +8,9 @@
#
#-- The download utilities that makepkg should use to acquire sources
# Format: 'protocol::agent'
DLAGENTS=('file::/usr/bin/curl -gqC - -o %o %u'
'ftp::/usr/bin/curl -gqfC - --ftp-pasv --retry 3 --retry-delay 3 -o %o %u'
'http::/usr/bin/curl -gqb "" -fLC - --retry 3 --retry-delay 3 -o %o %u'
'https::/usr/bin/curl -gqb "" -fLC - --retry 3 --retry-delay 3 -o %o %u'
DLAGENTS=('ftp::/usr/bin/curl -fC - --ftp-pasv --retry 3 --retry-delay 3 -o %o %u'
'http::/usr/bin/curl -fLC - --retry 3 --retry-delay 3 -o %o %u'
'https::/usr/bin/curl -fLC - --retry 3 --retry-delay 3 -o %o %u'
'rsync::/usr/bin/rsync --no-motd -z %u %o'
'scp::/usr/bin/scp -C %u %o')
@ -36,10 +34,12 @@ CARCH="@CARCH@"
CHOST="@CHOST@"
#-- Compiler and Linker Flags
# -march (or -mcpu) builds exclusively for an architecture
# -mtune optimizes for an architecture, but builds for whole processor family
CPPFLAGS="-D_FORTIFY_SOURCE=2"
CFLAGS="@CFLAGS@"
CXXFLAGS="@CFLAGS@"
LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now"
LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro"
#-- Make Flags: change this for DistCC/SMP systems
#MAKEFLAGS="-j2"
#-- Debugging flags
@ -50,7 +50,7 @@ DEBUG_CXXFLAGS="-g -fvar-tracking-assignments"
# BUILD ENVIRONMENT
#########################################################################
#
# Defaults: BUILDENV=(!distcc !color !ccache check !sign)
# Defaults: BUILDENV=(fakeroot !distcc color !ccache check !sign)
# A negated environment option will do the opposite of the comments below.
#
#-- fakeroot: Allow building packages as a non-root user
@ -74,7 +74,7 @@ BUILDENV=(!distcc color !ccache check !sign)
# These are default values for the options=() settings
#########################################################################
#
# Default: OPTIONS=(!strip docs libtool staticlibs emptydirs !zipman !purge !debug)
# Default: OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !optipng !upx !debug)
# A negated option will do the opposite of the comments below.
#
#-- strip: Strip symbols from binaries/libraries
@ -84,9 +84,10 @@ BUILDENV=(!distcc color !ccache check !sign)
#-- emptydirs: Leave empty directories in packages
#-- zipman: Compress manual (man and info) pages in MAN_DIRS with gzip
#-- purge: Remove files specified by PURGE_TARGETS
#-- upx: Compress binary executable files using UPX
#-- debug: Add debugging flags as specified in DEBUG_* variables
#
OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !debug)
OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !optipng !upx !debug)
#-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512
INTEGRITY_CHECK=(md5)
@ -102,8 +103,6 @@ MAN_DIRS=({usr{,/local}{,/share},opt/*}/{man,info})
DOC_DIRS=(usr/{,local/}{,share/}{doc,gtk-doc} opt/*/{doc,gtk-doc})
#-- Files to be removed from all packages (if purge is specified)
PURGE_TARGETS=(usr/{,share}/info/dir .packlist *.pod)
#-- Directory to store source code in for debug packages
DBGSRCDIR="/usr/src/debug"
#########################################################################
# PACKAGE OUTPUT
@ -131,12 +130,9 @@ DBGSRCDIR="/usr/src/debug"
COMPRESSGZ=(gzip -c -f -n)
COMPRESSBZ2=(bzip2 -c -f)
COMPRESSXZ=(xz -c -z -)
COMPRESSZST=(zstd -c -T0 --ultra -20 -)
COMPRESSLRZ=(lrzip -q)
COMPRESSLZO=(lzop -q)
COMPRESSZ=(compress -c -f)
COMPRESSLZ4=(lz4 -q)
COMPRESSLZ=(lzip -c -f)
#########################################################################
# EXTENSION DEFAULTS
@ -145,5 +141,7 @@ COMPRESSLZ=(lzip -c -f)
# WARNING: Do NOT modify these variables unless you know what you are
# doing.
#
PKGEXT='.pkg.tar.zst'
PKGEXT='.pkg.tar.xz'
SRCEXT='.src.tar.gz'
# vim: set ft=sh ts=2 sw=2 et:

View file

@ -5,7 +5,7 @@
# default target branch
# target_branch=stable
# default target arch: auto detect
# default taget arch: auto detect
# target_arch=$(uname -m)
# cache dir where buildpkg, buildtree cache packages/pkgbuild, builiso iso files
@ -14,16 +14,13 @@
# build dir where buildpkg or buildiso chroots are created
# chroots_dir=/var/lib/manjaro-tools
# log dir where log files are created
# log_dir='/var/log/manjaro-tools'
# custom build mirror server
# build_mirror=https://manjaro.moson.eu/
# build_mirror=http://mirror.netzspielplatz.de/manjaro/packages
################ buildtree ###############
# manjaro package tree
# repo_tree=('core' 'extra' 'community' 'multilib')
# repo_tree=('core' 'extra' 'community' 'multilib' 'openrc')
# host_tree=https://github.com/manjaro
@ -37,86 +34,40 @@
################ buildiso ################
# default branch for iso-profiles repo: v18.1 Juhraya master>development release
# branch=v18.1
# default iso build list; name without .list extension
# build_list_iso=default
# the dist release; default: auto
# dist_release=18.1
# the dist codename; default: auto
# dist_codename=Juhraya
# the OS branding; default: auto
# dist_name
# dist_release=17.0
# the branding; default: auto
# dist_branding="MJRO"
# compression used, possible values gzip, lzma, lz4, lzo, xy, zstd (default)
# iso_compression=zstd
# possible values: openrc,systemd
# initsys="systemd"
# unset defaults to given value
# kernel="linux54"
# kernel="linux49"
# gpg key; leave empty or commented to skip sfs signing
# gpgkey=""
########## calamares preferences ##########
#See branding.desc.d for reference
# welcome style for calamares: true="Welcome to the %1 installer." ; false="Welcome to the Calamares installer for %1." (default)
# welcomestyle=false
# welcome image scaled (productWelcome)
# welcomelogo=true
# size and expansion policy for Calamares (possible value: normal,fullscreen,noexpand)
# windowexp=noexpand
# size of Calamares window, expressed as w,h.
# (possible units: pixel (px) or font-units (em))
# windowsize="800px,520px"
# placement of Calamares window, either "center" or "free".
# windowplacement="center"
# colors for text and background components:
# background of the sidebar
# sidebarbackground=#454948
# text color
# sidebartext=#efefef
# background of the selected step
# sidebartextselect=#4d915e
# text color of the selected step
# sidebartexthighlight=#1a1c1b
################ deployiso ################
# the server user
# account=[SetUser]
# Set to 'true' to use ssh-agent to store passphrase.
# ssh_agent=false
# use alternative storage server (one or the other might be more stable)
# alt_storage=false
# the server project: manjaro|manjaro-community
# determined automatically based on profile if unset
# the server project
# project="[SetProject]"
# set upload bandwidth limit in kB/s
# limit=
# limit=100
# the torrent tracker urls, comma separated
# tracker_url='udp://tracker.opentrackr.org:1337'
# tracker_url='udp://mirror.strits.dk:6969'
# Piece size, 2^n
# piece_size=21
# iso mirrors
# iso_mirrors=('heanet' 'jaist' 'netcologne' 'iweb' 'kent')

View file

@ -1,3 +1,3 @@
MODULES=(loop dm-snapshot)
HOOKS=(base udev miso_shutdown miso miso_loop_mnt miso_pxe_common miso_pxe_http miso_pxe_nbd miso_pxe_nfs miso_kms modconf block filesystems keyboard keymap)
MODULES="loop dm-snapshot"
HOOKS="base udev miso_shutdown miso miso_loop_mnt miso_pxe_common miso_pxe_http miso_pxe_nbd miso_pxe_nfs miso_kms modconf block pcmcia filesystems keyboard keymap"
COMPRESSION="xz"

View file

@ -18,7 +18,7 @@
HoldPkg = pacman glibc
# If upgrades are available for these packages they will be asked for first
SyncFirst = manjaro-system archlinux-keyring manjaro-keyring
#XferCommand = /usr/bin/curl -L -C - -f -o %o %u
#XferCommand = /usr/bin/curl -C - -f %u > %o
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
#CleanMethod = KeepInstalled
#UseDelta = 0.7
@ -34,11 +34,10 @@ Architecture = auto
# Misc options
#UseSyslog
#Color
#NoProgressBar
#TotalDownload
# We cannot check disk space from within a chroot environment
#CheckSpace
#VerbosePkgLists
ParallelDownloads = 4
# By default, pacman accepts packages signed by keys that its local keyring
# trusts (see pacman-key and its man page), as well as unsigned packages.
@ -81,8 +80,13 @@ Include = /etc/pacman.d/mirrorlist
SigLevel = PackageRequired
Include = /etc/pacman.d/mirrorlist
[community]
SigLevel = PackageRequired
Include = /etc/pacman.d/mirrorlist
# An example of a custom package repository. See the pacman manpage for
# tips on creating your own repositories.
#[custom]
#SigLevel = Optional TrustAll
#Server = file:///home/custompkgs

View file

@ -15,7 +15,7 @@
#LogFile = /var/log/pacman.log
#GPGDir = /etc/pacman.d/gnupg/
HoldPkg = pacman glibc
#XferCommand = /usr/bin/curl -L -C - -f -o %o %u
#XferCommand = /usr/bin/curl -C - -f %u > %o
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
#CleanMethod = KeepInstalled
Architecture = auto
@ -30,10 +30,9 @@ Architecture = auto
# Misc options
#UseSyslog
#UseDelta
#NoProgressBar
#TotalDownload
CheckSpace
#VerbosePkgLists
#ParallelDownloads = 5
# PGP signature checking
# NOTE: None of this will work without running `pacman-key --init` first.
@ -69,4 +68,4 @@ SigLevel = Never
[mhwd]
#SigLevel = Optional TrustAll
Server = file:///opt/mhwd/pkg
Server = file:///opt/pkg

View file

@ -10,18 +10,19 @@ Branch = stable
## 2) random - randomly generate the output mirrorlist
# Method = rank
## Filename to use when ranking mirrors
## The file must be present in core repo
# TestFile = core.db.tar.gz
## Specify to use only mirrors from specific a country.
## Can add multiple countries separated by a comma (ex: Germany,France)
## Empty means all
# OnlyCountry =
## Define protocols and priority
## separated by comma 'https,http' or 'http,https'
## ATM available protocols are: http, https, ftp
## Not specifying a protocol will ban the protocol from being used
## If a mirror has more than one protocol defined only the first is written to the mirrorlist
## Empty means all in reversed alphabetic order
# Protocols =
## Mirrors directory
# MirrorlistsDir = /etc/pacman.d/mirrors
## When set to False - all certificates are accepted.
## Use only if you fully trust all ssl-enabled mirrors.
# SSLVerify = True
## Output file
# OutputMirrorlist = /etc/pacman.d/mirrorlist
## When set to True prevents the regeneration of the mirrorlist if
## pacman-mirrors is invoked with the --no-update argument.
## Useful if you don't want the mirrorlist regenerated after a
## pacman-mirrors package upgrade.
# NoUpdate = False

View file

@ -18,7 +18,7 @@
HoldPkg = pacman glibc
# If upgrades are available for these packages they will be asked for first
SyncFirst = manjaro-system archlinux-keyring manjaro-keyring
#XferCommand = /usr/bin/curl -L -C - -f -o %o %u
#XferCommand = /usr/bin/curl -C - -f %u > %o
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
#CleanMethod = KeepInstalled
#UseDelta = 0.7
@ -34,11 +34,10 @@ Architecture = auto
# Misc options
#UseSyslog
#Color
#NoProgressBar
#TotalDownload
# We cannot check disk space from within a chroot environment
#CheckSpace
#VerbosePkgLists
ParallelDownloads = 4
# By default, pacman accepts packages signed by keys that its local keyring
# trusts (see pacman-key and its man page), as well as unsigned packages.
@ -81,6 +80,10 @@ Include = /etc/pacman.d/mirrorlist
SigLevel = PackageRequired
Include = /etc/pacman.d/mirrorlist
[community]
SigLevel = PackageRequired
Include = /etc/pacman.d/mirrorlist
# If you want to run 32 bit applications on your x86_64 system,
# enable the multilib repositories as required here.

View file

@ -8,22 +8,12 @@
# use extra packages as defined in pkglist to activate a full profile
# extra="false"
# use office installer module
# office_installer="false"
################ install ################
# default displaymanager: none
# supported; lightdm, sddm, gdm, lxdm, mdm
# displaymanager="none"
# add strict snaps: strict_snaps="core18 snap-store"
# strict_snaps=""
# add classic snaps: classic_snaps="code"
# classic_snaps=""
# choose the snap channel. Possible options are: stable, candidate, beta, edge
# snap_channel="stable"
# Set to false to disable autologin in the livecd
# autologin="true"
@ -33,9 +23,6 @@
# possible values: grub;systemd-boot
# efi_boot_loader="grub"
# kernel parameters (array); example: custom_boot_args="'acpi_osi=Linux'"
# custom_boot_args=
# configure calamares for netinstall
# netinstall="false"
@ -47,21 +34,20 @@
# unset defaults to given values
# names must match systemd service names
# enable_systemd=('avahi-daemon' 'bluetooth' 'cronie' 'ModemManager' 'NetworkManager' 'org.cups.cupsd' 'tlp' 'tlp-sleep' 'ufw')
# disable_systemd=('pacman-init')
# enable_systemd=('bluetooth' 'cronie' 'ModemManager' 'NetworkManager' 'org.cups.cupsd' 'tlp' 'tlp-sleep')
# disable_systemd=()
# unset defaults to given values,
# names must match openrc service names
# enable_openrc=('acpid' 'bluetooth' 'consolekit' 'cronie' 'cupsd' 'dbus' 'syslog-ng' 'NetworkManager')
# disable_openrc=()
# unset defaults to given values
# addgroups="lp,network,power,sys, wheel"
# addgroups="video,power,disk,storage,optical,network,lp,scanner,wheel"
# the same workgroup name if samba is used
# smb_workgroup="Manjaro"
# default system shell is bash
# '/etc/defaults/useradd': " "
# userShell : "/bin/zsh"
# empty value will not be used
#user_shell=
################# live-session #################
# unset defaults to given value
@ -78,4 +64,7 @@
# services in enable_systemd array don't need to be listed here
# enable_systemd_live=('manjaro-live' 'mhwd-live' 'pacman-init' 'mirrors-live')
# disable_systemd_live=()
# unset defaults to given values,
# names must match openrc service names
# services in enable_openrc array don't need to be listed here
# enable_openrc_live=('manjaro-live' 'mhwd-live' 'pacman-init' 'mirrors-live')

View file

@ -91,48 +91,6 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
<listitem><para>Branch where the mirrors in the iso will point.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-c</option></term>
<listitem><para>Disable clean working directory step.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-f</option></term>
<listitem><para>Build full iso profile including packages with the >extra flag.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-g KEY</option></term>
<listitem><para>The GPG key to use to sign the sfs images.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-h</option></term>
<listitem><para>Help.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-k linuxXXX</option></term>
<listitem><para>The kernel on the iso</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-m</option></term>
<listitem><para>Enable persistence mode.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-q</option></term>
<listitem><para>Query settings and pretend build.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-r DIR</option></term>
@ -146,9 +104,33 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
</varlistentry>
<varlistentry>
<term><option>-v</option></term>
<term><option>-i systemd|openrc</option></term>
<listitem><para>Verbose output to log file, show profile detail in combination with pretend.</para></listitem>
<listitem><para>The init system on the iso</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-g KEY</option></term>
<listitem><para>The GPG key to use to sign the sfs images.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-k linuxXXX</option></term>
<listitem><para>The kernel on the iso</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-c</option></term>
<listitem><para>Disable clean working directory step.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-m</option></term>
<listitem><para>Enable persistence mode.</para></listitem>
</varlistentry>
<varlistentry>
@ -162,6 +144,24 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
<listitem><para>Generate iso from already created images, for example created with the -x option.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-v</option></term>
<listitem><para>Verbose output to log file, show profile detail in combination with pretend.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-q</option></term>
<listitem><para>Query settings and pretend build.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-h</option></term>
<listitem><para>Help.</para></listitem>
</varlistentry>
</variablelist>
</refsect1>

View file

@ -96,13 +96,31 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
<varlistentry>
<term><option>-i PKG</option></term>
<listitem><para>Install a package into the working copy of the chroot.</para></listitem>
<listitem><para>Install packages into the working copy of the chroot.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-o</option></term>
<listitem><para>Create chroot.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-d</option></term>
<listitem><para>Delete chroot.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-c</option></term>
<listitem><para>Recreate chroot.</para></listitem>
<listitem><para>Clean chroot copy.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-u</option></term>
<listitem><para>Update chroot copy.</para></listitem>
</varlistentry>
<varlistentry>
@ -123,6 +141,12 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
<listitem><para>Sign package.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-x</option></term>
<listitem><para>Udev base-devel group (no systemd).</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-q</option></term>

View file

@ -81,6 +81,12 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
<listitem><para>Architecture that the yaml will be created for. Can be i686 or x86_64.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-i systemd|openrc</option></term>
<listitem><para>The init system the yaml will be created for.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-k linuxXXX</option></term>

View file

@ -70,16 +70,10 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
<variablelist>
<varlistentry>
<term><option>-d</option></term>
<term><option>-p PROFILE...</option></term>
<listitem><para>Use hidden remote directory.
The target directory name will be prefaced with a dot.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-h</option></term>
<listitem><para>Help.</para></listitem>
<listitem><para>Name of the build list or name of the directory
you will upload.</para></listitem>
</varlistentry>
<varlistentry>
@ -89,22 +83,9 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
</varlistentry>
<varlistentry>
<term><option>-p PROFILE...</option></term>
<term><option>-u</option></term>
<listitem><para>Name of the build list or name of the directory
you will upload.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-q</option></term>
<listitem><para>Query settings and pretend upload.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-s</option></term>
<listitem><para>Sign ISO and create checksums before uploading.</para></listitem>
<listitem><para>Update remote iso.</para></listitem>
</varlistentry>
<varlistentry>
@ -113,17 +94,23 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
<listitem><para>Create a torrent from iso file.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-u</option></term>
<listitem><para>Update remote iso.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-v</option></term>
<listitem><para>Verbose output.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-q</option></term>
<listitem><para>Query settings and pretend upload.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-h</option></term>
<listitem><para>Help.</para></listitem>
</varlistentry>
</variablelist>
</refsect1>

View file

@ -132,7 +132,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
<term><varname>repo_tree=</varname></term>
<listitem><para>Manjaro package tree. Default is
"('core' 'extra' 'community' 'multilib')".
"('core' 'extra' 'community' 'multilib' 'openrc')".
</para></listitem>
</varlistentry>
@ -208,6 +208,18 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>initsys=</varname></term>
<listitem><para>Takes <option>systemd</option> (the default)
or <option>openrc</option>. Selecting and option will change
how the hostname, the displaymanager and services will be configured.
For services also controls if buildiso will use enable_systemd and
enable_systemd_live or enable_openrc and enable_openrc_live to determine
the default services that will be enabled automatically.
</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>kernel=</varname></term>
@ -225,6 +237,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
<para>The following options are understood:</para>
<variablelist>
<varlistentry>
<term><varname>account=</varname></term>
@ -232,29 +245,10 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>ssh_agent=true|false</varname></term>
<listitem><para>When set true, the ssh-agent will be used to store
the passphrase.
</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>alt_storage=true|false</varname></term>
<listitem><para>When set true deployiso will upload to OSDN's
alternative server. Under some circumstances and depending on your
location the connection might be more stable.
</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>project=</varname></term>
<listitem><para>Default OSDN project name to be used for upload.
If unset, 'manjaro' or 'manjaro-community' will be determined
automatically based on profile.
<listitem><para>Default SF project name to be used for upload.
</para></listitem>
</varlistentry>
@ -280,6 +274,14 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>iso_mirrors=</varname></term>
<listitem><para>Array of iso mirrors that will be
used for webseeds.
</para></listitem>
</varlistentry>
</variablelist>
</refsect1>

View file

@ -152,6 +152,14 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>enable_openrc=</varname></term>
<listitem><para>Array of services that will be
enabled in openrc systems.
</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>hostname=</varname></term>
@ -201,6 +209,14 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>enable_openrc_live=</varname></term>
<listitem><para>Array of services that will be
enabled in the openrc live-cd.
</para></listitem>
</varlistentry>
</variablelist>
</refsect1>

View file

@ -117,54 +117,12 @@ _verify_signature() {
return ${_status}
}
_find_dev_by_path () {
local path="${1}"
local tmp_mnt=/tmp_mnt
local _mnt
local a d
local device
[[ "$path" ]] || return 1
mkdir -p "${tmp_mnt}"
for a in 1 2 3; do
for d in $(awk '{ print "/dev/"$4 }' /proc/partitions); do
# If the device is already mounted, it shouldn't be
# unmounted after the check.
grep -q "^$d " /proc/mounts && {
_mnt=$(grep "^$d " /proc/mounts | cut -d ' ' -f 2)
unmount=
} || {
mount -r -t auto "${d}" "${tmp_mnt}" 2> /dev/null || continue
_mnt="${tmp_mnt}"
unmount=true
}
# File exists in $d. Save $d on $device.
[[ -f "${_mnt}/${path}" ]] && device="${d}"
[[ "${unmount}" ]] && umount "${tmp_mnt}" 2> /dev/null || true
[[ "${device}" ]] && {
echo "${device}"
return
}
done
sleep 1
done
return 1
}
run_hook() {
[[ -z "${arch}" ]] && arch="$(uname -m)"
[[ -z "${copytoram_size}" ]] && copytoram_size="75%"
[[ -z "${misobasedir}" ]] && misobasedir="manjaro"
[[ -z "${dm_snap_prefix}" ]] && dm_snap_prefix="manjaro"
misodevice=$(_find_dev_by_path /.miso)
[[ -z "${dm_snap_prefix}" ]] && dm_snap_prefix="arch"
[[ -z "${misodevice}" ]] && misodevice="/dev/disk/by-label/${misolabel}"
[[ -z "${cow_spacesize}" ]] && cow_spacesize="256M"
[[ -z "${overlay_root_size}" ]] && overlay_root_size="75%"
@ -200,7 +158,7 @@ miso_mount_handler() {
fi
if [[ "${checksum}" == "y" ]]; then
for fs in rootfs desktopfs mhwdfs livefs; do
for fs in rootfs desktopfs mhwdfs livefs;do
if [[ -f "/run/miso/bootmnt/${misobasedir}/${arch}/${fs}.sfs" ]]; then
if [[ -f "/run/miso/bootmnt/${misobasedir}/${arch}/${fs}.md5" ]]; then
msg -n ":: Self-test requested, please wait..."
@ -220,7 +178,7 @@ miso_mount_handler() {
fi
if [[ "${verify}" == "y" ]]; then
for fs in rootfs desktopfs mhwdfs livefs; do
for fs in rootfs desktopfs mhwdfs livefs;do
if [[ -f "/run/miso/bootmnt/${misobasedir}/${arch}/${fs}.sfs" ]]; then
if [[ -f "/run/miso/bootmnt/${misobasedir}/${arch}/${fs}.sfs.sig" ]]; then
msg -n ":: Signature verification requested, please wait..."
@ -263,7 +221,7 @@ miso_mount_handler() {
local dest_sfs="/run/miso/sfs" dest_img="/run/miso/img"
local lower_dir
for sfs in livefs mhwdfs desktopfs rootfs; do
for sfs in livefs mhwdfs desktopfs rootfs;do
if [[ -f "${src}/${sfs}.sfs" ]]; then
_mnt_sfs "${src}/${sfs}.sfs" "${dest_sfs}/${sfs}"
if [[ -f "${dest_sfs}/${sfs}/${sfs}.img" ]]; then

View file

@ -1,56 +1,9 @@
# vim: set ft=sh:
find_dev_by_path () {
local path="${1}"
local tmp_mnt=/tmp_mnt
local _mnt
local a d
local device
[[ "$path" ]] || return 1
mkdir -p "${tmp_mnt}"
for a in 1 2 3; do
for d in $(awk '{ print "/dev/"$4 }' /proc/partitions); do
# If the device is already mounted, it shouldn't be
# unmounted after the check.
grep -q "^$d " /proc/mounts && {
_mnt=$(grep "^$d " /proc/mounts | cut -d ' ' -f 2)
unmount=
} || {
mount -r -t auto "${d}" "${tmp_mnt}" 2> /dev/null || continue
_mnt="${tmp_mnt}"
unmount=true
}
# File exists in $d. Save $d on $device.
[[ -f "${_mnt}/${path}" ]] && device="${d}"
[[ "${unmount}" ]] && umount "${tmp_mnt}" 2> /dev/null || true
[[ "${device}" ]] && {
echo "${device}"
return
}
done
sleep 1
done
return 1
}
run_hook () {
[[ -n "${img_label}" ]] && img_dev="/dev/disk/by-label/${img_label}"
[[ -z "${img_flags}" ]] && img_flags="defaults"
if [[ "${img_loop}" ]]; then
img_dev=$(find_dev_by_path "${img_loop}")
if [[ -z "${img_dev}" ]]; then
[[ -b "/dev/disk/by-label/${img_label}" ]] &&
img_dev="/dev/disk/by-label/${img_label}"
fi
if [[ -n "${img_dev}" && -n "${img_loop}" ]]; then
mount_handler="miso_loop_mount_handler"
fi
}
@ -78,7 +31,5 @@ miso_loop_mount_handler () {
if [[ "${copytoram}" == "y" ]]; then
losetup -d ${_dev_loop} 2>/dev/null
umount /run/miso/img_dev
else
echo $(readlink -f ${img_dev}) >> /run/miso/used_block_devices
fi
}

View file

@ -40,7 +40,7 @@ miso_pxe_http_mount_handler () {
local _src=${miso_http_srv}${misobasedir}/${arch}
for sfs in livefs mhwdfs desktopfs rootfs; do
for sfs in livefs mhwdfs desktopfs rootfs;do
if [[ ! -z "$( curl -L -s --head "${_src}/${sfs}.sfs" | grep "OK" )" ]]; then
_curl_get "${_src}/${sfs}.sfs" "/${arch}"

View file

@ -1,6 +1,6 @@
run_cleanuphook() {
rm -rf /usr/lib/modules
cp -ax /. /run/initramfs
cp -ax / /run/initramfs
}
# vim: set ft=sh ts=4 sw=4 et:

View file

@ -4,8 +4,6 @@ build() {
add_runscript
add_binary curl
add_file $(readlink -f /etc/ssl/certs/ca-certificates.crt) /etc/ssl/certs/ca-certificates.crt
}
help() {

94
lib/util-chroot.sh Normal file
View file

@ -0,0 +1,94 @@
#!/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.
copy_mirrorlist(){
cp -a /etc/pacman.d/mirrorlist "$1/etc/pacman.d/"
}
copy_keyring(){
if [[ -d /etc/pacman.d/gnupg ]] && [[ ! -d $1/etc/pacman.d/gnupg ]]; then
cp -a /etc/pacman.d/gnupg "$1/etc/pacman.d/"
fi
}
create_min_fs(){
msg "Creating install root at %s" "$1"
mkdir -m 0755 -p $1/var/{cache/pacman/pkg,lib/pacman,log} $1/{dev,run,etc}
mkdir -m 1777 -p $1/tmp
mkdir -m 0555 -p $1/{sys,proc}
}
is_btrfs() {
[[ -e "$1" && "$(stat -f -c %T "$1")" == btrfs ]]
}
subvolume_delete_recursive() {
local subvol
is_btrfs "$1" || return 0
while IFS= read -d $'\0' -r subvol; do
if ! btrfs subvolume delete "$subvol" &>/dev/null; then
error "Unable to delete subvolume %s" "$subvol"
return 1
fi
done < <(find "$1" -xdev -depth -inum 256 -print0)
return 0
}
create_chroot(){
local timer=$(get_timer)
setarch "${target_arch}" \
mkchroot "$@"
show_elapsed_time "${FUNCNAME}" "${timer}"
}
delete_chroot() {
local copydir=$1
local copy=${1:-$2}
stat_busy "Removing chroot copy [%s]" "$copy"
if is_btrfs "$chrootdir" && ! mountpoint -q "$copydir"; then
subvolume_delete_recursive "$copydir" ||
die "Unable to delete subvolume %s" "$copydir"
else
# avoid change of filesystem in case of an umount failure
rm --recursive --force --one-file-system "$copydir" ||
die "Unable to delete %s" "$copydir"
fi
# remove lock file
rm -f "$copydir.lock"
stat_done
}
# $1: chroot
# kill_chroot_process(){
# # enable to have more debug info
# #msg "machine-id (etc): $(cat $1/etc/machine-id)"
# #[[ -e $1/var/lib/dbus/machine-id ]] && msg "machine-id (lib): $(cat $1/var/lib/dbus/machine-id)"
# #msg "running processes: "
# #lsof | grep $1
#
# local prefix="$1" flink pid name
# for root_dir in /proc/*/root; do
# flink=$(readlink $root_dir)
# if [ "x$flink" != "x" ]; then
# if [ "x${flink:0:${#prefix}}" = "x$prefix" ]; then
# # this process is in the chroot...
# pid=$(basename $(dirname "$root_dir"))
# name=$(ps -p $pid -o comm=)
# info "Killing chroot process: %s (%s)" "$name" "$pid"
# kill -9 "$pid"
# fi
# fi
# done
# }

View file

@ -1,102 +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.
prepare_initcpio(){
msg2 "Copying initcpio ..."
cp /etc/initcpio/hooks/miso* $1/etc/initcpio/hooks
cp /etc/initcpio/install/miso* $1/etc/initcpio/install
cp /etc/initcpio/miso_shutdown $1/etc/initcpio
}
prepare_initramfs(){
cp ${DATADIR}/mkinitcpio.conf $1/etc/mkinitcpio-${iso_name}.conf
local _kernver=$(cat $1/usr/lib/modules/*/kernelbase | awk -F'-' '{print $1}')
if [[ -n ${gpgkey} ]]; then
su ${OWNER} -c "gpg --export ${gpgkey} >${USERCONFDIR}/gpgkey"
exec 17<>${USERCONFDIR}/gpgkey
fi
MISO_GNUPG_FD=${gpgkey:+17} chroot-run $1 \
/usr/bin/mkinitcpio -k ${_kernver} \
-c /etc/mkinitcpio-${iso_name}.conf \
-g /boot/initramfs.img
if [[ -n ${gpgkey} ]]; then
exec 17<&-
fi
if [[ -f ${USERCONFDIR}/gpgkey ]]; then
rm ${USERCONFDIR}/gpgkey
fi
}
prepare_boot_extras(){
cp $1/boot/amd-ucode.img $2/amd_ucode.img
cp $1/boot/intel-ucode.img $2/intel_ucode.img
cp $1/usr/share/licenses/amd-ucode/LIC* $2/amd_ucode.LICENSE
cp $1/usr/share/licenses/intel-ucode/LIC* $2/intel_ucode.LICENSE
cp $1/boot/memtest86+/memtest.bin $2/memtest
}
prepare_grub(){
local platform=i386-pc img='core.img' grub=$2/boot/grub efi=$2/efi/boot \
data_live=$1/usr/share/grub lib=usr/lib/grub prefix=/boot/grub data=/usr/share/grub \
path="${work_dir}/rootfs"
prepare_dir ${grub}/${platform}
cp ${data_live}/cfg/*.cfg ${grub}
cp ${path}/${lib}/${platform}/* ${grub}/${platform}
msg2 "Building %s ..." "${img}"
grub-mkimage -d ${grub}/${platform} -o ${grub}/${platform}/${img} -O ${platform} -p ${prefix} biosdisk iso9660
cat ${grub}/${platform}/cdboot.img ${grub}/${platform}/${img} > ${grub}/${platform}/eltorito.img
case ${target_arch} in
'i686')
platform=i386-efi
img=bootia32.efi
;;
'x86_64')
platform=x86_64-efi
img=bootx64.efi
;;
esac
prepare_dir ${efi}
prepare_dir ${grub}/${platform}
cp ${path}/${lib}/${platform}/* ${grub}/${platform}
msg2 "Building %s ..." "${img}"
grub-mkimage -d ${grub}/${platform} -o ${efi}/${img} -O ${platform} -p ${prefix} iso9660
prepare_dir ${grub}/themes
cp -r ${data_live}/themes/${iso_name}-live ${grub}/themes/
cp ${data}/unicode.pf2 ${grub}
cp -r ${data_live}/{locales,tz} ${grub}
msg2 "Set menu_show_once=1 in '${grub}/grubenv'"
grub-editenv ${grub}/grubenv set menu_show_once=1
local size=4M mnt="${mnt_dir}/efiboot" efi_img="$2/efi.img"
msg2 "Creating fat image of %s ..." "${size}"
truncate -s ${size} "${efi_img}"
mkfs.fat -n MISO_EFI "${efi_img}" &>/dev/null
prepare_dir "${mnt}"
mount_img "${efi_img}" "${mnt}"
prepare_dir ${mnt}/efi/boot
msg2 "Building %s ..." "${img}"
grub-mkimage -d ${grub}/${platform} -o ${mnt}/efi/boot/${img} -O ${platform} -p ${prefix} iso9660
umount_img "${mnt}"
}

366
lib/util-iso-chroot.sh Normal file
View file

@ -0,0 +1,366 @@
#!/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.
copy_overlay(){
local src="$1" dest="$2"
if [[ -e $src ]];then
msg2 "Copying [%s] ..." "${src##*/}"
if [[ -L $src ]];then
cp -a --no-preserve=ownership $src/* $dest
else
cp -LR $src/* $dest
fi
fi
}
add_svc_rc(){
local mnt="$1" name="$2"
if [[ -f $mnt/etc/init.d/$name ]];then
msg2 "Setting %s ..." "$name"
chroot $mnt rc-update add $name default &>/dev/null
fi
}
add_svc_sd(){
local mnt="$1" name="$2"
if [[ -f $mnt/etc/systemd/system/$name.service ]] || \
[[ -f $mnt/usr/lib/systemd/system/$name.service ]];then
msg2 "Setting %s ..." "$name"
chroot $mnt systemctl enable $name &>/dev/null
fi
}
set_xdm(){
if [[ -f $1/etc/conf.d/xdm ]];then
local conf='DISPLAYMANAGER="'${displaymanager}'"'
sed -i -e "s|^.*DISPLAYMANAGER=.*|${conf}|" $1/etc/conf.d/xdm
fi
}
configure_mhwd_drivers(){
local path=$1${mhwd_repo}/ \
drv_path=$1/var/lib/mhwd/db/pci/graphic_drivers
info "Configuring mwwd db ..."
if [ -z "$(ls $path | grep catalyst-utils 2> /dev/null)" ]; then
msg2 "Disabling Catalyst driver"
mkdir -p $drv_path/catalyst/
touch $drv_path/catalyst/MHWDCONFIG
fi
if [ -z "$(ls $path | grep nvidia-utils 2> /dev/null)" ]; then
msg2 "Disabling Nvidia driver"
mkdir -p $drv_path/nvidia/
touch $drv_path/nvidia/MHWDCONFIG
msg2 "Disabling Nvidia Bumblebee driver"
mkdir -p $drv_path/hybrid-intel-nvidia-bumblebee/
touch $drv_path/hybrid-intel-nvidia-bumblebee/MHWDCONFIG
fi
if [ -z "$(ls $path | grep nvidia-304xx-utils 2> /dev/null)" ]; then
msg2 "Disabling Nvidia 304xx driver"
mkdir -p $drv_path/nvidia-304xx/
touch $drv_path/nvidia-304xx/MHWDCONFIG
fi
if [ -z "$(ls $path | grep nvidia-340xx-utils 2> /dev/null)" ]; then
msg2 "Disabling Nvidia 340xx driver"
mkdir -p $drv_path/nvidia-340xx/
touch $drv_path/nvidia-340xx/MHWDCONFIG
fi
if [ -z "$(ls $path | grep xf86-video-amdgpu 2> /dev/null)" ]; then
msg2 "Disabling AMD gpu driver"
mkdir -p $drv_path/xf86-video-amdgpu/
touch $drv_path/xf86-video-amdgpu/MHWDCONFIG
fi
}
configure_hosts(){
sed -e "s|localhost.localdomain|localhost.localdomain ${hostname}|" -i $1/etc/hosts
}
configure_lsb(){
local conf=$1/etc/lsb-release
if [[ -e $conf ]] ; then
msg2 "Configuring lsb-release"
sed -i -e "s/^.*DISTRIB_RELEASE.*/DISTRIB_RELEASE=${dist_release}/" $conf
sed -i -e "s/^.*DISTRIB_CODENAME.*/DISTRIB_CODENAME=${dist_codename}/" $conf
fi
}
configure_logind(){
msg2 "Configuring logind ..."
local conf=$1/etc/$2/logind.conf
if [[ -e $conf ]];then
sed -i 's/#\(HandleSuspendKey=\)suspend/\1ignore/' "$conf"
sed -i 's/#\(HandleLidSwitch=\)suspend/\1ignore/' "$conf"
sed -i 's/#\(HandleHibernateKey=\)hibernate/\1ignore/' "$conf"
fi
}
configure_journald(){
msg2 "Configuring journald ..."
local conf=$1/etc/systemd/journald.conf
sed -i 's/#\(Storage=\)auto/\1volatile/' "$conf"
}
configure_services(){
local mnt="$1"
info "Configuring [%s]" "${initsys}"
case ${initsys} in
'openrc')
for svc in ${enable_openrc[@]}; do
[[ $svc == "xdm" ]] && set_xdm "$mnt"
add_svc_rc "$mnt" "$svc"
done
for svc in ${enable_openrc_live[@]}; do
add_svc_rc "$mnt" "$svc"
done
;;
'systemd')
for svc in ${enable_systemd[@]}; do
add_svc_sd "$mnt" "$svc"
done
for svc in ${enable_systemd_live[@]}; do
add_svc_sd "$mnt" "$svc"
done
;;
esac
info "Done configuring [%s]" "${initsys}"
}
write_live_session_conf(){
local path=$1${SYSCONFDIR}
[[ ! -d $path ]] && mkdir -p $path
local conf=$path/live.conf
msg2 "Writing %s" "${conf##*/}"
echo '# live session configuration' > ${conf}
echo '' >> ${conf}
echo '# autologin' >> ${conf}
echo "autologin=${autologin}" >> ${conf}
echo '' >> ${conf}
echo '# login shell' >> ${conf}
echo "login_shell=${login_shell}" >> ${conf}
echo '' >> ${conf}
echo '# live username' >> ${conf}
echo "username=${username}" >> ${conf}
echo '' >> ${conf}
echo '# live password' >> ${conf}
echo "password=${password}" >> ${conf}
echo '' >> ${conf}
echo '# live group membership' >> ${conf}
echo "addgroups='${addgroups}'" >> ${conf}
if [[ -n ${smb_workgroup} ]];then
echo '' >> ${conf}
echo '# samba workgroup' >> ${conf}
echo "smb_workgroup=${smb_workgroup}" >> ${conf}
fi
}
configure_system(){
local mnt="$1"
case ${initsys} in
'systemd')
configure_logind "$mnt" "systemd"
configure_journald "$mnt"
# Prevent some services to be started in the livecd
echo 'File created by manjaro-tools. See systemd-update-done.service(8).' \
| tee "${path}/etc/.updated" >"${path}/var/.updated"
msg2 "Disable systemd-gpt-auto-generator"
ln -sf /dev/null "${path}/usr/lib/systemd/system-generators/systemd-gpt-auto-generator"
;;
'openrc')
configure_logind "$mnt" "elogind"
;;
esac
echo ${hostname} > $mnt/etc/hostname
}
make_repo(){
local dest="$1"
cp ${DATADIR}/pacman-mhwd.conf $dest/opt
repo-add $dest${mhwd_repo}/mhwd.db.tar.gz $dest${mhwd_repo}/*pkg*z
}
clean_iso_root(){
local dest="$1"
msg2 "Deleting isoroot [%s] ..." "${dest##*/}"
rm -rf --one-file-system "$dest"
}
clean_up_image(){
local path mnt="$1"
msg2 "Cleaning [%s]" "${mnt##*/}"
if [[ ${1##*/} == 'mhwdfs' ]];then
path=$mnt/var
if [[ -d $path ]];then
find "$path" -mindepth 0 -delete &> /dev/null
fi
path=$mnt/etc
if [[ -d $path ]];then
find "$path" -mindepth 0 -delete &> /dev/null
fi
else
[[ -f "$mnt/etc/locale.gen.bak" ]] && mv "$mnt/etc/locale.gen.bak" "$mnt/etc/locale.gen"
[[ -f "$mnt/etc/locale.conf.bak" ]] && mv "$mnt/etc/locale.conf.bak" "$mnt/etc/locale.conf"
path=$mnt/boot
if [[ -d "$path" ]]; then
find "$path" -name 'initramfs*.img' -delete &> /dev/null
fi
path=$mnt/var/lib/pacman/sync
if [[ -d $path ]];then
find "$path" -type f -delete &> /dev/null
fi
path=$mnt/var/cache/pacman/pkg
if [[ -d $path ]]; then
find "$path" -type f -delete &> /dev/null
fi
path=$mnt/var/log
if [[ -d $path ]]; then
find "$path" -type f -delete &> /dev/null
fi
path=$mnt/var/tmp
if [[ -d $path ]];then
find "$path" -mindepth 1 -delete &> /dev/null
fi
path=$mnt/tmp
if [[ -d $path ]];then
find "$path" -mindepth 1 -delete &> /dev/null
fi
if [[ ${mnt##*/} == 'livefs' ]];then
rm -rf "$mnt/etc/pacman.d/gnupg"
fi
fi
find "$mnt" -name *.pacnew -name *.pacsave -name *.pacorig -delete
file=$mnt/boot/grub/grub.cfg
if [[ -f "$file" ]]; then
rm $file
fi
}
copy_from_cache(){
local list="${tmp_dir}"/mhwd-cache.list mirror="${build_mirror}/${target_branch}"
local mnt="$1"; shift
chroot-run -B "$mirror" "$mnt" \
pacman -v -Syw --noconfirm "$@" || return 1
chroot-run -B "$mirror" "$mnt" \
pacman -v -Sp --noconfirm "$@" > "$list"
sed -ni '/.pkg.tar.xz/p' "$list"
sed -i "s/.*\///" "$list"
msg2 "Copying mhwd package cache ..."
rsync -v --files-from="$list" /var/cache/pacman/pkg "$mnt${mhwd_repo}"
}
chroot_clean(){
local dest="$1"
for root in "$dest"/*; do
[[ -d ${root} ]] || continue
local name=${root##*/}
if [[ $name != "mhwdfs" ]];then
# lock 9 "$name.lock" "Locking chroot copy [%s]" "$name"
delete_chroot "${root}" "$dest"
fi
done
rm -rf --one-file-system "$dest"
}
prepare_initcpio(){
msg2 "Copying initcpio ..."
local dest="$1"
cp /etc/initcpio/hooks/miso* $dest/etc/initcpio/hooks
cp /etc/initcpio/install/miso* $dest/etc/initcpio/install
cp /etc/initcpio/miso_shutdown $dest/etc/initcpio
}
prepare_initramfs(){
local mnt="$1"
cp ${DATADIR}/mkinitcpio.conf $mnt/etc/mkinitcpio-${iso_name}.conf
local _kernver=$(cat $mnt/usr/lib/modules/*/version)
if [[ -n ${gpgkey} ]]; then
su ${OWNER} -c "gpg --export ${gpgkey} >${MT_USERCONFDIR}/gpgkey"
exec 17<>${MT_USERCONFDIR}/gpgkey
fi
MISO_GNUPG_FD=${gpgkey:+17} chroot-run $mnt \
/usr/bin/mkinitcpio -k ${_kernver} \
-c /etc/mkinitcpio-${iso_name}.conf \
-g /boot/initramfs.img
if [[ -n ${gpgkey} ]]; then
exec 17<&-
fi
if [[ -f ${MT_USERCONFDIR}/gpgkey ]]; then
rm ${MT_USERCONFDIR}/gpgkey
fi
}
prepare_boot_extras(){
local src="$1" dest="$2"
cp $src/boot/intel-ucode.img $dest/intel_ucode.img
cp $src/usr/share/licenses/intel-ucode/LICENSE $dest/intel_ucode.LICENSE
cp $src/boot/memtest86+/memtest.bin $dest/memtest
cp $src/usr/share/licenses/common/GPL2/license.txt $dest/memtest.COPYING
}
prepare_grub(){
local platform=i386-pc img='core.img' grub=$3/boot/grub efi=$3/efi/boot \
lib=$1/usr/lib/grub prefix=/boot/grub theme=$2/usr/share/grub data=$1/usr/share/grub
prepare_dir ${grub}/${platform}
cp ${theme}/cfg/*.cfg ${grub}
cp ${lib}/${platform}/* ${grub}/${platform}
msg2 "Building %s ..." "${img}"
grub-mkimage -d ${grub}/${platform} -o ${grub}/${platform}/${img} -O ${platform} -p ${prefix} biosdisk iso9660
cat ${grub}/${platform}/cdboot.img ${grub}/${platform}/${img} > ${grub}/${platform}/eltorito.img
case ${target_arch} in
'i686')
platform=i386-efi
img=bootia32.efi
;;
'x86_64')
platform=x86_64-efi
img=bootx64.efi
;;
esac
prepare_dir ${efi}
prepare_dir ${grub}/${platform}
cp ${lib}/${platform}/* ${grub}/${platform}
msg2 "Building %s ..." "${img}"
grub-mkimage -d ${grub}/${platform} -o ${efi}/${img} -O ${platform} -p ${prefix} iso9660
prepare_dir ${grub}/themes
cp -r ${theme}/themes/${iso_name}-live ${grub}/themes/
cp ${data}/unicode.pf2 ${grub}
cp -r ${theme}/{locales,tz} ${grub}
local size=4M mnt="${mnt_dir}/efiboot" efi_img="$3/efi.img"
msg2 "Creating fat image of %s ..." "${size}"
truncate -s ${size} "${efi_img}"
mkfs.fat -n MISO_EFI "${efi_img}" &>/dev/null
prepare_dir "${mnt}"
mount_img "${efi_img}" "${mnt}"
prepare_dir ${mnt}/efi/boot
msg2 "Building %s ..." "${img}"
grub-mkimage -d ${grub}/${platform} -o ${mnt}/efi/boot/${img} -O ${platform} -p ${prefix} iso9660
umount_img "${mnt}"
}

View file

@ -1,700 +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.
copy_overlay(){
if [[ -e $1 ]]; then
msg2 "Copying [%s] ..." "${1##*/}"
if [[ -L $1 ]]; then
cp -a --no-preserve=ownership $1/* $2
else
cp -LR $1/* $2
fi
fi
}
add_svc_rc(){
if [[ -f $1/etc/init.d/$2 ]]; then
msg2 "Setting %s ..." "$2"
chroot $1 rc-update add $2 default &>/dev/null
fi
}
add_svc_sd(){
if [[ -f $1/etc/systemd/system/$2.service ]] || \
[[ -f $1/usr/lib/systemd/system/$2.service ]]; then
msg2 "Setting %s ..." "$2"
chroot $1 systemctl enable $2 &>/dev/null
fi
if [[ -f $1/etc/systemd/system/$2 ]] || \
[[ -f $1/usr/lib/systemd/system/$2 ]]; then
msg2 "Setting %s ..." "$2"
chroot $1 systemctl enable $2 &>/dev/null
fi
}
set_xdm(){
if [[ -f $1/etc/conf.d/xdm ]]; then
local conf='DISPLAYMANAGER="'${displaymanager}'"'
sed -i -e "s|^.*DISPLAYMANAGER=.*|${conf}|" $1/etc/conf.d/xdm
fi
}
configure_mhwd_drivers(){
local path=$1${mhwd_repo}/ \
drv_path=$1/var/lib/mhwd/db/pci/graphic_drivers
info "Configuring mhwd db ..."
if [ -z "$(ls $path | grep nvidia-390xx-utils 2> /dev/null)" ]; then
msg2 "Disabling Nvidia 390xx driver"
mkdir -p $drv_path/nvidia-390xx/
echo "" > $drv_path/nvidia-390xx/MHWDCONFIG
msg2 "Disabling Nvidia 390xx Bumblebee driver"
mkdir -p $drv_path/hybrid-intel-nvidia-390xx-bumblebee/
echo "" > $drv_path/hybrid-intel-nvidia-390xx-bumblebee/MHWDCONFIG
fi
if [ -z "$(ls $path | grep nvidia-utils 2> /dev/null)" ]; then
msg2 "Disabling Nvidia driver"
mkdir -p $drv_path/nvidia/
echo "" > $drv_path/nvidia/MHWDCONFIG
msg2 "Disabling Nvidia AMD Prime driver"
mkdir -p $drv_path/hybrid-amd-nvidia-prime/
echo "" > $drv_path/hybrid-amd-nvidia-prime/MHWDCONFIG
msg2 "Disabling Nvidia Intel Prime driver"
mkdir -p $drv_path/hybrid-intel-nvidia-prime/
echo "" > $drv_path/hybrid-intel-nvidia-prime/MHWDCONFIG
fi
if [ -z "$(ls $path | grep nvidia-470xx-utils 2> /dev/null)" ]; then
msg2 "Disabling Nvidia 470xx driver"
mkdir -p $drv_path/nvidia-470xx/
echo "" > $drv_path/nvidia-470xx/MHWDCONFIG
msg2 "Disabling Nvidia 470xx AMD Prime driver"
mkdir -p $drv_path/hybrid-amd-nvidia-470xx-prime/
echo "" > $drv_path/hybrid-amd-nvidia-470xx-prime/MHWDCONFIG
msg2 "Disabling Nvidia 470xx Intel Prime driver"
mkdir -p $drv_path/hybrid-intel-nvidia-470xx-prime/
echo "" > $drv_path/hybrid-intel-nvidia-470xx-prime/MHWDCONFIG
fi
local drv_path=$1/var/lib/mhwd/db/pci/network_drivers
if [ -z "$(ls $path | grep broadcom-wl 2> /dev/null)" ]; then
msg2 "Disabling broadcom-wl driver"
mkdir -p $drv_path/broadcom-wl/
echo "" > $drv_path/broadcom-wl/MHWDCONFIG
fi
if [ -z "$(ls $path | grep rt3562sta 2> /dev/null)" ]; then
msg2 "Disabling rt3562sta driver"
mkdir -p $drv_path/rt3562sta/
echo "" > $drv_path/rt3562sta/MHWDCONFIG
fi
if [ -z "$(ls $path | grep r8168 2> /dev/null)" ]; then
msg2 "Disabling r8168 driver"
mkdir -p $drv_path/r8168/
echo "" > $drv_path/r8168/MHWDCONFIG
fi
}
configure_lsb(){
if [ -e $1/etc/lsb-release ] ; then
msg2 "Configuring lsb-release"
sed -i -e "s/^.*DISTRIB_RELEASE.*/DISTRIB_RELEASE=\"${dist_release}\"/" $1/etc/lsb-release
sed -i -e "s/^.*DISTRIB_CODENAME.*/DISTRIB_CODENAME=\"${dist_codename}\"/" $1/etc/lsb-release
fi
}
configure_branding_old(){
msg2 "Configuring branding"
echo "---
componentName: manjaro
# This selects between different welcome texts. When false, uses
# the traditional 'Welcome to the %1 installer.', and when true,
# uses 'Welcome to the Calamares installer for %1.'. This allows
# to distinguish this installer from other installers for the
# same distribution.
welcomeStyleCalamares: ${welcomestyle}
# Should the welcome image (productWelcome, below) be scaled
# up beyond its natural size? If false, the image does not grow
# with the window but remains the same size throughout (this
# may have surprising effects on HiDPI monitors).
welcomeExpandingLogo: ${welcomelogo}
# Size and expansion policy for Calamares.
# - "normal" or unset, expand as needed, use *windowSize*
# - "fullscreen", start as large as possible, ignore *windowSize*
# - "noexpand", never expand, use *windowSize*
windowExpanding: ${windowexp}
# Size of Calamares window, expressed as w,h. Both w and h
# may be either pixels (suffix px) or font-units (suffix em).
# e.g. "800px,600px"
# "60em,480px"
# This setting is ignored if "fullscreen" is selected for
# *windowExpanding*, above. If not set, use constants defined
# in CalamaresUtilsGui, 800x520.
windowSize: ${windowsize}
# Placement of Calamares window. Either "center" or "free".
# Whether "center" actually works does depend on the window
# manager in use (and only makes sense if you're not using
# *windowExpanding* set to "fullscreen").
windowPlacement: ${windowplacement}
# These are strings shown to the user in the user interface.
# There is no provision for translating them -- since they
# are names, the string is included as-is.
#
# The four Url strings are the Urls used by the buttons in
# the welcome screen, and are not shown to the user. Clicking
# on the "Support" button, for instance, opens the link supportUrl.
# If a Url is empty, the corresponding button is not shown.
#
# bootloaderEntryName is how this installation / distro is named
# in the boot loader (e.g. in the GRUB menu).
strings:
productName: ${dist_name} Linux
shortProductName: ${dist_name}
version: ${dist_release}
shortVersion: ${dist_release}
versionedName: ${dist_name} Linux ${dist_release} "\"${dist_codename}"\"
shortVersionedName: ${dist_name} ${dist_release}
bootloaderEntryName: ${dist_name}
# These images are loaded from the branding module directory.
#
# productIcon is used as the window icon, and will (usually) be used
# by the window manager to represent the application. This image
# should be square, and may be displayed by the window manager
# as small as 16x16 (but possibly larger).
# productLogo is used as the logo at the top of the left-hand column
# which shows the steps to be taken. The image should be square,
# and is displayed at 80x80 pixels (also on HiDPI).
# productWelcome is shown on the welcome page of the application in
# the middle of the window, below the welcome text. It can be
# any size and proportion, and will be scaled to fit inside
# the window. Use 'welcomeExpandingLogo' to make it non-scaled.
# Recommended size is 320x150.
images:
productLogo: "logo.png"
productIcon: "logo.png"
productWelcome: "languages.png"
# The slideshow is displayed during execution steps (e.g. when the
# installer is actually writing to disk and doing other slow things).
slideshow: "show.qml"
# There are two available APIs for the slideshow:
# - 1 (the default) loads the entire slideshow when the installation-
# slideshow page is shown and starts the QML then. The QML
# is never stopped (after installation is done, times etc.
# continue to fire).
# - 2 loads the slideshow on startup and calls onActivate() and
# onLeave() in the root object. After the installation is done,
# the show is stopped (first by calling onLeave(), then destroying
# the QML components).
slideshowAPI: 1
# Colors for text and background components.
#
# - sidebarBackground is the background of the sidebar
# - sidebarText is the (foreground) text color
# - sidebarTextHighlight sets the background of the selected (current) step.
# Optional, and defaults to the application palette.
# - sidebarSelect is the text color of the selected step.
#
style:
sidebarBackground: "\"${sidebarbackground}"\"
sidebarText: "\"${sidebartext}"\"
sidebarTextSelect: "\"${sidebartextselect}"\"
sidebarTextHighlight: "\"${sidebartexthighlight}"\"" > $1/usr/share/calamares/branding/manjaro/branding.desc
}
configure_branding(){
msg2 "Configuring branding"
echo "# SPDX-FileCopyrightText: no
# SPDX-License-Identifier: CC0-1.0
#
# Product branding information. This influences some global
# user-visible aspects of Calamares, such as the product
# name, window behavior, and the slideshow during installation.
#
# Additional styling can be done using the stylesheet.qss
# file, also in the branding directory.
---
componentName: manjaro
### WELCOME / OVERALL WORDING
#
# These settings affect some overall phrasing and looks,
# which are most visible in the welcome page.
# This selects between different welcome texts. When false, uses
# the traditional "Welcome to the %1 installer.", and when true,
# uses "Welcome to the Calamares installer for %1." This allows
# to distinguish this installer from other installers for the
# same distribution.
welcomeStyleCalamares: ${welcomestyle}
# Should the welcome image (productWelcome, below) be scaled
# up beyond its natural size? If false, the image does not grow
# with the window but remains the same size throughout (this
# may have surprising effects on HiDPI monitors).
welcomeExpandingLogo: ${welcomelogo}
### WINDOW CONFIGURATION
#
# The settings here affect the placement of the Calamares
# window through hints to the window manager and initial
# sizing of the Calamares window.
# Size and expansion policy for Calamares.
# - "normal" or unset, expand as needed, use *windowSize*
# - "fullscreen", start as large as possible, ignore *windowSize*
# - "noexpand", don't expand automatically, use *windowSize*
windowExpanding: ${windowexp}
# Size of Calamares window, expressed as w,h. Both w and h
# may be either pixels (suffix px) or font-units (suffix em).
# e.g. "800px,600px"
# "60em,480px"
# This setting is ignored if "fullscreen" is selected for
# *windowExpanding*, above. If not set, use constants defined
# in CalamaresUtilsGui, 800x520.
windowSize: ${windowsize}
# Placement of Calamares window. Either "center" or "free".
# Whether "center" actually works does depend on the window
# manager in use (and only makes sense if you're not using
# *windowExpanding* set to "fullscreen").
windowPlacement: ${windowplacement}
### PANELS CONFIGURATION
#
# Calamares has a main content area, and two panels (navigation
# and progress / sidebar). The panels can be controlled individually,
# or switched off. If both panels are switched off, the layout of
# the main content area loses its margins, on the assumption that
# you're doing something special.
# Kind of sidebar (panel on the left, showing progress).
# - "widget" or unset, use traditional sidebar (logo, items)
# - "none", hide it entirely
# - "qml", use calamares-sidebar.qml from branding folder
# In addition, you **may** specify a side, separated by a comma,
# from the kind. Valid sides are:
# - "left" (if not specified, uses this)
# - "right"
# - "top"
# - "bottom"
# For instance, "widget,right" is valid; so is "qml", which defaults
# to putting the sidebar on the left. Also valid is "qml,top".
# While "widget,top" is valid, the widgets code is **not** flexible
# and results will be terrible.
sidebar: qml
# Kind of navigation (button panel on the bottom).
# - "widget" or unset, use traditional navigation
# - "none", hide it entirely
# - "qml", use calamares-navigation.qml from branding folder
# In addition, you **may** specify a side, separated by a comma,
# from the kind. The same sides are valid as for *sidebar*,
# except the default is *bottom*.
navigation: widget
### STRINGS, IMAGES AND COLORS
#
# This section contains the "branding proper" of names
# and images, rather than global-look settings.
# These are strings shown to the user in the user interface.
# There is no provision for translating them -- since they
# are names, the string is included as-is.
#
# The four Url strings are the Urls used by the buttons in
# the welcome screen, and are not shown to the user. Clicking
# on the "Support" button, for instance, opens the link supportUrl.
# If a Url is empty, the corresponding button is not shown.
#
# bootloaderEntryName is how this installation / distro is named
# in the boot loader (e.g. in the GRUB menu).
#
# These strings support substitution from /etc/os-release
# if KDE Frameworks 5.58 are available at build-time. When
# enabled, @{var-name} is replaced by the equivalent value
# from os-release. All the supported var-names are in all-caps,
# and are listed on the FreeDesktop.org site,
# https://www.freedesktop.org/software/systemd/man/os-release.html
# Note that ANSI_COLOR and CPE_NAME don't make sense here, and
# are not supported (the rest are). Remember to quote the string
# if it contains substitutions, or you'll get YAML exceptions.
#
# The *Url* entries are used on the welcome page, and they
# are visible as buttons there if the corresponding *show* keys
# are set to "true" (they can also be overridden).
strings:
productName: ${dist_name} Linux
shortProductName: ${dist_name}
version: ${dist_release}
shortVersion: ${dist_release}
versionedName: ${dist_name} Linux ${dist_release} "\"${dist_codename}"\"
shortVersionedName: ${dist_name} ${dist_release}
bootloaderEntryName: ${dist_name}
# These images are loaded from the branding module directory.
#
# productBanner is an optional image, which if present, will be shown
# on the welcome page of the application, above the welcome text.
# It is intended to have a width much greater than height.
# It is displayed at 64px height (also on HiDPI).
# Recommended size is 64px tall, and up to 460px wide.
# productIcon is used as the window icon, and will (usually) be used
# by the window manager to represent the application. This image
# should be square, and may be displayed by the window manager
# as small as 16x16 (but possibly larger).
# productLogo is used as the logo at the top of the left-hand column
# which shows the steps to be taken. The image should be square,
# and is displayed at 80x80 pixels (also on HiDPI).
# productWallpaper is an optional image, which if present, will replace
# the normal solid background on every page of the application.
# It can be any size and proportion,
# and will be tiled to fit the entire window.
# For a non-tiled wallpaper, the size should be the same as
# the overall window, see *windowSize* above (800x520).
# productWelcome is shown on the welcome page of the application in
# the middle of the window, below the welcome text. It can be
# any size and proportion, and will be scaled to fit inside
# the window. Use 'welcomeExpandingLogo' to make it non-scaled.
# Recommended size is 320x150.
#
# These filenames can also use substitutions from os-release (see above).
images:
# productBanner: "banner.png"
productIcon: "logo_small.svg"
productLogo: "logo.svg"
# productWallpaper: "wallpaper.png"
productWelcome: "welcome/mascot.svg"
# Colors for text and background components.
#
# - SidebarBackground is the background of the sidebar
# - SidebarText is the (foreground) text color
# - SidebarBackgroundCurrent sets the background of the current step.
# Optional, and defaults to the application palette.
# - SidebarTextCurrent is the text color of the current step.
#
# These colors can **also** be set through the stylesheet, if the
# branding component also ships a stylesheet.qss. Then they are
# the corresponding CSS attributes of #sidebarApp.
style:
sidebarBackground: "\"${sidebarbackground}"\"
sidebarText: "\"${sidebartext}"\"
sidebarTextSelect: "\"${sidebartextselect}"\"
sidebarTextHighlight: "\"${sidebartexthighlight}"\"
SidebarBackground: "\"${sidebarbackground}"\"
SidebarText: "\"${sidebartext}"\"
SidebarTextSelect: "\"${sidebartextselect}"\"
SidebarBackgroundCurrent: "\"${sidebartexthighlight}"\"
### SLIDESHOW
#
# The slideshow is displayed during execution steps (e.g. when the
# installer is actually writing to disk and doing other slow things).
# The slideshow can be a QML file (recommended) which can display
# arbitrary things -- text, images, animations, or even play a game --
# during the execution step. The QML **is** abruptly stopped when the
# execution step is done, though, so maybe a game isn't a great idea.
#
# The slideshow can also be a sequence of images (not recommended unless
# you don't want QML at all in your Calamares). The images are displayed
# at a rate of 1 every 2 seconds during the execution step.
#
# To configure a QML file, list a single filename:
# slideshow: "show.qml"
# To configure images, like the filenames (here, as an inline list):
# slideshow: [ "/etc/calamares/slideshow/0.png", "/etc/logo.png" ]
slideshow: "slideshow/SlideShow.qml"
# There are two available APIs for a QML slideshow:
# - 1 (the default) loads the entire slideshow when the installation-
# slideshow page is shown and starts the QML then. The QML
# is never stopped (after installation is done, times etc.
# continue to fire).
# - 2 loads the slideshow on startup and calls onActivate() and
# onLeave() in the root object. After the installation is done,
# the show is stopped (first by calling onLeave(), then destroying
# the QML components).
#
# An image slideshow does not need to have the API defined.
slideshowAPI: 2
# These options are to customize online uploading of logs to pastebins:
# - type : Defines the kind of pastebin service to be used. Currently
# it accepts two values:
# - none : disables the pastebin functionality
# - fiche : use fiche pastebin server
# - url : Defines the address of pastebin service to be used.
# Takes string as input. Important bits are the host and port,
# the scheme is not used.
# - sizeLimit : Defines maximum size limit (in KiB) of log file to be pasted.
# The option must be set, to have the log option work.
# Takes integer as input. If < 0, no limit will be forced,
# else only last (approximately) 'n' KiB of log file will be pasted.
# Please note that upload size may be slightly over the limit (due
# to last minute logging), so provide a suitable value.
uploadServer :
type : "fiche"
url : "http://termbin.com:9999"
sizeLimit : -1" > $1/usr/share/calamares/branding/manjaro/branding.desc
}
configure_polkit_user_rules(){
msg2 "Configuring polkit user rules"
echo "/* Stop asking the user for a password while they are in a live session
*/
polkit.addRule(function(action, subject) {
if (subject.user == \"${username}\")
{
return polkit.Result.YES;
}
});" > $1/etc/polkit-1/rules.d/49-nopasswd-live.rules
}
configure_logind(){
msg2 "Configuring logind ..."
local conf=$1/etc/systemd/logind.conf
sed -i 's/#\(HandleSuspendKey=\)suspend/\1ignore/' "$conf"
sed -i 's/#\(HandleLidSwitch=\)suspend/\1ignore/' "$conf"
sed -i 's/#\(HandleHibernateKey=\)hibernate/\1ignore/' "$conf"
}
configure_journald(){
msg2 "Configuring journald ..."
local conf=$1/etc/systemd/journald.conf
sed -i 's/#\(Storage=\)auto/\1volatile/' "$conf"
}
disable_srv_live(){
for srv in ${disable_systemd_live[@]}; do
enable_systemd_live=(${enable_systemd_live[@]//*$srv*})
done
}
configure_services(){
info "Configuring services"
use_apparmor="false"
apparmor_boot_args=""
enable_systemd_live=(${enable_systemd_live[@]} ${enable_systemd[@]})
[[ ! -z $disable_systemd_live ]] && disable_srv_live
for svc in ${enable_systemd_live[@]}; do
add_svc_sd "$1" "$svc"
[[ "$svc" == "apparmor" ]] && use_apparmor="true"
done
if [[ ${use_apparmor} == 'true' ]]; then
msg2 "Enable apparmor kernel parameters"
apparmor_boot_args="'apparmor=1' 'security=apparmor'"
fi
info "Done configuring services"
}
write_live_session_conf(){
local path=$1${SYSCONFDIR}
[[ ! -d $path ]] && mkdir -p $path
local conf=$path/live.conf
msg2 "Writing %s" "${conf##*/}"
echo '# live session configuration' > ${conf}
echo '' >> ${conf}
echo '# autologin' >> ${conf}
echo "autologin=${autologin}" >> ${conf}
echo '' >> ${conf}
echo '# login shell' >> ${conf}
echo "login_shell=${login_shell}" >> ${conf}
echo '' >> ${conf}
echo '# live username' >> ${conf}
echo "username=${username}" >> ${conf}
echo '' >> ${conf}
echo '# live password' >> ${conf}
echo "password=${password}" >> ${conf}
echo '' >> ${conf}
echo '# live group membership' >> ${conf}
echo "addgroups='${addgroups}'" >> ${conf}
if [[ -n ${smb_workgroup} ]]; then
echo '' >> ${conf}
echo '# samba workgroup' >> ${conf}
echo "smb_workgroup=${smb_workgroup}" >> ${conf}
fi
}
configure_hosts(){
sed -e "s|localhost.localdomain|localhost.localdomain ${hostname}|" -i $1/etc/hosts
}
configure_system(){
configure_logind "$1"
configure_journald "$1"
# Prevent some services to be started in the livecd
echo 'File created by manjaro-tools. See systemd-update-done.service(8).' \
| tee "${path}/etc/.updated" >"${path}/var/.updated"
msg2 "Disable systemd-gpt-auto-generator"
ln -sf /dev/null "${path}/usr/lib/systemd/system-generators/systemd-gpt-auto-generator"
echo ${hostname} > $1/etc/hostname
}
configure_thus(){
msg2 "Configuring Thus ..."
source "$1/etc/mkinitcpio.d/${kernel}.preset"
local conf="$1/etc/thus.conf"
echo "[distribution]" > "$conf"
echo "DISTRIBUTION_NAME = \"${dist_name} Linux\"" >> "$conf"
echo "DISTRIBUTION_VERSION = \"${dist_release}\"" >> "$conf"
echo "SHORT_NAME = \"${dist_name}\"" >> "$conf"
echo "[install]" >> "$conf"
echo "LIVE_MEDIA_SOURCE = \"/run/miso/bootmnt/${iso_name}/${target_arch}/rootfs.sfs\"" >> "$conf"
echo "LIVE_MEDIA_DESKTOP = \"/run/miso/bootmnt/${iso_name}/${target_arch}/desktopfs.sfs\"" >> "$conf"
echo "LIVE_MEDIA_TYPE = \"squashfs\"" >> "$conf"
echo "LIVE_USER_NAME = \"${username}\"" >> "$conf"
echo "KERNEL = \"${kernel}\"" >> "$conf"
echo "VMLINUZ = \"$(echo ${ALL_kver} | sed s'|/boot/||')\"" >> "$conf"
echo "INITRAMFS = \"$(echo ${default_image} | sed s'|/boot/||')\"" >> "$conf"
echo "FALLBACK = \"$(echo ${fallback_image} | sed s'|/boot/||')\"" >> "$conf"
# if [[ -f $1/usr/share/applications/thus.desktop && -f $1/usr/bin/kdesu ]]; then
# sed -i -e 's|sudo|kdesu|g' $1/usr/share/applications/thus.desktop
# fi
}
configure_live_image(){
msg "Configuring [livefs]"
configure_hosts "$1"
configure_system "$1"
configure_services "$1"
configure_calamares "$1"
# [[ ${edition} == "sonar" ]] && configure_thus "$1"
write_live_session_conf "$1"
msg "Done configuring [livefs]"
}
make_repo(){
repo-add $1${mhwd_repo}/mhwd.db.tar.gz $1${mhwd_repo}/*pkg.tar*
}
copy_from_cache(){
local list="${tmp_dir}"/mhwd-cache.list
chroot-run \
-r "${mountargs_ro}" \
-w "${mountargs_rw}" \
-B "${build_mirror}/${target_branch}" \
"$1" \
pacman -v -Syw $2 --noconfirm || return 1
chroot-run \
-r "${mountargs_ro}" \
-w "${mountargs_rw}" \
-B "${build_mirror}/${target_branch}" \
"$1" \
pacman -v -Sp $2 --noconfirm > "$list"
sed -ni '/pkg.tar/p' "$list"
sed -i "s/.*\///" "$list"
msg2 "Copying mhwd package cache ..."
rsync -v --files-from="$list" /var/cache/pacman/pkg "$1${mhwd_repo}"
}
chroot_create(){
[[ "${1##*/}" == "rootfs" ]] && local flag="-L"
setarch "${target_arch}" \
mkchroot ${mkchroot_args[*]} ${flag} $@
}
clean_iso_root(){
msg2 "Deleting isoroot [%s] ..." "${1##*/}"
rm -rf --one-file-system "$1"
}
chroot_clean(){
msg "Cleaning up ..."
for image in "$1"/*fs; do
[[ -d ${image} ]] || continue
local name=${image##*/}
if [[ $name != "mhwdfs" ]]; then
msg2 "Deleting chroot [%s] (%s) ..." "$name" "${1##*/}"
lock 9 "${image}.lock" "Locking chroot '${image}'"
if [[ "$(stat -f -c %T "${image}")" == btrfs ]]; then
{ type -P btrfs && btrfs subvolume delete "${image}"; } #&> /dev/null
fi
rm -rf --one-file-system "${image}"
fi
done
exec 9>&-
rm -rf --one-file-system "$1"
}
clean_up_image(){
msg2 "Cleaning [%s]" "${1##*/}"
local path
if [[ ${1##*/} == 'mhwdfs' ]]; then
path=$1/var
if [[ -d $path/lib/mhwd ]]; then
mv $path/lib/mhwd $1 &> /dev/null
fi
if [[ -d $path ]]; then
find "$path" -mindepth 0 -delete &> /dev/null
fi
if [[ -d $1/mhwd ]]; then
mkdir -p $path/lib
mv $1/mhwd $path/lib &> /dev/null
fi
path=$1/etc
if [[ -d $path ]]; then
find "$path" -mindepth 0 -delete &> /dev/null
fi
else
[[ -f "$1/etc/locale.gen.bak" ]] && mv "$1/etc/locale.gen.bak" "$1/etc/locale.gen"
[[ -f "$1/etc/locale.conf.bak" ]] && mv "$1/etc/locale.conf.bak" "$1/etc/locale.conf"
path=$1/boot
if [[ -d "$path" ]]; then
find "$path" -name 'initramfs*.img' -delete &> /dev/null
fi
path=$1/var/lib/pacman/sync
if [[ -d $path ]]; then
find "$path" -type f -delete &> /dev/null
fi
path=$1/var/cache/pacman/pkg
if [[ -d $path ]]; then
find "$path" -type f -delete &> /dev/null
fi
path=$1/var/log
if [[ -d $path ]]; then
find "$path" -type f -delete &> /dev/null
fi
path=$1/var/tmp
if [[ -d $path ]]; then
find "$path" -mindepth 1 -delete &> /dev/null
fi
path=$1/tmp
if [[ -d $path ]]; then
find "$path" -mindepth 1 -delete &> /dev/null
fi
fi
find "$1" -name *.pacnew -name *.pacsave -name *.pacorig -delete
file=$1/boot/grub/grub.cfg
if [[ -f "$file" ]]; then
rm $file
fi
}

View file

@ -21,7 +21,7 @@ mount_img() {
}
umount_img() {
if [[ -n ${IMG_ACTIVE_MOUNTS[@]} ]]; then
if [[ -n ${IMG_ACTIVE_MOUNTS[@]} ]];then
info "umount: [%s]" "${IMG_ACTIVE_MOUNTS[@]}"
umount "${IMG_ACTIVE_MOUNTS[@]}"
unset IMG_ACTIVE_MOUNTS
@ -34,54 +34,32 @@ track_fs() {
mount "$@" && FS_ACTIVE_MOUNTS=("$5" "${FS_ACTIVE_MOUNTS[@]}")
}
# $1: new branch
mount_fs_root(){
mount_fs(){
FS_ACTIVE_MOUNTS=()
local lower= upper="$1" work="$2" pkglist="$3"
local fs=${upper##*/}
local rootfs="$work/rootfs" desktopfs="$work/desktopfs" livefs="$work/livefs"
mkdir -p "${mnt_dir}/work"
track_fs -t overlay overlay -olowerdir="${work_dir}/rootfs",upperdir="$1",workdir="${mnt_dir}/work" "$1"
}
mount_fs_desktop(){
FS_ACTIVE_MOUNTS=()
mkdir -p "${mnt_dir}/work"
track_fs -t overlay overlay -olowerdir="${work_dir}/desktopfs":"${work_dir}/rootfs",upperdir="$1",workdir="${mnt_dir}/work" "$1"
}
mount_fs_live(){
FS_ACTIVE_MOUNTS=()
mkdir -p "${mnt_dir}/work"
track_fs -t overlay overlay -olowerdir="${work_dir}/livefs":"${work_dir}/desktopfs":"${work_dir}/rootfs",upperdir="$1",workdir="${mnt_dir}/work" "$1"
}
mount_fs_net(){
FS_ACTIVE_MOUNTS=()
mkdir -p "${mnt_dir}/work"
track_fs -t overlay overlay -olowerdir="${work_dir}/livefs":"${work_dir}/rootfs",upperdir="$1",workdir="${mnt_dir}/work" "$1"
}
check_umount() {
if mountpoint -q "$1"
then
umount -l "$1"
fi
mkdir -p "$upper"
case $fs in
desktopfs) lower="$rootfs" ;;
livefs|mhwdfs)
lower="$rootfs"
[[ -f $pkglist ]] && lower="$desktopfs":"$rootfs"
;;
bootfs)
lower="$livefs":"$rootfs"
[[ -f $pkglist ]] && lower="$livefs":"$desktopfs":"$rootfs"
;;
esac
track_fs -t overlay overlay -olowerdir="$lower",upperdir="$upper",workdir="${mnt_dir}/work" "$upper"
}
umount_fs(){
if [[ -n ${FS_ACTIVE_MOUNTS[@]} ]]; then
if [[ -n ${FS_ACTIVE_MOUNTS[@]} ]];then
info "overlayfs umount: [%s]" "${FS_ACTIVE_MOUNTS[@]}"
#umount "${FS_ACTIVE_MOUNTS[@]}"
for i in "${FS_ACTIVE_MOUNTS[@]}"
do
info "umount overlayfs: [%s]" "$i"
check_umount $i
done
umount "${FS_ACTIVE_MOUNTS[@]}"
unset FS_ACTIVE_MOUNTS
rm -rf "${mnt_dir}/work"
fi
mount_folders=$(grep "${work_dir}" /proc/mounts | awk '{print$2}' | sort -r)
for i in $mount_folders
do
info "umount folder: [%s]" "$i"
check_umount $i
done
}

View file

@ -9,17 +9,18 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
import ${LIBDIR}/util-iso-image.sh
import ${LIBDIR}/util-iso-boot.sh
import ${LIBDIR}/util-chroot.sh
import ${LIBDIR}/util-iso-chroot.sh
import ${LIBDIR}/util-yaml.sh
error_function() {
if [[ -p $logpipe ]]; then
rm "$logpipe"
fi
local func="$1"
# first exit all subshells, then print the error
if (( ! BASH_SUBSHELL )); then
error "A failure occurred in %s()." "$1"
error "A failure occurred in %s()." "$func"
plain "Aborting..."
fi
umount_fs
@ -49,7 +50,7 @@ run_safe() {
restoretrap=$(trap -p ERR)
trap 'error_function $func' ERR
if ${verbose}; then
if ${verbose};then
run_log "$func"
else
"$func"
@ -68,20 +69,57 @@ trap_exit() {
kill "-$sig" "$$"
}
configure_thus(){
local fs="$1"
msg2 "Configuring Thus ..."
source "$fs/etc/mkinitcpio.d/${kernel}.preset"
local conf="$fs/etc/thus.conf"
echo "[distribution]" > "$conf"
echo "DISTRIBUTION_NAME = \"${dist_name} Linux\"" >> "$conf"
echo "DISTRIBUTION_VERSION = \"${dist_release}\"" >> "$conf"
echo "SHORT_NAME = \"${dist_name}\"" >> "$conf"
echo "[install]" >> "$conf"
echo "LIVE_MEDIA_SOURCE = \"/run/miso/bootmnt/${iso_name}/${target_arch}/rootfs.sfs\"" >> "$conf"
echo "LIVE_MEDIA_DESKTOP = \"/run/miso/bootmnt/${iso_name}/${target_arch}/desktopfs.sfs\"" >> "$conf"
echo "LIVE_MEDIA_TYPE = \"squashfs\"" >> "$conf"
echo "LIVE_USER_NAME = \"${username}\"" >> "$conf"
echo "KERNEL = \"${kernel}\"" >> "$conf"
echo "VMLINUZ = \"$(echo ${ALL_kver} | sed s'|/boot/||')\"" >> "$conf"
echo "INITRAMFS = \"$(echo ${default_image} | sed s'|/boot/||')\"" >> "$conf"
echo "FALLBACK = \"$(echo ${fallback_image} | sed s'|/boot/||')\"" >> "$conf"
if [[ -f $fs/usr/share/applications/thus.desktop && -f $fs/usr/bin/kdesu ]];then
sed -i -e 's|sudo|kdesu|g' $fs/usr/share/applications/thus.desktop
fi
}
configure_live_image(){
local fs="$1"
msg "Configuring [livefs]"
configure_hosts "$fs"
configure_system "$fs"
configure_services "$fs"
configure_calamares "$fs"
[[ ${edition} == "sonar" ]] && configure_thus "$fs"
write_live_session_conf "$fs"
msg "Done configuring [livefs]"
}
make_sig () {
local idir="$1" file="$2"
msg2 "Creating signature file..."
cd "$1"
user_own "$1"
su ${OWNER} -c "gpg --detach-sign --default-key ${gpgkey} $2.sfs"
chown -R root "$1"
cd "$idir"
user_own "$idir"
su ${OWNER} -c "gpg --detach-sign --default-key ${gpgkey} $file.sfs"
chown -R root "$idir"
cd ${OLDPWD}
}
# $1: file
make_checksum(){
local idir="$1" file="$2"
msg2 "Creating md5sum ..."
cd $1
md5sum $2.sfs > $2.md5
cd $idir
md5sum $file.sfs > $file.md5
cd ${OLDPWD}
}
@ -110,7 +148,7 @@ make_sfs() {
fi
fi
if ${persist}; then
if ${persist};then
local size=32G
local mnt="${mnt_dir}/${name}"
msg2 "Creating ext4 image of %s ..." "${size}"
@ -129,7 +167,7 @@ make_sfs() {
msg2 "Creating SquashFS image, this may take some time..."
local used_kernel=${kernel:5:1} mksfs_args=()
if ${persist}; then
if ${persist};then
mksfs_args+=(${work_dir}/${name}.img)
else
mksfs_args+=(${src})
@ -137,15 +175,14 @@ make_sfs() {
mksfs_args+=(${sfs} -noappend)
local highcomp
local highcomp="-b 256K -Xbcj x86" comp='xz'
[[ "${iso_compression}" == "xz" ]] && highcomp="-b 256K -Xbcj x86"
[[ "${iso_compression}" == "zstd" ]] && highcomp="-b 256K -Xcompression-level 20" #compression level max 22 (default 15)
mksfs_args+=(-comp ${iso_compression} ${highcomp})
if ${verbose}; then
if [[ "${name}" == "mhwdfs" && ${used_kernel} < "4" ]]; then
mksfs_args+=(-comp lz4)
else
mksfs_args+=(-comp ${comp} ${highcomp})
fi
if ${verbose};then
mksquashfs "${mksfs_args[@]}" >/dev/null
else
mksquashfs "${mksfs_args[@]}"
@ -153,7 +190,7 @@ make_sfs() {
make_checksum "${dest}" "${name}"
${persist} && rm "${src}.img"
if [[ -n ${gpgkey} ]]; then
if [[ -n ${gpgkey} ]];then
make_sig "${dest}" "${name}"
fi
@ -177,7 +214,6 @@ assemble_iso(){
--sort-weight 0 / \
--sort-weight 1 /boot \
--grub2-mbr ${iso_root}/boot/grub/i386-pc/boot_hybrid.img \
-iso_mbr_part_type 0x00 \
-partition_offset 16 \
-b boot/grub/i386-pc/eltorito.img \
-c boot.catalog \
@ -186,10 +222,12 @@ assemble_iso(){
-append_partition 2 0xef ${iso_root}/efi.img \
-e --interval:appended_partition_2:all:: \
-no-emul-boot \
-full-iso9660-filenames \
-iso-level 3 -rock -joliet \
-iso-level 3 \
-o ${iso_dir}/${iso_file} \
${iso_root}/
# arg to add with xorriso-1.4.7
# -iso_mbr_part_type 0x00
}
# Build ISO
@ -198,10 +236,6 @@ make_iso() {
touch "${iso_root}/.miso"
for sfs_dir in $(find "${work_dir}" -maxdepth 1 -type d); do
if [[ "${sfs_dir}" != "${work_dir}" ]]; then
if [[ -e "${sfs_dir}"/etc/pacman.d/gnupg ]]; then
msg2 "Removing '/etc/pacman.d/gnupg' folder from ${sfs_dir}"
rm -rf "${sfs_dir}"/etc/pacman.d/gnupg
fi
make_sfs "${sfs_dir}"
fi
done
@ -210,337 +244,224 @@ make_iso() {
# Sanity checks
[[ ! -d "${iso_root}" ]] && return 1
if [[ -f "${iso_dir}/${iso_file}" ]]; then
msg2 "Removing ${iso_file} related files ..."
[[ -f "${iso_dir}/${iso_file}" ]] && rm -f "${iso_dir}/${iso_file}"
[[ -f "${iso_dir}/${iso_file}.sig" ]] && rm -f "${iso_dir}/${iso_file}.sig"
[[ -f "${iso_dir}/${iso_file}.sha1" ]] && rm -f "${iso_dir}/${iso_file}.sha1"
[[ -f "${iso_dir}/${iso_file}.sha256" ]] && rm -f "${iso_dir}/${iso_file}.sha256"
[[ -f "${iso_dir}/${iso_file}.torrent" ]] && rm -f "${iso_dir}/${iso_file}.torrent"
msg2 "Removing existing bootable image..."
rm -rf "${iso_dir}/${iso_file}"
fi
assemble_iso
${permalink} && gen_permalink
msg "Done [Build ISO]"
}
gen_permalink(){
if [[ ${edition} == "community" ]] || [[ ${edition} == "manjaro" ]]; then
if [[ -f "${iso_dir}/${iso_file}" ]]; then
msg2 "Creating download link ..."
direct_url="https://osdn.net/dl/${edition}/${iso_file}"
[[ ${edition} == "community" ]] && direct_url="https://osdn.net/dl/manjaro-${edition}/${iso_file}"
## html permalink
html_doc="<!DOCTYPE HTML>"
html_doc+="<meta charset=\"UTF-8\">"
html_doc+="<meta http-equiv=\"refresh\" content=\"1; url=${direct_url}\">"
html_doc+="<script>window.location.href=\"${direct_url}\"</script>"
html_doc+="<title>Download Redirection</title>"
html_doc+="If you are not redirected automatically, follow the <a href=\"${direct_url}\">link to latest iso</a>"
## php permalink
php_doc="<?php "
php_doc+="header('Location: ' . '${direct_url}', true, 303); "
php_doc+="die(); "
php_doc+="?>"
## write files
if [[ ${extra} == "true" ]]; then
echo ${html_doc} > "${iso_dir}/.latest"
echo ${php_doc} > "${iso_dir}/.latest.php"
else
echo ${html_doc} > "${iso_dir}/.latest-minimal"
echo ${php_doc} > "${iso_dir}/.latest-minimal.php"
fi
fi
fi
}
gen_iso_fn(){
local vars=() name
vars+=("${iso_name}")
if ! ${chrootcfg}; then
vars+=("${iso_name}")
if ! ${chrootcfg};then
[[ -n ${profile} ]] && vars+=("${profile}")
fi
[[ ${initsys} == 'openrc' ]] && vars+=("${initsys}")
vars+=("${dist_release}")
[[ ! ${target_branch} == "stable" ]] && vars+=("${target_branch}")
[[ ${extra} == 'false' ]] && vars+=("minimal")
vars+=("$(date +%y%m%d)")
vars+=("${kernel}")
[[ ${target_arch} == "i686" ]] && vars+=("${target_arch}")
for n in ${vars[@]}; do
vars+=("${target_branch}")
if ! ${full_iso}; then
vars+=("minimal")
fi
vars+=("${target_arch}")
for n in ${vars[@]};do
name=${name:-}${name:+-}${n}
done
echo $name
}
reset_pac_conf(){
info "Restoring [%s/etc/pacman.conf] ..." "$1"
local fs="$1"
info "Restoring [%s/etc/pacman.conf] ..." "$fs"
sed -e 's|^.*HoldPkg.*|HoldPkg = pacman glibc manjaro-system|' \
-e "s|^.*#CheckSpace|CheckSpace|" \
-i "$1/etc/pacman.conf"
}
# Snap support
function seed_snaps() {
local SEED_DIR="/var/lib/snapd/seed"
local SEED_CHANNEL="${snap_channel}"
local SEED_SNAPS="${strict_snaps} ${classic_snaps}"
if [[ -n "${strict_snaps}" ]] || [[ -n "${classic_snaps}" ]]; then
msg2 "Configuring snaps"
# Preseeded snaps should be downloaded from a versioned channel
rm -rfv "$1/${SEED_DIR}"
mkdir -p "$1/${SEED_DIR}/snaps"
mkdir -p "$1/${SEED_DIR}/assertions"
SEED_LIST=()
# Update SEED_LIST
for SEED_SNAP in ${SEED_SNAPS}; do
if [[ "${SEED_SNAP}" == "core" ]] || [[ "${SEED_SNAP}" == "core16" ]] || [[ "${SEED_SNAP}" == "core18" ]]; then
SEED_LIST+=(--snap=${SEED_SNAP}=stable)
else
SEED_LIST+=(--snap=${SEED_SNAP}=${SEED_CHANNEL})
fi
done
# Create model and account assertions
# Runs outside the container.
snap known model > /tmp/generic.model
snap prepare-image --arch amd64 --classic /tmp/generic.model "${SEED_LIST[@]}" "$1"
else
msg2 "No snaps found in profile. Skipping adding snaps"
fi
-i "$fs/etc/pacman.conf"
}
# Base installation (rootfs)
make_image_root() {
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
if [[ ! -e ${work_dir}/rootfs.lock ]]; then
msg "Prepare [Base installation] (rootfs)"
local path="${work_dir}/rootfs"
mkdir -p ${path}
local rootfs="${work_dir}/rootfs"
chroot_create "${path}" "${packages}" || die
prepare_dir "${rootfs}"
# profide multilib usage to mhwd-script
if [[ ! -z ${multilib} ]]; then
echo 'MHWD64_IS_LIB32="'${multilib}'"' > "${path}/etc/mhwd-x86_64.conf"
fi
create_chroot "${mkchroot_args[@]}" "${rootfs}" "${packages[@]}"
pacman -Qr "${path}" > "${path}/rootfs-pkgs.txt"
copy_overlay "${profile_dir}/root-overlay" "${path}"
pacman -Qr "${rootfs}" > "${rootfs}/rootfs-pkgs.txt"
copy_overlay "${profile_dir}/root-overlay" "${rootfs}"
reset_pac_conf "${path}"
reset_pac_conf "${rootfs}"
configure_lsb "${path}"
configure_lsb "${rootfs}"
clean_up_image "${rootfs}"
clean_up_image "${path}"
: > ${work_dir}/build.${FUNCNAME}
msg "Done [Base installation] (rootfs)"
fi
}
make_image_desktop() {
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
if [[ ! -e ${work_dir}/desktopfs.lock ]]; then
msg "Prepare [Desktop installation] (desktopfs)"
local path="${work_dir}/desktopfs"
mkdir -p ${path}
local desktopfs="${work_dir}/desktopfs"
mount_fs_root "${path}"
prepare_dir "${desktopfs}"
chroot_create "${path}" "${packages}"
mount_fs "${desktopfs}" "${work_dir}"
pacman -Qr "${path}" > "${path}/desktopfs-pkgs.txt"
cp "${path}/desktopfs-pkgs.txt" ${iso_dir}/$(gen_iso_fn)-pkgs.txt
[[ -e ${profile_dir}/desktop-overlay ]] && copy_overlay "${profile_dir}/desktop-overlay" "${path}"
create_chroot "${mkchroot_args[@]}" "${desktopfs}" "${packages[@]}"
if [[ -e "${path}/usr/share/calamares/branding/manjaro/calamares-sidebar.qml" ]]; then
configure_branding "${path}"
msg "Done [Distribution: Release ${dist_release} Codename ${dist_codename}]"
elif [[ -e "${path}/usr/share/calamares/branding/manjaro/show.qml" ]]; then
configure_branding_old "${path}"
msg "Done [Distribution: Release ${dist_release} Codename ${dist_codename}]"
fi
pacman -Qr "${desktopfs}" > "${desktopfs}/desktopfs-pkgs.txt"
cp "${desktopfs}/desktopfs-pkgs.txt" ${iso_dir}/$(gen_iso_fn)-pkgs.txt
[[ -e ${profile_dir}/desktop-overlay ]] && copy_overlay "${profile_dir}/desktop-overlay" "${desktopfs}"
reset_pac_conf "${path}"
seed_snaps ${path}
echo "Enable os-prober"
sed -i -e 's,.*GRUB_DISABLE_OS_PROBER=.*,GRUB_DISABLE_OS_PROBER=false,' "${path}/etc/default/grub"
reset_pac_conf "${desktopfs}"
umount_fs
clean_up_image "${path}"
: > ${work_dir}/build.${FUNCNAME}
clean_up_image "${desktopfs}"
msg "Done [Desktop installation] (desktopfs)"
fi
}
mount_fs_select(){
if [[ -f "${packages_desktop}" ]]; then
mount_fs_desktop "$1"
else
mount_fs_root "$1"
fi
}
make_image_live() {
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
if [[ ! -e ${work_dir}/livefs.lock ]]; then
msg "Prepare [Live installation] (livefs)"
local path="${work_dir}/livefs"
mkdir -p ${path}
local livefs="${work_dir}/livefs"
mount_fs_select "${path}"
prepare_dir "${livefs}"
chroot_create "${path}" "${packages}"
mount_fs "${livefs}" "${work_dir}" "${desktop_list}"
pacman -Qr "${path}" > "${path}/livefs-pkgs.txt"
copy_overlay "${profile_dir}/live-overlay" "${path}"
configure_live_image "${path}"
create_chroot "${mkchroot_args[@]}" "${livefs}" "${packages[@]}"
# mask some systemd targets on live-session
mkdir -p "${path}"/etc/systemd/system
ln -sfv /dev/null "${path}"/etc/systemd/system/sleep.target
ln -sfv /dev/null "${path}"/etc/systemd/system/suspend.target
ln -sfv /dev/null "${path}"/etc/systemd/system/hibernate.target
ln -sfv /dev/null "${path}"/etc/systemd/system/hybrid-sleep.target
pacman -Qr "${livefs}" > "${livefs}/livefs-pkgs.txt"
copy_overlay "${profile_dir}/live-overlay" "${livefs}"
configure_live_image "${livefs}"
if [[ -e "${path}/usr/share/calamares/branding/manjaro/calamares-sidebar.qml" ]]; then
configure_branding "${path}"
msg "Done [Distribution: Release ${dist_release} Codename ${dist_codename}]"
elif [[ -e "${path}/usr/share/calamares/branding/manjaro/show.qml" ]]; then
configure_branding_old "${path}"
msg "Done [Distribution: Release ${dist_release} Codename ${dist_codename}]"
fi
configure_polkit_user_rules "${path}"
reset_pac_conf "${path}"
reset_pac_conf "${livefs}"
umount_fs
clean_up_image "${path}"
: > ${work_dir}/build.${FUNCNAME}
clean_up_image "${livefs}"
msg "Done [Live installation] (livefs)"
fi
}
make_image_mhwd() {
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
if [[ ! -e ${work_dir}/mhwdfs.lock ]]; then
msg "Prepare [drivers repository] (mhwdfs)"
local path="${work_dir}/mhwdfs"
mkdir -p ${path}${mhwd_repo}
local mhwdfs="${work_dir}/mhwdfs"
mount_fs_select "${path}"
prepare_dir "${mhwdfs}${mhwd_repo}"
reset_pac_conf "${path}"
mount_fs "${mhwdfs}" "${work_dir}" "${desktop_list}"
copy_from_cache "${path}" "${packages}"
reset_pac_conf "${mhwdfs}"
if [[ -n "${packages_cleanup}" ]]; then
for mhwd_clean in ${packages_cleanup}; do
rm ${path}${mhwd_repo}/${mhwd_clean}
copy_from_cache "${mhwdfs}" "${packages[@]}"
if [[ -n "${packages_cleanup[@]}" ]]; then
for pkg in ${packages_cleanup[@]}; do
rm ${mhwdfs}${mhwd_repo}/${pkg}
done
fi
cp ${DATADIR}/pacman-mhwd.conf ${path}/opt/mhwd
make_repo "${path}"
configure_mhwd_drivers "${path}"
make_repo "${mhwdfs}"
configure_mhwd_drivers "${mhwdfs}"
umount_fs
clean_up_image "${path}"
: > ${work_dir}/build.${FUNCNAME}
clean_up_image "${mhwdfs}"
: > ${work_dir}/mhwdfs.lock
msg "Done [drivers repository] (mhwdfs)"
fi
}
make_image_boot() {
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
if [[ ! -e ${work_dir}/bootfs.lock ]]; then
msg "Prepare [/iso/boot]"
local boot="${iso_root}/boot"
mkdir -p ${boot}
prepare_dir "${boot}"
cp ${work_dir}/rootfs/boot/vmlinuz* ${boot}/vmlinuz-${target_arch}
local path="${work_dir}/bootfs"
mkdir -p ${path}
local bootfs="${work_dir}/bootfs"
if [[ -f "${packages_desktop}" ]]; then
mount_fs_live "${path}"
else
mount_fs_net "${path}"
fi
mount_fs "${bootfs}" "${work_dir}" "${desktop_list}"
prepare_initcpio "${path}"
prepare_initramfs "${path}"
prepare_initcpio "${bootfs}"
prepare_initramfs "${bootfs}"
cp ${path}/boot/initramfs.img ${boot}/initramfs-${target_arch}.img
prepare_boot_extras "${path}" "${boot}"
cp ${bootfs}/boot/initramfs.img ${boot}/initramfs-${target_arch}.img
prepare_boot_extras "${bootfs}" "${boot}"
umount_fs
rm -R ${path}
: > ${work_dir}/build.${FUNCNAME}
rm -R ${bootfs}
: > ${work_dir}/bootfs.lock
msg "Done [/iso/boot]"
fi
}
configure_grub(){
local default_args="misobasedir=${iso_name} misolabel=${iso_label}" \
boot_args=('quiet' 'systemd.show_status=1' ${custom_boot_args} ${apparmor_boot_args})
local conf="$1"
local default_args="misobasedir=${iso_name} misolabel=${iso_label}" boot_args=('quiet')
[[ ${initsys} == 'systemd' ]] && boot_args+=('systemd.show_status=1')
sed -e "s|@DIST_NAME@|${dist_name}|g" \
-e "s|@ARCH@|${target_arch}|g" \
-e "s|@DEFAULT_ARGS@|${default_args}|g" \
-e "s|@BOOT_ARGS@|${boot_args[*]}|g" \
-e "s|@PROFILE@|${profile}|g" \
-i $1
-i $conf
}
configure_grub_theme(){
sed -e "s|@ISO_NAME@|${iso_name}|" -i "$1"
local conf="$1"
sed -e "s|@ISO_NAME@|${iso_name}|" -i "$conf"
}
make_grub(){
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
if [[ ! -e ${work_dir}/grub.lock ]]; then
msg "Prepare [/iso/boot/grub]"
local path="${work_dir}/livefs"
prepare_grub "${path}" "${iso_root}"
prepare_grub "${work_dir}/rootfs" "${work_dir}/livefs" "${iso_root}"
configure_grub "${iso_root}/boot/grub/kernels.cfg"
configure_grub_theme "${iso_root}/boot/grub/variable.cfg"
: > ${work_dir}/build.${FUNCNAME}
: > ${work_dir}/grub.lock
msg "Done [/iso/boot/grub]"
fi
}
check_requirements(){
prepare_dir "${log_dir}"
eval_build_list "${list_dir_iso}" "${build_list_iso}"
[[ -f ${run_dir}/repo_info ]] || die "%s is not a valid iso profiles directory!" "${run_dir}"
if ! $(is_valid_arch_iso ${target_arch}); then
die "%s is not a valid arch!" "${target_arch}"
fi
if ! $(is_valid_branch ${target_branch}); then
die "%s is not a valid branch!" "${target_branch}"
fi
if ! $(is_valid_comp ${iso_compression}); then
die "%s is not a valid compression algorithm!" "${iso_compression}"
local iso_kernel=${kernel:5:1} host_kernel=$(uname -r)
if [[ ${iso_kernel} < "4" ]] \
|| [[ ${host_kernel%%*.} < "4" ]];then
die "The host and iso kernels must be version>=4.0!"
fi
local iso_kernel=${kernel:5:1}
[[ ${iso_kernel} < "4" ]] && die "ISO kernel must be version>=4.0!"
for sig in TERM HUP QUIT; do
trap "trap_exit $sig \"$(gettext "%s signal caught. Exiting...")\" \"$sig\"" "$sig"
done
trap 'trap_exit INT "$(gettext "Aborted by user! Exiting...")"' INT
trap 'trap_exit USR1 "$(gettext "An unknown error has occurred. Exiting...")"' ERR
}
compress_images(){
local timer=$(get_timer)
run_safe "make_iso"
user_own "${cache_dir_iso}" "-R"
user_own "${iso_dir}" "-R"
show_elapsed_time "${FUNCNAME}" "${timer}"
}
@ -548,16 +469,16 @@ prepare_images(){
local timer=$(get_timer)
load_pkgs "${profile_dir}/Packages-Root"
run_safe "make_image_root"
if [[ -f "${packages_desktop}" ]] ; then
load_pkgs "${packages_desktop}"
if [[ -f "${desktop_list}" ]] ; then
load_pkgs "${desktop_list}"
run_safe "make_image_desktop"
fi
if [[ -f ${profile_dir}/Packages-Live ]]; then
load_pkgs "${profile_dir}/Packages-Live"
run_safe "make_image_live"
fi
if [[ -f ${packages_mhwd} ]] ; then
load_pkgs "${packages_mhwd}"
if [[ -f ${mhwd_list} ]] ; then
load_pkgs "${mhwd_list}"
run_safe "make_image_mhwd"
fi
run_safe "make_image_boot"
@ -577,7 +498,7 @@ archive_logs(){
make_profile(){
msg "Start building [%s]" "${profile}"
if ${clean_first}; then
if ${clean_first};then
chroot_clean "${chroots_iso}/${profile}/${target_arch}"
local unused_arch=''
@ -585,7 +506,7 @@ make_profile(){
i686) unused_arch='x86_64' ;;
x86_64) unused_arch='i686' ;;
esac
if [[ -d "${chroots_iso}/${profile}/${unused_arch}" ]]; then
if [[ -d "${chroots_iso}/${profile}/${unused_arch}" ]];then
chroot_clean "${chroots_iso}/${profile}/${unused_arch}"
fi
clean_iso_root "${iso_root}"
@ -615,7 +536,7 @@ make_profile(){
get_pacman_conf(){
local user_conf=${profile_dir}/user-repos.conf pac_arch='default' conf
[[ "${target_arch}" == 'x86_64' ]] && pac_arch='multilib'
if [[ -f ${user_conf} ]]; then
if [[ -f ${user_conf} ]];then
info "detected: %s" "user-repos.conf"
check_user_repos_conf "${user_conf}"
conf=${tmp_dir}/custom-pacman.conf
@ -626,44 +547,8 @@ get_pacman_conf(){
echo "$conf"
}
load_profile(){
conf="$1/profile.conf"
info "Profile: [%s]" "${profile}"
load_profile_config "$conf"
pacman_conf=$(get_pacman_conf)
mirrors_conf=$(get_pac_mirrors_conf "${target_branch}")
iso_file=$(gen_iso_fn).iso
[[ ${extra} == 'false' ]] && _edition=("m")
iso_label=$(get_iso_label "${dist_branding}_${profile}${_edition}_${dist_release//.}")
mkchroot_args+=(-C ${pacman_conf} -S ${mirrors_conf} -B "${build_mirror}/${target_branch}" -K)
work_dir=${chroots_iso}/${profile}/${target_arch}
iso_dir="${cache_dir_iso}/${edition}/${profile}/${dist_release}"
iso_root=${chroots_iso}/${profile}/iso
mnt_dir=${chroots_iso}/${profile}/mnt
prepare_dir "${mnt_dir}"
prepare_dir "${iso_dir}"
user_own "${cache_dir_iso}" "-R"
}
prepare_profile(){
profile=$1
edition=$(get_edition ${profile})
profile_dir=${run_dir}/${edition}/${profile}
check_profile "${profile_dir}"
load_profile "${profile_dir}"
}
build(){
prepare_profile "$1"
local prof="$1"
prepare_build "$prof"
make_profile
}

View file

@ -45,31 +45,33 @@ chroot_part_mount() {
}
select_os(){
local detected_os_list=( $(detect) ) os_list=() count select os_str os_root
for os in ${detected_os_list[@]}; do
case ${os##*:} in
'linux') os_list+=($os)
esac
done
count=${#os_list[@]}
if [[ ${count} < 1 ]]; then
die "No Linux partitions detected!"
fi
if [[ ${count} > 1 ]]; then
msg "Detected systems:"
local i=0
for os in ${os_list[@]}; do
info "$i) $(get_os_name $os)"; i=$((i+1))
done
local os_list=( $(detect) ) count=${#os_list[@]}
if [[ ${count} > 1 ]];then
msg "Detected systems:"
local i=0
for os in ${os_list[@]};do
local last=${os##*:}
case $last in
'efi') count=$((count-1)) ;;
*) info "$i) $(get_os_name $os)"; i=$((i+1)) ;;
esac
done
i=0
msg "Select system to mount [0-%s] : " "$((count-1))"
read select
else
read select
else
select=0
fi
os_str=${os_list[$select]}
os_root=${os_str%%:*}
msg "Mounting (%s) [%s]" "$(get_os_name $os_str)" "$os_root"
chroot_mount_partitions "$1" "$os_root"
local os_str=${os_list[$select]} type
type=$os_str
root=${os_str%%:*}
type=${type##*:}
if [[ "${type##*:}" == 'linux' ]];then
msg "Mounting (%s) [%s]" "$(get_os_name $os_str)" "$root"
chroot_mount_partitions "$1" "$root"
else
die "You can't mount %s!" "$select"
fi
}
chroot_mount_partitions(){
@ -97,7 +99,7 @@ chroot_mount_partitions(){
[[ ${chroot_arch} == x86-64 ]] && chroot_arch=${chroot_arch/-/_}
case ${target_arch} in
i686)
if [[ ${chroot_arch} == x86_64 ]]; then
if [[ ${chroot_arch} == x86_64 ]];then
die "You can't chroot from %s host into %s!" "${target_arch}" "${chroot_arch}"
fi
;;

View file

@ -11,11 +11,9 @@
export LC_MESSAGES=C
export LANG=C
disable_colors(){
unset ALL_OFF BOLD BLUE GREEN RED YELLOW
}
declare ALL_OFF='' BOLD='' BLUE='' GREEN='' RED='' YELLOW=''
enable_colors(){
if [[ -t 2 ]]; then
# prefer terminal safe colored and bold text when tput is supported
if tput setaf 0 &>/dev/null; then
ALL_OFF="$(tput sgr0)"
@ -32,14 +30,8 @@ enable_colors(){
YELLOW="${BOLD}\e[33m"
BLUE="${BOLD}\e[34m"
fi
readonly ALL_OFF BOLD BLUE GREEN RED YELLOW
}
if [[ -t 2 ]]; then
enable_colors
else
disable_colors
fi
readonly ALL_OFF BOLD BLUE GREEN RED YELLOW
plain() {
local mesg=$1; shift
@ -73,13 +65,42 @@ error() {
stat_busy() {
local mesg=$1; shift
printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}...${ALL_OFF}" >&2
printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}...${ALL_OFF}" "$@" >&2
}
stat_done() {
printf "${BOLD}done${ALL_OFF}\n" >&2
}
lock_close() {
local fd=$1
exec {fd}>&-
}
lock() {
if ! [[ "/dev/fd/$1" -ef "$2" ]]; then
mkdir -p -- "$(dirname -- "$2")"
eval "exec $1>"'"$2"'
fi
if ! flock -n $1; then
stat_busy "$3"
flock $1
stat_done
fi
}
slock() {
if ! [[ "/dev/fd/$1" -ef "$2" ]]; then
mkdir -p -- "$(dirname -- "$2")"
eval "exec $1>"'"$2"'
fi
if ! flock -sn $1; then
stat_busy "$3"
flock -s $1
stat_done
fi
}
cleanup() {
exit ${1:-0}
}
@ -95,7 +116,7 @@ die() {
}
import(){
if [[ -r $1 ]]; then
if [[ -r $1 ]];then
source $1
else
die "Could not import $1"

View file

@ -10,23 +10,25 @@
# GNU General Public License for more details.
load_compiler_settings(){
local tarch="$1" conf
conf=${make_conf_dir}/$tarch.conf
local arch="$1" conf
conf=${make_conf_dir}/$arch.conf
[[ -f $conf ]] || return 1
info "Loading compiler settings: %s" "$tarch"
info "Loading compiler settings: %s" "$arch"
source $conf
return 0
}
get_makepkg_conf(){
local conf="${tmp_dir}/makepkg-$1.conf"
local arch="$1"
local conf="${tmp_dir}/makepkg-${arch}.conf"
cp "${DATADIR}/makepkg.conf" "$conf"
load_compiler_settings "$1"
load_compiler_settings "${arch}"
sed -i "$conf" \
-e "s|@CARCH[@]|$carch|g" \
@ -36,128 +38,86 @@ get_makepkg_conf(){
echo "$conf"
}
# $1: target_arch
prepare_conf(){
if ! is_valid_arch_pkg "$1"; then
die "%s is not a valid arch!" "$1"
fi
local pac_arch='default'
if [[ "$1" == 'multilib' ]]; then
pac_arch='multilib'
is_multilib=true
fi
pacman_conf="${DATADIR}/pacman-$pac_arch.conf"
work_dir="${chroots_pkg}/${target_branch}/$1"
pkg_dir="${cache_dir_pkg}/${target_branch}/$1"
makepkg_conf=$(get_makepkg_conf "$1")
[[ "$pac_arch" == 'multilib' ]] && target_arch='x86_64'
}
check_build(){
find_pkg $1
[[ ! -f $1/PKGBUILD ]] && die "Directory must contain a PKGBUILD!"
local bdir="$1"
find_pkg "${bdir}"
[[ ! -f ${bdir}/PKGBUILD ]] && die "Directory must contain a PKGBUILD!"
}
find_pkg(){
local result=$(find . -type d -name "$1")
[[ -z $result ]] && die "%s is not a valid package or build list!" "$1"
local bdir="$1"
local result=$(find . -type d -name "${bdir}")
[[ -z $result ]] && die "%s is not a valid package or build list!" "${bdir}"
}
init_base_devel(){
if ${is_multilib}; then
base_packages=('base-devel' 'multilib-devel')
if ${udev_root};then
local _multi _space="s| ||g" _clean=':a;N;$!ba;s/\n/ /g' _com_rm="s|#.*||g"
local file=${DATADIR}/base-devel-udev
# info "Loading custom group: %s" "$file"
_multi="s|>multilib.*||g"
${is_multilib} && _multi="s|>multilib||g"
packages=($(sed "$_com_rm" "$file" \
| sed "$_space" \
| sed "$_multi" \
| sed "$_clean"))
else
base_packages=('base-devel')
packages=('base-devel')
${is_multilib} && packages+=('multilib-devel')
fi
}
chroot_create(){
msg "Creating chroot for [%s] (%s)..." "${target_branch}" "${target_arch}"
mkdir -p "${work_dir}"
mkchroot_args+=(-L)
setarch "${target_arch}" \
mkchroot ${mkchroot_args[*]} \
"${work_dir}/root" \
${base_packages[*]} || abort
}
chroot_clean(){
msg "Cleaning chroot for [%s] (%s)..." "${target_branch}" "${target_arch}"
for copy in "${work_dir}"/*; do
[[ -d ${copy} ]] || continue
msg2 "Deleting chroot copy %s ..." "$(basename "${copy}")"
lock 9 "${copy}.lock" "Locking chroot copy '${copy}'"
subvolume_delete_recursive "${copy}"
rm -rf --one-file-system "${copy}"
done
exec 9>&-
rm -rf --one-file-system "${work_dir}"
}
chroot_update(){
msg "Updating chroot for [%s] (%s)..." "${target_branch}" "${target_arch}"
chroot-run ${mkchroot_args[*]} \
"${work_dir}/${OWNER}" \
pacman -Syu --noconfirm || abort
}
clean_up(){
msg "Cleaning up ..."
# msg "Cleaning up ..."
msg2 "Cleaning [%s]" "${pkg_dir}"
find ${pkg_dir} -maxdepth 1 -name "*.*" -delete #&> /dev/null
if [[ -z $SRCDEST ]]; then
if [[ -z $SRCDEST ]];then
msg2 "Cleaning [source files]"
find $PWD -maxdepth 1 -name '*.?z?' -delete #&> /dev/null
fi
}
sign_pkg(){
su ${OWNER} -c "signfile ${pkg_dir}/$1"
local pkg="$1"
su ${OWNER} -c "signfile ${pkg_dir}/${pkg}"
}
move_to_cache(){
prepare_dir "${log_dir}"
local src="$1"
[[ -n $PKGDEST ]] && src="$PKGDEST/$1"
[[ -n $PKGDEST ]] && src="$PKGDEST/$src"
[[ ! -f $src ]] && die
if [[ ${pkg_dir} != $PKGDEST ]]; then
msg2 "Moving [%s] -> [%s]" "${src##*/}" "${pkg_dir}"
mv $src ${pkg_dir}/
fi
msg2 "Moving [%s] -> [%s]" "${src##*/}" "${pkg_dir}"
mv $src ${pkg_dir}/
${sign} && sign_pkg "${src##*/}"
# [[ -n $PKGDEST ]] && rm "$src"
user_own "${pkg_dir}" "-R"
}
archive_logs(){
local archive name="$1" ext=log.tar.xz ver src=${tmp_dir}/archives.list target='.'
local archive name="$1" ext=log.tar.xz ver src=${tmp_dir}/archives.list dest='.'
ver=$(get_full_version "$name")
archive="${name}-${ver}-${target_arch}"
if [[ -n $LOGDEST ]]; then
target=$LOGDEST
find $target -maxdepth 1 -name "$archive*.log" -printf "%f\n" > $src
if [[ -n $LOGDEST ]];then
dest=$LOGDEST
find ${dest} -maxdepth 1 -name "$archive*.log" -printf "%f\n" > $src
else
find $target -maxdepth 1 -name "$archive*.log" > $src
find ${dest} -maxdepth 1 -name "$archive*.log" > $src
fi
msg2 "Archiving log files [%s] ..." "$archive.$ext"
tar -cJf ${log_dir}/$archive.$ext -C "$target" -T $src
tar -cJf ${log_dir}/$archive.$ext -C "${dest}" -T $src
msg2 "Cleaning log files ..."
find $target -maxdepth 1 -name "$archive*.log" -delete
find ${dest} -maxdepth 1 -name "$archive*.log" -delete
}
post_build(){
source PKGBUILD
local ext='pkg.tar.zst' tarch ver src
for pkg in ${pkgname[@]}; do
local ext='pkg.tar.xz' tarch ver src
for pkg in ${pkgname[@]};do
case $arch in
any) tarch='any' ;;
*) tarch=${target_arch}
@ -170,30 +130,23 @@ post_build(){
archive_logs "$name"
}
chroot_init(){
local timer=$(get_timer)
if ${clean_first} || [[ ! -d "${work_dir}" ]]; then
chroot_clean
chroot_create
else
chroot_update
fi
show_elapsed_time "${FUNCNAME}" "${timer}"
}
build_pkg(){
prepare_dir "${pkg_dir}"
user_own "${pkg_dir}"
${purge} && clean_up
setarch "${target_arch}" \
mkchrootpkg ${mkchrootpkg_args[*]}
mkchrootpkg "${mkchrootpkg_args[@]}"
post_build
}
make_pkg(){
check_build "$1"
msg "Start building [%s]" "$1"
cd $1
local pkg="$1"
check_build "${pkg}"
msg "Start building [%s]" "${pkg}"
cd ${pkg}
build_pkg
cd ..
msg "Finished building [%s]" "$1"
msg "Finished building [%s]" "${pkg}"
show_elapsed_time "${FUNCNAME}" "${timer_start}"
}

View file

@ -37,8 +37,8 @@ clone_tree(){
sync_tree_manjaro(){
cd ${tree_dir}
for repo in ${repo_tree[@]}; do
if [[ -d packages-${repo} ]]; then
for repo in ${repo_tree[@]};do
if [[ -d packages-${repo} ]];then
cd packages-${repo}
sync_tree "${repo}"
cd ..
@ -52,8 +52,8 @@ sync_tree_manjaro(){
sync_tree_abs(){
local repo_tree_abs=('packages' 'community')
cd ${tree_dir_abs}
for repo in ${repo_tree_abs[@]}; do
if [[ -d ${repo} ]]; then
for repo in ${repo_tree_abs[@]};do
if [[ -d ${repo} ]];then
cd ${repo}
sync_tree "${repo}"
cd ..

View file

@ -9,7 +9,14 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
import ${LIBDIR}/util.sh
in_array() {
local needle=$1; shift
local item
for item in "$@"; do
[[ $item = $needle ]] && return 0 # Found
done
return 1 # Not Found
}
# $1: sofile
# $2: soarch

View file

@ -9,27 +9,26 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
local MINIMAL
connect(){
${alt_storage} && server="storage-in" || server="storage"
local storage="@${server}.osdn.net:/storage/groups/m/ma/"
echo "${account}${storage}${project}"
local home="/home/frs/project"
echo "${account},${project}@frs.${host}:${home}/${project}"
}
connect_shell(){
local shell="@shell.osdn.net:/home/groups/m/ma/"
echo "${account}${shell}${project}"
gen_webseed(){
local webseed seed="$1"
for mirror in ${iso_mirrors[@]};do
webseed=${webseed:-}${webseed:+,}"http://${mirror}.dl.${seed}"
done
echo ${webseed}
}
make_torrent(){
find ${src_dir} -type f -name "*.torrent" -delete
if [[ -n $(find ${src_dir} -type f -name "*.iso") ]]; then
isos=$(ls ${src_dir}/*.iso)
for iso in ${isos}; do
local seed=https://${host}/dl/${project}/${iso##*/}
local mktorrent_args=(-c "${torrent_meta}" -p -l ${piece_size} -a ${tracker_url} -w ${seed})
for iso in $(ls ${src_dir}/*.iso);do
local seed=${host}/project/${project}/${target_dir}/${iso##*/}
local mktorrent_args=(-c "${torrent_meta}" -p -l ${piece_size} -a ${tracker_url} -w $(gen_webseed ${seed}))
${verbose} && mktorrent_args+=(-v)
msg2 "Creating (%s) ..." "${iso##*/}.torrent"
mktorrent ${mktorrent_args[*]} -o ${iso}.torrent ${iso}
@ -39,223 +38,18 @@ make_torrent(){
prepare_transfer(){
profile="$1"
hidden="$2"
edition=$(get_edition "${profile}")
[[ -z ${project} ]] && project="$(get_project)"
server=$(connect)
webshell=$(connect_shell)
htdocs="htdocs/${profile}"
url=$(connect)
target_dir="${profile}/${dist_release}"
src_dir="${run_dir}/${edition}/${target_dir}"
${hidden} && target_dir="${profile}/.${dist_release}"
}
start_agent(){
msg2 "Initializing SSH agent..."
ssh-agent | sed 's/^echo/#echo/' > "$1"
chmod 600 "$1"
. "$1" > /dev/null
ssh-add
}
ssh_add(){
local ssh_env="$USER_HOME/.ssh/environment"
if [ -f "${ssh_env}" ]; then
. "${ssh_env}" > /dev/null
ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
start_agent ${ssh_env};
}
else
start_agent ${ssh_env};
fi
${torrent} && make_torrent
}
sync_dir(){
count=1
max_count=10
prepare_transfer "$1" "${hidden}"
${torrent} && make_torrent
${sign} && signiso "${src_dir}"
${ssh_agent} && ssh_add
msg "Start upload [%s] to [%s] ..." "$1" "${project}"
while [[ $count -le $max_count ]]; do
rsync ${rsync_args[*]} --exclude '.latest*' --exclude 'index.html' --exclude 'links.txt' ${src_dir}/ ${server}/${target_dir}/
if [[ $? != 0 ]]; then
count=$(($count + 1))
msg "Upload failed. retrying (%s/%s) ..." "$count" "$max_count"
sleep 2
else
count=$(($max_count + 1))
${upd_homepage} && pull_hp_repo
${shell_upload} && upload_permalinks
msg "Done upload [%s]" "$1"
show_elapsed_time "${FUNCNAME}" "${timer_start}"
fi
done
}
upload_permalinks(){
## permalinks for full ISO
if [[ -f "${src_dir}/.latest" ]]; then
msg "Uploading permalinks ..."
LATEST_ISO=$(sed -e 's/\"/\n/g' < "${src_dir}/.latest" | grep -Eo 'http.*iso$' -m1 | awk '{split($0,x,"/"); print x[6]}')
PKGLIST="${LATEST_ISO/.iso/-pkgs.txt}"
## upload redirector files
[[ -f "${src_dir}/.latest" ]] && sync_latest_html
[[ -f "${src_dir}/.latest.php" ]] && sync_latest_php
## upload verification files, torrent and package list
[[ -f "${src_dir}/${LATEST_ISO}.torrent" ]] && sync_latest_torrent
[[ -f "${src_dir}/${LATEST_ISO}.sig" ]] && sync_latest_signature
[[ -f "${src_dir}/${LATEST_ISO}.sha1" ]] && sync_latest_checksum_sha1
[[ -f "${src_dir}/${LATEST_ISO}.sha256" ]] && sync_latest_checksum_sha256
[[ -f "${src_dir}/${PKGLIST}" ]] && sync_latest_pkg_list
${upd_homepage} && upd_dl_checksum
fi
## permalinks for minimal ISO
if [[ -f "${src_dir}/.latest-minimal" ]]; then
msg "Uploading permalinks (minimal) ..."
MINIMAL="yes"
LATEST_ISO=$(sed -e 's/\"/\n/g' < "${src_dir}/.latest-minimal" | grep -Eo 'http.*iso$' -m1 | awk '{split($0,x,"/"); print x[6]}')
PKGLIST="${LATEST_ISO/.iso/-pkgs.txt}"
## upload redirector files
[[ -f "${src_dir}/.latest-minimal" ]] && sync_latest_html
[[ -f "${src_dir}/.latest-minimal.php" ]] && sync_latest_php
## upload verification files, torrent and package list
[[ -f "${src_dir}/${LATEST_ISO}.torrent" ]] && sync_latest_torrent
[[ -f "${src_dir}/${LATEST_ISO}.sig" ]] && sync_latest_signature
[[ -f "${src_dir}/${LATEST_ISO}.sha1" ]] && sync_latest_checksum_sha1
[[ -f "${src_dir}/${LATEST_ISO}.sha256" ]] && sync_latest_checksum_sha256
[[ -f "${src_dir}/${PKGLIST}" ]] && sync_latest_pkg_list
${upd_homepage} && upd_dl_checksum_minimal
fi
${upd_homepage} && upd_dl_version && push_hp_repo
}
sync_latest_pkg_list(){
msg2 "Uploading package list ..."
local pkglist="latest-pkgs.txt"
[[ ${MINIMAL} == "yes" ]] && pkglist="latest-minimal-pkgs.txt"
chmod g+w "${src_dir}/${PKGLIST}"
scp -p "${src_dir}/${PKGLIST}" "${webshell}/${htdocs}/${pkglist}"
}
sync_latest_checksum_sha256(){
msg2 "Uploading sha256 checksum file ..."
local filename="${LATEST_ISO}.sha256"
local checksum_file="latest.sha256"
[[ ${MINIMAL} == "yes" ]] && checksum_file="latest-minimal.sha256"
chmod g+w "${src_dir}/${filename}"
scp -p "${src_dir}/${filename}" "${webshell}/${htdocs}/${checksum_file}"
}
sync_latest_checksum_sha1(){
msg2 "Uploading sha1 checksum file ..."
local filename="${LATEST_ISO}.sha1"
local checksum_file="latest.sha1"
[[ ${MINIMAL} == "yes" ]] && checksum_file="latest-minimal.sha1"
chmod g+w "${src_dir}/${filename}"
scp -p "${src_dir}/${filename}" "${webshell}/${htdocs}/${checksum_file}"
}
sync_latest_signature(){
msg2 "Uploading signature file ..."
local filename="${LATEST_ISO}.sig"
local signature="latest.sig"
[[ ${MINIMAL} == "yes" ]] && signature="latest-minimal.sig"
chmod g+w "${src_dir}/${filename}"
scp -p "${src_dir}/${filename}" "${webshell}/${htdocs}/${signature}"
}
sync_latest_torrent(){
msg2 "Uploading torrent file ..."
local filename="${LATEST_ISO}.torrent"
local torrent="latest.torrent"
[[ ${MINIMAL} == "yes" ]] && torrent="latest-minimal.torrent"
chmod g+w "${src_dir}/${filename}"
scp -p "${src_dir}/${filename}" "${webshell}/${htdocs}/${torrent}"
}
sync_latest_php(){
msg2 "Uploading php redirector ..."
local filename=".latest.php"
local php="latest.php"
[[ ${MINIMAL} == "yes" ]] && filename=".latest-minimal.php" && php="latest-minimal.php"
chmod g+w "${src_dir}/${filename}"
scp -p "${src_dir}/.${php}" "${webshell}/${htdocs}/${php}"
}
sync_latest_html(){
msg2 "Uploading url redirector ..."
local filename=".latest"
local html="latest"
[[ ${MINIMAL} == "yes" ]] && filename=".latest-minimal" && html="latest-minimal"
chmod g+w "${src_dir}/${filename}"
scp -p "${src_dir}/.${html}" "${webshell}/${htdocs}/${html}"
}
pull_hp_repo(){
load_vars "$USER_HOME/.makepkg.conf" || load_vars /etc/makepkg.conf
[[ -z $SRCDEST ]] && SRCDEST=${cache_dir}
hp_repo=manjaro-homepage
[[ ${edition} == "manjaro" ]] && _edition="official" || _edition=${edition}
dl_file="${SRCDEST}/${hp_repo}/site/content/downloads/${_edition}/${profile}.md"
cd "${SRCDEST}"
if [[ ! -d "${hp_repo}" ]]; then
msg "Cloning manjaro.org"
git clone "ssh://git@gitlab.manjaro.org:22277/webpage/${hp_repo}.git"
else
cd "${hp_repo}"
msg "Pulling manjaro.org"
git pull
fi
}
push_hp_repo(){
cd "${SRCDEST}/${hp_repo}"
msg "Updating manjaro.org"
git add ${dl_file}
git commit -m "update download ${profile}"
git push
}
upd_dl_checksum(){
local checksum=$(cat "${src_dir}/${LATEST_ISO}.sha1" | cut -d' ' -f1)
msg "Updating download page:"
msg2 "checksum > ${checksum}"
sed -i "/Download_x64_Checksum/c\Download_x64_Checksum = \"${checksum}\"" ${dl_file}
}
upd_dl_checksum_minimal(){
local checksum=$(cat "${src_dir}/${LATEST_ISO}.sha1" | cut -d' ' -f1)
msg "Updating download page:"
msg2 "checksum_minimal > ${checksum}"
sed -i "/Download_Minimal_x64_Checksum/c\Download_Minimal_x64_Checksum = \"${checksum}\"" ${dl_file}
}
upd_dl_version(){
timestamp=$(date -u +%Y-%m-%dT%T%Z)
msg2 "Version > ${dist_release}"
sed -i "/Version/c\Version = \"${dist_release}\"" ${dl_file}
msg2 "date > ${timestamp}"
sed -i "/^date/c\date = \"${timestamp}\"" ${dl_file}
prepare_transfer "$1"
msg "Start upload [%s] ..." "$1"
rsync ${rsync_args[*]} ${src_dir}/ ${url}/${target_dir}/
msg "Done upload [%s]" "$1"
show_elapsed_time "${FUNCNAME}" "${timer_start}"
}

View file

@ -10,20 +10,22 @@
# GNU General Public License for more details.
write_machineid_conf(){
local conf="${etc_config_dir}/machineid.conf"
local conf="${modules_dir}/machineid.conf" switch='false'
msg2 "Writing %s ..." "${conf##*/}"
echo '---' > "$conf"
echo "systemd: true" >> $conf
[[ ${initsys} == 'systemd' ]] && switch='true'
echo "systemd: ${switch}" >> $conf
echo "dbus: true" >> $conf
echo "symlink: true" >> $conf
}
write_finished_conf(){
msg2 "Writing %s ..." "finished.conf"
local conf="${etc_config_dir}/finished.conf" cmd="systemctl reboot"
local conf="${modules_dir}/finished.conf" cmd="loginctl reboot"
echo '---' > "$conf"
echo 'restartNowEnabled: true' >> "$conf"
echo 'restartNowChecked: false' >> "$conf"
[[ ${initsys} == 'systemd' ]] && cmd="systemctl reboot"
echo "restartNowCommand: \"${cmd}\"" >> "$conf"
}
@ -42,7 +44,7 @@ get_preset(){
}
write_bootloader_conf(){
local conf="${etc_config_dir}/bootloader.conf"
local conf="${modules_dir}/bootloader.conf"
msg2 "Writing %s ..." "${conf##*/}"
source "$(get_preset)"
echo '---' > "$conf"
@ -56,83 +58,55 @@ write_bootloader_conf(){
echo 'grubInstall: "grub-install"' >> "$conf"
echo 'grubMkconfig: "grub-mkconfig"' >> "$conf"
echo 'grubCfg: "/boot/grub/grub.cfg"' >> "$conf"
echo 'grubProbe: "grub-probe"' >> "$conf"
echo 'efiBootMgr: "efibootmgr"' >> "$conf"
echo '#efiBootloaderId: "dirname"' >> "$conf"
echo 'installEFIFallback: true' >> "$conf"
}
write_servicescfg_conf(){
local conf="${etc_config_dir}/servicescfg.conf"
local conf="${modules_dir}/servicescfg.conf"
msg2 "Writing %s ..." "${conf##*/}"
echo '---' > "$conf"
echo '' >> "$conf"
echo 'services:' >> "$conf"
echo ' enabled:' >> "$conf"
for s in ${enable_openrc[@]};do
echo " - name: $s" >> "$conf"
echo ' runlevel: default' >> "$conf"
done
if [[ -n ${disable_openrc[@]} ]];then
echo ' disabled:' >> "$conf"
for s in ${disable_openrc[@]};do
echo " - name: $s" >> "$conf"
echo ' runlevel: default' >> "$conf"
echo '' >> "$conf"
done
fi
}
write_services_conf(){
local conf="${etc_config_dir}/services.conf"
local check="${modules_dir}/services.conf"
local conf="${modules_dir}/services.conf"
msg2 "Writing %s ..." "${conf##*/}"
echo '---' > "$conf"
echo '' >> "$conf"
if [ ! ${#enable_systemd[@]} -eq 0 ]; then
if [ ! $(grep "services:" ${check} | wc -l) -eq 0 ]; then
echo 'services:' >> "$conf"
else
echo 'units:' >> "$conf"
fi
for s in ${enable_systemd[@]}; do
if [ ! $(grep "services:" ${check} | wc -l) -eq 0 ]; then
echo " - name: $s" >> "$conf"
else
echo " - name: $s.service" >> "$conf"
echo ' action: "enable"' >> "$conf"
fi
echo ' mandatory: false' >> "$conf"
echo '' >> "$conf"
done
fi
if [ ! ${#enable_systemd_timers[@]} -eq 0 ]; then
[ ! $(grep "timers:" ${check} | wc -l) -eq 0 ] && echo 'timers:' >> "$conf"
for s in ${enable_systemd_timers[@]}; do
if [ ! $(grep "timers:" ${check} | wc -l) -eq 0 ]; then
echo " - name: $s" >> "$conf"
else
echo " - name: $s.timer" >> "$conf"
echo ' action: "enable"' >> "$conf"
fi
echo ' mandatory: false' >> "$conf"
echo '' >> "$conf"
done
fi
[ ! $(grep "targets:" ${check} | wc -l) -eq 0 ] && echo 'targets:' >> "$conf"
if [ ! $(grep "targets:" ${check} | wc -l) -eq 0 ]; then
echo ' - name: "graphical"' >> "$conf"
else
echo ' - name: "graphical.target"' >> "$conf"
echo ' action: "set-default"' >> "$conf"
fi
echo 'services:' > "$conf"
for s in ${enable_systemd[@]};do
echo " - name: $s" >> "$conf"
echo ' mandatory: false' >> "$conf"
echo '' >> "$conf"
done
echo 'targets:' >> "$conf"
echo ' - name: "graphical"' >> "$conf"
echo ' mandatory: true' >> "$conf"
echo '' >> "$conf"
if [ ! ${#disable_systemd[@]} -eq 0 ]; then
[ ! $(grep "disable:" ${check} | wc -l) -eq 0 ] && echo 'disable:' >> "$conf"
for s in ${disable_systemd[@]}; do
if [ ! $(grep "services:" ${check} | wc -l) -eq 0 ]; then
echo " - name: $s" >> "$conf"
else
echo " - name: $s.service" >> "$conf"
echo ' action: "disable"' >> "$conf"
fi
echo ' mandatory: false' >> "$conf"
echo '' >> "$conf"
done
fi
echo 'disable:' >> "$conf"
for s in ${disable_systemd[@]};do
echo " - name: $s" >> "$conf"
echo ' mandatory: false' >> "$conf"
echo '' >> "$conf"
done
}
write_displaymanager_conf(){
local conf="${etc_config_dir}/displaymanager.conf"
local conf="${modules_dir}/displaymanager.conf"
msg2 "Writing %s ..." "${conf##*/}"
echo "---" > "$conf"
echo "displaymanagers:" >> "$conf"
@ -147,21 +121,21 @@ write_displaymanager_conf(){
}
write_initcpio_conf(){
local conf="${etc_config_dir}/initcpio.conf"
local conf="${modules_dir}/initcpio.conf"
msg2 "Writing %s ..." "${conf##*/}"
echo "---" > "$conf"
echo "kernel: ${kernel}" >> "$conf"
}
write_unpack_conf(){
local conf="${etc_config_dir}/unpackfs.conf"
local conf="${modules_dir}/unpackfs.conf"
msg2 "Writing %s ..." "${conf##*/}"
echo "---" > "$conf"
echo "unpack:" >> "$conf"
echo " - source: \"/run/miso/bootmnt/${iso_name}/${target_arch}/rootfs.sfs\"" >> "$conf"
echo " sourcefs: \"squashfs\"" >> "$conf"
echo " destination: \"\"" >> "$conf"
if [[ -f "${packages_desktop}" ]] ; then
if [[ -f "${desktop_list}" ]] ; then
echo " - source: \"/run/miso/bootmnt/${iso_name}/${target_arch}/desktopfs.sfs\"" >> "$conf"
echo " sourcefs: \"squashfs\"" >> "$conf"
echo " destination: \"\"" >> "$conf"
@ -169,65 +143,35 @@ write_unpack_conf(){
}
write_users_conf(){
local conf="${etc_config_dir}/users.conf"
local conf="${modules_dir}/users.conf"
msg2 "Writing %s ..." "${conf##*/}"
echo "---" > "$conf"
echo "defaultGroups:" >> "$conf"
local IFS=','
for g in ${addgroups[@]}; do
for g in ${addgroups[@]};do
echo " - $g" >> "$conf"
done
unset IFS
echo "autologinGroup: autologin" >> "$conf"
echo "doAutologin: false" >> "$conf" # can be either 'true' or 'false'
echo "sudoersGroup: wheel" >> "$conf"
echo "passwordRequirements:" >> "$conf"
echo " nonempty: true" >> "$conf" # can be either 'true' or 'false'
echo "setRootPassword: true" >> "$conf" # must be true, else some options get hidden
echo "doReusePassword: false" >> "$conf" # only used in old 'users' module
echo "availableShells: /bin/bash, /bin/zsh" >> "$conf" # only used in new 'users' module
echo "avatarFilePath: ~/.face" >> "$conf" # mostly used file-name for avatar
if [[ -n "$user_shell" ]]; then
echo "userShell: $user_shell" >> "$conf"
fi
}
write_partition_conf(){
local conf="${etc_config_dir}/partition.conf"
msg2 "Writing %s ..." "${conf##*/}"
echo "---" > "$conf"
echo "efiSystemPartition: \"/boot/efi\"" >> "$conf"
echo "userSwapChoices:" >> "$conf"
echo " - none # Create no swap, use no swap" >> "$conf"
echo " - small # Up to 4GB" >> "$conf"
echo " - suspend # At least main memory size" >> "$conf"
echo " - file # To swap file instead of partition" >> "$conf"
echo "alwaysShowPartitionLabels: true" >> "$conf"
echo "# There are four options: erase, replace, alongside, manual)," >> "$conf"
echo "# the default is \"none\"." >> "$conf"
echo "initialPartitioningChoice: erase" >> "$conf"
echo "initialSwapChoice: none" >> "$conf"
echo "defaultFileSystemType: \"ext4\"" >> "$conf"
echo "availableFileSystemTypes: [\"ext4\",\"btrfs\",\"f2fs\",\"xfs\"]" >> "$conf"
}
write_packages_conf(){
local conf="${etc_config_dir}/packages.conf"
local conf="${modules_dir}/packages.conf"
msg2 "Writing %s ..." "${conf##*/}"
echo "---" > "$conf"
echo "backend: pacman" >> "$conf"
echo '' >> "$conf"
if ${needs_internet}; then
echo "skip_if_no_internet: false" >> "$conf"
else
echo "skip_if_no_internet: true" >> "$conf"
fi
echo "update_db: true" >> "$conf"
echo "update_system: true" >> "$conf"
}
write_welcome_conf(){
local conf="${etc_config_dir}/welcome.conf"
local conf="${modules_dir}/welcome.conf"
msg2 "Writing %s ..." "${conf##*/}"
echo "---" > "$conf" >> "$conf"
echo "showSupportUrl: true" >> "$conf"
@ -248,19 +192,13 @@ write_welcome_conf(){
echo " - storage" >> "$conf"
echo " - ram" >> "$conf"
echo " - root" >> "$conf"
if ${needs_internet}; then
if ${netinstall};then
echo " - internet" >> "$conf"
fi
if ${geoip}; then
echo 'geoip:' >> "$conf"
echo ' style: "json"' >> "$conf"
echo ' url: "https://ipapi.co/json"' >> "$conf"
echo ' selector: "country"' >> "$conf"
fi
}
write_mhwdcfg_conf(){
local conf="${etc_config_dir}/mhwdcfg.conf"
local conf="${modules_dir}/mhwdcfg.conf"
msg2 "Writing %s ..." "${conf##*/}"
echo "---" > "$conf"
echo "bus:" >> "$conf"
@ -283,59 +221,62 @@ write_mhwdcfg_conf(){
${netinstall} && switch='false'
echo "local: ${switch}" >> "$conf"
echo '' >> "$conf"
echo 'repo: /opt/mhwd/pacman-mhwd.conf' >> "$conf"
echo 'repo: /opt/pacman-mhwd.conf' >> "$conf"
}
write_postcfg_conf(){
local conf="${etc_config_dir}/postcfg.conf"
local conf="${modules_dir}/postcfg.conf"
msg2 "Writing %s ..." "${conf##*/}"
echo "---" > "$conf"
echo "keyrings:" >> "$conf"
echo " - archlinux" >> "$conf"
echo " - manjaro" >> "$conf"
if [[ -n ${smb_workgroup} ]]; then
if [[ -n ${smb_workgroup} ]];then
echo "" >> "$conf"
echo "samba:" >> "$conf"
echo " - workgroup: ${smb_workgroup}" >> "$conf"
fi
}
write_umount_conf(){
local conf="${modules_dir}/umount.conf"
msg2 "Writing %s ..." "${conf##*/}"
echo "---" > "$conf"
echo 'srcLog: "/root/.cache/Calamares/Calamares/Calamares.log"' >> "$conf"
echo 'destLog: "/var/log/Calamares.log"' >> "$conf"
}
get_yaml(){
local args=() yaml
if ${chrootcfg}; then
if ${chrootcfg};then
args+=("${profile}/chrootcfg")
else
args+=("${profile}/packages")
fi
args+=("systemd")
for arg in ${args[@]}; do
args+=("${initsys}")
for arg in ${args[@]};do
yaml=${yaml:-}${yaml:+-}${arg}
done
echo "${yaml}.yaml"
}
write_netinstall_conf(){
local conf="${etc_config_dir}/netinstall.conf"
local conf="${modules_dir}/netinstall.conf"
msg2 "Writing %s ..." "${conf##*/}"
echo "---" > "$conf"
echo "groupsUrl: ${netgroups}/$(get_yaml)" >> "$conf"
echo "label:" >> "$conf"
echo " sidebar: \"${netinstall_label}\"" >> "$conf"
}
write_locale_conf(){
local conf="${etc_config_dir}/locale.conf"
local conf="${modules_dir}/locale.conf"
msg2 "Writing %s ..." "${conf##*/}"
echo "---" > "$conf"
echo "localeGenPath: /etc/locale.gen" >> "$conf"
if ${geoip}; then
echo 'geoip:' >> "$conf"
echo ' style: "json"' >> "$conf"
echo ' url: "https://ipapi.co/json"' >> "$conf"
echo ' selector: "timezone"' >> "$conf"
if ${geoip};then
echo "geoipUrl: freegeoip.net" >> "$conf"
else
echo "region: America" >> "$conf"
echo "zone: New_York" >> "$conf"
echo "region: Europe" >> "$conf"
echo "zone: London" >> "$conf"
fi
}
@ -348,35 +289,18 @@ write_settings_conf(){
echo "sequence:" >> "$conf"
echo " - show:" >> "$conf"
echo " - welcome" >> "$conf" && write_welcome_conf
if ${oem_used}; then
msg2 "Skipping to show locale and keyboard modules."
else
echo " - locale" >> "$conf" && write_locale_conf
echo " - keyboard" >> "$conf"
fi
echo " - partition" >> "$conf" && write_partition_conf
if ${oem_used}; then
msg2 "Skipping to show users module."
else
echo " - users" >> "$conf" && write_users_conf
fi
# WIP - OfficeChooser
if ${oem_used} || ! ${office_installer}; then
msg2 "Skipping enabling PackageChooser module."
else
msg2 "Enabling PackageChooser module."
echo " - packagechooser" >> "$conf"
fi
if ${netinstall}; then
echo " - locale" >> "$conf" && write_locale_conf
echo " - keyboard" >> "$conf"
echo " - partition" >> "$conf"
echo " - users" >> "$conf" && write_users_conf
if ${netinstall};then
echo " - netinstall" >> "$conf" && write_netinstall_conf
fi
echo " - summary" >> "$conf"
echo " - exec:" >> "$conf"
echo " - partition" >> "$conf"
echo " - mount" >> "$conf"
if ${netinstall}; then
if ${netinstall};then
if ${chrootcfg}; then
echo " - chrootcfg" >> "$conf"
echo " - networkcfg" >> "$conf"
@ -391,70 +315,39 @@ write_settings_conf(){
fi
echo " - machineid" >> "$conf" && write_machineid_conf
echo " - fstab" >> "$conf"
if ${oem_used}; then
msg2 "Skipping to set locale, keyboard and localecfg modules."
else
echo " - locale" >> "$conf"
echo " - keyboard" >> "$conf"
echo " - localecfg" >> "$conf"
fi
echo " - locale" >> "$conf"
echo " - keyboard" >> "$conf"
echo " - localecfg" >> "$conf"
echo " - luksopenswaphookcfg" >> "$conf"
echo " - luksbootkeyfile" >> "$conf"
echo " - initcpiocfg" >> "$conf"
echo " - initcpio" >> "$conf" && write_initcpio_conf
if ${oem_used}; then
msg2 "Skipping to set users module."
if ${set_oem_user}; then
msg2 "Setup OEM user."
echo " - oemuser" >> "$conf"
fi
else
echo " - users" >> "$conf"
fi
echo " - users" >> "$conf"
echo " - displaymanager" >> "$conf" && write_displaymanager_conf
if ${mhwd_used}; then
echo " - mhwdcfg" >> "$conf" && write_mhwdcfg_conf
else
msg2 "Skipping to set mhwdcfg module."
fi
echo " - mhwdcfg" >> "$conf" && write_mhwdcfg_conf
echo " - hwclock" >> "$conf"
echo " - services" >> "$conf" && write_services_conf
case ${initsys} in
'systemd') echo " - services" >> "$conf" && write_services_conf ;;
'openrc') echo " - servicescfg" >> "$conf" && write_servicescfg_conf ;;
esac
echo " - grubcfg" >> "$conf"
echo " - bootloader" >> "$conf" && write_bootloader_conf
if ${oem_used}; then
msg2 "Skipping to set postcfg module."
else
echo " - postcfg" >> "$conf" && write_postcfg_conf
fi
echo " - umount" >> "$conf"
echo " - postcfg" >> "$conf" && write_postcfg_conf
echo " - umount" >> "$conf" && write_umount_conf
echo " - show:" >> "$conf"
echo " - finished" >> "$conf" && write_finished_conf
echo '' >> "$conf"
echo "branding: ${iso_name}" >> "$conf"
echo '' >> "$conf"
if ${oem_used}; then
echo "prompt-install: false" >> "$conf"
else
echo "prompt-install: true" >> "$conf"
fi
echo "prompt-install: false" >> "$conf"
echo '' >> "$conf"
echo "dont-chroot: false" >> "$conf"
if ${oem_used}; then
echo "oem-setup: true" >> "$conf"
echo "disable-cancel: true" >> "$conf"
else
echo "oem-setup: false" >> "$conf"
echo "disable-cancel: false" >> "$conf"
fi
echo "disable-cancel-during-exec: true" >> "$conf"
echo "quit-at-end: false" >> "$conf"
}
configure_calamares(){
info "Configuring [Calamares]"
etc_config_dir=$1/etc/calamares/modules
modules_dir=$1/usr/share/calamares/modules
prepare_dir "${etc_config_dir}"
modules_dir=$1/etc/calamares/modules
prepare_dir "${modules_dir}"
write_settings_conf "$1"
info "Done configuring [Calamares]"
}
@ -497,7 +390,7 @@ write_netgroup_yaml(){
echo " hidden: false" >> "$2"
echo " critical: false" >> "$2"
echo " packages:" >> "$2"
for p in ${packages[@]}; do
for p in ${packages[@]};do
echo " - $p" >> "$2"
done
${validate} && check_yaml "$2"
@ -525,15 +418,15 @@ prepare_check(){
}
gen_fn(){
echo "${yaml_dir}/$1-${target_arch}-systemd.yaml"
echo "${yaml_dir}/$1-${target_arch}-${initsys}.yaml"
}
make_profile_yaml(){
prepare_check "$1"
load_pkgs "${profile_dir}/Packages-Root"
write_netgroup_yaml "$1" "$(gen_fn "Packages-Root")"
if [[ -f "${packages_desktop}" ]]; then
load_pkgs "${packages_desktop}"
if [[ -f "${desktop_list}" ]]; then
load_pkgs "${desktop_list}"
write_netgroup_yaml "$1" "$(gen_fn "Packages-Desktop")"
fi
${calamares} && write_calamares_yaml "$1"

View file

@ -110,20 +110,10 @@ eval_build_list(){
esac"
}
in_array() {
local needle=$1; shift
local item
for item in "$@"; do
[[ $item = $needle ]] && return 0 # Found
done
return 1 # Not Found
}
get_timer(){
echo $(date +%s)
}
# $1: start timer
elapsed_time(){
echo $(echo $1 $(get_timer) | awk '{ printf "%0.2f",($2-$1)/60 }')
@ -133,43 +123,6 @@ show_elapsed_time(){
info "Time %s: %s minutes" "$1" "$(elapsed_time $2)"
}
lock() {
eval "exec $1>"'"$2"'
if ! flock -n $1; then
stat_busy "$3"
flock $1
stat_done
fi
}
slock() {
eval "exec $1>"'"$2"'
if ! flock -sn $1; then
stat_busy "$3"
flock -s $1
stat_done
fi
}
check_root() {
(( EUID == 0 )) && return
if type -P sudo >/dev/null; then
exec sudo -- "$@"
else
exec su root -c "$(printf ' %q' "$@")"
fi
}
copy_mirrorlist(){
cp -a /etc/pacman.d/mirrorlist "$1/etc/pacman.d/"
}
copy_keyring(){
if [[ -d /etc/pacman.d/gnupg ]] && [[ ! -d $1/etc/pacman.d/gnupg ]]; then
cp -a /etc/pacman.d/gnupg "$1/etc/pacman.d/"
fi
}
load_vars() {
local var
@ -183,9 +136,7 @@ load_vars() {
}
prepare_dir(){
if [[ ! -d $1 ]]; then
mkdir -p $1
fi
[[ ! -d $1 ]] && mkdir -p $1
}
# $1: chroot
@ -196,10 +147,8 @@ get_branch(){
# $1: chroot
# $2: branch
set_branch(){
if [[ $1 =~ "rootfs" ]]; then
info "Setting mirrorlist branch: %s" "$2"
sed -e "s|/stable|/$2|g" -i "$1/etc/pacman.d/mirrorlist"
fi
info "Setting mirrorlist branch: %s" "$2"
sed -e "s|/stable|/$2|g" -i "$1/etc/pacman.d/mirrorlist"
}
init_common(){
@ -211,11 +160,11 @@ init_common(){
[[ -z ${chroots_dir} ]] && chroots_dir='/var/lib/manjaro-tools'
[[ -z ${log_dir} ]] && log_dir='/var/log/manjaro-tools'
[[ -z ${build_mirror} ]] && build_mirror='http://mirror.netzspielplatz.de/manjaro/packages'
[[ -z ${build_mirror} ]] && build_mirror='https://mirror.easyname.at/manjaro'
log_dir='/var/log/manjaro-tools'
[[ -z ${tmp_dir} ]] && tmp_dir='/tmp/manjaro-tools'
tmp_dir='/tmp'
}
init_buildtree(){
@ -223,7 +172,7 @@ init_buildtree(){
tree_dir_abs=${tree_dir}/packages-archlinux
[[ -z ${repo_tree[@]} ]] && repo_tree=('core' 'extra' 'community' 'multilib')
[[ -z ${repo_tree[@]} ]] && repo_tree=('core' 'extra' 'community' 'multilib' 'openrc')
[[ -z ${host_tree} ]] && host_tree='https://github.com/manjaro'
@ -237,7 +186,7 @@ init_buildpkg(){
make_conf_dir="${SYSCONFDIR}/make.conf.d"
[[ -d ${USERCONFDIR}/pkg.list.d ]] && list_dir_pkg=${USERCONFDIR}/pkg.list.d
[[ -d ${MT_USERCONFDIR}/pkg.list.d ]] && list_dir_pkg=${MT_USERCONFDIR}/pkg.list.d
[[ -z ${build_list_pkg} ]] && build_list_pkg='default'
@ -246,10 +195,10 @@ init_buildpkg(){
get_iso_label(){
local label="$1"
#label="${label//_}" # relace all _
label="${label//_}" # relace all _
label="${label//-}" # relace all -
label="${label^^}" # all uppercase
label="${label::32}" # limit to 32 characters
label="${label^^}" # all uppercase
label="${label::8}" # limit to 8 characters
echo ${label}
}
@ -293,7 +242,7 @@ init_buildiso(){
list_dir_iso="${SYSCONFDIR}/iso.list.d"
[[ -d ${USERCONFDIR}/iso.list.d ]] && list_dir_iso=${USERCONFDIR}/iso.list.d
[[ -d ${MT_USERCONFDIR}/iso.list.d ]] && list_dir_iso=${MT_USERCONFDIR}/iso.list.d
[[ -z ${build_list_iso} ]] && build_list_iso='default'
@ -305,68 +254,41 @@ init_buildiso(){
[[ -z ${dist_release} ]] && dist_release=$(get_release)
[[ -z ${dist_codename} ]] && dist_codename=$(get_codename)
dist_codename=$(get_codename)
dist_name=$(get_distname)
iso_name=$(get_osid)
[[ -z ${dist_branding} ]] && dist_branding="MANJARO"
[[ -z ${dist_branding} ]] && dist_branding="MJRO"
[[ -z ${iso_compression} ]] && iso_compression='zstd'
iso_label=$(get_iso_label "${dist_branding}${dist_release//.}")
[[ -z ${kernel} ]] && kernel="linux54"
load_run_dir "${profile_repo}"
if [[ -d ${run_dir}/.git ]]; then
current_path=$(pwd)
cd ${run_dir}
branch=$(git rev-parse --abbrev-ref HEAD)
cd ${current_path}
else
[[ -z ${branch} ]] && branch="v18.0" #current branch release
fi
[[ -z ${initsys} ]] && initsys="systemd"
[[ -z ${kernel} ]] && kernel="linux49"
[[ -z ${gpgkey} ]] && gpgkey=''
mhwd_repo="/opt/mhwd/pkg"
mhwd_repo="/opt/pkg"
}
init_calamares(){
[[ -z ${welcomestyle} ]] && welcomestyle=false
[[ -z ${welcomelogo} ]] && welcomelogo=true
[[ -z ${windowexp} ]] && windowexp=noexpand
[[ -z ${windowsize} ]] && windowsize="800px,560px"
[[ -z ${windowplacement} ]] && windowplacement="center"
[[ -z ${sidebarbackground} ]] && sidebarbackground=#454948
[[ -z ${sidebartext} ]] && sidebartext=#efefef
[[ -z ${sidebartextselect} ]] && sidebartextselect=#4d915e
[[ -z ${sidebartexthighlight} ]] && sidebartexthighlight=#1a1c1b
}
init_deployiso(){
host="osdn.net"
host="sourceforge.net"
[[ -z ${project} ]] && project="[SetProject]"
[[ -z ${account} ]] && account="[SetUser]"
[[ -z ${alt_storage} ]] && alt_storage=false
[[ -z ${limit} ]] && limit=100
[[ -z ${tracker_url} ]] && tracker_url='udp://tracker.opentrackr.org:1337'
[[ -z ${tracker_url} ]] && tracker_url='udp://mirror.strits.dk:6969'
[[ -z ${piece_size} ]] && piece_size=21
[[ -z ${iso_mirrors[@]} ]] && iso_mirrors=('heanet' 'jaist' 'netcologne' 'iweb' 'kent')
torrent_meta="$(get_distid)"
}
@ -386,8 +308,6 @@ load_config(){
init_buildiso
init_calamares
init_deployiso
return 0
@ -406,10 +326,7 @@ load_profile_config(){
[[ -z ${autologin} ]] && autologin="true"
[[ ${displaymanager} == 'none' ]] && autologin="false"
[[ -z ${snap_channel} ]] && snap_channel="stable"
[[ -z ${multilib} ]] && multilib="true"
[[ ${no_multilib} == 'true' ]] && multilib="false"
[[ -z ${nonfree_mhwd} ]] && nonfree_mhwd="true"
@ -421,52 +338,55 @@ load_profile_config(){
[[ -z ${password} ]] && password="manjaro"
[[ -z ${user_shell} ]] && user_shell='/bin/bash'
[[ -z ${login_shell} ]] && login_shell='/bin/bash'
if [[ -z ${addgroups} ]]; then
addgroups="lp,network,power,sys,wheel"
if [[ -z ${addgroups} ]];then
addgroups="video,power,storage,optical,network,lp,scanner,wheel,sys"
fi
if [[ -z ${enable_systemd[@]} ]]; then
enable_systemd=('avahi-daemon' 'bluetooth' 'cronie' 'ModemManager' 'NetworkManager' 'org.cups.cupsd' 'tlp' 'tlp-sleep' 'ufw')
if [[ -z ${enable_systemd[@]} ]];then
enable_systemd=('bluetooth' 'cronie' 'ModemManager' 'NetworkManager' 'org.cups.cupsd' 'tlp' 'tlp-sleep')
fi
[[ -z ${disable_systemd[@]} ]] && disable_systemd=('pacman-init')
if [[ -z ${enable_systemd_live[@]} ]]; then
if [[ -z ${enable_openrc[@]} ]];then
enable_openrc=('acpid' 'bluetooth' 'elogind' 'cronie' 'cupsd' 'dbus' 'syslog-ng' 'NetworkManager')
fi
[[ -z ${disable_openrc[@]} ]] && disable_openrc=()
if [[ -z ${enable_systemd_live[@]} ]];then
enable_systemd_live=('manjaro-live' 'mhwd-live' 'pacman-init' 'mirrors-live')
fi
if [[ -z ${enable_openrc_live[@]} ]];then
enable_openrc_live=('manjaro-live' 'mhwd-live' 'pacman-init' 'mirrors-live')
fi
if [[ ${displaymanager} != "none" ]]; then
enable_openrc+=('xdm')
enable_systemd+=("${displaymanager}")
fi
[[ -z ${needs_internet} ]] && needs_internet='false'
[[ -z ${netinstall} ]] && netinstall='false'
[[ -z ${netinstall_label} ]] && netinstall_label='Package selection'
[[ -z ${mhwd_used} ]] && mhwd_used='true'
[[ -z ${oem_used} ]] && oem_used='false'
[[ -z ${set_oem_user} ]] && set_oem_user='true'
[[ -z ${chrootcfg} ]] && chrootcfg='false'
netgroups="https://gitlab.manjaro.org/applications/calamares-netgroups/-/raw/master/"
netgroups="https://raw.githubusercontent.com/manjaro/calamares-netgroups/master"
[[ -z ${geoip} ]] && geoip='true'
[[ -z ${smb_workgroup} ]] && smb_workgroup=''
[[ -z ${extra} ]] && extra='false'
[[ ${full_iso} ]] && extra='true'
if ${full_iso}; then
extra='true'
fi
basic='true'
[[ ${extra} == 'true' ]] && basic='false'
[[ -z ${extra} ]] && extra='false'
[[ -z ${office_installer} ]] && office_installer="false"
${extra} && basic='false'
return 0
}
@ -478,23 +398,8 @@ get_edition(){
echo ${path##*/}
}
get_project(){
case "${edition}" in
'manjaro')
project="manjaro"
;;
'community')
project="manjaro-community"
;;
esac
echo "${project}"
}
reset_profile(){
unset displaymanager
unset strict_snaps
unset classic_snaps
unset snap_channel
unset autologin
unset multilib
unset nonfree_mhwd
@ -505,19 +410,17 @@ reset_profile(){
unset addgroups
unset enable_systemd
unset disable_systemd
unset enable_openrc
unset disable_openrc
unset enable_systemd_live
unset disable_systemd_live
unset packages_desktop
unset packages_mhwd
unset user_shell
unset enable_openrc_live
unset desktop_list
unset mhwd_list
unset login_shell
unset netinstall
unset chrootcfg
unset geoip
unset extra
unset full_iso
unset office_installer
unset no_multilib
}
check_profile(){
@ -529,7 +432,7 @@ check_profile(){
local has_keyfiles=false has_keydirs=false
for f in ${keyfiles[@]}; do
if [[ -f $f ]]; then
if [[ -f $f ]];then
has_keyfiles=true
else
has_keyfiles=false
@ -537,20 +440,20 @@ check_profile(){
fi
done
for d in ${keydirs[@]}; do
if [[ -d $d ]]; then
if [[ -d $d ]];then
has_keydirs=true
else
has_keydirs=false
break
fi
done
if ! ${has_keyfiles} && ! ${has_keydirs}; then
if ! ${has_keyfiles} && ! ${has_keydirs};then
die "Profile [%s] sanity check failed!" "$1"
fi
[[ -f "$1/Packages-Desktop" ]] && packages_desktop=$1/Packages-Desktop
[[ -f "$1/Packages-Desktop" ]] && desktop_list=$1/Packages-Desktop
[[ -f "$1/Packages-Mhwd" ]] && packages_mhwd=$1/Packages-Mhwd
[[ -f "$1/Packages-Mhwd" ]] && mhwd_list=$1/Packages-Mhwd
if ! ${netinstall}; then
chrootcfg="false"
@ -561,15 +464,27 @@ check_profile(){
load_pkgs(){
info "Loading Packages: [%s] ..." "${1##*/}"
local _init _init_rm
case "${initsys}" in
'openrc')
_init="s|>openrc||g"
_init_rm="s|>systemd.*||g"
;;
*)
_init="s|>systemd||g"
_init_rm="s|>openrc.*||g"
;;
esac
local _multi _nonfree_default _nonfree_multi _arch _arch_rm _nonfree_i686 _nonfree_x86_64 _basic _basic_rm _extra _extra_rm
if ${basic}; then
if ${basic};then
_basic="s|>basic||g"
else
_basic_rm="s|>basic.*||g"
fi
if ${extra}; then
if ${extra};then
_extra="s|>extra||g"
else
_extra_rm="s|>extra.*||g"
@ -582,7 +497,7 @@ load_pkgs(){
_multi="s|>multilib.*||g"
_nonfree_multi="s|>nonfree_multilib.*||g"
_nonfree_x86_64="s|>nonfree_x86_64.*||g"
if ${nonfree_mhwd}; then
if ${nonfree_mhwd};then
_nonfree_default="s|>nonfree_default||g"
_nonfree_i686="s|>nonfree_i686||g"
@ -595,9 +510,9 @@ load_pkgs(){
_arch="s|>x86_64||g"
_arch_rm="s|>i686.*||g"
_nonfree_i686="s|>nonfree_i686.*||g"
if ${multilib}; then
if ${multilib};then
_multi="s|>multilib||g"
if ${nonfree_mhwd}; then
if ${nonfree_mhwd};then
_nonfree_default="s|>nonfree_default||g"
_nonfree_x86_64="s|>nonfree_x86_64||g"
_nonfree_multi="s|>nonfree_multilib||g"
@ -608,7 +523,7 @@ load_pkgs(){
fi
else
_multi="s|>multilib.*||g"
if ${nonfree_mhwd}; then
if ${nonfree_mhwd};then
_nonfree_default="s|>nonfree_default||g"
_nonfree_x86_64="s|>nonfree_x86_64||g"
_nonfree_multi="s|>nonfree_multilib.*||g"
@ -621,7 +536,6 @@ load_pkgs(){
;;
esac
# We can reuse this code
local _edition _edition_rm
case "${edition}" in
'sonar')
@ -634,13 +548,6 @@ load_pkgs(){
;;
esac
local _office _office_rm
if ${office_installer}; then
_office="s|>office||g"
else
_office_rm="s|>office.*||g"
fi
local _blacklist="s|>blacklist.*||g" \
_kernel="s|KERNEL|$kernel|g" \
_used_kernel=${kernel:5:2} \
@ -650,10 +557,12 @@ load_pkgs(){
_purge="s|>cleanup.*||g" \
_purge_rm="s|>cleanup||g"
packages=$(sed "$_com_rm" "$1" \
packages=($(sed "$_com_rm" "$1" \
| sed "$_space" \
| sed "$_blacklist" \
| sed "$_purge" \
| sed "$_init" \
| sed "$_init_rm" \
| sed "$_arch" \
| sed "$_arch_rm" \
| sed "$_nonfree_default" \
@ -668,20 +577,18 @@ load_pkgs(){
| sed "$_basic_rm" \
| sed "$_extra" \
| sed "$_extra_rm" \
| sed "$_office" \
| sed "$_office_rm" \
| sed "$_clean")
| sed "$_clean"))
if [[ $1 == "${packages_mhwd}" ]]; then
if [[ $1 == "${mhwd_list}" ]]; then
[[ ${_used_kernel} < "42" ]] && local _amd="s|xf86-video-amdgpu||g"
packages_cleanup=$(sed "$_com_rm" "$1" \
packages_cleanup=($(sed "$_com_rm" "$1" \
| grep cleanup \
| sed "$_purge_rm" \
| sed "$_kernel" \
| sed "$_clean" \
| sed "$_amd")
| sed "$_amd"))
fi
}
@ -704,7 +611,7 @@ write_repo_conf(){
for r in ${repos[@]}; do
path=${r%/repo_info}
name=${path##*/}
echo "run_dir=$path" > ${USERCONFDIR}/$name.conf
echo "run_dir=$path" > ${MT_USERCONFDIR}/$name.conf
done
}
@ -717,13 +624,14 @@ load_user_info(){
USER_HOME=$HOME
fi
USERCONFDIR="$USER_HOME/.config/manjaro-tools"
prepare_dir "${USERCONFDIR}"
MT_USERCONFDIR="${XDG_CONFIG_HOME:-$USER_HOME/.config}/manjaro-tools"
PAC_USERCONFDIR="${XDG_CONFIG_HOME:-$USER_HOME/.config}/pacman"
prepare_dir "${MT_USERCONFDIR}"
}
load_run_dir(){
[[ -f ${USERCONFDIR}/$1.conf ]] || write_repo_conf
[[ -r ${USERCONFDIR}/$1.conf ]] && source ${USERCONFDIR}/$1.conf
[[ -f ${MT_USERCONFDIR}/$1.conf ]] || write_repo_conf
[[ -r ${MT_USERCONFDIR}/$1.conf ]] && source ${MT_USERCONFDIR}/$1.conf
return 0
}
@ -733,74 +641,16 @@ show_version(){
}
show_config(){
if [[ -f ${USERCONFDIR}/manjaro-tools.conf ]]; then
if [[ -f ${MT_USERCONFDIR}/manjaro-tools.conf ]]; then
msg2 "config: %s" "~/.config/manjaro-tools/manjaro-tools.conf"
else
msg2 "config: %s" "${manjaro_tools_conf}"
fi
}
# $1: chroot
kill_chroot_process(){
# enable to have more debug info
#msg "machine-id (etc): $(cat $1/etc/machine-id)"
#[[ -e $1/var/lib/dbus/machine-id ]] && msg "machine-id (lib): $(cat $1/var/lib/dbus/machine-id)"
#msg "running processes: "
#lsof | grep $1
local prefix="$1" flink pid name
for root_dir in /proc/*/root; do
flink=$(readlink $root_dir)
if [ "x$flink" != "x" ]; then
if [ "x${flink:0:${#prefix}}" = "x$prefix" ]; then
# this process is in the chroot...
pid=$(basename $(dirname "$root_dir"))
name=$(ps -p $pid -o comm=)
info "Killing chroot process: %s (%s)" "$name" "$pid"
kill -9 "$pid"
fi
fi
done
}
create_min_fs(){
msg "Creating install root at %s" "$1"
mkdir -m 0755 -p $1/var/{cache/pacman/pkg,lib/pacman,log} $1/{dev,run,etc}
mkdir -m 1777 -p $1/tmp
mkdir -m 0555 -p $1/{sys,proc}
}
is_valid_arch_pkg(){
eval "case $1 in
$(show_build_profiles "${make_conf_dir}")) return 0 ;;
*) return 1 ;;
esac"
}
is_valid_arch_iso(){
case $1 in
'i686'|'x86_64') return 0 ;;
*) return 1 ;;
esac
}
is_valid_branch(){
case $1 in
'stable'|'stable-staging'|'testing'|'unstable') return 0 ;;
*) return 1 ;;
esac
}
is_valid_comp(){
case $1 in
'gzip'|'lzma'|'lz4'|'lzo'|'xz'|'zstd') return 0 ;;
*) return 1 ;;
esac
}
run(){
if ${is_build_list}; then
for item in ${build_list[@]}; do
if ${is_build_list};then
for item in ${build_list[@]};do
$1 $item
done
else
@ -808,50 +658,11 @@ run(){
fi
}
is_btrfs() {
[[ -e "$1" && "$(stat -f -c %T "$1")" == btrfs ]]
}
subvolume_delete_recursive() {
local subvol
is_btrfs "$1" || return 0
while IFS= read -d $'\0' -r subvol; do
if ! btrfs subvolume delete "$subvol" &>/dev/null; then
error "Unable to delete subvolume %s" "$subvol"
return 1
fi
done < <(find "$1" -xdev -depth -inum 256 -print0)
return 0
}
create_chksums() {
msg2 "creating checksums for [$1]"
sha1sum $1 > $1.sha1
sha256sum $1 > $1.sha256
}
init_profiles() {
_workdir='/usr/share/manjaro-tools'
if [[ -d ${_workdir}/iso-profiles ]]; then
rm -Rf ${_workdir}/iso-profiles
fi
git clone -q --depth 1 -b ${branch} https://gitlab.manjaro.org/profiles-and-settings/iso-profiles.git ${_workdir}/iso-profiles/
#Check if git clone is done
if [[ -d ${_workdir}/iso-profiles/manjaro ]] && [[ -d ${_workdir}/iso-profiles/community ]]; then
for i in ${_workdir}/iso-profiles/.gitignore ${_workdir}/iso-profiles/README.md; do
rm -f $i
done
for i in ${_workdir}/iso-profiles/.git ${_workdir}/iso-profiles/sonar; do
rm -Rf $i
done
else msg2 "Impossible to initialize iso-profiles, please check internet connection or browse at 'https://gitlab.manjaro.org/profiles-and-settings/iso-profiles'"
exit 1
check_root() {
(( EUID == 0 )) && return
if type -P sudo >/dev/null; then
exec sudo -- "${orig_argv[@]}"
else
exec su root -c "$(printf ' %q' "${orig_argv[@]}")"
fi
}