Compare commits

..

21 commits

Author SHA1 Message Date
Philip
a0986ae472 [util-iso-image] fix thus.conf port for v0.13 2016-12-15 21:07:26 +01:00
udeved
83de201055 util-iso-image: configure thus for sonar 2016-12-05 20:18:29 +01:00
Philip
53b3ce5dc1 [util-yaml] lower value 'requiredStorage' to 7.9 GiB
- this might satisfy Windows-Klicki-Bunti users
- however we should create a more dynamic approach and calculate the real need of space
2016-11-23 19:44:31 +01:00
Philip
bdf55196c3 [util-yaml] higher 'requiredStorage' to 8.0 GiB
- see also: https://bugs.manjaro.org/index.php?do=details&task_id=95
- we might need a more dynamic approach and also think about NetInstall
2016-11-22 08:05:33 +01:00
udeved
26cca31fb1 Merge branch 'master' of github.com:manjaro/manjaro-tools into stable-0.13.x 2016-09-30 23:17:08 +02:00
udeved
2a3c20e3a9 Merge branch 'master' of github.com:manjaro/manjaro-tools into stable-0.13.x 2016-09-30 15:30:46 +02:00
udeved
ef9d9e34fa Merge branch 'master' of github.com:manjaro/manjaro-tools into stable-0.13.x 2016-09-28 15:42:11 +02:00
udeved
f2d646b371 Merge branch 'master' of github.com:manjaro/manjaro-tools into stable-0.13.x 2016-09-18 15:54:28 +02:00
udeved
b4389f1c06 start 0.13.7 2016-09-18 15:54:10 +02:00
Philip
0c40ad7d35 bump 2016-09-10 22:07:07 +02:00
Philip
0d61fc0869 Merge branch 'master' into stable-0.13.x 2016-09-10 22:06:49 +02:00
Philip
9b478fdc2e bump 2016-08-28 13:35:54 +02:00
Philip
c61f1ac9ba Merge branch 'master' into stable-0.13.x 2016-08-28 13:35:40 +02:00
Philip
c99ffacc8e bump 2016-08-21 10:00:10 +02:00
Philip
0990d44bf4 Merge branch 'master' into stable-0.13.x 2016-08-21 09:59:46 +02:00
Philip
c5c8c5e5ff bump 2016-08-18 21:53:53 +02:00
Philip
31970d78a2 Merge branch 'master' into stable-0.13.x 2016-08-18 21:53:29 +02:00
Philip
360da72fc6 bump 2016-08-06 09:34:02 +02:00
Philip
3a37521eed Merge branch 'master' into stable-0.13.x 2016-08-06 09:29:04 +02:00
Philip
4d6b18c660 v0.13.1 2016-08-03 07:21:20 +02:00
Bernhard Landauer
0f7ba32e56 [util-iso-image] qt vars: add deepin, avoid double entry 2016-08-01 22:27:37 +02:00
78 changed files with 2643 additions and 3502 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.13.8
PREFIX = /usr/local
SYSCONFDIR = /etc
SYSCONF = \
data/manjaro-tools.conf \
data/branding.desc.d
data/manjaro-tools.conf
BIN_BASE = \
bin/mkchroot \
@ -13,8 +12,7 @@ BIN_BASE = \
bin/manjaro-chroot \
bin/fstabgen \
bin/signfile \
bin/chroot-run \
bin/check-yaml
bin/chroot-run
LIBS_BASE = \
lib/util.sh \
@ -28,10 +26,15 @@ SHARED_BASE = \
data/pacman-mirrors.conf
LIST_PKG = \
$(wildcard data/pkg.list.d/*.list)
data/pkg.list.d/default.list
ARCH_CONF = \
$(wildcard data/make.conf.d/*.conf)
data/make.conf.d/i686.conf \
data/make.conf.d/x86_64.conf \
data/make.conf.d/multilib.conf
# data/make.conf.d/aarch64.conf \
# data/make.conf.d/armv6h.conf \
# data/make.conf.d/armv7h.conf
BIN_PKG = \
bin/checkpkg \
@ -44,37 +47,51 @@ BIN_PKG = \
bin/buildtree
LIBS_PKG = \
$(wildcard lib/util-pkg*.sh)
lib/util-pkg.sh \
lib/util-pkgtree.sh
SHARED_PKG = \
data/makepkg.conf
data/makepkg.conf \
data/base-devel-udev
LIST_ISO = \
$(wildcard data/iso.list.d/*.list)
data/iso.list.d/default.list \
data/iso.list.d/official.list \
data/iso.list.d/community.list \
data/iso.list.d/minimal.list \
data/iso.list.d/sonar.list
BIN_ISO = \
bin/buildiso \
bin/testiso \
bin/deployiso \
bin/signiso
bin/deployiso
LIBS_ISO = \
$(wildcard lib/util-iso*.sh) \
lib/util-iso.sh \
lib/util-iso-aufs.sh \
lib/util-iso-overlayfs.sh \
lib/util-iso-image.sh \
lib/util-iso-boot.sh \
lib/util-publish.sh
SHARED_ISO = \
data/pacman-mhwd.conf \
data/mkinitcpio.conf \
data/profile.conf.example
CPIOHOOKS = \
$(wildcard initcpio/hooks/*)
initcpio/hooks/miso \
initcpio/hooks/miso_overlayfs \
initcpio/hooks/miso_loop_mnt \
initcpio/hooks/miso_pxe_common \
initcpio/hooks/miso_pxe_http
CPIOINST = \
$(wildcard initcpio/install/*)
CPIO = \
initcpio/script/miso_shutdown
initcpio/inst/miso \
initcpio/inst/miso_overlayfs \
initcpio/inst/miso_loop_mnt \
initcpio/inst/miso_pxe_common \
initcpio/inst/miso_pxe_http \
initcpio/inst/miso_kms
MAN_XML = \
buildpkg.xml \
@ -161,14 +178,11 @@ install_iso:
install -dm0755 $(DESTDIR)$(PREFIX)/lib/manjaro-tools
install -m0644 ${LIBS_ISO} $(DESTDIR)$(PREFIX)/lib/manjaro-tools
install -dm0755 $(DESTDIR)$(SYSCONFDIR)/initcpio/hooks
install -m0755 ${CPIOHOOKS} $(DESTDIR)$(SYSCONFDIR)/initcpio/hooks
install -dm0755 $(DESTDIR)$(SYSCONFDIR)/initcpio/install
install -m0755 ${CPIOINST} $(DESTDIR)$(SYSCONFDIR)/initcpio/install
install -m0755 ${CPIO} $(DESTDIR)$(SYSCONFDIR)/initcpio
install -dm0755 $(DESTDIR)$(PREFIX)/lib/initcpio/hooks
install -m0755 ${CPIOHOOKS} $(DESTDIR)$(PREFIX)/lib/initcpio/hooks
install -dm0755 $(DESTDIR)$(PREFIX)/lib/initcpio/install
install -m0755 ${CPIOINST} $(DESTDIR)$(PREFIX)/lib/initcpio/install
install -dm0755 $(DESTDIR)$(PREFIX)/share/manjaro-tools
install -m0644 ${SHARED_ISO} $(DESTDIR)$(PREFIX)/share/manjaro-tools
@ -216,9 +230,8 @@ uninstall_iso:
for f in ${SHARED_ISO}; do rm -f $(DESTDIR)$(PREFIX)/share/manjaro-tools/$$f; done
for f in ${LIBS_ISO}; do rm -f $(DESTDIR)$(PREFIX)/lib/manjaro-tools/$$f; done
for f in ${CPIOHOOKS}; do rm -f $(DESTDIR)$(SYSCONFDIR)/initcpio/hooks/$$f; done
for f in ${CPIOINST}; do rm -f $(DESTDIR)$(SYSCONFDIR)/initcpio/install/$$f; done
for f in ${CPIO}; do rm -f $(DESTDIR)$(SYSCONFDIR)/initcpio/$$f; done
for f in ${CPIOHOOKS}; do rm -f $(DESTDIR)$(PREFIX)/lib/initcpio/hooks/$$f; done
for f in ${CPIOINST}; do rm -f $(DESTDIR)$(PREFIX)/lib/initcpio/install/$$f; done
rm -f $(DESTDIR)$(PREFIX)/share/man/man1/buildiso.1.gz
rm -f $(DESTDIR)$(PREFIX)/share/man/man1/deployiso.1.gz
rm -f $(DESTDIR)$(PREFIX)/share/man/man5/manjaro-tools.conf.5.gz

257
README.md
View file

@ -1,11 +1,11 @@
manjaro-tools
=============
Manjaro-tools-0.15
Manjaro-tools-0.13
User manual
### 1. manjaro-tools.conf
###1. manjaro-tools.conf
manjaro-tools.conf is the central configuration file for manjaro-tools.
By default, the config is installed in
@ -56,7 +56,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
@ -69,12 +69,12 @@ overriding
# 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,106 +88,84 @@ overriding
################ buildiso ################
#default branch for iso-profiles repo: v17.1>current release | master>development release
# branch=v17.1
# the name of the profiles directory
# profile_repo='manjaro-tools-iso-profiles'
# default iso build list; name without .list extension
# build_list_iso=default
# the dist name; default: Manjaro
# dist_name="Manjaro"
# the dist release; default: auto
# dist_release=auto
# dist_release=16.10
# the codename; defaults to value sourced from /etc/lsb-release
# dist_codename="Fringilla"
# the branding; default: auto
# dist_branding="MANJARO"
# dist_branding="MJRO"
# iso publisher
# iso_publisher="Manjaro Linux <http://www.manjaro.org>"
# iso app id
# iso_app_id="Manjaro Linux Live/Rescue CD"
# compression used, possible values xz (default, best compression), gzip, lzma, lzo, lz4
# lz4 is faster but worst compression, may be useful for locally testing isos
# iso_compression=xz
# valid: md5, sha1, sha256, sha384, sha512
# iso_checksum=md5
# possible values: openrc,systemd
# initsys="systemd"
# unset defaults to given value
# kernel="linux54"
# kernel="linux44"
# 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
# experimental; use overlayfs instead of aufs
# requires minimum 4.0 kernel on the build host and on iso in profile.conf
# use_overlayfs="false"
################ 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=
# the torrent tracker urls, comma separated
# tracker_url='udp://mirror.strits.dk:6969'
# Piece size, 2^n
# piece_size=21
# limit=100
~~~
### 2. buildpkg
###2. buildpkg
buildpkg is the chroot build script of manjaro-tools.
It it run in a abs/pkgbuilds directory which contains directories with PKGBUILD.
###### manjaro-tools.conf supports the makepkg.conf variables
######manjaro-tools.conf supports the makepkg.conf variables
#### Arguments
####Arguments
~~~
$ buildpkg -h
Usage: buildpkg [options]
-p <pkg> Buildset 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 <pkg> Install a package into the working copy of the chroot
-c Recreate chroot
-w Clean up cache and sources
-n Install and run namcap check
-s Sign packages
-u udev base-devel group (no systemd)
-q Query settings and pretend build
-h This help
~~~
###### * build sysvinit package for both arches and branch testing:
######* build sysvinit package for both arches and branch testing:
* i686(buildsystem is x86_64)
@ -204,66 +182,60 @@ buildpkg -p sysvinit -b testing -cswn
You can drop the branch arg if you set the branch in manjaro-tools.conf
The arch can also be set in manjaro-tools.conf, but under normal conditions, it is better to specify the non native arch by -a parameter.
###### * -c
######* -c
* 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
###### * -s
* Signs the package when built
###### * -w
######* -w
* Cleans pkgcache, and logfiles
### 3. buildiso
######* -s
* Signs the package when built
######* -n
* Installs the built package in the chroot and runs a namcap check
######* -u
* Create udev build root (for eudev builds)
###3. buildiso
buildiso is used to build manjaro-iso-profiles. It is run insde the profiles folder.
##### Packages for livecd only:
#####Packages for livecd only:
* manjaro-livecd-cli-installer
* manjaro-livecd-openrc
* manjaro-livecd-systemd
#### Arguments
####Arguments
~~~
$ 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: linux44]
-i <name> Init system to use
[default: systemd]
-s Sign the iso
-c Disable clean work dir
-x Build images only
-z Generate iso only
Requires pre built images (-x)
-w Create iso torrent
-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.
######* build xfce iso profile for both arches and branch testing on x86_64 build system
* i686 (buildsystem is x86_64)
@ -279,16 +251,16 @@ buildiso -p xfce -b testing
The branch can be defined also in manjaro-tools.conf, but a manual parameter will always override conf settings.
#### Special parameters
####Special parameters
###### * -x
######* -x
* Build images only
* will stop after all packages have been installed. No iso sqfs compression will be executed
###### * -z
######* -z
* Use this to sqfs compress the chroots if you previously used -x.
### 4. check-yaml
###4. check-yaml
check-yaml can be used to write profile package lists to yaml.
It is also possible to generate calamares conf file as buildiso would do.
@ -297,16 +269,17 @@ 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
######* build xfce iso profile for both arches and branch testing on x86_64 build system
* i686 (buildsystem is x86_64)
@ -326,50 +299,50 @@ check-yaml -p xfce -c
check-yaml -p kdebase -gv
~~~
#### Special parameters
####Special parameters
###### * -c
######* -c
* generate calamares module and settings conf files per profile
###### * -g
######* -g
* generate a netgroup for specified pacman group
### 5. buildtree
###5. buildtree
buildtree is a little tools to sync arch abs and manjaro PKGBUILD git repos.
#### Arguments
####Arguments
~~~
$ 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
######* sync arch and manjaro trees
~~~
buildtree -as
~~~
### 6. manjaro-chroot
###6. manjaro-chroot
manjaro-chroot is a little tool to quickly chroot into a second system installed on the host.
If the automount option is enabled, manjaro-chroot will detect installed systems with os-prober, and pops up a list with linux systems to select from.
If there is only 1 system installed besides the host system, no list will pop up and it will automatically mount the second system.
#### Arguments
####Arguments
~~~
$ 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.
@ -377,51 +350,47 @@ usage: manjaro-chroot -a [or] manjaro-chroot chroot-dir [command]
and /build/manjaro-tools/manjaro-chroot.
~~~
###### * automount
######* automount
~~~
manjaro-chroot -a
~~~
###### * mount manually
######* mount manually
~~~
manjaro-chroot /mnt /bin/bash
~~~
### 7. deployiso
###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.
#### Arguments
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
-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
######* 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

@ -55,11 +55,11 @@ 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 ;;
@ -99,11 +99,11 @@ fi
# kill chroot process if needed (TODO: check if needed at all)
kill_chroot_process "$newroot"
if ${copykeyring}; then
if ${copykeyring};then
copy_keyring "$newroot"
fi
if ${copymirrorlist}; then
if ${copymirrorlist};then
copy_mirrorlist "$newroot"
fi

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

@ -16,47 +16,51 @@ DATADIR='@datadir@'
SYSCONFDIR='@sysconfdir@'
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
import ${LIBDIR}/util.sh
show_profile(){
prepare_profile "$1"
msg2 "iso_file: %s" "${iso_file}"
msg2 "iso_label: %s" "${iso_label}"
if ${verbose}; then
msg2 "pacman_conf: %s" "${pacman_conf}"
if ${verbose};then
msg2 "work_dir: %s" "${work_dir}"
msg2 "iso_dir: %s" "${iso_dir}"
msg2 "iso_file: %s" "${iso_file}"
msg2 "autologin: %s" "${autologin}"
msg2 "nonfree_mhwd: %s" "${nonfree_mhwd}"
msg2 "pxe_boot: %s" "${pxe_boot}"
msg2 "plymouth_boot: %s" "${plymouth_boot}"
${plymouth_boot} && msg2 "plymouth_theme: %s" "${plymouth_theme}"
[[ ${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
if ${torrent};then
msg2 "tracker_url: %s" "${tracker_url}"
msg2 "piece_size: %s" "${piece_size}"
fi
fi
reset_profile
}
@ -66,33 +70,40 @@ display_settings(){
show_config
msg "PROFILE:"
msg2 "gitlab branch: %s" "${branch}"
msg2 "list_dir_iso: %s" "${list_dir_iso}"
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}"
msg2 "build_mirror: %s" "${build_mirror}/${target_branch}"
${verbose} && msg2 "run_dir: %s" "${run_dir}"
msg "OPTIONS:"
msg2 "arch: %s" "${target_arch}"
msg2 "branch: %s" "${target_branch}"
msg2 "chroots_iso: %s" "${chroots_iso}"
msg2 "initsys: %s" "${initsys}"
msg2 "kernel: %s" "${kernel}"
[[ -n ${gpgkey} ]] && msg2 "gpgkey: %s" "${gpgkey}"
msg "ARGS:"
msg2 "clean_first: %s" "${clean_first}"
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}"
msg2 "sign: %s" "${sign}"
msg2 "torrent: %s" "${torrent}"
msg "DIST SETTINGS:"
msg2 "dist_name: %s" "${dist_name}"
msg2 "dist_release: %s" "${dist_release}"
msg2 "dist_codename: %s" "${dist_codename}"
msg "ISO INFO:"
msg "ISO SETTINGS:"
msg2 "iso_label: %s" "${iso_label}"
msg2 "iso_publisher: %s" "${iso_publisher}"
msg2 "iso_app_id: %s" "${iso_app_id}"
msg2 "iso_compression: %s" "${iso_compression}"
msg2 "iso_checksum: %s" "${iso_checksum}"
msg2 "use_overlayfs: %s" "${use_overlayfs}"
${verbose} && msg2 "iso_fs: %s" "${iso_fs}"
msg "BUILD QUEUE:"
run show_profile "${build_list_iso}"
@ -112,37 +123,30 @@ pretend=false
images_only=false
iso_only=false
verbose=false
persist=false
initialize=false
permalink=false
sign=false
torrent=false
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 ' -s Sign the iso'
echo ' -c Disable clean work dir'
echo ' -x Build images only'
echo ' -z Generate iso only'
echo ' Requires pre built images (-x)'
echo ' -w Create iso torrent'
echo ' -v Verbose output to log file, show profile detail (-q)'
echo ' -q Query settings and pretend build'
echo ' -h This help'
echo ''
echo ''
@ -151,29 +155,24 @@ usage() {
orig_argv=("$@")
opts='p:a:b:r:t:k:g:d:cfzxmnvqhilo'
opts='p:a:b:r:t:k:i:czxswvqh'
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" ;;
s) sign=true ;;
c) clean_first=false ;;
x) images_only=true ;;
z) iso_only=true ;;
l) permalink=true ;;
o) office_installer=true ;;
w) torrent=true ;;
v) verbose=true ;;
q) pretend=true ;;
h|?) usage 0 ;;
*) echo "invalid argument '${arg}'"; usage 1 ;;
esac
@ -181,27 +180,17 @@ 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_requirements

View file

@ -21,7 +21,6 @@ SYSCONFDIR='@sysconfdir@'
import ${LIBDIR}/util.sh
import ${LIBDIR}/util-pkg.sh
import ${LIBDIR}/util-pkg-chroot.sh
show_pkg(){
check_build "$1"
@ -38,9 +37,13 @@ display_settings(){
show_config
msg "PROFILE:"
msg2 "list_dir_pkg: %s" "${list_dir_pkg}"
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}"
msg2 "build_mirror: %s" "${build_mirror}/${target_branch}"
# msg2 "make_conf_dir: %s" "${make_conf_dir}"
# msg2 "build_profiles: %s" "$(show_build_profiles ${make_conf_dir})"
msg "OPTIONS:"
msg2 "arch: %s" "${target_arch}"
@ -53,11 +56,13 @@ display_settings(){
msg2 "wipe_clean: %s" "${wipe_clean}"
msg2 "namcap: %s" "${namcap}"
msg2 "sign: %s" "${sign}"
msg2 "udev_root: %s" "${udev_root}"
msg "PATHS:"
msg2 "work_dir: %s" "${work_dir}"
msg2 "pkg_dir: %s" "${pkg_dir}"
if ${clean_first}; then
if ${clean_first};then
msg "PKG:"
msg2 "base_packages: %s" "${base_packages[*]}"
fi
@ -71,28 +76,32 @@ 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
install_pkgs=()
clean_first=false
wipe_clean=false
namcap=false
pretend=false
is_build_list=false
sign=false
udev_root=false
is_multilib=false
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 <pkg> Install a package into the working copy of the chroot'
echo ' -c Recreate chroot'
echo ' -w Clean up cache and sources'
echo ' -n Install and run namcap check'
echo ' -s Sign packages'
echo ' -u Udev base-devel group (no systemd)'
echo ' -q Query settings and pretend build'
echo ' -h This help'
echo ''
echo ''
exit $1
@ -104,16 +113,17 @@ opts='p:a:b:r:i:cwnsuqh'
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" ;;
s) sign=true ;;
i) install_pkgs+="$OPTARG"; mkchrootpkg_args+=(-I ${install_pkgs[*]}) ;;
c) clean_first=true ;;
w) wipe_clean=true ;;
n) namcap=true; mkchrootpkg_args+=(-n) ;;
s) sign=true ;;
u) udev_root=true ;;
q) pretend=true ;;
h|?) usage 0 ;;
*) echo "invalid argument '${arg}'"; usage 1 ;;
esac
@ -125,8 +135,6 @@ check_root "$0" "${orig_argv[@]}"
prepare_dir "${log_dir}"
user_own "${log_dir}"
prepare_dir "${tmp_dir}"
prepare_conf "${target_arch}"

View file

@ -23,7 +23,7 @@ display_settings(){
show_config
msg "ARGS:"
# msg2 "sync: %s" "${sync}"
msg2 "sync: %s" "${sync}"
msg2 "abs: %s" "${abs}"
msg2 "clean: %s" "${clean}"
@ -38,14 +38,14 @@ load_user_info
load_config "${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'
@ -57,14 +57,14 @@ usage() {
orig_argv=("$@")
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
@ -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

@ -26,11 +26,12 @@ show_profile(){
msg2 "nonfree_mhwd: %s" "${nonfree_mhwd}"
msg2 "autologin: %s" "${autologin}"
msg2 "nonfree_mhwd: %s" "${nonfree_mhwd}"
msg2 "pxe_boot: %s" "${pxe_boot}"
msg2 "plymouth_boot: %s" "${plymouth_boot}"
${plymouth_boot} && msg2 "plymouth_theme: %s" "${plymouth_theme}"
[[ ${target_arch} == 'x86_64' ]] && msg2 "multilib: %s" "${multilib}"
msg2 "extra: %s" "${extra}"
msg2 "netinstall: %s" "${netinstall}"
msg2 "chrootcfg: %s" "${chrootcfg}"
${netinstall} && msg2 "netgroups: %s" "$(get_yaml)"
@ -44,9 +45,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
@ -57,12 +64,14 @@ display_settings(){
show_config
msg "PROFILE:"
msg2 "list_dir_iso: %s" "${list_dir_iso}"
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:"
@ -91,14 +100,15 @@ 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
@ -110,13 +120,14 @@ 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

View file

@ -81,7 +81,7 @@ 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
if [[ -n ${build_mirror} ]];then
build_mirror=${build_mirror}'/$repo/$arch'
if ${keep_mirrors}; then
set_branch "$1" "$(get_branch $1)"
@ -103,7 +103,7 @@ chroot_extra_umount() {
chroot_mount "$cache_dir" "$1${cache_dir}" -Br
done
if [[ -n ${mountargs_ro[@]} ]]; then
if [[ -n ${mountargs_ro[@]} ]];then
local IFS=','
for m in ${mountargs_ro[@]}; do
chroot_mount "${m%%:*}" "$1${m##*:}" -Br
@ -111,7 +111,7 @@ chroot_extra_umount() {
unset IFS
fi
if [[ -n ${mountargs_rw[@]} ]]; then
if [[ -n ${mountargs_rw[@]} ]];then
local IFS=','
for m in ${mountargs_rw[@]}; do
chroot_mount "${m%%:*}" "$1${m##*:}" -B

View file

@ -20,11 +20,11 @@ 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(){
@ -32,33 +32,24 @@ display_settings(){
show_config
msg "PROFILE:"
msg2 "list_dir_iso: %s" "${list_dir_iso}"
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 "release: %s" "${release}"
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
msg2 "tracker_url: %s" "${tracker_url}"
msg2 "piece_size: %s" "${piece_size}"
msg2 "torrent_meta: %s" "${torrent_meta}"
fi
msg2 "rsync_args: %s" "${rsync_args[*]}"
msg "REMOTE:"
msg2 "account: %s" "${account}"
msg2 "host: %s" "${host}"
msg2 "alt_storage: %s" "${alt_storage}"
msg2 "ssh_agent: %s" "${ssh_agent}"
msg "UPLOAD QUEUE:"
run show_profile "${build_list_iso}"
@ -70,52 +61,38 @@ load_config "${USERCONFDIR}/manjaro-tools.conf" || load_config "${SYSCONFDIR}/ma
run_dir=${cache_dir_iso}
hidden=false
pretend=false
torrent=false
release=false
update=false
verbose=false
sign=false
alt_storage=false
shell_upload=false
upd_homepage=false
exists=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 ' -c Create new remote release directory'
echo ' -u Update remote directory'
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:cuvqh'
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" ;;
c) release=true ;;
u) update=true; rsync_args+=(-u) ;;
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 +104,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

@ -15,7 +15,22 @@ LIBDIR='@libdir@'
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
import ${LIBDIR}/util-pkg.sh
# $1: sofile
# $2: soarch
process_sofile() {
# extract the library name: libfoo.so
local soname="${1%.so?(+(.+([0-9])))}".so
# extract the major version: 1
soversion="${1##*\.so\.}"
if [[ "$soversion" = "$1" ]] && (($IGNORE_INTERNAL)); then
continue
fi
if ! in_array "${soname}=${soversion}-$2" ${soobjects[@]}; then
# libfoo.so=1-64
msg "${soname}=${soversion}-$2"
soobjects+=("${soname}=${soversion}-$2")
fi
}
set -e
shopt -s extglob

View file

@ -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 ''
@ -71,7 +71,7 @@ shift $(( OPTIND - 1 ))
check_root "$0" "${orig_argv[@]}"
if ${automount}; then
if ${automount};then
chrootdir=/mnt
run_args=/bin/bash
@ -87,7 +87,7 @@ else
${pretend} && display_settings && exit 1
chroot_api_efi_mount "${chrootdir}" || die "failed to setup API filesystems in chroot %s" "${chrootdir}"
chroot_api_mount "${chrootdir}" || die "failed to setup API filesystems in chroot %s" "${chrootdir}"
chroot_mount /etc/resolv.conf "${chrootdir}/etc/resolv.conf" --bind
fi

View file

@ -81,7 +81,7 @@ umask 0022
lock 9 "${working_dir}.lock" "Locking chroot"
if is_btrfs "$working_dir"; then
if [[ $(stat -f -c %T "$working_dir") == btrfs ]]; then
rmdir "$working_dir"
if ! btrfs subvolume create "$working_dir"; then
die "Couldn't create subvolume for '%s'" "$working_dir"
@ -92,8 +92,7 @@ fi
# 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
@ -108,19 +107,18 @@ 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})
exec chroot-run \
${chroot_args[*]} \
"$working_dir" locale-gen

View file

@ -128,9 +128,11 @@ create_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"
if [[ "$chroottype" == btrfs ]] && ! mountpoint -q "$copydir"; then
if [[ -d $copydir ]]; then
btrfs subvolume delete "$copydir" >/dev/null ||
die "Unable to delete subvolume %s" "$copydir"
fi
btrfs subvolume snapshot "$chrootdir/root" "$copydir" >/dev/null ||
die "Unable to create subvolume %s" "$copydir"
else
@ -149,7 +151,7 @@ create_chroot() {
clean_temporary() {
stat_busy "Removing temporary copy [$copy]"
if is_btrfs "$chrootdir" && ! mountpoint -q "$copydir"; then
if [[ "$chroottype" == btrfs ]] && ! mountpoint -q "$copydir"; then
btrfs subvolume delete "$copydir" >/dev/null ||
die "Unable to delete subvolume %s" "$copydir"
else
@ -191,10 +193,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}
@ -212,6 +213,7 @@ prepare_chroot() {
done
cat > "$copydir/etc/sudoers.d/builduser-pacman" <<EOF
Defaults env_keep += "HOME"
builduser ALL = NOPASSWD: /usr/bin/pacman
EOF
chmod 440 "$copydir/etc/sudoers.d/builduser-pacman"
@ -236,18 +238,10 @@ EOF
# These functions aren't run in makechrootpkg,
# so no global variables
_chrootbuild() {
export LC_ALL=en_US.UTF-8
. /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
export HOME=/build
cd /startdir
sudo -u builduser makepkg "$@"
}
_chrootnamcap() {
@ -260,7 +254,7 @@ _chrootnamcap() {
download_sources() {
local builddir="$(mktemp -d)"
chown $SUDO_USER: "$builddir"
chmod 1777 "$builddir"
# Ensure sources are downloaded
if [[ -n $SUDO_USER ]]; then
@ -281,12 +275,6 @@ move_products() {
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
for l in "$copydir"/logdest/*; do

View file

@ -26,5 +26,4 @@ if [ ! -e "$1" ]; then
fi
msg2 "Signing [%s] with key %s" "${1##*/}" "${GPGKEY}..."
[[ -e "$1".sig ]] && rm "$1".sig
gpg --detach-sign --use-agent -u "${GPGKEY}" "$1"

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-systemd
fakeroot
file
findutils
flex
gawk
gcc
gettext
grep
groff
gzip
libtool
m4
make
pacman
patch
pkg-config
sed
sudo
texinfo
util-linux
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,14 @@
awesome
bspwm
bspwm-mate
budgie
cinnamon
deepin
fluxbox
gnome
i3
jwm
lumina
lxde
lxqt
mate
openbox
webdad
netbook
pantheon

View file

@ -1 +1 @@
xfce
xfce-minimal

View file

@ -0,0 +1,7 @@
budgie-minimal
cinnamon-minimal
deepin-minimal
gnome-minimal
kde-minimal
lxqt-minimal
xfce-minimal

View file

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

View file

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

View file

@ -0,0 +1,3 @@
carch="aarch64"
chost="aarch64-unknown-linux-gnu"
cflags="-march=armv8-a -O2 -pipe -fstack-protector --param=ssp-buffer-size=4"

View file

@ -0,0 +1,3 @@
carch="armv6h"
chost="armv6l-unknown-linux-gnueabihf"
cflags="-march=armv6 -mfloat-abi=hard -mfpu=vfp -O2 -pipe -fstack-protector --param=ssp-buffer-size=4"

View file

@ -0,0 +1,3 @@
carch="armv7h"
chost="armv7l-unknown-linux-gnueabihf"
cflags="-march=armv7-a -mfloat-abi=hard -mfpu=vfpv3-d16 -O2 -pipe -fstack-protector --param=ssp-buffer-size=4"

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
@ -18,12 +18,12 @@
# 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 +37,52 @@
################ buildiso ################
# default branch for iso-profiles repo: v18.1 Juhraya master>development release
# branch=v18.1
# the name of the profiles directory
# profile_repo='manjaro-tools-iso-profiles'
# default iso build list; name without .list extension
# build_list_iso=default
# the dist name; default: Manjaro
# dist_name="Manjaro"
# the dist release; default: auto
# dist_release=18.1
# dist_release=16.06
# the dist codename; default: auto
# dist_codename=Juhraya
# the OS branding; default: auto
# dist_name
# the codename; defaults to value sourced from /etc/lsb-release
# dist_codename="Daniella"
# the branding; default: auto
# dist_branding="MJRO"
# compression used, possible values gzip, lzma, lz4, lzo, xy, zstd (default)
# iso_compression=zstd
# iso publisher
# iso_publisher="Manjaro Linux <http://www.manjaro.org>"
# iso app id
# iso_app_id="Manjaro Linux Live/Rescue CD"
# compression used, possible values xz (default, best compression), gzip, lzma, lzo, lz4
# lz4 is faster but worst compression, may be useful for locally testing isos
# iso_compression=xz
# valid: md5, sha1, sha256, sha384, sha512
# iso_checksum=md5
# possible values: openrc,systemd
# initsys="systemd"
# unset defaults to given value
# kernel="linux54"
# kernel="linux44"
# 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
# experimental; use overlayfs instead of aufs
# requires minimum 4.0 kernel on the build host and on iso in profile.conf
# use_overlayfs="false"
################ 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://tracker.opentrackr.org:1337'
# Piece size, 2^n
# piece_size=21

View file

@ -1,3 +0,0 @@
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)
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

@ -5,11 +5,16 @@
# use multilib packages; x86_64 only
# multilib="true"
# use extra packages as defined in pkglist to activate a full profile
# extra="false"
# use pxe
# pxe_boot="true"
# use office installer module
# office_installer="false"
################ torrent ################
# the torrent tracker urls, comma separated
# tracker_url='udp://mirror.strits.dk:6969'
# Piece size, 2^n
# piece_size=21
################ install ################
@ -17,51 +22,49 @@
# 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"
# nonfree xorg drivers
# nonfree_mhwd="true"
# use plymouth
# plymouth_boot="true"
# 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"
# the default url for the netinstall.yaml
# netgroups="https://raw.githubusercontent.com/manjaro/manjaro-tools-iso-profiles/master/shared/netinst"
# configure calamares to use chrootcfg instead of unpackfs; default: unpackfs
# chrootcfg="false"
# use geoip
# geoip="true"
# 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')
# unset defaults to given value
# plymouth_theme=manjaro-elegant
# unset defaults to given values
# addgroups="lp,network,power,sys, wheel"
# names must match systemd service names
# 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="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 +81,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

@ -61,7 +61,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
<para>With buildiso you can build ISOs suitable to be booted from a removable media
like a DVD o a USB Stick, it will automatically create the necessary files to
install this ISO using calamares.</para>
install this ISO using calamares or the cli installer.</para>
</refsect1>
@ -75,7 +75,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
<term><option>-p PROFILE...</option></term>
<listitem><para>Name of the build list or name of the directory
you will build. It needs to contain an existing build list or a
you will build. It needs to cantains a existing build list or a
folder with a valid profile.</para></listitem>
</varlistentry>
@ -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,11 +104,30 @@ 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>-s</option></term>
<listitem><para>Sign the iso.</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>-x</option></term>
@ -162,6 +139,30 @@ 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>-w</option></term>
<listitem><para>Create a torrent from iso file.</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

@ -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

@ -59,7 +59,8 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
<para><command>deployiso</command> is used to upload a particular ISO or a set of ISOs. </para>
<para>deployiso is a script to upload a specific iso or a buiildset to SF.</para>
<para>deployiso is a script to upload a specific iso or a buiildset to SF.
It needs to be run inside the iso-profiles directory.</para>
</refsect1>
@ -69,25 +70,6 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
<para>The following options are understood:</para>
<variablelist>
<varlistentry>
<term><option>-d</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>
</varlistentry>
<varlistentry>
<term><option>-l</option></term>
<listitem><para>Limit bandwidth in kB/s.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-p PROFILE...</option></term>
@ -96,21 +78,15 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
</varlistentry>
<varlistentry>
<term><option>-q</option></term>
<term><option>-c</option></term>
<listitem><para>Query settings and pretend upload.</para></listitem>
<listitem><para>Create new remote release.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-s</option></term>
<term><option>-l</option></term>
<listitem><para>Sign ISO and create checksums before uploading.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-t</option></term>
<listitem><para>Create a torrent from iso file.</para></listitem>
<listitem><para>Limit bandwidth in kB/s.</para></listitem>
</varlistentry>
<varlistentry>
@ -124,6 +100,18 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
<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

@ -119,6 +119,13 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
</para></listitem>
</varlistentry>
<!--<varlistentry>
<term><varname>host=</varname></term>
<listitem><para>Default url to be used for upload.
</para></listitem>
</varlistentry>-->
</variablelist>
</refsect1>
@ -132,7 +139,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>
@ -186,9 +193,27 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
</varlistentry>
<varlistentry>
<!-- TODO: We should tell where exactly this is used -->
<term><varname>dist_name=</varname></term>
<listitem><para>Name of the distribution.
</para></listitem>
</varlistentry>
<varlistentry>
<!-- TODO: We should tell where exactly this is used -->
<term><varname>dist_release=</varname></term>
<listitem><para>Release version of the distribution.
<listitem><para>Release of the distribution.
</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>dist_codename=</varname></term>
<listitem><para>Codename of this release. It's the value
of DISTRIB_CODENAME in /etc/lsb-release.
</para></listitem>
</varlistentry>
@ -201,11 +226,50 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
</varlistentry>
<varlistentry>
<term><varname>gpgkey=</varname></term>
<!-- TODO: We should tell where exactly this is used -->
<term><varname>iso_publisher=</varname></term>
<listitem><para>If the gpgkey is supplied, the sfs images on iso will be signed.
If the key is left empty or commented, signing will be skipped.
</para></listitem>
<listitem><para>Publisher of the iso.
</para></listitem>
</varlistentry>
<varlistentry>
<!-- TODO: We should tell where exactly this is used -->
<term><varname>iso_app_id=</varname></term>
<listitem><para>Application ID of the iso.
</para></listitem>
</varlistentry>
<varlistentry>
<!-- TODO: Need list of other available compressions -->
<term><varname>iso_compression=</varname></term>
<listitem><para>Defaults compression that will be used
when creating the various images. Defaults to xz.
</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>iso_checksum=</varname></term>
<listitem><para>Checksum that will be created against the
final .iso file. Can be <option>md5</option> (the default),
<option>sha1</option>, <option>sha256</option>,
<option>sha384</option> or <option>sha512</option>.
</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>
@ -225,6 +289,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,32 +297,6 @@ 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.
</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>limit=</varname></term>
@ -265,20 +304,6 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>tracker_url=</varname></term>
<listitem><para>Default tracker announce for the torrent.
The tracker url can also contain comma separated urls.
</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>piece_size=</varname></term>
<listitem><para>Default priece size for the torrent in 2^n.
</para></listitem>
</varlistentry>
</variablelist>
</refsect1>

View file

@ -109,21 +109,10 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
</varlistentry>
<varlistentry>
<term><varname>extra=</varname></term>
<term><varname>netgroups=</varname></term>
<listitem><para>Accepts
<option>false</option> (the default)
<option>false</option>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>multilib=</varname></term>
<listitem><para>Accepts
<option>true</option> (the default)
<option>false</option>.</para>
</listitem>
<listitem><para>Default url for the netinstall.yaml.
</para></listitem>
</varlistentry>
<varlistentry>
@ -143,6 +132,15 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>plymouth_theme=</varname></term>
<listitem><para>Takes the name of the plymouth
theme. It should be the directory of a valid
plymouth theme installed in /usr/share/plymouth/themes/
</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>enable_systemd=</varname></term>
@ -152,6 +150,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 +207,29 @@ 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>
<varlistentry>
<term><varname>tracker_url=</varname></term>
<listitem><para>Default tracker announce for the torrent.
The tracker url can also contain comma separated urls.
</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>piece_size=</varname></term>
<listitem><para>Default priece size for the torrent in 2^n.
</para></listitem>
</varlistentry>
</variablelist>
</refsect1>

View file

@ -1,287 +1,265 @@
# args: source, newroot, mountpoint
_mnt_dmsnapshot() {
local img="${1}"
local mnt="${2}"
local img_fullname="${img##*/}";
local img_name="${img_fullname%%.*}"
local dm_snap_name="${dm_snap_prefix}_${img_name}"
local ro_dev ro_dev_size rw_dev
# kernel_cmdline <param> <default>
# Looks for a parameter on the kernel's boot-time command line.
#
# returns: 0 if param was found. Also prints its value if it was a K=V param.
# 1 if it was not. Also prints value passed as <default>
#
ro_dev=$(losetup --find --show --read-only "${img}")
echo ${ro_dev} >> /run/miso/used_block_devices
ro_dev_size=$(blockdev --getsz ${ro_dev})
if [[ "${cow_persistent}" == "P" ]]; then
if [[ -f "/run/miso/cowspace/${cow_directory}/${img_name}.cow" ]]; then
msg ":: Found '/run/miso/cowspace/${cow_directory}/${img_name}.cow', using as persistent."
else
msg ":: Creating '/run/miso/cowspace/${cow_directory}/${img_name}.cow' as persistent."
truncate -s "${cow_spacesize}" "/run/miso/cowspace/${cow_directory}/${img_name}.cow"
fi
else
if [[ -f "/run/miso/cowspace/${cow_directory}/${img_name}.cow" ]]; then
msg ":: Found '/run/miso/cowspace/${cow_directory}/${img_name}.cow' but non-persistent requested, removing."
rm -f "/run/miso/cowspace/${cow_directory}/${img_name}.cow"
fi
msg ":: Creating '/run/miso/cowspace/${cow_directory}/${img_name}.cow' as non-persistent."
truncate -s "${cow_spacesize}" "/run/miso/cowspace/${cow_directory}/${img_name}.cow"
fi
rw_dev=$(losetup --find --show "/run/miso/cowspace/${cow_directory}/${img_name}.cow")
echo ${rw_dev} >> /run/miso/used_block_devices
dmsetup create ${dm_snap_name} --table "0 ${ro_dev_size} snapshot ${ro_dev} ${rw_dev} ${cow_persistent} ${cow_chunksize}"
_mnt_dev "/dev/mapper/${dm_snap_name}" "${mnt}" "-w" "defaults"
echo $(readlink -f /dev/mapper/${dm_snap_name}) >> /run/miso/used_block_devices
}
# args: source, newroot, mountpoint
_mnt_overlayfs() {
local src="${1}"
local newroot="${2}"
local mnt="${3}"
local work_dir="/run/miso/overlay_root/work"
local upper_dir="/run/miso/overlay_root/upper"
mkdir -p "${upper_dir}" "${work_dir}"
mount -t overlay overlay -o lowerdir="${src}",upperdir="${upper_dir}",workdir="${work_dir}" "${newroot}${mnt}"
}
# args: /path/to/image_file, mountpoint
_mnt_sfs() {
local img="${1}"
local mnt="${2}"
local img_fullname="${img##*/}"
local sfs_dev
local oper=$( [[ -n "${ip}" && -n "${miso_http_srv}" ]] && echo "mv" || echo "cp" )
if [[ "${copytoram}" == "y" ]]; then
msg -n ":: Copying squashfs image to RAM..."
if ! "${oper}" "${img}" "/run/miso/copytoram/${img_fullname}" ; then
echo "ERROR: while copy '${img}' to '/run/miso/copytoram/${img_fullname}'"
launch_interactive_shell
fi
img="/run/miso/copytoram/${img_fullname}"
msg "done."
fi
sfs_dev=$(losetup --find --show --read-only "${img}")
echo ${sfs_dev} >> /run/miso/used_block_devices
_mnt_dev "${sfs_dev}" "${mnt}" "-r" "defaults"
}
# args: device, mountpoint, flags, opts
_mnt_dev() {
local dev="${1}"
local mnt="${2}"
local flg="${3}"
local opts="${4}"
mkdir -p "${mnt}"
msg ":: Mounting '${dev}' to '${mnt}'"
while ! poll_device "${dev}" 30; do
echo "ERROR: '${dev}' device did not show up after 30 seconds..."
echo " Falling back to interactive prompt"
echo " You can try to fix the problem manually, log out when you are finished"
launch_interactive_shell
done
if mount -o "${opts}" "${flg}" "${dev}" "${mnt}"; then
msg ":: Device '${dev}' mounted successfully."
else
echo "ERROR; Failed to mount '${dev}'"
echo " Falling back to interactive prompt"
echo " You can try to fix the problem manually, log out when you are finished"
launch_interactive_shell
fi
}
_verify_checksum() {
local _status
cd "/run/miso/bootmnt/${misobasedir}/${arch}"
md5sum -c $1.md5 > /tmp/checksum.log 2>&1
_status=$?
cd "${OLDPWD}"
return ${_status}
}
_verify_signature() {
local _status
cd "/run/miso/bootmnt/${misobasedir}/${arch}"
gpg --homedir /gpg --status-fd 1 --verify $1.sfs.sig 2>/dev/null | grep -qE '^\[GNUPG:\] GOODSIG'
_status=$?
cd "${OLDPWD}"
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
kernel_cmdline ()
{
for param in $(/bin/cat /proc/cmdline); do
case "${param}" in
$1=*) echo "${param##*=}"; return 0 ;;
$1) return 0 ;;
*) continue ;;
esac
done
[ -n "${2}" ] && echo "${2}"
return 1
}
run_hook() {
[[ -z "${arch}" ]] && arch="$(uname -m)"
[[ -z "${copytoram_size}" ]] && copytoram_size="75%"
[[ -z "${misobasedir}" ]] && misobasedir="manjaro"
# 1$ : kernel argument to check
overlay_arg_available() {
for arg in $(echo "$(kernel_cmdline overlay)" | /bin/sed 's/,/ /g')
do
[ "${arg}" == "$1" ] && return 0
done
[[ -z "${dm_snap_prefix}" ]] && dm_snap_prefix="manjaro"
misodevice=$(_find_dev_by_path /.miso)
[[ -z "${misodevice}" ]] && misodevice="/dev/disk/by-label/${misolabel}"
[[ -z "${cow_spacesize}" ]] && cow_spacesize="256M"
[[ -z "${overlay_root_size}" ]] && overlay_root_size="75%"
return 1
}
if [[ -n "${cow_label}" ]]; then
cow_device="/dev/disk/by-label/${cow_label}"
[[ -z "${cow_persistent}" ]] && cow_persistent="P"
elif [[ -n "${cow_device}" ]]; then
[[ -z "${cow_persistent}" ]] && cow_persistent="P"
else
cow_persistent="N"
# args: source, mountpoint
_mnt_aufs() {
local src="${1}"
local mnt="${2}"
msg "::: Adding new aufs branch: ${src} to ${mnt}"
mkdir -p "${mnt}"
/bin/mount -t aufs -o remount,append:"${src}"=ro none "${mnt}"
}
# args: source, mountpoint
_mnt_bind() {
local src="${1}"
local mnt="${2}"
msg "::: Binding ${src} to ${mnt}"
mkdir -p "${mnt}"
/bin/mount -o bind "${src}" "${mnt}"
}
# args: /path/to/image_file, mountpoint
_mnt_squashfs() {
local img="${1}"
local mnt="${2}"
local img_fullname="${img##*/}";
local img_name="${img_fullname%.*}"
local tmp_mnt="/ro_branch/${img_name}"
if [ "${copytoram}" = "y" ]; then
msg -n ":: Copying squashfs image to RAM..."
/bin/cp "${img}" "/copytoram/${img_fullname}"
if [ $? -ne 0 ]; then
echo ">> ERROR: while copy ${img} to /copytoram/${img_fullname}"
launch_interactive_shell
fi
img="/copytoram/${img_fullname}"
msg "done."
fi
[[ -z "${cow_flags}" ]] && cow_flags="defaults"
[[ -z "${cow_directory}" ]] && cow_directory="persistent_${misolabel}/${arch}"
[[ -z "${cow_chunksize}" ]] && cow_chunksize="8"
mkdir -p "${tmp_mnt}"
/bin/mount -r -t squashfs "${img}" "${tmp_mnt}"
if [ $? -ne 0 ]; then
echo ">> ERROR: while mounting ${img} to ${tmp_mnt}"
launch_interactive_shell
fi
if [ "/${mnt#/*/}" = "/" ]; then
_mnt_aufs "${tmp_mnt}" "${mnt}"
else
_mnt_bind "${tmp_mnt}" "${mnt}"
fi
}
run_hook() {
modprobe loop
if [ "x${arch}" = "x" ]; then
arch="$(uname -m)"
fi
if [ "x${rw_branch_size}" = "x" ]; then
rw_branch_size="75%"
fi
if [ "x${copytoram_size}" = "x" ]; then
copytoram_size="75%"
fi
if [ "x${misobasedir}" = "x" ]; then
misobasedir="manjaro"
fi
if [ "x${isomounts}" != "x" ]; then
isomounts="/bootmnt/${isomounts}"
else
isomounts="/bootmnt/${misobasedir}/isomounts"
fi
# set mount handler for miso
mount_handler="miso_mount_handler"
}
# This function is called normally from init script, but it can be called
# as chain from other mount handlers.
# args: /path/to/newroot
testdevice() {
fstype=$( blkid -s TYPE -o value ${MDEV} )
mount -r -t ${fstype} -o noatime "${MDEV}" "/bootmnt" >/dev/null 2>/dev/null
if [ $? -eq 0 ]; then
if [ -f "/bootmnt/.miso" ]; then
msg "::: INFO: miso system at ${MDEV}"
found="yes"
else
/bin/umount "/bootmnt/" 2>/dev/null
msg "::: INFO: No miso system at ${MDEV}"
MDEV=""
fi
else
msg ">> ERROR: Couldn't mount ${MDEV}"
MDEV=""
fi
}
probedevice() {
if [[ -n "${ip}" && -n "${miso_http_srv}" && -f "${isomounts}" ]]; then
found="yes"
return
fi
# Loop device test every second up to some limit
if [ "x${usbdelay}" != "x" ]; then
waittime=${usbdelay}
else
waittime=35
fi
waitcount=0
while [ ${waittime} -ne ${waitcount} ]; do
# first we look for root, e.g. /dev/sda1 to see if .miso will be found
if [ "x${root}" != "x" ]; then
[ ${waitcount} -eq 0 ] && msg ":: Looking for ${root}"
if [ -e ${root} ]; then
MDEV=${root}
testdevice
fi
fi
# if still not found, we will look for misolabel
if [ "x${misolabel}" != "x" ]; then
[ ${waitcount} -eq 0 ] && msg ":: Looking for LABEL ${misolabel}"
MDEV=$( blkid -L ${misolabel} )
if [ "x${MDEV}" != "x" ]; then
testdevice
else
msg "::: INFO: LABEL ${misolabel} is not valid!"
misolabel=""
fi
fi
# still nothing found, we will look for boot device
if [ -z "${found}" ]; then
[ ${waitcount} -eq 0 ] && msg ":: Looking for boot device"
if [ "x${nocd}" = "x" ]; then
# Look for CD
cdroms=$( /bin/cat /proc/sys/dev/cdrom/info | { while read a b c; do
if [ "${a}" = "drive" -a "${b}" = "name:" ]; then
echo "${c}"
break
fi
done
} )
for i in ${cdroms}; do
MDEV=/dev/${i}
testdevice
if [ "x${MDEV}" != "x" ]; then
break
fi
done
fi
# Test partitions
if [ "x${MDEV}" = "x" ]; then
for d in /dev/sd[a-z][0-9]*; do
MDEV=${d}
testdevice
if [ "x${MDEV}" != "x" ]; then
break
fi
done
fi
fi
[ "x${MDEV}" != "x" ] && break
/bin/sleep 1
waitcount=$(( ${waitcount} + 1 ))
done
}
miso_mount_handler() {
local newroot="${1}"
local found
if ! mountpoint -q "/run/miso/bootmnt"; then
_mnt_dev "${misodevice}" "/run/miso/bootmnt" "-r" "defaults"
if [[ "${copytoram}" != "y" ]]; then
echo $(readlink -f ${misodevice}) >> /run/miso/used_block_devices
# Probe all devices
probedevice
if [ -z "${found}" ]; then
echo ">> ERROR: unable to find boot device"
echo " Falling back to interactive prompt"
echo " You can try to fix the problem manually, log out when you are finished"
launch_interactive_shell
fi
if [ "${copytoram}" = "y" ]; then
msg -n ":: Mounting /copytoram (tmpfs) filesystem, size=${copytoram_size}..."
mount -t tmpfs -o "size=${copytoram_size}",mode=0755 copytoram /copytoram
msg "done."
fi
msg -n ":: Mounting rw_branch (tmpfs) filesystem, size=${rw_branch_size}..."
mount -t tmpfs -o "size=${rw_branch_size}",mode=0755 rw_branch /rw_branch
msg "done."
msg ":: Mounting root (aufs) filesystem"
/bin/mount -t aufs -o dirs=/rw_branch=rw union "${newroot}"
if [ $? -ne 0 ]; then
echo ">> ERROR: while mounting root (aufs) filesystem."
launch_interactive_shell
fi
msg ":: Mounting images"
while read img imgarch mountpoint type kernelarg; do
# check if this line is a comment (starts with #)
[ "${img#"#"}" != "${img}" ] && continue
[ "$imgarch" != "$arch" ] && continue
[ ! -r "/bootmnt/${misobasedir}/${img}" ] && continue
# check if the overlay should be loaded
overlay_arg_available "$kernelarg"
if [ $? == 1 ] && [ "$kernelarg" != "" ]; then
continue
fi
fi
if [[ "${checksum}" == "y" ]]; then
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..."
if _verify_checksum "${fs}"; then
msg "done. Checksum is OK, continue booting."
else
echo "ERROR: one or more files are corrupted"
echo "see /tmp/checksum.log for details"
launch_interactive_shell
fi
else
echo "ERROR: checksum=y option specified but ${misobasedir}/${arch}/${fs}.md5 not found"
launch_interactive_shell
fi
fi
done
fi
if [ "${type}" = "bind" ]; then
_mnt_bind "/bootmnt/${misobasedir}/${img}" "${newroot}${mountpoint}"
elif [ "${type}" = "squashfs" ]; then
_mnt_squashfs "/bootmnt/${misobasedir}/${img}" "${newroot}${mountpoint}"
fi
done < "${isomounts}"
if [[ "${verify}" == "y" ]]; then
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..."
if _verify_signature "${fs}"; then
msg "done. Signature is OK, continue booting."
else
echo "ERROR: one or more files are corrupted"
launch_interactive_shell
fi
else
echo "ERROR: verify=y option specified but ${misobasedir}/${arch}/${fs}.sfs.sig not found"
launch_interactive_shell
fi
fi
done
fi
if [[ "${copytoram}" == "y" ]]; then
msg ":: Mounting /run/miso/copytoram (tmpfs) filesystem, size=${copytoram_size}"
mkdir -p /run/miso/copytoram
mount -t tmpfs -o "size=${copytoram_size}",mode=0755 copytoram /run/miso/copytoram
fi
if [[ -n "${cow_device}" ]]; then
_mnt_dev "${cow_device}" "/run/miso/cowspace" "-r" "${cow_flags}"
echo $(readlink -f ${cow_device}) >> /run/miso/used_block_devices
mount -o remount,rw "/run/miso/cowspace"
if [ "${copytoram}" = "y" ]; then
/bin/umount -d /bootmnt
else
msg ":: Mounting /run/miso/cowspace (tmpfs) filesystem, size=${cow_spacesize}..."
mkdir -p /run/miso/cowspace
mount -t tmpfs -o "size=${cow_spacesize}",mode=0755 cowspace /run/miso/cowspace
fi
mkdir -p -m 0700 "/run/miso/cowspace/${cow_directory}"
msg -n ":: Mounting overlay root (tmpfs) filesystem, size=${overlay_root_size}..."
mkdir -p /run/miso/overlay_root
mount -t tmpfs -o "size=${overlay_root_size}",mode=0755 overlay_root /run/miso/overlay_root
local src="/run/miso/bootmnt/${misobasedir}/${arch}"
local dest_sfs="/run/miso/sfs" dest_img="/run/miso/img"
local lower_dir
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
mkdir -p ${dest_img}
lower_dir=${lower_dir:-}${lower_dir:+:}"${dest_img}/${sfs}"
_mnt_dmsnapshot "${dest_sfs}/${sfs}/${sfs}.img" "${dest_img}/${sfs}"
else
lower_dir=${lower_dir:-}${lower_dir:+:}"${dest_sfs}/${sfs}"
fi
fi
done
_mnt_overlayfs "${lower_dir}" "${newroot}" "/"
if [[ "${copytoram}" == "y" ]]; then
umount -d /run/miso/bootmnt
mkdir -p /run/miso/bootmnt/${misobasedir}/${arch}
mount -o bind /run/miso/copytoram /run/miso/bootmnt/${misobasedir}/${arch}
_mnt_bind /bootmnt "${newroot}/bootmnt"
fi
}

View file

@ -1,56 +1,7 @@
# 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 () {
[[ -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
}
@ -58,27 +9,32 @@ run_hook () {
miso_loop_mount_handler () {
newroot="${1}"
local _dev_loop
imgdev=$(resolve_device "$img_dev") && img_dev=$imgdev
unset imgdev
msg ":: Setup a loop device from ${img_loop} located at device ${img_dev}"
_mnt_dev "${img_dev}" "/run/miso/img_dev" "-r" "${img_flags}"
if [[ "${copytoram}" != "y" ]]; then
echo $(readlink -f ${img_dev}) >> /run/miso/used_block_devices
fi
if _dev_loop=$(losetup --find --show --read-only "/run/miso/img_dev/${img_loop}"); then
misodevice="${_dev_loop}"
else
echo "ERROR: Setting loopback device for file '/run/miso/img_dev/${img_loop}'"
msg ":: Waiting for boot device..."
while ! poll_device ${img_dev} 30; do
echo "ERROR: boot device didn't show up after 30 seconds..."
echo " Falling back to interactive prompt"
echo " You can try to fix the problem manually, log out when you are finished"
launch_interactive_shell
done
msg "::: Setup a loop device from ${img_loop} located at device ${img_dev}"
FSTYPE=$(blkid -o value -s TYPE -p ${img_dev} 2> /dev/null)
if [ -n "${FSTYPE}" ]; then
if mount -r -t "${FSTYPE}" ${img_dev} /img_dev > /dev/null 2>&1; then
_dev_loop=$(losetup -f)
losetup ${_dev_loop} /img_dev/${img_loop}
fi
fi
miso_mount_handler ${newroot}
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
if [ "${copytoram}" = "y" ]; then
msg "::: Deataching loop device ${_dev_loop}"
losetup -d ${_dev_loop}
msg "::: Unmounting ${img_dev}"
umount -d ${img_dev}
fi
}

View file

@ -0,0 +1,257 @@
# kernel_cmdline <param> <default>
# Looks for a parameter on the kernel's boot-time command line.
#
# returns: 0 if param was found. Also prints its value if it was a K=V param.
# 1 if it was not. Also prints value passed as <default>
#
kernel_cmdline ()
{
for param in $(/bin/cat /proc/cmdline); do
case "${param}" in
$1=*) echo "${param##*=}"; return 0 ;;
$1) return 0 ;;
*) continue ;;
esac
done
[ -n "${2}" ] && echo "${2}"
return 1
}
# 1$ : kernel argument to check
overlay_arg_available() {
for arg in $(echo "$(kernel_cmdline overlay)" | /bin/sed 's/,/ /g')
do
[ "${arg}" == "$1" ] && return 0
done
return 1
}
# args: source, mountpoint
_mnt_bind() {
local src="${1}"
local mnt="${2}"
msg "::: Binding ${src} to ${mnt}"
mkdir -p "${mnt}"
/bin/mount -o bind "${src}" "${mnt}"
}
# args: /path/to/image_file, mountpoint
_mnt_squashfs() {
local img="${1}"
local mnt="${2}"
local img_fullname="${img##*/}";
local img_name="${img_fullname%.*}"
local tmp_mnt="/ro_branch/${img_name}"
if [ "${copytoram}" = "y" ]; then
msg -n ":: Copying squashfs image to RAM..."
/bin/cp "${img}" "/copytoram/${img_fullname}"
if [ $? -ne 0 ]; then
echo ">> ERROR: while copy ${img} to /copytoram/${img_fullname}"
launch_interactive_shell
fi
img="/copytoram/${img_fullname}"
msg "done."
fi
mkdir -p "${tmp_mnt}"
/bin/mount -r -t squashfs "${img}" "${tmp_mnt}"
if [ $? -ne 0 ]; then
echo ">> ERROR: while mounting ${img} to ${tmp_mnt}"
launch_interactive_shell
fi
if [ "/${mnt#/*/}" = "/" ]; then
overlayfs="${overlayfs}:${tmp_mnt}"
else
_mnt_bind "${tmp_mnt}" "${mnt}"
fi
}
run_hook() {
modprobe loop
if [ "x${arch}" = "x" ]; then
arch="$(uname -m)"
fi
if [ "x${rw_branch_size}" = "x" ]; then
rw_branch_size="75%"
fi
if [ "x${copytoram_size}" = "x" ]; then
copytoram_size="75%"
fi
if [ "x${misobasedir}" = "x" ]; then
misobasedir="manjaro"
fi
if [ "x${isomounts}" != "x" ]; then
isomounts="/bootmnt/${isomounts}"
else
isomounts="/bootmnt/${misobasedir}/isomounts"
fi
# set mount handler for miso
mount_handler="miso_mount_handler"
}
testdevice() {
fstype=$( blkid -s TYPE -o value ${MDEV} )
mount -r -t ${fstype} -o noatime "${MDEV}" "/bootmnt" >/dev/null 2>/dev/null
if [ $? -eq 0 ]; then
if [ -f "/bootmnt/.miso" ]; then
msg "::: INFO: miso system at ${MDEV}"
found="yes"
else
/bin/umount "/bootmnt/" 2>/dev/null
msg "::: INFO: No miso system at ${MDEV}"
MDEV=""
fi
else
msg ">> ERROR: Couldn't mount ${MDEV}"
MDEV=""
fi
}
probedevice() {
if [[ -n "${ip}" && -n "${miso_http_srv}" && -f "${isomounts}" ]]; then
found="yes"
return
fi
# Loop device test every second up to some limit
if [ "x${usbdelay}" != "x" ]; then
waittime=${usbdelay}
else
waittime=35
fi
waitcount=0
while [ ${waittime} -ne ${waitcount} ]; do
# first we look for root, e.g. /dev/sda1 to see if .miso will be found
if [ "x${root}" != "x" ]; then
[ ${waitcount} -eq 0 ] && msg ":: Looking for ${root}"
if [ -e ${root} ]; then
MDEV=${root}
testdevice
fi
fi
# if still not found, we will look for misolabel
if [ "x${misolabel}" != "x" ]; then
[ ${waitcount} -eq 0 ] && msg ":: Looking for LABEL ${misolabel}"
MDEV=$( blkid -L ${misolabel} )
if [ "x${MDEV}" != "x" ]; then
testdevice
else
msg "::: INFO: LABEL ${misolabel} is not valid!"
misolabel=""
fi
fi
# still nothing found, we will look for boot device
if [ -z "${found}" ]; then
[ ${waitcount} -eq 0 ] && msg ":: Looking for boot device"
if [ "x${nocd}" = "x" ]; then
# Look for CD
cdroms=$( /bin/cat /proc/sys/dev/cdrom/info | { while read a b c; do
if [ "${a}" = "drive" -a "${b}" = "name:" ]; then
echo "${c}"
break
fi
done
} )
for i in ${cdroms}; do
MDEV=/dev/${i}
testdevice
if [ "x${MDEV}" != "x" ]; then
break
fi
done
fi
# Test partitions
if [ "x${MDEV}" = "x" ]; then
for d in /dev/sd[a-z][0-9]*; do
MDEV=${d}
testdevice
if [ "x${MDEV}" != "x" ]; then
break
fi
done
fi
fi
[ "x${MDEV}" != "x" ] && break
/bin/sleep 1
waitcount=$(( ${waitcount} + 1 ))
done
}
miso_mount_handler() {
local newroot="${1}"
local found
local overlayfs
# Probe all devices
probedevice
if [ -z "${found}" ]; then
echo ">> ERROR: unable to find boot device"
echo " Falling back to interactive prompt"
echo " You can try to fix the problem manually, log out when you are finished"
launch_interactive_shell
fi
if [ "${copytoram}" = "y" ]; then
msg -n ":: Mounting /copytoram (tmpfs) filesystem, size=${copytoram_size}..."
mount -t tmpfs -o "size=${copytoram_size}",mode=0755 copytoram /copytoram
msg "done."
fi
msg -n ":: Mounting rw_branch (tmpfs) filesystem, size=${rw_branch_size}..."
mount -t tmpfs -o "size=${rw_branch_size}",mode=0755 rw_branch /rw_branch
msg "done."
msg ":: Mounting images"
while read img imgarch mountpoint type kernelarg; do
# check if this line is a comment (starts with #)
[ "${img#"#"}" != "${img}" ] && continue
[ "$imgarch" != "$arch" ] && continue
[ ! -r "/bootmnt/${misobasedir}/${img}" ] && continue
# check if the overlay should be loaded
overlay_arg_available "$kernelarg"
if [ $? == 1 ] && [ "$kernelarg" != "" ]; then
continue
fi
if [ "${type}" = "bind" ]; then
_mnt_bind "/bootmnt/${misobasedir}/${img}" "${newroot}${mountpoint}"
elif [ "${type}" = "squashfs" ]; then
_mnt_squashfs "/bootmnt/${misobasedir}/${img}" "${newroot}${mountpoint}"
fi
done < "${isomounts}"
msg "Mounting ${overlayfs:1}"
mkdir -p "/rw_branch/upper"
mkdir -p "/rw_branch/work"
mount -t overlay overlay -olowerdir="${overlayfs:1}",upperdir="/rw_branch/upper",workdir="/rw_branch/work" "${newroot}/"
if [ "${copytoram}" = "y" ]; then
/bin/umount -d /bootmnt
else
_mnt_bind /bootmnt "${newroot}/bootmnt"
fi
}
# vim:ft=sh:ts=4:sw=4:et:

View file

@ -1,8 +1,7 @@
# vim: set ft=sh:
run_hook () {
# Do *not* declare 'bootif_dev' local! We need it in run_latehook().
local i net_mac bootif_mac
local i net_mac bootif_mac bootif_dev
# These variables will be parsed from /tmp/net-*.conf generated by ipconfig
local DEVICE
local IPV4ADDR IPV4BROADCAST IPV4NETMASK IPV4GATEWAY IPV4DNS0 IPV4DNS1
@ -22,20 +21,11 @@ run_hook () {
break
fi
done
if [[ "${ip}" == "dhcp" ]]; then
ip=":::::${bootif_dev}:dhcp"
else
ip="${ip}::${bootif_dev}"
fi
ip="${ip}::${bootif_dev}"
fi
# setup network and save some values
if ! ipconfig -t 20 "ip=${ip}"; then
echo "ERROR; Failed to configure network"
echo " Falling back to interactive prompt"
echo " You can try to fix the problem manually, log out when you are finished"
launch_interactive_shell
fi
ipconfig "ip=${ip}"
. /tmp/net-*.conf
@ -43,30 +33,18 @@ run_hook () {
# setup DNS resolver
if [[ "${IPV4DNS0}" != "0.0.0.0" ]]; then
echo "# added by miso_pxe_common hook" > /etc/resolv.conf
echo "nameserver ${IPV4DNS0}" >> /etc/resolv.conf
echo "nameserver ${IPV4DNS0}" > /etc/resolv.conf
fi
if [[ "${IPV4DNS1}" != "0.0.0.0" ]]; then
echo "nameserver ${IPV4DNS1}" >> /etc/resolv.conf
fi
if [[ -n "${DNSDOMAIN}" ]]; then
echo "search ${DNSDOMAIN}" >> /etc/resolv.conf
echo "domain ${DNSDOMAIN}" >> /etc/resolv.conf
fi
fi
}
run_latehook () {
if [[ -n "${ip}" ]]; then
[[ -z "${copy_resolvconf}" ]] && copy_resolvconf="y"
[[ -z "${copy_resolvconf}" ]] && copy_resolvconf="y"
if [[ "${copytoram}" == "y" ]]; then
if [[ -n "${bootif_dev}" ]]; then
ip addr flush dev "${bootif_dev}"
ip link set "${bootif_dev}" down
fi
elif [[ "${copy_resolvconf}" != "n" && -f /etc/resolv.conf ]]; then
cp /etc/resolv.conf /new_root/etc/resolv.conf
fi
if [[ "${copy_resolvconf}" != "n" && -f /etc/resolv.conf ]]; then
cp /etc/resolv.conf /new_root/etc/resolv.conf
fi
}

View file

@ -3,10 +3,6 @@
run_hook() {
if [[ -n "${ip}" && -n "${miso_http_srv}" ]]; then
# booting with http is always copy-to-ram, so set here to make sure
# addresses are flushed and interface is set down
copytoram="y"
miso_http_srv=$(eval echo ${miso_http_srv})
[[ -z "${miso_http_spc}" ]] && miso_http_spc="75%"
@ -23,7 +19,7 @@ _curl_get() {
local _dst="${2}"
msg ":: Downloading '${_url}'"
if ! curl -L -f -o "/run/miso/httpspace/${misobasedir}${_dst}/${_url##*/}" --create-dirs "${_url}"; then
if ! curl -L -f -o "${_dst}" --create-dirs "${_url}"; then
echo "ERROR: Downloading '${_url}'"
echo " Falling back to interactive prompt"
echo " You can try to fix the problem manually, log out when you are finished"
@ -34,26 +30,18 @@ _curl_get() {
miso_pxe_http_mount_handler () {
newroot="${1}"
msg ":: Mounting /run/miso/httpspace (tmpfs) filesystem, size='${miso_http_spc}'"
mkdir -p "/run/miso/httpspace"
mount -t tmpfs -o size="${miso_http_spc}",mode=0755 httpspace "/run/miso/httpspace"
_curl_get "${miso_http_srv}${misobasedir}/isomounts" "${isomounts}"
local _src=${miso_http_srv}${misobasedir}/${arch}
msg ":: Retrieving images"
while read img imgarch mountpoint type kernelarg; do
# check if this line is a comment (starts with #)
[ "${img#"#"}" != "${img}" ] && continue
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}"
[ "$imgarch" != "$arch" ] && continue
if [[ "${checksum}" == "y" ]]; then
_curl_get "${_src}/${sfs}.md5" "/${arch}"
fi
if [[ "${verify}" == "y" ]]; then
_curl_get "${_src}/${sfs}.sfs.sig" "/${arch}"
fi
fi
done
mkdir -p "/run/miso/bootmnt"
mount -o bind /run/miso/httpspace /run/miso/bootmnt
_curl_get "${miso_http_srv}${misobasedir}/${img}" "/bootmnt/${misobasedir}/${img}"
done < "${isomounts}"
miso_mount_handler ${newroot}
}

View file

@ -1,47 +0,0 @@
# vim: set ft=sh:
run_earlyhook() {
if [[ -n "${ip}" && -n "${miso_nbd_srv}" ]]; then
# Module autoloading like with loop devices does not work, doing manually...
modprobe nbd 2> /dev/null
fi
}
run_hook() {
if [[ -n "${ip}" && -n "${miso_nbd_srv}" ]]; then
miso_nbd_srv=$(eval echo ${miso_nbd_srv})
[[ -z "${miso_nbd_name}" ]] && miso_nbd_name="miso"
mount_handler="miso_pxe_nbd_mount_handler"
fi
}
miso_pxe_nbd_mount_handler () {
newroot="${1}"
msg ":: Waiting for boot device..."
while ! poll_device /dev/nbd0 30; do
echo "ERROR: boot device didn't show up after 30 seconds..."
echo " Falling back to interactive prompt"
echo " You can try to fix the problem manually, log out when you are finished"
launch_interactive_shell
done
msg ":: Setup NBD from ${miso_nbd_srv} at /dev/nbd0"
if [[ "${copytoram}" != "n" ]]; then
nbd-client ${miso_nbd_srv} -N ${miso_nbd_name} /dev/nbd0
copytoram="y"
else
nbd-client ${miso_nbd_srv} -N ${miso_nbd_name} -systemd-mark -persist /dev/nbd0
fi
misodevice=/dev/nbd0
miso_mount_handler ${newroot}
if [[ "${copytoram}" == "y" ]]; then
msg ":: Disconnect NBD from ${miso_nbd_srv} at /dev/nbd0"
nbd-client -d /dev/nbd0
fi
}

View file

@ -1,30 +0,0 @@
# vim: set ft=sh:
run_hook() {
if [[ -n "${ip}" && -n "${miso_nfs_srv}" ]]; then
miso_nfs_srv=$(eval echo ${miso_nfs_srv})
[[ -n "${miso_nfs_opt}" ]] && miso_nfs_opt="-o ${miso_nfs_opt}"
mount_handler="miso_nfs_mount_handler"
fi
}
miso_nfs_mount_handler() {
newroot="${1}"
mkdir -p "/run/miso/bootmnt"
msg ":: Mounting '${miso_nfs_srv}'"
# Do not put "${miso_nfs_opt}" nfsmount fails!
if ! nfsmount ${miso_nfs_opt} "${miso_nfs_srv}" "/run/miso/bootmnt"; then
echo "ERROR: Mounting '${miso_nfs_srv}'"
echo " Falling back to interactive prompt"
echo " You can try to fix the problem manually, log out when you are finished"
launch_interactive_shell
fi
if [[ "${copytoram}" != "n" ]]; then
copytoram="y"
fi
miso_mount_handler ${newroot}
}

View file

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

31
initcpio/inst/miso Normal file
View file

@ -0,0 +1,31 @@
#!/bin/bash
build() {
add_module "cdrom"
add_module "aufs"
add_module "squashfs"
add_module "isofs"
add_module "loop"
add_module "usb_storage"
add_module "sd_mod"
add_module "sr_mod"
add_module "virtio_pci"
add_module "virtio_blk"
add_dir /rw_branch
add_dir /ro_branch
add_dir /copytoram
add_dir /bootmnt
add_runscript
add_binary /usr/lib/udev/cdrom_id
add_binary blockdev
add_binary losetup
add_binary mountpoint
add_file /usr/lib/udev/rules.d/60-cdrom_id.rules
}
# vim: set ft=sh ts=4 sw=4 et:

View file

@ -1,6 +1,7 @@
#!/bin/bash
build() {
add_dir /img_dev
add_runscript
}
@ -11,3 +12,4 @@ HELPEOF
}
# vim: set ft=sh ts=4 sw=4 et:

View file

@ -0,0 +1,31 @@
#!/bin/bash
build() {
add_module "cdrom"
add_module "overlay"
add_module "squashfs"
add_module "isofs"
add_module "loop"
add_module "usb_storage"
add_module "sd_mod"
add_module "sr_mod"
add_module "virtio_pci"
add_module "virtio_blk"
add_dir /rw_branch
add_dir /ro_branch
add_dir /copytoram
add_dir /bootmnt
add_runscript
add_binary /usr/lib/udev/cdrom_id
add_binary blockdev
add_binary losetup
add_binary mountpoint
add_file /usr/lib/udev/rules.d/60-cdrom_id.rules
}
# vim: set ft=sh ts=4 sw=4 et:

View file

@ -22,5 +22,3 @@ cat<<HELPEOF
This hook loads the necessary modules for boot via PXE.
HELPEOF
}
# vim: set ft=sh ts=4 sw=4 et:

View file

@ -0,0 +1,13 @@
#!/bin/bash
build() {
add_binary "/usr/bin/curl" "/bin/curl"
add_runscript
}
help() {
cat<<HELPEOF
This hook loads the necessary modules for boot via PXE by HTTP.
HELPEOF
}

View file

@ -1,30 +0,0 @@
#!/bin/bash
build() {
add_module "cdrom"
add_module "loop"
add_module "dm-snapshot"
add_module "overlay"
add_runscript
add_binary /usr/lib/udev/cdrom_id
add_binary blockdev
add_binary dmsetup
add_binary losetup
add_binary mountpoint
add_binary truncate
add_binary gpg
add_binary grep
add_file /usr/lib/udev/rules.d/60-cdrom_id.rules
add_file /usr/lib/udev/rules.d/10-dm.rules
add_file /usr/lib/udev/rules.d/95-dm-notify.rules
add_file /usr/lib/initcpio/udev/11-dm-initramfs.rules /usr/lib/udev/rules.d/11-dm-initramfs.rules
if [[ $MISO_GNUPG_FD ]]; then
mkdir -p "$BUILDROOT$dest"/gpg
gpg --homedir "$BUILDROOT$dest"/gpg --import <&$MISO_GNUPG_FD
fi
}
# vim: set ft=sh ts=4 sw=4 et:

View file

@ -1,17 +0,0 @@
#!/bin/bash
build() {
add_runscript
add_binary curl
add_file $(readlink -f /etc/ssl/certs/ca-certificates.crt) /etc/ssl/certs/ca-certificates.crt
}
help() {
cat<<HELPEOF
This hook loads the necessary modules for boot via PXE and HTTP.
HELPEOF
}
# vim: set ft=sh ts=4 sw=4 et:

View file

@ -1,17 +0,0 @@
#!/bin/bash
build() {
add_module "nbd"
add_runscript
add_binary nbd-client
}
help() {
cat<<HELPEOF
This hook loads the necessary modules for boot via PXE and NBD.
HELPEOF
}
# vim: set ft=sh ts=4 sw=4 et:

View file

@ -1,17 +0,0 @@
#!/bin/bash
build() {
add_module "nfs"
add_runscript
add_binary /usr/lib/initcpio/nfsmount /bin/nfsmount
}
help() {
cat <<HELPEOF
This hook loads the necessary modules for boot via PXE and NFS.
HELPEOF
}
# vim: set ft=sh ts=4 sw=4 et:

View file

@ -1,20 +0,0 @@
#!/bin/bash
build() {
add_binary cp
add_runscript
add_file /etc/initcpio/miso_shutdown /shutdown
}
help() {
cat <<HELPEOF
This hook will create a shutdown initramfs in /run/initramfs
that we can pivot to on shutdown in order to unmount / and
and others mount points, dm-snapshot devices and loopback devices.
Mostly usefull for dm-snapshot persistent.
HELPEOF
}
# vim: set ft=sh ts=4 sw=4 et:

View file

@ -1,38 +0,0 @@
#!/bin/ash
# /oldroot depends on things inside /oldroot/run/miso...
mkdir /oldrun
mount -n --move /oldroot/run /oldrun
# Unmount all mounts now.
#umount $(mount | awk '$3 ~/^\/oldroot/ {print $3}' | sort -r)
umount $(mount | awk '$3 ~/^\/oldroot/ {if($3 != "/run/miso/bootmnt") print $3}' | sort -r)
# Remove all dm-snapshot devices.
dmsetup remove_all
# Remove all loopback devices.
for _lup in $(grep ^/dev/loop /oldrun/miso/used_block_devices | tac); do
if ! losetup -d ${_lup} 2> /dev/null; then
umount -d ${_lup}
fi
done
# Unmount the space used to store *.cow.
umount /oldrun/miso/cowspace
# Unmount boot device if needed (no copytoram=y used)
if [[ ! -d /oldrun/miso/copytoram ]]; then
if [[ -d /oldrun/miso/img_dev ]]; then
umount /oldrun/miso/img_dev
else
umount /oldrun/miso/bootmnt
fi
fi
# reboot / poweroff / halt, depending on the argument passed by init
# if something invalid is passed, we halt
case "$1" in
reboot|poweroff|halt) "$1" -f ;;
*) halt -f;;
esac

35
lib/util-iso-aufs.sh Normal file
View file

@ -0,0 +1,35 @@
#!/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.
track_image() {
info "%s mount: [%s]" "${iso_fs}" "$6"
mount "$@" && IMAGE_ACTIVE_MOUNTS=("$6" "${IMAGE_ACTIVE_MOUNTS[@]}")
}
# $1: new branch
mount_image(){
IMAGE_ACTIVE_MOUNTS=()
track_image -t aufs -o br="$1":${work_dir}/root-image=ro none "$1"
}
mount_image_custom(){
IMAGE_ACTIVE_MOUNTS=()
track_image -t aufs -o br="$1":${work_dir}/${profile}-image=ro:${work_dir}/root-image=ro none "$1"
}
# $1: image path
umount_image(){
if [[ -n ${IMAGE_ACTIVE_MOUNTS[@]} ]];then
umount "${IMAGE_ACTIVE_MOUNTS[@]}"
unset IMAGE_ACTIVE_MOUNTS
find $1 -name '.wh.*' -delete &> /dev/null
fi
}

View file

@ -9,94 +9,289 @@
# 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
copy_efi_shells(){
if [[ -f ${DATADIR}/efi_shell/shellx64_v1.efi ]];then
msg2 "Copying shellx64_v1.efi ..."
cp ${DATADIR}/efi_shell/shellx64_v1.efi $1/
fi
if [[ -f ${DATADIR}/efi_shell/shellx64_v2.efi ]];then
msg2 "Copying shellx64_v2.efi ..."
cp ${DATADIR}/efi_shell/shellx64_v2.efi $1/
fi
}
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
set_mkinicpio_hooks(){
if ! ${pxe_boot};then
msg2 "Removing pxe hooks"
sed -e 's/miso_pxe_common miso_pxe_http //' \
-e 's/memdisk //' -i $1
fi
MISO_GNUPG_FD=${gpgkey:+17} chroot-run $1 \
if ! ${plymouth_boot};then
msg2 "Removing plymouth hook"
sed -e 's/plymouth //' -i $1
fi
if ${use_overlayfs};then
sed -e 's/miso /miso_overlayfs /' -i $1
fi
}
set_silent_switch_root(){
sed -e 's|"$@"|"$@" >/dev/null 2>&1|' -i $1/usr/lib/initcpio/init
}
copy_initcpio(){
msg2 "Copying initcpio ..."
cp /usr/lib/initcpio/hooks/miso* $2/usr/lib/initcpio/hooks
cp /usr/lib/initcpio/install/miso* $2/usr/lib/initcpio/install
cp $1/mkinitcpio.conf $2/etc/mkinitcpio-${iso_name}.conf
set_mkinicpio_hooks "$2/etc/mkinitcpio-${iso_name}.conf"
set_silent_switch_root "$2"
}
# $1: work_dir
gen_boot_image(){
local _kernver=$(cat $1/usr/lib/modules/*/version)
chroot-run $1 \
/usr/bin/mkinitcpio -k ${_kernver} \
-c /etc/mkinitcpio-${iso_name}.conf \
-g /boot/initramfs.img
-g /boot/${iso_name}.img
}
if [[ -n ${gpgkey} ]]; then
exec 17<&-
fi
if [[ -f ${USERCONFDIR}/gpgkey ]]; then
rm ${USERCONFDIR}/gpgkey
copy_efi_loaders(){
msg2 "Copying efi loaders ..."
cp $1/usr/share/efitools/efi/PreLoader.efi $2/bootx64.efi
cp $1/usr/share/efitools/efi/HashTool.efi $2/
if [[ -f $1/usr/lib/systemd/boot/efi/systemd-bootx64.efi ]] ; then
cp $1/usr/lib/systemd/boot/efi/systemd-bootx64.efi $2/loader.efi
else
cp $1/usr/share/efitools/efi/Loader.efi $2/loader.efi
fi
}
prepare_boot_extras(){
cp $1/boot/amd-ucode.img $2/amd_ucode.img
copy_boot_images(){
msg2 "Copying boot images ..."
cp $1/x86_64/${iso_name} $2/${iso_name}.efi
cp $1/x86_64/${iso_name}.img $2/${iso_name}.img
if [[ -f $1/intel_ucode.img ]] ; then
msg2 "Using intel_ucode.img ..."
cp $1/intel_ucode.img $2/intel_ucode.img
fi
}
copy_ucode(){
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
cp $1/usr/share/licenses/intel-ucode/LICENSE $2/intel_ucode.LICENSE
}
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}"
write_loader_conf(){
local fn=loader.conf
local conf=$1/${fn}
msg2 "Writing %s ..." "${fn}"
echo 'timeout 3' > ${conf}
echo "default ${iso_name}-${target_arch}" >> ${conf}
}
write_efi_shellv1_conf(){
local fn=uefi-shell-v1-${target_arch}.conf
local conf=$1/${fn}
msg2 "Writing %s ..." "${fn}"
echo "title UEFI Shell ${target_arch} v1" > ${conf}
echo "efi /EFI/shellx64_v1.efi" >> ${conf}
}
write_efi_shellv2_conf(){
local fn=uefi-shell-v2-${target_arch}.conf
local conf=$1/${fn}
msg2 "Writing %s ..." "${fn}"
echo "title UEFI Shell ${target_arch} v2" > ${conf}
echo "efi /EFI/shellx64_v2.efi" >> ${conf}
}
write_dvd_conf(){
local fn=${iso_name}-${target_arch}.conf
local conf=$1/${fn} path=$2
msg2 "Writing %s ..." "${fn}"
echo "title ${dist_name} Linux ${target_arch} UEFI DVD (default)" > ${conf}
echo "linux /EFI/miso/${iso_name}.efi" >> ${conf}
if [[ -f ${path}/${iso_name}/boot/intel_ucode.img ]] ; then
msg2 "Using intel_ucode.img ..."
echo "initrd /EFI/miso/intel_ucode.img" >> ${conf}
fi
echo "initrd /EFI/miso/${iso_name}.img" >> ${conf}
echo "options misobasedir=${iso_name} misolabel=${iso_label} nouveau.modeset=1 i915.modeset=1 radeon.modeset=1 logo.nologo overlay=free" >> ${conf}
}
write_dvd_nonfree_conf(){
local fn=${iso_name}-${target_arch}-nonfree.conf
local conf=$1/${fn} path=$2
msg2 "Writing %s ..." "${fn}"
echo "title ${dist_name} Linux ${target_arch} UEFI DVD (nonfree)" > ${conf}
echo "linux /EFI/miso/${iso_name}.efi" >> ${conf}
if [[ -f ${path}/${iso_name}/boot/intel_ucode.img ]] ; then
msg2 "Using intel_ucode.img ..."
echo "initrd /EFI/miso/intel_ucode.img" >> ${conf}
fi
echo "initrd /EFI/miso/${iso_name}.img" >> ${conf}
echo "options misobasedir=${iso_name} misolabel=${iso_label} nouveau.modeset=1 i915.modeset=1 radeon.modeset=1 logo.nologo overlay=nonfree nonfree=yes" >> ${conf}
}
write_usb_conf(){
local fn=${iso_name}-${target_arch}.conf
local conf=$1/${fn} path=$2
msg2 "Writing %s ..." "${fn}"
echo "title ${dist_name} Linux ${target_arch} UEFI USB (default)" > ${conf}
echo "linux /${iso_name}/boot/${target_arch}/${iso_name}" >> ${conf}
if [[ -f ${path}/${iso_name}/boot/intel_ucode.img ]] ; then
msg2 "Using intel_ucode.img ..."
echo "initrd /${iso_name}/boot/intel_ucode.img" >> ${conf}
fi
echo "initrd /${iso_name}/boot/${target_arch}/${iso_name}.img" >> ${conf}
echo "options misobasedir=${iso_name} misolabel=${iso_label} nouveau.modeset=1 i915.modeset=1 radeon.modeset=1 logo.nologo overlay=free" >> ${conf}
}
write_usb_nonfree_conf(){
local fn=${iso_name}-${target_arch}-nonfree.conf
local conf=$1/${fn} path=$2
msg2 "Writing %s ..." "${fn}"
echo "title ${dist_name} Linux ${target_arch} UEFI USB (nonfree)" > ${conf}
echo "linux /${iso_name}/boot/${target_arch}/${iso_name}" >> ${conf}
if [[ -f ${path}/${iso_name}/boot/intel_ucode.img ]] ; then
msg2 "Using intel_ucode.img ..."
echo "initrd /${iso_name}/boot/intel_ucode.img" >> ${conf}
fi
echo "initrd /${iso_name}/boot/${target_arch}/${iso_name}.img" >> ${conf}
echo "options misobasedir=${iso_name} misolabel=${iso_label} nouveau.modeset=1 i915.modeset=1 radeon.modeset=1 logo.nologo overlay=nonfree nonfree=yes" >> ${conf}
}
copy_isolinux_bin(){
if [[ -e $1/usr/lib/syslinux/bios ]]; then
msg2 "Copying isolinux bios binaries ..."
cp $1/usr/lib/syslinux/bios/isolinux.bin $2
cp $1/usr/lib/syslinux/bios/isohdpfx.bin $2
cp $1/usr/lib/syslinux/bios/ldlinux.c32 $2
cp $1/usr/lib/syslinux/bios/gfxboot.c32 $2
cp $1/usr/lib/syslinux/bios/whichsys.c32 $2
cp $1/usr/lib/syslinux/bios/mboot.c32 $2
cp $1/usr/lib/syslinux/bios/hdt.c32 $2
cp $1/usr/lib/syslinux/bios/chain.c32 $2
cp $1/usr/lib/syslinux/bios/libcom32.c32 $2
cp $1/usr/lib/syslinux/bios/libmenu.c32 $2
cp $1/usr/lib/syslinux/bios/libutil.c32 $2
cp $1/usr/lib/syslinux/bios/libgpl.c32 $2
else
msg2 "Copying isolinux binaries ..."
cp $1/usr/lib/syslinux/isolinux.bin $2
cp $1/usr/lib/syslinux/isohdpfx.bin $2
cp $1/usr/lib/syslinux/gfxboot.c32 $2
cp $1/usr/lib/syslinux/whichsys.c32 $2
cp $1/usr/lib/syslinux/mboot.c32 $2
cp $1/usr/lib/syslinux/hdt.c32 $2
cp $1/usr/lib/syslinux/chain.c32 $2
fi
}
gen_boot_args(){
local args=(quiet)
if ${plymouth_boot};then
args+=(splash)
fi
echo ${args[@]}
}
gen_initrd_arg(){
local path="/${iso_name}/boot/${target_arch}/${iso_name}.img"
local arg="initrd=${path}"
if [[ -f $1/${iso_name}/boot/intel_ucode.img ]] ; then
arg="initrd=/${iso_name}/boot/intel_ucode.img,${path}"
fi
echo $arg
}
write_isolinux_cfg(){
local fn=isolinux.cfg
local conf=$1/${fn} path=$2
msg2 "Writing %s ..." "${fn}"
echo "default start" > ${conf}
echo "implicit 1" >> ${conf}
echo "display isolinux.msg" >> ${conf}
echo "ui gfxboot bootlogo isolinux.msg" >> ${conf}
echo "prompt 1" >> ${conf}
echo "timeout 200" >> ${conf}
echo '' >> ${conf}
echo "label start" >> ${conf}
echo " kernel /${iso_name}/boot/${target_arch}/${iso_name}" >> ${conf}
local boot_args=($(gen_boot_args))
local initrd_arg=$(gen_initrd_arg $path)
echo " append ${initrd_arg} misobasedir=${iso_name} misolabel=${iso_label} nouveau.modeset=1 i915.modeset=1 radeon.modeset=1 logo.nologo overlay=free ${boot_args[@]} showopts" >> ${conf}
echo '' >> ${conf}
if ${nonfree_mhwd};then
echo "label nonfree" >> ${conf}
echo " kernel /${iso_name}/boot/${target_arch}/${iso_name}" >> ${conf}
echo " append ${initrd_arg} misobasedir=${iso_name} misolabel=${iso_label} nouveau.modeset=0 i915.modeset=1 radeon.modeset=0 nonfree=yes logo.nologo overlay=nonfree ${boot_args[@]} showopts" >> ${conf}
echo '' >> ${conf}
fi
echo "label harddisk" >> ${conf}
echo " com32 whichsys.c32" >> ${conf}
echo " append -iso- chain.c32 hd0" >> ${conf}
echo '' >> ${conf}
echo "label hdt" >> ${conf}
echo " kernel hdt.c32" >> ${conf}
echo '' >> ${conf}
echo "label memtest" >> ${conf}
echo " kernel memtest" >> ${conf}
}
write_isolinux_msg(){
local fn=isolinux.msg
local conf=$1/${fn}
msg2 "Writing %s ..." "${fn}"
echo "Welcome to ${dist_name} Linux!" > ${conf}
echo '' >> ${conf}
echo "To start the system enter 'start' and press <return>" >> ${conf}
echo '' >> ${conf}
echo '' >> ${conf}
echo "Available boot options:" >> ${conf}
echo "start - Start ${dist_name} Live System" >> ${conf}
if ${nonfree_mhwd};then
echo "nonfree - Start with proprietary drivers" >> ${conf}
fi
echo "harddisk - Boot from local hard disk" >> ${conf}
echo "hdt - Run Hardware Detection Tool" >> ${conf}
echo "memtest - Run Memory Test" >> ${conf}
}
update_isolinux_cfg(){
local fn=isolinux.cfg
msg2 "Updating %s ..." "${fn}"
sed -i "s|%ISO_LABEL%|${iso_label}|g;
s|%ISO_NAME%|${iso_name}|g;
s|%ARCH%|${target_arch}|g" $2/${fn}
}
update_isolinux_msg(){
local fn=isolinux.msg
msg2 "Updating %s ..." "${fn}"
sed -i "s|%DIST_NAME%|${dist_name}|g" $2/${fn}
}
write_isomounts(){
local file=$1/isomounts
echo '# syntax: <img> <arch> <mount point> <type> <kernel argument>' > ${file}
echo '# Sample kernel argument in syslinux: overlay=extra,extra2' >> ${file}
echo '' >> ${file}
msg2 "Writing live entry ..."
echo "${target_arch}/live-image.sqfs ${target_arch} / squashfs" >> ${file}
if [[ -f ${packages_mhwd} ]] ; then
msg2 "Writing mhwd entry ..."
echo "${target_arch}/mhwd-image.sqfs ${target_arch} / squashfs" >> ${file}
fi
if [[ -f "${packages_custom}" ]] ; then
msg2 "Writing %s entry ..." "${profile}"
echo "${target_arch}/${profile}-image.sqfs ${target_arch} / squashfs" >> ${file}
fi
msg2 "Writing root entry ..."
echo "${target_arch}/root-image.sqfs ${target_arch} / squashfs" >> ${file}
}

View file

@ -10,9 +10,9 @@
# GNU General Public License for more details.
copy_overlay(){
if [[ -e $1 ]]; then
if [[ -e $1 ]];then
msg2 "Copying [%s] ..." "${1##*/}"
if [[ -L $1 ]]; then
if [[ -L $1 ]];then
cp -a --no-preserve=ownership $1/* $2
else
cp -LR $1/* $2
@ -20,8 +20,16 @@ copy_overlay(){
fi
}
configure_plymouth(){
if ${plymouth_boot};then
msg2 "Configuring plymouth: %s" "${plymouth_theme}"
local conf=$1/etc/plymouth/plymouthd.conf
sed -i -e "s/^.*Theme=.*/Theme=${plymouth_theme}/" "${conf}"
fi
}
add_svc_rc(){
if [[ -f $1/etc/init.d/$2 ]]; then
if [[ -f $1/etc/init.d/$2 ]];then
msg2 "Setting %s ..." "$2"
chroot $1 rc-update add $2 default &>/dev/null
fi
@ -29,19 +37,14 @@ add_svc_rc(){
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
[[ -f $1/usr/lib/systemd/system/$2.service ]];then
msg2 "Setting %s ..." "$2"
chroot $1 systemctl enable $2 &>/dev/null
fi
}
set_xdm(){
if [[ -f $1/etc/conf.d/xdm ]]; then
if [[ -f $1/etc/conf.d/xdm ]];then
local conf='DISPLAYMANAGER="'${displaymanager}'"'
sed -i -e "s|^.*DISPLAYMANAGER=.*|${conf}|" $1/etc/conf.d/xdm
fi
@ -50,424 +53,53 @@ set_xdm(){
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
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/
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
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-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
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
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
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 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
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_lsb(){
[[ -f $1/boot/grub/grub.cfg ]] && rm $1/boot/grub/grub.cfg
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
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_mhwd(){
if [[ ${target_arch} == "x86_64" ]];then
if ! ${multilib};then
msg2 "Disable mhwd lib32 support"
echo 'MHWD64_IS_LIB32="false"' > $1/etc/mhwd-x86_64.conf
fi
fi
}
configure_logind(){
@ -484,31 +116,28 @@ configure_journald(){
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"
info "Configuring [%s]" "${initsys}"
case ${initsys} in
'openrc')
for svc in ${enable_openrc[@]}; do
[[ $svc == "xdm" ]] && set_xdm "$1"
add_svc_rc "$1" "$svc"
done
for svc in ${enable_openrc_live[@]}; do
add_svc_rc "$1" "$svc"
done
;;
'systemd')
for svc in ${enable_systemd[@]}; do
add_svc_sd "$1" "$svc"
done
for svc in ${enable_systemd_live[@]}; do
add_svc_sd "$1" "$svc"
done
;;
esac
info "Done configuring [%s]" "${initsys}"
}
write_live_session_conf(){
@ -532,7 +161,7 @@ write_live_session_conf(){
echo '' >> ${conf}
echo '# live group membership' >> ${conf}
echo "addgroups='${addgroups}'" >> ${conf}
if [[ -n ${smb_workgroup} ]]; then
if [[ -n ${smb_workgroup} ]];then
echo '' >> ${conf}
echo '# samba workgroup' >> ${conf}
echo "smb_workgroup=${smb_workgroup}" >> ${conf}
@ -544,16 +173,25 @@ configure_hosts(){
}
configure_system(){
configure_logind "$1"
configure_journald "$1"
case ${initsys} in
'systemd')
configure_journald "$1"
configure_logind "$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"
# 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
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
;;
'openrc')
local hn='hostname="'${hostname}'"'
sed -i -e "s|^.*hostname=.*|${hn}|" $1/etc/conf.d/hostname
;;
esac
}
configure_thus(){
@ -565,8 +203,8 @@ configure_thus(){
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_SOURCE = \"/bootmnt/${iso_name}/${target_arch}/root-image.sqfs\"" >> "$conf"
echo "LIVE_MEDIA_DESKTOP = \"/bootmnt/${iso_name}/${target_arch}/${profile}-image.sqfs\"" >> "$conf"
echo "LIVE_MEDIA_TYPE = \"squashfs\"" >> "$conf"
echo "LIVE_USER_NAME = \"${username}\"" >> "$conf"
echo "KERNEL = \"${kernel}\"" >> "$conf"
@ -574,24 +212,26 @@ configure_thus(){
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
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]"
msg "Configuring [live-image]"
configure_hosts "$1"
configure_lsb "$1"
configure_mhwd "$1"
configure_system "$1"
configure_services "$1"
configure_calamares "$1"
# [[ ${edition} == "sonar" ]] && configure_thus "$1"
[[ ${edition} == "sonar" ]] && configure_thus "$1"
write_live_session_conf "$1"
msg "Done configuring [livefs]"
msg "Done configuring [live-image]"
}
make_repo(){
repo-add $1${mhwd_repo}/mhwd.db.tar.gz $1${mhwd_repo}/*pkg.tar*
repo-add $1${mhwd_repo}/mhwd.db.tar.gz $1${mhwd_repo}/*pkg*z
}
copy_from_cache(){
@ -608,7 +248,7 @@ copy_from_cache(){
-B "${build_mirror}/${target_branch}" \
"$1" \
pacman -v -Sp $2 --noconfirm > "$list"
sed -ni '/pkg.tar/p' "$list"
sed -ni '/.pkg.tar.xz/p' "$list"
sed -i "s/.*\///" "$list"
msg2 "Copying mhwd package cache ..."
@ -616,23 +256,18 @@ copy_from_cache(){
}
chroot_create(){
[[ "${1##*/}" == "rootfs" ]] && local flag="-L"
[[ "${1##*/}" == "root-image" ]] && 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
for image in "$1"/*-image; do
[[ -d ${image} ]] || continue
local name=${image##*/}
if [[ $name != "mhwdfs" ]]; then
msg2 "Deleting chroot [%s] (%s) ..." "$name" "${1##*/}"
if [[ $name != "mhwd-image" ]];then
msg2 "Deleting chroot [%s] ..." "$name"
lock 9 "${image}.lock" "Locking chroot '${image}'"
if [[ "$(stat -f -c %T "${image}")" == btrfs ]]; then
{ type -P btrfs && btrfs subvolume delete "${image}"; } #&> /dev/null
@ -648,20 +283,13 @@ clean_up_image(){
msg2 "Cleaning [%s]" "${1##*/}"
local path
if [[ ${1##*/} == 'mhwdfs' ]]; then
if [[ ${1##*/} == 'mhwd-image' ]];then
path=$1/var
if [[ -d $path/lib/mhwd ]]; then
mv $path/lib/mhwd $1 &> /dev/null
fi
if [[ -d $path ]]; then
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
if [[ -d $path ]];then
find "$path" -mindepth 0 -delete &> /dev/null
fi
else
@ -672,7 +300,7 @@ clean_up_image(){
find "$path" -name 'initramfs*.img' -delete &> /dev/null
fi
path=$1/var/lib/pacman/sync
if [[ -d $path ]]; then
if [[ -d $path ]];then
find "$path" -type f -delete &> /dev/null
fi
path=$1/var/cache/pacman/pkg
@ -684,17 +312,13 @@ clean_up_image(){
find "$path" -type f -delete &> /dev/null
fi
path=$1/var/tmp
if [[ -d $path ]]; then
if [[ -d $path ]];then
find "$path" -mindepth 1 -delete &> /dev/null
fi
path=$1/tmp
if [[ -d $path ]]; then
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
# find "${work_dir}" -name *.pacnew -name *.pacsave -name *.pacorig -delete
}

View file

@ -1,87 +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.
track_img() {
info "mount: [%s]" "$2"
mount "$@" && IMG_ACTIVE_MOUNTS=("$2" "${IMG_ACTIVE_MOUNTS[@]}")
}
mount_img() {
IMG_ACTIVE_MOUNTS=()
mkdir -p "$2"
track_img "$1" "$2"
}
umount_img() {
if [[ -n ${IMG_ACTIVE_MOUNTS[@]} ]]; then
info "umount: [%s]" "${IMG_ACTIVE_MOUNTS[@]}"
umount "${IMG_ACTIVE_MOUNTS[@]}"
unset IMG_ACTIVE_MOUNTS
rm -r "$1"
fi
}
track_fs() {
info "overlayfs mount: [%s]" "$5"
mount "$@" && FS_ACTIVE_MOUNTS=("$5" "${FS_ACTIVE_MOUNTS[@]}")
}
# $1: new branch
mount_fs_root(){
FS_ACTIVE_MOUNTS=()
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
}
umount_fs(){
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
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
}

37
lib/util-iso-overlayfs.sh Normal file
View file

@ -0,0 +1,37 @@
#!/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.
track_image() {
info "%s mount: [%s]" "${iso_fs}" "$5"
mount "$@" && IMAGE_ACTIVE_MOUNTS=("$5" "${IMAGE_ACTIVE_MOUNTS[@]}")
}
# $1: new branch
mount_image(){
IMAGE_ACTIVE_MOUNTS=()
mkdir -p "${work_dir}/work"
track_image -t overlay overlay -olowerdir="${work_dir}/root-image",upperdir="$1",workdir="${work_dir}/work" "$1"
}
mount_image_custom(){
IMAGE_ACTIVE_MOUNTS=()
mkdir -p "${work_dir}/work"
track_image -t overlay overlay -olowerdir="${work_dir}/${profile}-image":"${work_dir}/root-image",upperdir="$1",workdir="${work_dir}/work" "$1"
}
umount_image(){
if [[ -n ${IMAGE_ACTIVE_MOUNTS[@]} ]];then
info "%s umount: [%s]" "${iso_fs}" "${IMAGE_ACTIVE_MOUNTS[@]}"
umount "${IMAGE_ACTIVE_MOUNTS[@]}"
unset IMAGE_ACTIVE_MOUNTS
rm -rf "${work_dir}/work"
fi
}

View file

@ -22,8 +22,7 @@ error_function() {
error "A failure occurred in %s()." "$1"
plain "Aborting..."
fi
umount_fs
umount_img
umount_image
exit 2
}
@ -49,7 +48,7 @@ run_safe() {
restoretrap=$(trap -p ERR)
trap 'error_function $func' ERR
if ${verbose}; then
if ${verbose};then
run_log "$func"
else
"$func"
@ -63,98 +62,54 @@ run_safe() {
trap_exit() {
local sig=$1; shift
error "$@"
umount_fs
umount_image
trap -- "$sig"
kill "-$sig" "$$"
}
make_sig () {
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 ${OLDPWD}
}
# $1: file
make_checksum(){
msg2 "Creating md5sum ..."
cd $1
md5sum $2.sfs > $2.md5
cd ${OLDPWD}
}
# $1: image path
make_sfs() {
local src="$1"
if [[ ! -e "${src}" ]]; then
error "The path %s does not exist" "${src}"
retrun 1
make_sqfs() {
if [[ ! -d "$1" ]]; then
error "$1 is not a directory"
return 1
fi
local timer=$(get_timer) dest=${iso_root}/${iso_name}/${target_arch}
local timer=$(get_timer) path=${work_dir}/iso/${iso_name}/${target_arch}
local name=${1##*/}
local sfs="${dest}/${name}.sfs"
mkdir -p ${dest}
msg "Generating SquashFS image for %s" "${src}"
if [[ -f "${sfs}" ]]; then
local has_changed_dir=$(find ${src} -newer ${sfs})
msg2 "Possible changes for %s ..." "${src}" >> ${tmp_dir}/buildiso.debug
local sq_img="${path}/$name.sqfs"
mkdir -p ${path}
msg "Generating SquashFS image for %s" "${1}"
if [[ -f "${sq_img}" ]]; then
local has_changed_dir=$(find ${1} -newer ${sq_img})
msg2 "Possible changes for %s ..." "${1}" >> ${tmp_dir}/buildiso.debug
msg2 "%s" "${has_changed_dir}" >> ${tmp_dir}/buildiso.debug
if [[ -n "${has_changed_dir}" ]]; then
msg2 "SquashFS image %s is not up to date, rebuilding..." "${sfs}"
rm "${sfs}"
msg2 "SquashFS image %s is not up to date, rebuilding..." "${sq_img}"
rm "${sq_img}"
else
msg2 "SquashFS image %s is up to date, skipping." "${sfs}"
msg2 "SquashFS image %s is up to date, skipping." "${sq_img}"
return
fi
fi
if ${persist}; then
local size=32G
local mnt="${mnt_dir}/${name}"
msg2 "Creating ext4 image of %s ..." "${size}"
truncate -s ${size} "${src}.img"
local ext4_args=()
${verbose} && ext4_args+=(-q)
ext4_args+=(-O ^has_journal,^resize_inode -E lazy_itable_init=0 -m 0)
mkfs.ext4 ${ext4_args[@]} -F "${src}.img" &>/dev/null
tune2fs -c 0 -i 0 "${src}.img" &> /dev/null
mount_img "${work_dir}/${name}.img" "${mnt}"
msg2 "Copying %s ..." "${src}/"
cp -aT "${src}/" "${mnt}/"
umount_img "${mnt}"
msg2 "Creating SquashFS image. This may take some time..."
local used_kernel=${kernel:5:1} mksqfs_args=(${1} ${sq_img} -noappend)
local highcomp="-b 256K -Xbcj x86"
[[ "${iso_compression}" != "xz" ]] && highcomp=""
fi
msg2 "Creating SquashFS image, this may take some time..."
local used_kernel=${kernel:5:1} mksfs_args=()
if ${persist}; then
mksfs_args+=(${work_dir}/${name}.img)
if [[ "$name" == "mhwd-image" && ${used_kernel} < "4" ]]; then
mksqfs_args+=(-comp lz4)
if ${verbose};then
mksquashfs "${mksqfs_args[@]}" >/dev/null
else
mksquashfs "${mksqfs_args[@]}"
fi
else
mksfs_args+=(${src})
fi
mksfs_args+=(${sfs} -noappend)
local highcomp
[[ "${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
mksquashfs "${mksfs_args[@]}" >/dev/null
else
mksquashfs "${mksfs_args[@]}"
fi
make_checksum "${dest}" "${name}"
${persist} && rm "${src}.img"
if [[ -n ${gpgkey} ]]; then
make_sig "${dest}" "${name}"
mksqfs_args+=(-comp ${iso_compression} ${highcomp})
if ${verbose};then
mksquashfs "${mksqfs_args[@]}" >/dev/null
else
mksquashfs "${mksqfs_args[@]}"
fi
fi
show_elapsed_time "${FUNCNAME}" "${timer_start}"
@ -162,119 +117,70 @@ make_sfs() {
assemble_iso(){
msg "Creating ISO image..."
local iso_publisher="$(get_osname) <$(get_disturl)>" \
iso_app_id="$(get_osname) Live/Rescue CD" \
mod_date=$(date -u +%Y-%m-%d-%H-%M-%S-00 | sed -e s/-//g)
local efi_boot_args=()
if [[ -f "${work_dir}/iso/EFI/miso/${iso_name}.img" ]]; then
msg2 "Setting efi args. El Torito detected."
efi_boot_args=("-eltorito-alt-boot"
"-e EFI/miso/${iso_name}.img"
"-isohybrid-gpt-basdat"
"-no-emul-boot")
fi
xorriso -as mkisofs \
--modification-date=${mod_date} \
--protective-msdos-label \
-iso-level 3 -rock -joliet \
-max-iso9660-filenames -omit-period \
-omit-version-number \
-relaxed-filenames -allow-lowercase \
-volid "${iso_label}" \
-appid "${iso_app_id}" \
-publisher "${iso_publisher}" \
-preparer "Prepared by manjaro-tools/${0##*/}" \
-r -graft-points -no-pad \
--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 \
-no-emul-boot -boot-load-size 4 -boot-info-table --grub2-boot-info \
-eltorito-alt-boot \
-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 \
-o ${iso_dir}/${iso_file} \
${iso_root}/
-eltorito-boot isolinux/isolinux.bin \
-eltorito-catalog isolinux/boot.cat \
-no-emul-boot -boot-load-size 4 -boot-info-table \
-isohybrid-mbr "${work_dir}/iso/isolinux/isohdpfx.bin" \
${efi_boot_args[@]} \
-output "${iso_dir}/${iso_file}" \
"${work_dir}/iso/"
}
# Build ISO
make_iso() {
msg "Start [Build 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}"
touch "${work_dir}/iso/.miso"
for d in $(find "${work_dir}" -maxdepth 1 -type d -name '[^.]*'); do
if [[ "$d" != "${work_dir}/iso" ]] && \
[[ "${d##*/}" != "iso" ]] && \
[[ "${d##*/}" != "efiboot" ]] && \
[[ "$d" != "${work_dir}" ]]; then
make_sqfs "$d"
fi
done
msg "Making bootable image"
# Sanity checks
[[ ! -d "${iso_root}" ]] && return 1
[[ ! -d "${work_dir}/iso" ]] && 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
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}")
vars+=("${target_arch}")
for n in ${vars[@]};do
name=${name:-}${name:+-}${n}
done
echo $name
}
@ -285,157 +191,90 @@ reset_pac_conf(){
-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
}
# Base installation (rootfs)
# Base installation (root-image)
make_image_root() {
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
msg "Prepare [Base installation] (rootfs)"
local path="${work_dir}/rootfs"
msg "Prepare [Base installation] (root-image)"
local path="${work_dir}/root-image"
mkdir -p ${path}
chroot_create "${path}" "${packages}" || die
# profide multilib usage to mhwd-script
if [[ ! -z ${multilib} ]]; then
echo 'MHWD64_IS_LIB32="'${multilib}'"' > "${path}/etc/mhwd-x86_64.conf"
fi
pacman -Qr "${path}" > "${path}/rootfs-pkgs.txt"
pacman -Qr "${path}" > "${path}/root-image-pkgs.txt"
copy_overlay "${profile_dir}/root-overlay" "${path}"
reset_pac_conf "${path}"
configure_lsb "${path}"
clean_up_image "${path}"
: > ${work_dir}/build.${FUNCNAME}
msg "Done [Base installation] (rootfs)"
msg "Done [Base installation] (root-image)"
fi
}
make_image_desktop() {
make_image_custom() {
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
msg "Prepare [Desktop installation] (desktopfs)"
local path="${work_dir}/desktopfs"
msg "Prepare [Desktop installation] (%s-image)" "${profile}"
local path="${work_dir}/${profile}-image"
mkdir -p ${path}
mount_fs_root "${path}"
mount_image "${path}"
chroot_create "${path}" "${packages}"
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}"
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 "${path}" > "${path}/${profile}-image-pkgs.txt"
cp "${path}/${profile}-image-pkgs.txt" ${iso_dir}/$(gen_iso_fn)-pkgs.txt
[[ -e ${profile_dir}/${profile}-overlay ]] && copy_overlay "${profile_dir}/${profile}-overlay" "${path}"
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"
umount_fs
umount_image
clean_up_image "${path}"
: > ${work_dir}/build.${FUNCNAME}
msg "Done [Desktop installation] (desktopfs)"
msg "Done [Desktop installation] (%s-image)" "${profile}"
fi
}
mount_fs_select(){
if [[ -f "${packages_desktop}" ]]; then
mount_fs_desktop "$1"
mount_image_select(){
if [[ -f "${packages_custom}" ]]; then
mount_image_custom "$1"
else
mount_fs_root "$1"
mount_image "$1"
fi
}
make_image_live() {
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
msg "Prepare [Live installation] (livefs)"
local path="${work_dir}/livefs"
msg "Prepare [Live installation] (live-image)"
local path="${work_dir}/live-image"
mkdir -p ${path}
mount_fs_select "${path}"
mount_image_select "${path}"
chroot_create "${path}" "${packages}"
pacman -Qr "${path}" > "${path}/livefs-pkgs.txt"
pacman -Qr "${path}" > "${path}/live-image-pkgs.txt"
copy_overlay "${profile_dir}/live-overlay" "${path}"
configure_live_image "${path}"
# 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
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}"
umount_fs
umount_image
# Clean up GnuPG keys
rm -rf "${path}/etc/pacman.d/gnupg"
clean_up_image "${path}"
: > ${work_dir}/build.${FUNCNAME}
msg "Done [Live installation] (livefs)"
msg "Done [Live installation] (live-image)"
fi
}
make_image_mhwd() {
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
msg "Prepare [drivers repository] (mhwdfs)"
local path="${work_dir}/mhwdfs"
msg "Prepare [drivers repository] (mhwd-image)"
local path="${work_dir}/mhwd-image"
mkdir -p ${path}${mhwd_repo}
mount_fs_select "${path}"
mount_image_select "${path}"
reset_pac_conf "${path}"
@ -446,101 +285,178 @@ make_image_mhwd() {
rm ${path}${mhwd_repo}/${mhwd_clean}
done
fi
cp ${DATADIR}/pacman-mhwd.conf ${path}/opt/mhwd
cp ${DATADIR}/pacman-mhwd.conf ${path}/opt
make_repo "${path}"
configure_mhwd_drivers "${path}"
umount_fs
umount_image
clean_up_image "${path}"
: > ${work_dir}/build.${FUNCNAME}
msg "Done [drivers repository] (mhwdfs)"
msg "Done [drivers repository] (mhwd-image)"
fi
}
make_image_boot() {
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
msg "Prepare [/iso/boot]"
local boot="${iso_root}/boot"
mkdir -p ${boot}
cp ${work_dir}/rootfs/boot/vmlinuz* ${boot}/vmlinuz-${target_arch}
local path="${work_dir}/bootfs"
msg "Prepare [%s/boot]" "${iso_name}"
local path_iso="${work_dir}/iso/${iso_name}/boot"
mkdir -p ${path_iso}/${target_arch}
cp ${work_dir}/root-image/boot/memtest86+/memtest.bin ${path_iso}/${target_arch}/memtest
cp ${work_dir}/root-image/boot/vmlinuz* ${path_iso}/${target_arch}/${iso_name}
local path="${work_dir}/boot-image"
mkdir -p ${path}
if [[ -f "${packages_desktop}" ]]; then
mount_fs_live "${path}"
else
mount_fs_net "${path}"
fi
mount_image_select "${path}"
configure_plymouth "${path}"
prepare_initcpio "${path}"
prepare_initramfs "${path}"
copy_initcpio "${profile_dir}" "${path}"
cp ${path}/boot/initramfs.img ${boot}/initramfs-${target_arch}.img
prepare_boot_extras "${path}" "${boot}"
gen_boot_image "${path}"
umount_fs
mv ${path}/boot/${iso_name}.img ${path_iso}/${target_arch}/${iso_name}.img
[[ -f ${path}/boot/intel-ucode.img ]] && copy_ucode "${path}" "${path_iso}"
umount_image
rm -R ${path}
: > ${work_dir}/build.${FUNCNAME}
msg "Done [/iso/boot]"
msg "Done [%s/boot]" "${iso_name}"
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})
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
}
configure_grub_theme(){
sed -e "s|@ISO_NAME@|${iso_name}|" -i "$1"
}
make_grub(){
# Prepare /EFI
make_efi() {
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
msg "Prepare [/iso/boot/grub]"
local path="${work_dir}/livefs"
prepare_grub "${path}" "${iso_root}"
configure_grub "${iso_root}/boot/grub/kernels.cfg"
configure_grub_theme "${iso_root}/boot/grub/variable.cfg"
msg "Prepare [%s/boot/EFI]" "${iso_name}"
local path_iso="${work_dir}/iso"
local path_efi="${path_iso}/EFI"
mkdir -p ${path_efi}/boot
copy_efi_loaders "${work_dir}/root-image" "${path_efi}/boot"
mkdir -p ${path_iso}/loader/entries
write_loader_conf "${path_iso}/loader"
write_efi_shellv1_conf "${path_iso}/loader/entries"
write_efi_shellv2_conf "${path_iso}/loader/entries"
write_usb_conf "${path_iso}/loader/entries" "${path_iso}"
write_usb_nonfree_conf "${path_iso}/loader/entries" "${path_iso}"
copy_efi_shells "${path_efi}"
: > ${work_dir}/build.${FUNCNAME}
msg "Done [/iso/boot/grub]"
msg "Done [%s/boot/EFI]" "${iso_name}"
fi
}
# Prepare kernel.img::/EFI for "El Torito" EFI boot mode
make_efiboot() {
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
msg "Prepare [%s/iso/EFI]" "${iso_name}"
local path_iso="${work_dir}/iso" size="31M"
mkdir -p ${path_iso}/EFI/miso
truncate -s ${size} ${path_iso}/EFI/miso/${iso_name}.img
mkfs.fat -n MISO_EFI ${path_iso}/EFI/miso/${iso_name}.img
mkdir -p ${work_dir}/efiboot
mount ${path_iso}/EFI/miso/${iso_name}.img ${work_dir}/efiboot
local path_efi="${work_dir}/efiboot/EFI"
mkdir -p ${path_efi}/miso
copy_boot_images "${path_iso}/${iso_name}/boot" "${path_efi}/miso"
mkdir -p ${path_efi}/boot
copy_efi_loaders "${work_dir}/root-image" "${path_efi}/boot"
local efi_loader=${work_dir}/efiboot/loader
mkdir -p ${efi_loader}/entries
write_loader_conf "${efi_loader}"
write_efi_shellv1_conf "${efi_loader}/entries"
write_efi_shellv2_conf "${efi_loader}/entries"
write_dvd_conf "${efi_loader}/entries" "${path_iso}"
write_dvd_nonfree_conf "${efi_loader}/entries" "${path_iso}"
copy_efi_shells "${path_efi}"
umount ${work_dir}/efiboot
: > ${work_dir}/build.${FUNCNAME}
msg "Done [%s/iso/EFI]" "${iso_name}"
fi
}
# Prepare /isolinux
make_isolinux() {
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
msg "Prepare [%s/iso/isolinux]" "${iso_name}"
local path=${work_dir}/iso/isolinux
mkdir -p ${path}
copy_overlay "${DATADIR}/isolinux" "${path}"
write_isolinux_cfg "${path}" "${work_dir}/iso"
write_isolinux_msg "${path}"
if [[ -e ${profile_dir}/isolinux-overlay ]]; then
copy_overlay "${profile_dir}/isolinux-overlay" "${path}"
update_isolinux_cfg "${profile_dir}/isolinux-overlay" "${path}"
update_isolinux_msg "${profile_dir}/isolinux-overlay" "${path}"
fi
copy_isolinux_bin "${work_dir}/root-image" "${path}"
: > ${work_dir}/build.${FUNCNAME}
msg "Done [%s/iso/isolinux]" "${iso_name}"
fi
}
make_isomounts() {
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
msg "Prepare [isomounts]"
write_isomounts "${work_dir}/iso/${iso_name}"
: > ${work_dir}/build.${FUNCNAME}
msg "Done [isomounts]"
fi
}
check_requirements(){
[[ -f ${run_dir}/repo_info ]] || die "%s is not a valid iso profiles directory!" "${run_dir}"
if ! $(is_valid_arch_iso ${target_arch}); then
[[ -f ${run_dir}/.buildiso ]] || 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
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}"
if ! is_valid_init "${initsys}";then
die "%s is not a valid init system!" "${initsys}"
fi
local iso_kernel=${kernel:5:1}
[[ ${iso_kernel} < "4" ]] && die "ISO kernel must be version>=4.0!"
local iso_kernel=${kernel:5:1} host_kernel=$(uname -r)
if [[ ${iso_kernel} < "4" ]] || [[ ${host_kernel%%*.} < "4" ]];then
use_overlayfs='false'
fi
if ${use_overlayfs};then
iso_fs="overlayfs"
else
iso_fs="aufs"
fi
import ${LIBDIR}/util-iso-${iso_fs}.sh
}
sign_iso(){
su ${OWNER} -c "signfile ${iso_dir}/$1"
}
make_torrent(){
local fn=${iso_file}.torrent
msg2 "Creating (%s) ..." "${fn}"
[[ -f ${iso_dir}/${fn} ]] && rm ${iso_dir}/${fn}
mktorrent ${mktorrent_args[*]} -o ${iso_dir}/${fn} ${iso_dir}/${iso_file}
}
# $1: file
make_checksum(){
msg "Creating [%s] sum ..." "${iso_checksum}"
cd ${iso_dir}
local cs=$(${iso_checksum}sum $1)
msg2 "%s sum: %s" "${iso_checksum}" "${cs##*/}"
echo "${cs}" > ${iso_dir}/$1.${iso_checksum}
msg "Done [%s] sum" "${iso_checksum}"
}
compress_images(){
local timer=$(get_timer)
run_safe "make_iso"
user_own "${cache_dir_iso}" "-R"
make_checksum "${iso_file}"
${sign} && sign_iso "${iso_file}"
${torrent} && make_torrent
user_own "${iso_dir}" "-R"
show_elapsed_time "${FUNCNAME}" "${timer}"
}
@ -548,9 +464,9 @@ 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}"
run_safe "make_image_desktop"
if [[ -f "${packages_custom}" ]] ; then
load_pkgs "${packages_custom}"
run_safe "make_image_custom"
fi
if [[ -f ${profile_dir}/Packages-Live ]]; then
load_pkgs "${profile_dir}/Packages-Live"
@ -561,8 +477,12 @@ prepare_images(){
run_safe "make_image_mhwd"
fi
run_safe "make_image_boot"
run_safe "make_grub"
if [[ "${target_arch}" == "x86_64" ]]; then
run_safe "make_efi"
run_safe "make_efiboot"
fi
run_safe "make_isolinux"
run_safe "make_isomounts"
show_elapsed_time "${FUNCNAME}" "${timer}"
}
@ -577,20 +497,7 @@ archive_logs(){
make_profile(){
msg "Start building [%s]" "${profile}"
if ${clean_first}; then
chroot_clean "${chroots_iso}/${profile}/${target_arch}"
local unused_arch=''
case ${target_arch} in
i686) unused_arch='x86_64' ;;
x86_64) unused_arch='i686' ;;
esac
if [[ -d "${chroots_iso}/${profile}/${unused_arch}" ]]; then
chroot_clean "${chroots_iso}/${profile}/${unused_arch}"
fi
clean_iso_root "${iso_root}"
fi
${clean_first} && chroot_clean "${work_dir}"
if ${iso_only}; then
[[ ! -d ${work_dir} ]] && die "Create images: buildiso -p %s -x" "${profile}"
compress_images
@ -615,7 +522,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,8 +533,20 @@ get_pacman_conf(){
echo "$conf"
}
gen_webseed(){
local webseed url project=$(get_project "${edition}")
url=${host}/project/${project}/${dist_release}/${profile}/${iso_file}
local mirrors=('heanet' 'jaist' 'netcologne' 'iweb' 'kent')
for m in ${mirrors[@]};do
webseed=${webseed:-}${webseed:+,}"http://${m}.dl.${url}"
done
echo ${webseed}
}
load_profile(){
conf="$1/profile.conf"
conf="${profile_dir}/profile.conf"
info "Profile: [%s]" "${profile}"
@ -639,28 +558,23 @@ load_profile(){
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}"
iso_dir="${cache_dir_iso}/${edition}/${dist_release}/${profile}"
prepare_dir "${iso_dir}"
user_own "${cache_dir_iso}" "-R"
user_own "${iso_dir}"
mktorrent_args=(-v -p -l ${piece_size} -a ${tracker_url} -w $(gen_webseed))
}
prepare_profile(){
profile=$1
edition=$(get_edition ${profile})
profile_dir=${run_dir}/${edition}/${profile}
check_profile "${profile_dir}"
load_profile "${profile_dir}"
check_profile
load_profile
}
build(){

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
;;
@ -106,8 +108,8 @@ chroot_mount_partitions(){
chroot_mount_conditional "! mountpoint -q '$1'" "$1" "$1" --bind &&
chroot_mount proc "$1/proc" -t proc -o nosuid,noexec,nodev &&
chroot_mount sys "$1/sys" -t sysfs -o nosuid,noexec,nodev,ro &&
ignore_error chroot_mount_conditional "[[ -d '$1/sys/firmware/efi/efivars' ]]" \
efivarfs "$1/sys/firmware/efi/efivars" -t efivarfs -o nosuid,noexec,nodev &&
# ignore_error chroot_mount_conditional "[[ -d '$1/sys/firmware/efi/efivars' ]]" \
# efivarfs "$1/sys/firmware/efi/efivars" -t efivarfs -o nosuid,noexec,nodev &&
chroot_mount udev "$1/dev" -t devtmpfs -o mode=0755,nosuid &&
chroot_mount devpts "$1/dev/pts" -t devpts -o mode=0620,gid=5,nosuid,noexec &&
chroot_mount shm "$1/dev/shm" -t tmpfs -o mode=1777,nosuid,nodev &&
@ -128,23 +130,6 @@ chroot_mount_conditional() {
fi
}
chroot_api_efi_mount() {
CHROOT_ACTIVE_MOUNTS=()
[[ $(trap -p EXIT) ]] && die 'Error! Attempting to overwrite existing EXIT trap'
trap 'chroot_api_efi_umount' EXIT
chroot_mount_conditional "! mountpoint -q '$1'" "$1" "$1" --bind &&
chroot_mount proc "$1/proc" -t proc -o nosuid,noexec,nodev &&
chroot_mount sys "$1/sys" -t sysfs -o nosuid,noexec,nodev,ro &&
ignore_error chroot_mount_conditional "[[ -d '$1/sys/firmware/efi/efivars' ]]" \
efivarfs "$1/sys/firmware/efi/efivars" -t efivarfs -o nosuid,noexec,nodev &&
chroot_mount udev "$1/dev" -t devtmpfs -o mode=0755,nosuid &&
chroot_mount devpts "$1/dev/pts" -t devpts -o mode=0620,gid=5,nosuid,noexec &&
chroot_mount shm "$1/dev/shm" -t tmpfs -o mode=1777,nosuid,nodev &&
chroot_mount run "$1/run" -t tmpfs -o nosuid,nodev,mode=0755 &&
chroot_mount tmp "$1/tmp" -t tmpfs -o mode=1777,strictatime,nodev,nosuid
}
chroot_api_mount() {
CHROOT_ACTIVE_MOUNTS=()
[[ $(trap -p EXIT) ]] && die 'Error! Attempting to overwrite existing EXIT trap'
@ -153,6 +138,8 @@ chroot_api_mount() {
chroot_mount_conditional "! mountpoint -q '$1'" "$1" "$1" --bind &&
chroot_mount proc "$1/proc" -t proc -o nosuid,noexec,nodev &&
chroot_mount sys "$1/sys" -t sysfs -o nosuid,noexec,nodev,ro &&
# ignore_error chroot_mount_conditional "[[ -d '$1/sys/firmware/efi/efivars' ]]" \
# efivarfs "$1/sys/firmware/efi/efivars" -t efivarfs -o nosuid,noexec,nodev &&
chroot_mount udev "$1/dev" -t devtmpfs -o mode=0755,nosuid &&
chroot_mount devpts "$1/dev/pts" -t devpts -o mode=0620,gid=5,nosuid,noexec &&
chroot_mount shm "$1/dev/shm" -t tmpfs -o mode=1777,nosuid,nodev &&
@ -172,12 +159,6 @@ chroot_api_umount() {
unset CHROOT_ACTIVE_MOUNTS
}
chroot_api_efi_umount() {
#info "umount: [%s]" "${CHROOT_ACTIVE_MOUNTS[@]}"
umount "${CHROOT_ACTIVE_MOUNTS[@]}"
unset CHROOT_ACTIVE_MOUNTS
}
trap_handler(){
chroot_api_umount
chroot_part_umount

View file

@ -95,7 +95,7 @@ die() {
}
import(){
if [[ -r $1 ]]; then
if [[ -r $1 ]];then
source $1
else
die "Could not import $1"

View file

@ -1,199 +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.
load_compiler_settings(){
local tarch="$1" conf
conf=${make_conf_dir}/$tarch.conf
[[ -f $conf ]] || return 1
info "Loading compiler settings: %s" "$tarch"
source $conf
return 0
}
get_makepkg_conf(){
local conf="${tmp_dir}/makepkg-$1.conf"
cp "${DATADIR}/makepkg.conf" "$conf"
load_compiler_settings "$1"
sed -i "$conf" \
-e "s|@CARCH[@]|$carch|g" \
-e "s|@CHOST[@]|$chost|g" \
-e "s|@CFLAGS[@]|$cflags|g"
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!"
}
find_pkg(){
local result=$(find . -type d -name "$1")
[[ -z $result ]] && die "%s is not a valid package or build list!" "$1"
}
init_base_devel(){
if ${is_multilib}; then
base_packages=('base-devel' 'multilib-devel')
else
base_packages=('base-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 ..."
msg2 "Cleaning [%s]" "${pkg_dir}"
find ${pkg_dir} -maxdepth 1 -name "*.*" -delete #&> /dev/null
if [[ -z $SRCDEST ]]; then
msg2 "Cleaning [source files]"
find $PWD -maxdepth 1 -name '*.?z?' -delete #&> /dev/null
fi
}
sign_pkg(){
su ${OWNER} -c "signfile ${pkg_dir}/$1"
}
move_to_cache(){
local src="$1"
[[ -n $PKGDEST ]] && src="$PKGDEST/$1"
[[ ! -f $src ]] && die
if [[ ${pkg_dir} != $PKGDEST ]]; then
msg2 "Moving [%s] -> [%s]" "${src##*/}" "${pkg_dir}"
mv $src ${pkg_dir}/
fi
${sign} && sign_pkg "${src##*/}"
user_own "${pkg_dir}" "-R"
}
archive_logs(){
local archive name="$1" ext=log.tar.xz ver src=${tmp_dir}/archives.list target='.'
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
else
find $target -maxdepth 1 -name "$archive*.log" > $src
fi
msg2 "Archiving log files [%s] ..." "$archive.$ext"
tar -cJf ${log_dir}/$archive.$ext -C "$target" -T $src
msg2 "Cleaning log files ..."
find $target -maxdepth 1 -name "$archive*.log" -delete
}
post_build(){
source PKGBUILD
local ext='pkg.tar.zst' tarch ver src
for pkg in ${pkgname[@]}; do
case $arch in
any) tarch='any' ;;
*) tarch=${target_arch}
esac
local ver=$(get_full_version "$pkg") src
src=$pkg-$ver-$tarch.$ext
move_to_cache "$src"
done
local name=${pkgbase:-$pkgname}
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(){
setarch "${target_arch}" \
mkchrootpkg ${mkchrootpkg_args[*]}
post_build
}
make_pkg(){
check_build "$1"
msg "Start building [%s]" "$1"
cd $1
build_pkg
cd ..
msg "Finished building [%s]" "$1"
show_elapsed_time "${FUNCNAME}" "${timer_start}"
}

View file

@ -9,26 +9,59 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
import ${LIBDIR}/util.sh
load_compiler_settings(){
local tarch="$1" conf
conf=${make_conf_dir}/$tarch.conf
# $1: sofile
# $2: soarch
process_sofile() {
# extract the library name: libfoo.so
local soname="${1%.so?(+(.+([0-9])))}".so
# extract the major version: 1
soversion="${1##*\.so\.}"
if [[ "$soversion" = "$1" ]] && (($IGNORE_INTERNAL)); then
continue
[[ -f $conf ]] || return 1
info "Loading compiler settings: %s" "$tarch"
source $conf
return 0
}
get_makepkg_conf(){
local conf="${tmp_dir}/makepkg-$1.conf"
cp "${DATADIR}/makepkg.conf" "$conf"
load_compiler_settings "$1"
sed -i "$conf" \
-e "s|@CARCH[@]|$carch|g" \
-e "s|@CHOST[@]|$chost|g" \
-e "s|@CFLAGS[@]|$cflags|g"
echo "$conf"
}
# $1: target_arch
prepare_conf(){
if ! is_valid_arch_pkg "$1";then
die "%s is not a valid arch!" "$1"
fi
if ! in_array "${soname}=${soversion}-$2" ${soobjects[@]}; then
# libfoo.so=1-64
msg "${soname}=${soversion}-$2"
soobjects+=("${soname}=${soversion}-$2")
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'
}
pkgver_equal() {
local left right
if [[ $1 = *-* && $2 = *-* ]]; then
# if both versions have a pkgrel, then they must be an exact match
[[ $1 = "$2" ]]
@ -65,7 +98,7 @@ get_full_version() {
find_cached_package() {
local searchdirs=("$PWD" "$PKGDEST") results=()
local targetname=$1 targetver=$2 targetarch=$3
local dir pkg pkgbasename name ver rel arch r results
local dir pkg pkgbasename pkgparts name ver rel arch size r results
for dir in "${searchdirs[@]}"; do
[[ -d $dir ]] || continue
@ -113,3 +146,171 @@ find_cached_package() {
;;
esac
}
check_build(){
find_pkg $1
[[ ! -f $1/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"
}
load_group(){
local _multi \
_space="s| ||g" \
_clean=':a;N;$!ba;s/\n/ /g' \
_com_rm="s|#.*||g" \
devel_group='' \
file=${DATADIR}/base-devel-udev
info "Loading custom group: %s" "$file"
if ${is_multilib}; then
_multi="s|>multilib||g"
else
_multi="s|>multilib.*||g"
fi
devel_group=$(sed "$_com_rm" "$file" \
| sed "$_space" \
| sed "$_multi" \
| sed "$_clean")
echo ${devel_group}
}
init_base_devel(){
if ${udev_root};then
base_packages=( "$(load_group)" )
else
if ${is_multilib};then
base_packages=('base-devel' 'multilib-devel')
else
base_packages=('base-devel')
fi
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}'"
if [[ "$(stat -f -c %T "${copy}")" == btrfs ]]; then
{ type -P btrfs && btrfs subvolume delete "${copy}"; } &>/dev/null
fi
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 ..."
msg2 "Cleaning [%s]" "${pkg_dir}"
find ${pkg_dir} -maxdepth 1 -name "*.*" -delete #&> /dev/null
if [[ -z $SRCDEST ]];then
msg2 "Cleaning [source files]"
find $PWD -maxdepth 1 -name '*.?z?' -delete #&> /dev/null
fi
}
sign_pkg(){
su ${OWNER} -c "signfile ${pkg_dir}/$1"
}
move_to_cache(){
local src="$1"
[[ -n $PKGDEST ]] && src="$PKGDEST/$1"
msg2 "Moving [%s] -> [%s]" "${src##*/}" "${pkg_dir}"
mv $src ${pkg_dir}/
${sign} && sign_pkg "${src##*/}"
[[ -n $PKGDEST ]] && rm "$1"
user_own "${pkg_dir}" "-R"
}
archive_logs(){
local archive name="$1" ext=log.tar.xz ver src=${tmp_dir}/archives.list target='.'
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
else
find $target -maxdepth 1 -name "$archive*.log" > $src
fi
msg2 "Archiving log files [%s] ..." "$archive.$ext"
tar -cJf ${log_dir}/$archive.$ext -C "$target" -T $src
msg2 "Cleaning log files ..."
find $target -maxdepth 1 -name "$archive*.log" -delete
}
post_build(){
source PKGBUILD
local ext='pkg.tar.xz' tarch ver src
for pkg in ${pkgname[@]};do
case $arch in
any) tarch='any' ;;
*) tarch=${target_arch}
esac
local ver=$(get_full_version "$pkg") src
src=$pkg-$ver-$tarch.$ext
move_to_cache "$src"
done
local name=${pkgbase:-$pkgname}
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(){
setarch "${target_arch}" \
mkchrootpkg ${mkchrootpkg_args[*]} || return 1
if [ $? -eq 0 ]; then
post_build
fi
}
make_pkg(){
check_build "$1"
msg "Start building [%s]" "$1"
cd $1
build_pkg
cd ..
msg "Finished building [%s]" "$1"
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,253 +9,42 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
local MINIMAL
create_release(){
msg "Create release (%s) ..." "${dist_release}"
rsync ${rsync_args[*]} /dev/null ${url}/${dist_release}/
show_elapsed_time "${FUNCNAME}" "${timer_start}"
msg "Done (%s)" "${dist_release}"
}
get_edition(){
local result=$(find ${run_dir} -maxdepth 3 -name "$1") path
[[ -z $result ]] && die "%s is not a valid profile or build list!" "$1"
path=${result%/*}
path=${path%/*}
echo ${path##*/}
}
connect(){
${alt_storage} && server="storage-in" || server="storage"
local storage="@${server}.osdn.net:/storage/groups/m/ma/"
echo "${account}${storage}${project}"
}
connect_shell(){
local shell="@shell.osdn.net:/home/groups/m/ma/"
echo "${account}${shell}${project}"
}
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})
${verbose} && mktorrent_args+=(-v)
msg2 "Creating (%s) ..." "${iso##*/}.torrent"
mktorrent ${mktorrent_args[*]} -o ${iso}.torrent ${iso}
done
fi
local home="/home/frs/project"
echo "${account},$1@frs.${host}:${home}/$1"
}
prepare_transfer(){
profile="$1"
hidden="$2"
edition=$(get_edition "${profile}")
[[ -z ${project} ]] && project="$(get_project)"
server=$(connect)
webshell=$(connect_shell)
htdocs="htdocs/${profile}"
target_dir="${profile}/${dist_release}"
local edition=$(get_edition $1)
project=$(get_project "${edition}")
url=$(connect "${project}")
target_dir="${dist_release}/$1"
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
}
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
prepare_transfer "$1"
if ${release} && ! ${exists};then
create_release
exists=true
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}
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="shutdown -r now"
echo '---' > "$conf"
echo 'restartNowEnabled: true' >> "$conf"
echo 'restartNowChecked: false' >> "$conf"
[[ ${initsys} == 'systemd' ]] && cmd="systemctl -i 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,87 +121,51 @@ 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 " - source: \"/bootmnt/${iso_name}/${target_arch}/root-image.sqfs\"" >> "$conf"
echo " sourcefs: \"squashfs\"" >> "$conf"
echo " destination: \"\"" >> "$conf"
if [[ -f "${packages_desktop}" ]] ; then
echo " - source: \"/run/miso/bootmnt/${iso_name}/${target_arch}/desktopfs.sfs\"" >> "$conf"
if [[ -f "${packages_custom}" ]] ; then
echo " - source: \"/bootmnt/${iso_name}/${target_arch}/${profile}-image.sqfs\"" >> "$conf"
echo " sourcefs: \"squashfs\"" >> "$conf"
echo " destination: \"\"" >> "$conf"
fi
}
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"
echo "autologinGroup: autologin" >> "$conf"
echo "sudoersGroup: wheel" >> "$conf"
echo "setRootPassword: true" >> "$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"
@ -237,7 +175,6 @@ write_welcome_conf(){
echo "requirements:" >> "$conf"
echo " requiredStorage: 7.9" >> "$conf"
echo " requiredRam: 1.0" >> "$conf"
echo " internetCheckUrl: https://manjaro.org" >> "$conf"
echo " check:" >> "$conf"
echo " - storage" >> "$conf"
echo " - ram" >> "$conf"
@ -248,19 +185,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"
@ -280,20 +211,20 @@ write_mhwdcfg_conf(){
echo "driver: ${drv}" >> "$conf"
echo '' >> "$conf"
local switch='true'
${netinstall} && switch='false'
${chrootcfg} && 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"
@ -301,41 +232,44 @@ write_postcfg_conf(){
}
get_yaml(){
local args=() yaml
if ${chrootcfg}; then
args+=("${profile}/chrootcfg")
local args=() ext="yaml" yaml
if ${chrootcfg};then
args+=('netinstall')
else
args+=("${profile}/packages")
args+=("hybrid")
fi
args+=("systemd")
for arg in ${args[@]}; do
args+=("${initsys}")
[[ ${edition} == 'sonar' ]] && args+=("${edition}")
for arg in ${args[@]};do
yaml=${yaml:-}${yaml:+-}${arg}
done
echo "${yaml}.yaml"
echo "${yaml}.${ext}"
}
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_plymouthcfg_conf(){
local conf="${modules_dir}/plymouthcfg.conf"
msg2 "Writing %s ..." "${conf##*/}"
echo "---" > "$conf"
echo "plymouth_theme: ${plymouth_theme}" >> "$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 +282,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 +308,40 @@ 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 " - plymouthcfg" >> "$conf" && write_plymouthcfg_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 " - postcfg" >> "$conf" && write_postcfg_conf
echo " - 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]"
}
@ -481,11 +368,12 @@ check_yaml(){
write_calamares_yaml(){
configure_calamares "${yaml_dir}"
local yf
if ${validate}; then
for conf in "${yaml_dir}"/etc/calamares/modules/*.conf "${yaml_dir}"/etc/calamares/settings.conf; do
check_yaml "$conf"
done
fi
fi
}
write_netgroup_yaml(){
@ -495,12 +383,11 @@ write_netgroup_yaml(){
echo " description: '$1'" >> "$2"
echo " selected: false" >> "$2"
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"
${validate} && check_yaml "$2"
}
write_pacman_group_yaml(){
@ -513,9 +400,9 @@ write_pacman_group_yaml(){
prepare_check(){
profile=$1
local edition=$(get_edition ${profile})
edition=$(get_edition ${profile})
profile_dir=${run_dir}/${edition}/${profile}
check_profile "${profile_dir}"
check_profile
load_profile_config "${profile_dir}/profile.conf"
yaml_dir=${cache_dir_netinstall}/${profile}/${target_arch}
@ -525,16 +412,16 @@ 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}"
write_netgroup_yaml "$1" "$(gen_fn "Packages-Desktop")"
if [[ -f "${packages_custom}" ]]; then
load_pkgs "${packages_custom}"
write_netgroup_yaml "$1" "$(gen_fn "${packages_custom##*/}")"
fi
${calamares} && write_calamares_yaml "$1"
user_own "${cache_dir_netinstall}/$1" "-R"

View file

@ -93,12 +93,12 @@ show_build_lists(){
# $1: make_conf_dir
show_build_profiles(){
local cpuarch temp
local arch temp
for item in $(ls $1/*.conf); do
temp=${item##*/}
cpuarch=${cpuarch:-}${cpuarch:+|}${temp%.conf}
arch=${arch:-}${arch:+|}${temp%.conf}
done
echo $cpuarch
echo $arch
}
# $1: list_dir
@ -133,6 +133,16 @@ show_elapsed_time(){
info "Time %s: %s minutes" "$1" "$(elapsed_time $2)"
}
get_project(){
local project
case "$1" in
'community'|'minimal') project='manjarolinux-community' ;;
'official') project='manjarolinux' ;;
'sonar') project='sonargnulinux' ;;
esac
echo ${project}
}
lock() {
eval "exec $1>"'"$2"'
if ! flock -n $1; then
@ -183,9 +193,13 @@ load_vars() {
}
prepare_dir(){
if [[ ! -d $1 ]]; then
mkdir -p $1
fi
[[ ! -d $1 ]] && mkdir -p $1
}
version_gen(){
local y=$(date +%Y) m=$(date +%m) ver
ver=${y:2}.$m
echo $ver
}
# $1: chroot
@ -196,10 +210,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(){
@ -213,9 +225,11 @@ init_common(){
[[ -z ${log_dir} ]] && log_dir='/var/log/manjaro-tools'
[[ -z ${build_mirror} ]] && build_mirror='https://mirror.easyname.at/manjaro'
[[ -z ${build_mirror} ]] && build_mirror='http://mirror.netzspielplatz.de/manjaro/packages'
[[ -z ${tmp_dir} ]] && tmp_dir='/tmp/manjaro-tools'
[[ -z ${host} ]] && host="sourceforge.net"
}
init_buildtree(){
@ -223,7 +237,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'
@ -246,10 +260,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}
}
@ -258,36 +272,6 @@ get_codename(){
echo "${DISTRIB_CODENAME}"
}
get_release(){
source /etc/lsb-release
echo "${DISTRIB_RELEASE}"
}
get_distname(){
source /etc/lsb-release
echo "${DISTRIB_ID%Linux}"
}
get_distid(){
source /etc/lsb-release
echo "${DISTRIB_ID}"
}
get_disturl(){
source /usr/lib/os-release
echo "${HOME_URL}"
}
get_osname(){
source /usr/lib/os-release
echo "${NAME}"
}
get_osid(){
source /usr/lib/os-release
echo "${ID}"
}
init_buildiso(){
chroots_iso="${chroots_dir}/buildiso"
@ -299,75 +283,44 @@ init_buildiso(){
cache_dir_iso="${cache_dir}/iso"
profile_repo='iso-profiles'
##### iso settings #####
[[ -z ${dist_release} ]] && dist_release=$(get_release)
[[ -z ${dist_release} ]] && dist_release=$(version_gen)
[[ -z ${dist_codename} ]] && dist_codename=$(get_codename)
dist_name=$(get_distname)
[[ -z ${dist_branding} ]] && dist_branding="MJRO"
iso_name=$(get_osid)
[[ -z ${dist_name} ]] && dist_name="Manjaro"
[[ -z ${dist_branding} ]] && dist_branding="MANJARO"
iso_name=${dist_name,,}
[[ -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 ${iso_publisher} ]] && iso_publisher='Manjaro Linux <http://www.manjaro.org>'
[[ -z ${gpgkey} ]] && gpgkey=''
[[ -z ${iso_app_id} ]] && iso_app_id='Manjaro Linux Live/Rescue CD'
mhwd_repo="/opt/mhwd/pkg"
[[ -z ${iso_compression} ]] && iso_compression='xz'
[[ -z ${iso_checksum} ]] && iso_checksum='md5'
[[ -z ${initsys} ]] && initsys="systemd"
[[ -z ${kernel} ]] && kernel="linux44"
[[ -z ${use_overlayfs} ]] && use_overlayfs='true'
[[ -z ${profile_repo} ]] && profile_repo='manjaro-tools-iso-profiles'
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"
[[ -z ${account} ]] && account="[SetUser]"
[[ -z ${alt_storage} ]] && alt_storage=false
[[ -z ${tracker_url} ]] && tracker_url='udp://tracker.opentrackr.org:1337'
[[ -z ${piece_size} ]] && piece_size=21
torrent_meta="$(get_distid)"
[[ -z ${limit} ]] && limit=100
}
load_config(){
@ -386,13 +339,54 @@ load_config(){
init_buildiso
init_calamares
init_deployiso
return 0
}
is_valid_bool(){
case $1 in
'true'|'false') return 0 ;;
*) return 1 ;;
esac
}
check_profile_vars(){
if ! is_valid_bool "${autologin}";then
die "autologin only accepts true/false value!"
fi
if ! is_valid_bool "${multilib}";then
die "multilib only accepts true/false value!"
fi
if ! is_valid_bool "${nonfree_mhwd}";then
die "nonfree_mhwd only accepts true/false value!"
fi
if ! is_valid_bool "${plymouth_boot}";then
die "plymouth_boot only accepts true/false value!"
fi
if ! is_valid_bool "${pxe_boot}";then
die "pxe_boot only accepts true/false value!"
fi
if ! is_valid_bool "${netinstall}";then
die "netinstall only accepts true/false value!"
fi
if ! is_valid_bool "${chrootcfg}";then
die "chrootcfg only accepts true/false value!"
fi
if ! is_valid_bool "${geoip}";then
die "geoip only accepts true/false value!"
fi
}
get_svc(){
local service=${displaymanager}
case $service in
'sddm'|'lxdm') service="$service" ;;
*) ${plymouth_boot} && service="$service-plymouth" ;;
esac
echo $service
}
load_profile_config(){
[[ -f $1 ]] || return 1
@ -406,10 +400,12 @@ 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 ${pxe_boot} ]] && pxe_boot="true"
[[ -z ${plymouth_boot} ]] && plymouth_boot="true"
# [[ ${initsys} == 'openrc' ]] && plymouth_boot="false"
[[ -z ${nonfree_mhwd} ]] && nonfree_mhwd="true"
@ -419,54 +415,58 @@ load_profile_config(){
[[ -z ${username} ]] && username="manjaro"
[[ -z ${password} ]] && password="manjaro"
[[ -z ${plymouth_theme} ]] && plymouth_theme="manjaro-elegant"
[[ -z ${user_shell} ]] && user_shell='/bin/bash'
[[ -z ${password} ]] && password="manjaro"
[[ -z ${login_shell} ]] && login_shell='/bin/bash'
if [[ -z ${addgroups} ]]; then
addgroups="lp,network,power,sys,wheel"
if [[ -z ${addgroups} ]];then
addgroups="video,power,disk,storage,optical,network,lp,scanner,wheel"
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' 'cgmanager' 'consolekit' '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 [[ ${displaymanager} != "none" ]]; then
enable_systemd+=("${displaymanager}")
if [[ -z ${enable_openrc_live[@]} ]];then
enable_openrc_live=('manjaro-live' 'mhwd-live' 'pacman-init' 'mirrors-live')
fi
[[ -z ${needs_internet} ]] && needs_internet='false'
if [[ ${displaymanager} != "none" ]]; then
enable_openrc+=('xdm')
enable_systemd+=("$(get_svc)")
fi
[[ -z ${tracker_url} ]] && tracker_url='udp://mirror.strits.dk:6969'
[[ -z ${piece_size} ]] && piece_size=21
[[ -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/"
#[[ -z ${netgroups} ]] && -- needs to be hardcoded for now, until a standard has been established
# will be unlocked again after everything has been established.
netgroups="https://raw.githubusercontent.com/manjaro/manjaro-tools-iso-profiles/master/shared/netinst"
[[ -z ${geoip} ]] && geoip='true'
[[ -z ${smb_workgroup} ]] && smb_workgroup=''
[[ -z ${extra} ]] && extra='false'
[[ ${full_iso} ]] && extra='true'
basic='true'
[[ ${extra} == 'true' ]] && basic='false'
[[ -z ${office_installer} ]] && office_installer="false"
check_profile_vars
return 0
}
@ -478,58 +478,47 @@ 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 pxe_boot
unset plymouth_boot
unset nonfree_mhwd
unset efi_boot_loader
unset hostname
unset username
unset plymouth_theme
unset password
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 enable_openrc_live
unset packages_custom
unset packages_mhwd
unset user_shell
unset login_shell
unset tracker_url
unset piece_size
unset netinstall
unset chrootcfg
unset netgroups
unset geoip
unset extra
unset full_iso
unset office_installer
unset no_multilib
}
check_profile(){
local keyfiles=("$1/Packages-Root"
"$1/Packages-Live")
local keyfiles=("${profile_dir}/mkinitcpio.conf"
"${profile_dir}/Packages-Root"
"${profile_dir}/Packages-Live")
local keydirs=("$1/root-overlay"
"$1/live-overlay")
local keydirs=("${profile_dir}/root-overlay"
"${profile_dir}/live-overlay")
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,110 +526,96 @@ 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
die "Profile [%s] sanity check failed!" "$1"
if ! ${has_keyfiles} && ! ${has_keydirs};then
die "Profile [%s] sanity check failed!" "${profile_dir}"
fi
[[ -f "$1/Packages-Desktop" ]] && packages_desktop=$1/Packages-Desktop
local files=$(ls ${profile_dir}/Packages*)
for f in ${files[@]};do
case $f in
${profile_dir}/Packages-Root|${profile_dir}/Packages-Live|${profile_dir}/Packages-Mhwd) continue ;;
*) packages_custom="$f" ;;
esac
done
[[ -f "$1/Packages-Mhwd" ]] && packages_mhwd=$1/Packages-Mhwd
[[ -f "${profile_dir}/Packages-Mhwd" ]] && packages_mhwd=${profile_dir}/Packages-Mhwd
if ! ${netinstall}; then
chrootcfg="false"
fi
}
get_shared_list(){
local path
case ${edition} in
sonar|netrunner) path=${run_dir}/shared/${edition}/Packages-Desktop ;;
*) path=${run_dir}/shared/manjaro/Packages-Desktop ;;
esac
echo $path
}
# $1: file name
load_pkgs(){
info "Loading Packages: [%s] ..." "${1##*/}"
local _multi _nonfree_default _nonfree_multi _arch _arch_rm _nonfree_i686 _nonfree_x86_64 _basic _basic_rm _extra _extra_rm
local _init _init_rm _multi _nonfree_default _nonfree_multi _arch _arch_rm _nonfree_i686 _nonfree_x86_64
if ${basic}; then
_basic="s|>basic||g"
if [[ ${initsys} == 'openrc' ]];then
_init="s|>openrc||g"
_init_rm="s|>systemd.*||g"
else
_basic_rm="s|>basic.*||g"
_init="s|>systemd||g"
_init_rm="s|>openrc.*||g"
fi
if [[ "${target_arch}" == "i686" ]]; then
_arch="s|>i686||g"
_arch_rm="s|>x86_64.*||g"
_multi="s|>multilib.*||g"
_nonfree_multi="s|>nonfree_multilib.*||g"
_nonfree_x86_64="s|>nonfree_x86_64.*||g"
if ${nonfree_mhwd};then
_nonfree_default="s|>nonfree_default||g"
_nonfree_i686="s|>nonfree_i686||g"
if ${extra}; then
_extra="s|>extra||g"
else
_nonfree_default="s|>nonfree_default.*||g"
_nonfree_i686="s|>nonfree_i686.*||g"
fi
else
_extra_rm="s|>extra.*||g"
fi
case "${target_arch}" in
"i686")
_arch="s|>i686||g"
_arch_rm="s|>x86_64.*||g"
_multi="s|>multilib.*||g"
_nonfree_multi="s|>nonfree_multilib.*||g"
_nonfree_x86_64="s|>nonfree_x86_64.*||g"
if ${nonfree_mhwd}; then
_arch="s|>x86_64||g"
_arch_rm="s|>i686.*||g"
_nonfree_i686="s|>nonfree_i686.*||g"
if ${multilib};then
_multi="s|>multilib||g"
if ${nonfree_mhwd};then
_nonfree_default="s|>nonfree_default||g"
_nonfree_i686="s|>nonfree_i686||g"
_nonfree_x86_64="s|>nonfree_x86_64||g"
_nonfree_multi="s|>nonfree_multilib||g"
else
_nonfree_default="s|>nonfree_default.*||g"
_nonfree_i686="s|>nonfree_i686.*||g"
_nonfree_multi="s|>nonfree_multilib.*||g"
_nonfree_x86_64="s|>nonfree_x86_64.*||g"
fi
;;
*)
_arch="s|>x86_64||g"
_arch_rm="s|>i686.*||g"
_nonfree_i686="s|>nonfree_i686.*||g"
if ${multilib}; then
_multi="s|>multilib||g"
if ${nonfree_mhwd}; then
_nonfree_default="s|>nonfree_default||g"
_nonfree_x86_64="s|>nonfree_x86_64||g"
_nonfree_multi="s|>nonfree_multilib||g"
else
_nonfree_default="s|>nonfree_default.*||g"
_nonfree_multi="s|>nonfree_multilib.*||g"
_nonfree_x86_64="s|>nonfree_x86_64.*||g"
fi
else
_multi="s|>multilib.*||g"
if ${nonfree_mhwd};then
_nonfree_default="s|>nonfree_default||g"
_nonfree_x86_64="s|>nonfree_x86_64||g"
_nonfree_multi="s|>nonfree_multilib.*||g"
else
_multi="s|>multilib.*||g"
if ${nonfree_mhwd}; then
_nonfree_default="s|>nonfree_default||g"
_nonfree_x86_64="s|>nonfree_x86_64||g"
_nonfree_multi="s|>nonfree_multilib.*||g"
else
_nonfree_default="s|>nonfree_default.*||g"
_nonfree_x86_64="s|>nonfree_x86_64.*||g"
_nonfree_multi="s|>nonfree_multilib.*||g"
fi
_nonfree_default="s|>nonfree_default.*||g"
_nonfree_x86_64="s|>nonfree_x86_64.*||g"
_nonfree_multi="s|>nonfree_multilib.*||g"
fi
;;
esac
# We can reuse this code
local _edition _edition_rm
case "${edition}" in
'sonar')
_edition="s|>sonar||g"
_edition_rm="s|>manjaro.*||g"
;;
*)
_edition="s|>manjaro||g"
_edition_rm="s|>sonar.*||g"
;;
esac
local _office _office_rm
if ${office_installer}; then
_office="s|>office||g"
else
_office_rm="s|>office.*||g"
fi
fi
local _blacklist="s|>blacklist.*||g" \
_kernel="s|KERNEL|$kernel|g" \
_used_kernel=${kernel:5:2} \
@ -650,10 +625,19 @@ load_pkgs(){
_purge="s|>cleanup.*||g" \
_purge_rm="s|>cleanup||g"
packages=$(sed "$_com_rm" "$1" \
local list="$1"
if [[ "$list" == "${packages_custom}" ]];then
sort -u $(get_shared_list) ${packages_custom} > ${tmp_dir}/packages-desktop.list
list=${tmp_dir}/packages-desktop.list
fi
packages=$(sed "$_com_rm" "$list" \
| sed "$_space" \
| sed "$_blacklist" \
| sed "$_purge" \
| sed "$_init" \
| sed "$_init_rm" \
| sed "$_arch" \
| sed "$_arch_rm" \
| sed "$_nonfree_default" \
@ -662,19 +646,12 @@ load_pkgs(){
| sed "$_nonfree_x86_64" \
| sed "$_nonfree_multi" \
| sed "$_kernel" \
| sed "$_edition" \
| sed "$_edition_rm" \
| sed "$_basic" \
| sed "$_basic_rm" \
| sed "$_extra" \
| sed "$_extra_rm" \
| sed "$_office" \
| sed "$_office_rm" \
| sed "$_clean")
if [[ $1 == "${packages_mhwd}" ]]; then
[[ ${_used_kernel} < "42" ]] && local _amd="s|xf86-video-amdgpu||g"
local _used_kernel=${kernel:5:2}
[[ ${_used_kernel} < "42" ]] && local _amd="s|xf86-video-amdgpu||g"
packages_cleanup=$(sed "$_com_rm" "$1" \
| grep cleanup \
@ -698,11 +675,11 @@ clean_dir(){
}
write_repo_conf(){
local repos=$(find $USER_HOME -type f -name "repo_info")
local repos=$(find $USER_HOME -type f -name ".buildiso")
local path name
[[ -z ${repos[@]} ]] && run_dir=${DATADIR}/iso-profiles && return 1
for r in ${repos[@]}; do
path=${r%/repo_info}
path=${r%/.*}
name=${path##*/}
echo "run_dir=$path" > ${USERCONFDIR}/$name.conf
done
@ -734,10 +711,11 @@ show_version(){
show_config(){
if [[ -f ${USERCONFDIR}/manjaro-tools.conf ]]; then
msg2 "config: %s" "~/.config/manjaro-tools/manjaro-tools.conf"
msg2 "user_config: %s" "${USERCONFDIR}/manjaro-tools.conf"
else
msg2 "config: %s" "${manjaro_tools_conf}"
msg2 "manjaro_tools_conf: %s" "${manjaro_tools_conf}"
fi
msg2 "log_dir: %s" "${log_dir}"
}
# $1: chroot
@ -770,6 +748,13 @@ create_min_fs(){
mkdir -m 0555 -p $1/{sys,proc}
}
is_valid_init(){
case $1 in
'openrc'|'systemd') return 0 ;;
*) return 1 ;;
esac
}
is_valid_arch_pkg(){
eval "case $1 in
$(show_build_profiles "${make_conf_dir}")) return 0 ;;
@ -786,72 +771,17 @@ is_valid_arch_iso(){
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 ;;
'stable'|'testing'|'unstable') 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
$1 $2
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
fi
}