Compare commits

..

14 commits

60 changed files with 1768 additions and 2542 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.14.0
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,12 @@ 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
BIN_PKG = \
bin/checkpkg \
@ -44,34 +44,56 @@ 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/manjaro.list \
data/iso.list.d/community.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_aufs \
initcpio/hooks/miso_loop_mnt \
initcpio/hooks/miso_pxe_common \
initcpio/hooks/miso_pxe_http \
initcpio/hooks/miso_pxe_nbd \
initcpio/hooks/miso_pxe_nfs \
initcpio/hooks/miso_shutdown
CPIOINST = \
$(wildcard initcpio/install/*)
initcpio/install/miso \
initcpio/install/miso_aufs \
initcpio/install/miso_loop_mnt \
initcpio/install/miso_pxe_common \
initcpio/install/miso_pxe_http \
initcpio/install/miso_pxe_nbd \
initcpio/install/miso_pxe_nfs \
initcpio/install/miso_kms \
initcpio/install/miso_shutdown
CPIO = \
initcpio/script/miso_shutdown

234
README.md
View file

@ -1,11 +1,11 @@
manjaro-tools
=============
Manjaro-tools-0.15
Manjaro-tools-0.14
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,74 @@ overriding
################ buildiso ################
#default branch for iso-profiles repo: v17.1>current release | master>development release
# branch=v17.1
# default iso build list; name without .list extension
# build_list_iso=default
# the dist release; default: auto
# dist_release=auto
# dist_release=17.0
# the branding; default: auto
# dist_branding="MANJARO"
# dist_branding="MJRO"
# possible values: openrc,systemd
# initsys="systemd"
# unset defaults to given value
# kernel="linux54"
# kernel="linux49"
# experimental; use overlayfs instead of aufs
# requires minimum 4.0 kernel on the build host and on iso in profile.conf
# use_overlayfs="false"
# gpg key; leave empty or commented to skip sfs signing
# gpgkey=""
########## calamares preferences ##########
#See branding.desc.d for reference
# welcome style for calamares: true="Welcome to the %1 installer." ; false="Welcome to the Calamares installer for %1." (default)
# welcomestyle=false
# welcome image scaled (productWelcome)
# welcomelogo=true
# size and expansion policy for Calamares (possible value: normal,fullscreen,noexpand)
# windowexp=noexpand
# size of Calamares window, expressed as w,h.
# (possible units: pixel (px) or font-units (em))
# windowsize="800px,520px"
# colors for text and background components:
# background of the sidebar
# sidebarbackground=#454948
# text color
# sidebartext=#efefef
# background of the selected step
# sidebartextselect=#4d915e
# text color of the selected step
# sidebartexthighlight=#1a1c1b
################ deployiso ################
# the server user
# account=[SetUser]
# Set to 'true' to use ssh-agent to store passphrase.
# ssh_agent=false
# use alternative storage server (one or the other might be more stable)
# alt_storage=false
# the server project: manjaro|manjaro-community
# determined automatically based on profile if unset
# project="[SetProject]"
# set upload bandwidth limit in kB/s
# limit=
# limit=100
# the torrent tracker urls, comma separated
# tracker_url='udp://mirror.strits.dk:6969'
# Piece size, 2^n
# piece_size=21
# iso mirrors
# iso_mirrors=('heanet' 'jaist' 'netcologne' 'iweb' 'kent')
~~~
### 2. buildpkg
###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 +172,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-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: linux49]
-i <name> Init system to use
[default: systemd]
-g <key> The gpg key for sfs signing
[default: empty]
-m Set SquashFS image mode to persistence
-c Disable clean work dir
-x Build images only
-z Generate iso only
Requires pre built images (-x)
-v Verbose output to log file, show profile detail (-q)
-q Query settings and pretend build
-h This help
~~~
###### * build xfce iso profile for both arches and branch testing on x86_64 build system
* Remember: if you run buildiso for the first time you need to do:
~~~
buildiso -i
~~~
for download in /usr/share/manjaro-tools/iso-profiles our manjaro profiles. You can override in manjaro-tools.conf what branch use with buildiso: v17.1 or master ( development profiles ). The previous command can be used to refresh the profiles as needed in your local.
######* build xfce iso profile for both arches and branch testing on x86_64 build system
* i686 (buildsystem is x86_64)
@ -279,16 +241,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 +259,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 +289,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 +340,48 @@ 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
-t Create iso torrent
-q Query settings and pretend upload
-v Verbose output
-z Upload permalinks (shell.osdn.net)
-h This help
~~~
###### * upload official build list, ie all built iso defined in a build list
######* 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

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

@ -16,47 +16,46 @@ 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
if ${verbose};then
msg2 "autologin: %s" "${autologin}"
msg2 "nonfree_mhwd: %s" "${nonfree_mhwd}"
msg2 "pxe_boot: %s" "${pxe_boot}"
msg2 "plymouth_boot: %s" "${plymouth_boot}"
[[ ${target_arch} == 'x86_64' ]] && msg2 "multilib: %s" "${multilib}"
msg2 "basic: %s" "${basic}"
msg2 "extra: %s" "${extra}"
msg2 "office_installer: %s" "${office_installer}"
msg2 "permalink: %s" "${permalink}"
msg2 "netinstall: %s" "${netinstall}"
msg2 "chrootcfg: %s" "${chrootcfg}"
${netinstall} && msg2 "netgroups: %s" "$(get_yaml)"
msg2 "geoip: %s" "${geoip}"
msg2 "oem_used: %s" "${oem_used}"
msg2 "efi_boot_loader: %s" "${efi_boot_loader}"
msg2 "custom_boot_args: %s" "${custom_boot_args}"
msg2 "hostname: %s" "${hostname}"
msg2 "username: %s" "${username}"
msg2 "password: %s" "${password}"
msg2 "user_shell: %s" "${user_shell}"
msg2 "login_shell: %s" "${login_shell}"
msg2 "addgroups: %s" "${addgroups}"
[[ -n ${smb_workgroup} ]] && msg2 "smb_workgroup: %s" "${smb_workgroup}"
msg2 "enable_systemd: %s" "${enable_systemd[*]}"
msg2 "enable_systemd_timers: %s" "${enable_systemd_timers[*]}"
msg2 "enable_systemd_live: %s" "${enable_systemd_live[*]}"
[[ -n ${disable_systemd[*]} ]] && msg2 "disable_systemd: %s" "${disable_systemd[*]}"
msg2 "strict_snaps: %s" "${strict_snaps}"
msg2 "classic_snaps: %s" "${classic_snaps}"
msg2 "snap_channel: %s" "${snap_channel}"
if [[ ${initsys} == 'systemd' ]];then
msg2 "enable_systemd: %s" "${enable_systemd[*]}"
msg2 "enable_systemd_live: %s" "${enable_systemd_live[*]}"
[[ -n ${disable_systemd[*]} ]] && msg2 "disable_systemd: %s" "${disable_systemd[*]}"
else
msg2 "enable_openrc: %s" "${enable_openrc[*]}"
msg2 "enable_openrc_live: %s" "${enable_openrc_live[*]}"
[[ -n ${disable_openrc[*]} ]] && msg2 "disable_openrc: %s" "${disable_openrc[*]}"
fi
fi
reset_profile
}
@ -66,7 +65,6 @@ display_settings(){
show_config
msg "PROFILE:"
msg2 "gitlab branch: %s" "${branch}"
msg2 "build_lists: %s" "$(show_build_lists ${list_dir_iso})"
msg2 "build_list_iso: %s" "${build_list_iso}"
msg2 "is_build_list: %s" "${is_build_list}"
@ -74,6 +72,7 @@ display_settings(){
msg "OPTIONS:"
msg2 "arch: %s" "${target_arch}"
msg2 "branch: %s" "${target_branch}"
msg2 "initsys: %s" "${initsys}"
msg2 "kernel: %s" "${kernel}"
[[ -n ${gpgkey} ]] && msg2 "gpgkey: %s" "${gpgkey}"
@ -82,9 +81,6 @@ display_settings(){
msg2 "images_only: %s" "${images_only}"
msg2 "iso_only: %s" "${iso_only}"
msg2 "persist: %s" "${persist}"
msg2 "extra: %s" "${full_iso}"
msg2 "permalink: %s" "${permalink}"
msg2 "office_installer: %s" "${office_installer}"
msg "DIST SETTINGS:"
msg2 "dist_name: %s" "${dist_name}"
@ -92,7 +88,8 @@ display_settings(){
msg2 "dist_codename: %s" "${dist_codename}"
msg "ISO INFO:"
msg2 "iso_compression: %s" "${iso_compression}"
msg2 "iso_label: %s" "${iso_label}"
msg2 "iso_fs: %s" "${iso_fs}"
msg "BUILD QUEUE:"
run show_profile "${build_list_iso}"
@ -113,36 +110,29 @@ images_only=false
iso_only=false
verbose=false
persist=false
initialize=false
permalink=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 ' -g <key> The gpg key for sfs signing'
echo " [default: ${gpgkey}]"
echo ' -m Set SquashFS image mode to persistence'
echo ' -c Disable clean work dir'
echo ' -x Build images only'
echo ' -z Generate iso only'
echo ' Requires pre built images (-x)'
echo ' -v Verbose output to log file, show profile detail (-q)'
echo ' -q Query settings and pretend build'
echo ' -h This help'
echo ''
echo ''
@ -151,29 +141,24 @@ usage() {
orig_argv=("$@")
opts='p:a:b:r:t:k:g:d:cfzxmnvqhilo'
opts='p:a:b:r:t:k:i:g:czxmvqh'
while getopts "${opts}" arg; do
case "${arg}" in
i) initialize=true ;;
p) build_list_iso="$OPTARG" ;;
a) target_arch="$OPTARG" ;;
b) target_branch="$OPTARG" ;;
c) clean_first=false ;;
f) full_iso=true ;;
d) iso_compression="$OPTARG" ;;
g) gpgkey="$OPTARG" ;;
k) kernel="$OPTARG" ;;
m) persist=true ;;
n) no_multilib=true ;; # only exist if set here
p) build_list_iso="$OPTARG" ;;
q) pretend=true ;;
r) chroots_iso="$OPTARG" ;;
t) cache_dir_iso="$OPTARG" ;;
v) verbose=true ;;
k) kernel="$OPTARG" ;;
i) initsys="$OPTARG" ;;
g) gpgkey="$OPTARG" ;;
c) clean_first=false ;;
x) images_only=true ;;
z) iso_only=true ;;
l) permalink=true ;;
o) office_installer=true ;;
m) persist=true ;;
v) verbose=true ;;
q) pretend=true ;;
h|?) usage 0 ;;
*) echo "invalid argument '${arg}'"; usage 1 ;;
esac
@ -181,27 +166,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"
@ -53,11 +52,12 @@ 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 "pkg_dir: %s" "${pkg_dir}"
if ${clean_first}; then
if ${clean_first};then
msg "PKG:"
msg2 "base_packages: %s" "${base_packages[*]}"
fi
@ -71,28 +71,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 <pkgs> Install packages 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 +108,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 +130,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,9 +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}"
[[ ${target_arch} == 'x86_64' ]] && msg2 "multilib: %s" "${multilib}"
msg2 "basic: %s" "${basic}"
msg2 "extra: %s" "${extra}"
msg2 "netinstall: %s" "${netinstall}"
@ -44,9 +47,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
@ -63,6 +72,7 @@ display_settings(){
msg "OPTIONS:"
msg2 "arch: %s" "${target_arch}"
msg2 "initsys: %s" "${initsys}"
msg2 "kernel: %s" "${kernel}"
msg "ARGS:"
@ -91,14 +101,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 +121,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,10 @@ 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(){
@ -37,28 +36,26 @@ display_settings(){
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
if ${torrent};then
msg2 "tracker_url: %s" "${tracker_url}"
msg2 "piece_size: %s" "${piece_size}"
msg2 "iso_mirrors: %s" "${iso_mirrors[*]}"
msg2 "torrent_meta: %s" "${torrent_meta}"
fi
msg "REMOTE:"
msg2 "account: %s" "${account}"
msg2 "host: %s" "${host}"
msg2 "alt_storage: %s" "${alt_storage}"
msg2 "ssh_agent: %s" "${ssh_agent}"
msg2 "project: %s" "${project}"
msg "UPLOAD QUEUE:"
run show_profile "${build_list_iso}"
@ -70,52 +67,41 @@ 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
torrent=false
rsync_args=(-aP -e ssh)
rsync_args=(-aP --progress -e ssh)
usage() {
echo "Usage: ${0##*/} [options]"
echo ' -a Use alternate storage server'
echo ' -d Use hidden remote directory'
echo ' -h This help'
echo " -l Limit bandwidth in kB/s [default: ${limit}]"
echo " -p Source folder to upload [default: ${build_list_iso}]"
echo ' -q Query settings and pretend upload'
echo ' -s Sign ISO and create checksums'
echo ' -t Create ISO torrent'
echo " -p Source folder to upload [default:${build_list_iso}]"
echo " -l Limit bandwidth in kB/s [default:${limit}]"
echo ' -c Create new remote release directory'
echo ' -u Update remote directory'
echo ' -t Create iso torrent'
echo ' -q Query settings and pretend upload'
echo ' -v Verbose output'
echo ' -w Update download page on manjaro.org'
echo ' -z Upload permalinks (shell.osdn.net)'
echo ' -h This help'
echo ''
echo ''
exit $1
}
opts='adhl:p:qstuvwz'
opts='p:l:cuvtqh'
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) ;;
t) torrent=true ;;
v) verbose=true; rsync_args+=(-v --stats) ;;
q) pretend=true; rsync_args+=(-n) ;;
s) sign=true ;;
t) torrent=true ;;
u) update=true; rsync_args+=(-u) ;;
v) verbose=true; rsync_args+=(-v --stats) ;;
w) upd_homepage=true; shell_upload=true ;;
z) shell_upload=true ;;
h|?) usage 0 ;;
*) echo "invalid argument '${arg}'"; usage 1 ;;
esac
@ -127,6 +113,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

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}
@ -236,18 +237,11 @@ 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
}
_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

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,6 @@
awesome
bspwm
bspwm-mate
budgie
cinnamon
deepin
i3
lxde
lxqt
mate
openbox
webdad

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,3 +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,40 +5,39 @@
# use multilib packages; x86_64 only
# multilib="true"
# use pxe
# pxe_boot="true"
# use core packages as defined in pkglist to use in basic profile
# basic="false"
# use extra packages as defined in pkglist to activate a full profile
# extra="false"
# use office installer module
# office_installer="false"
################ install ################
# default displaymanager: none
# supported; lightdm, sddm, gdm, lxdm, mdm
# displaymanager="none"
# add strict snaps: strict_snaps="core18 snap-store"
# strict_snaps=""
# add classic snaps: classic_snaps="code"
# classic_snaps=""
# choose the snap channel. Possible options are: stable, candidate, beta, edge
# snap_channel="stable"
# Set to false to disable autologin in the livecd
# autologin="true"
# 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/calamares-netgroups/master"
# configure calamares to use chrootcfg instead of unpackfs; default: unpackfs
# chrootcfg="false"
@ -47,21 +46,20 @@
# unset defaults to given values
# names must match systemd service names
# enable_systemd=('avahi-daemon' 'bluetooth' 'cronie' 'ModemManager' 'NetworkManager' 'org.cups.cupsd' 'tlp' 'tlp-sleep' 'ufw')
# disable_systemd=('pacman-init')
# enable_systemd=('bluetooth' 'cronie' 'ModemManager' 'NetworkManager' 'org.cups.cupsd' 'tlp' 'tlp-sleep')
# disable_systemd=()
# unset defaults to given values,
# names must match openrc service names
# enable_openrc=('acpid' 'bluetooth' 'consolekit' 'cronie' 'cupsd' 'dbus' 'syslog-ng' 'NetworkManager')
# disable_openrc=()
# unset defaults to given values
# addgroups="lp,network,power,sys, wheel"
# addgroups="video,power,disk,storage,optical,network,lp,scanner,wheel"
# the same workgroup name if samba is used
# smb_workgroup="Manjaro"
# default system shell is bash
# '/etc/defaults/useradd': " "
# userShell : "/bin/zsh"
# empty value will not be used
#user_shell=
################# live-session #################
# unset defaults to given value
@ -78,4 +76,7 @@
# services in enable_systemd array don't need to be listed here
# enable_systemd_live=('manjaro-live' 'mhwd-live' 'pacman-init' 'mirrors-live')
# disable_systemd_live=()
# unset defaults to given values,
# names must match openrc service names
# services in enable_openrc array don't need to be listed here
# enable_openrc_live=('manjaro-live' 'mhwd-live' 'pacman-init' 'mirrors-live')

View file

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

View file

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

View file

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

View file

@ -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>
@ -208,6 +215,18 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>initsys=</varname></term>
<listitem><para>Takes <option>systemd</option> (the default)
or <option>openrc</option>. Selecting and option will change
how the hostname, the displaymanager and services will be configured.
For services also controls if buildiso will use enable_systemd and
enable_systemd_live or enable_openrc and enable_openrc_live to determine
the default services that will be enabled automatically.
</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>kernel=</varname></term>
@ -225,6 +244,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 +252,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>
@ -280,6 +274,14 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>iso_mirrors=</varname></term>
<listitem><para>Array of iso mirrors that will be
used for webseeds.
</para></listitem>
</varlistentry>
</variablelist>
</refsect1>

View file

@ -108,6 +108,22 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
</listitem>
</varlistentry>
<varlistentry>
<term><varname>netgroups=</varname></term>
<listitem><para>Default url for the netinstall.yaml.
</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>basic=</varname></term>
<listitem><para>Accepts
<option>true</option> (the default)
<option>false</option>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>extra=</varname></term>
@ -117,6 +133,15 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
</listitem>
</varlistentry>
<varlistentry>
<term><varname>pxe_boot=</varname></term>
<listitem><para>Accepts
<option>true</option> (the default)
<option>false</option>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>multilib=</varname></term>
@ -152,6 +177,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 +234,14 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>enable_openrc_live=</varname></term>
<listitem><para>Array of services that will be
enabled in the openrc live-cd.
</para></listitem>
</varlistentry>
</variablelist>
</refsect1>

View file

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

248
initcpio/hooks/miso_aufs Normal file
View file

@ -0,0 +1,248 @@
# 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
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
}
_mnt_overlayfs_root(){
local src="${1}"
local newroot="${2}"
local mnt="${3}"
msg ":: Mounting root (aufs) filesystem"
mount -t aufs -o dirs=${src}=rw union "${newroot}${mnt}"
}
# args: source, newroot, mountpoint
_mnt_overlayfs() {
local src="${1}"
local newroot="${2}"
local mnt="${3}"
msg ":: Adding new aufs branch: ${src} to ${newroot}${mnt}"
mount -t aufs -o remount,append:"${src}"=ro none "${newroot}${mnt}"
}
# args: /path/to/image_file, mountpoint
_mnt_sfs() {
local img="${1}"
local mnt="${2}"
local img_fullname="${img##*/}"
local sfs_dev
if [[ "${copytoram}" == "y" ]]; then
msg -n ":: Copying squashfs image to RAM..."
if ! cp "${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}
}
run_hook() {
[[ -z "${arch}" ]] && arch="$(uname -m)"
[[ -z "${copytoram_size}" ]] && copytoram_size="75%"
[[ -z "${misobasedir}" ]] && misobasedir="arch"
[[ -z "${dm_snap_prefix}" ]] && dm_snap_prefix="arch"
[[ -z "${misodevice}" ]] && misodevice="/dev/disk/by-label/${misolabel}"
[[ -z "${cow_spacesize}" ]] && cow_spacesize="256M"
[[ -z "${overlay_root_size}" ]] && overlay_root_size="75%"
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"
fi
[[ -z "${cow_flags}" ]] && cow_flags="defaults"
[[ -z "${cow_directory}" ]] && cow_directory="persistent_${misolabel}/${arch}"
[[ -z "${cow_chunksize}" ]] && cow_chunksize="8"
# 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
miso_mount_handler() {
local newroot="${1}"
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
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 [[ "${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"
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 work_dir="/run/miso/overlay_root"
_mnt_overlayfs_root "${work_dir}" "${newroot}" "/"
local src="/run/miso/bootmnt/${misobasedir}/${arch}"
local dest_sfs="/run/miso/sfs" dest_img="/run/miso/img"
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}
_mnt_dmsnapshot "${dest_sfs}/${sfs}/${sfs}.img" "${dest_img}/${sfs}"
_mnt_overlayfs "${dest_img}/${sfs}" "${newroot}" "/"
else
_mnt_overlayfs "${dest_sfs}/${sfs}" "${newroot}" "/"
fi
fi
done
if [[ "${copytoram}" == "y" ]]; then
umount -d /run/miso/bootmnt
fi
}
# vim:ft=sh:ts=4:sw=4:et:

View file

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

View file

@ -22,15 +22,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
if ! ipconfig "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"

View file

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

View file

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

View file

@ -0,0 +1,30 @@
#!/bin/bash
build() {
add_module "cdrom"
add_module "loop"
add_module "dm-snapshot"
add_module "aufs"
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

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

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

@ -0,0 +1,45 @@
#!/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_fs() {
info "%s mount: [%s]" "${iso_fs}" "$6"
mount "$@" && FS_ACTIVE_MOUNTS=("$6" "${FS_ACTIVE_MOUNTS[@]}")
}
# $1: new branch
mount_fs_root(){
FS_ACTIVE_MOUNTS=()
track_fs -t aufs -o br="$1":${work_dir}/rootfs=ro none "$1"
}
mount_fs_desktop(){
FS_ACTIVE_MOUNTS=()
track_fs -t aufs -o br="$1":${work_dir}/desktopfs=ro:${work_dir}/rootfs=ro none "$1"
}
mount_fs_live(){
FS_ACTIVE_MOUNTS=()
track_fs -t aufs -o br="$1":${work_dir}/livefs=ro:${work_dir}/desktopfs=ro:${work_dir}/rootfs=ro none "$1"
}
mount_fs_net(){
FS_ACTIVE_MOUNTS=()
track_fs -t aufs -o br="$1":${work_dir}/livefs=ro:${work_dir}/rootfs=ro none "$1"
}
# $1: image path
umount_fs(){
if [[ -n ${FS_ACTIVE_MOUNTS[@]} ]];then
umount "${FS_ACTIVE_MOUNTS[@]}"
unset FS_ACTIVE_MOUNTS
find $1 -name '.wh.*' -delete &> /dev/null
fi
}

View file

@ -9,21 +9,48 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
set_mkinicpio_hooks(){
if ! ${pxe_boot};then
msg2 "Removing pxe hooks"
sed -e 's/miso_pxe_common miso_pxe_http miso_pxe_nbd miso_pxe_nfs //' \
-e 's/memdisk //' -i $1
fi
if ! ${plymouth_boot};then
msg2 "Removing plymouth hook"
sed -e 's/plymouth //' -i $1
fi
if ! ${use_overlayfs};then
msg2 "Setting aufs hook"
sed -e 's/miso /miso_aufs /' -i $1
fi
}
gen_boot_args(){
local args=(quiet)
local args=()
if ${plymouth_boot};then
args+=(splash)
fi
echo ${args[@]}
}
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
# sed -e "s|/usr/lib/initcpio/|/etc/initcpio/|" -i $1/etc/initcpio/install/miso_shutdown
}
prepare_initramfs(){
cp ${DATADIR}/mkinitcpio.conf $1/etc/mkinitcpio-${iso_name}.conf
local _kernver=$(cat $1/usr/lib/modules/*/kernelbase | awk -F'-' '{print $1}')
cp $1/mkinitcpio.conf $2/etc/mkinitcpio-${iso_name}.conf
set_mkinicpio_hooks "$2/etc/mkinitcpio-${iso_name}.conf"
local _kernver=$(cat $2/usr/lib/modules/*/version)
if [[ -n ${gpgkey} ]]; then
su ${OWNER} -c "gpg --export ${gpgkey} >${USERCONFDIR}/gpgkey"
exec 17<>${USERCONFDIR}/gpgkey
fi
MISO_GNUPG_FD=${gpgkey:+17} chroot-run $1 \
MISO_GNUPG_FD=${gpgkey:+17} chroot-run $2 \
/usr/bin/mkinitcpio -k ${_kernver} \
-c /etc/mkinitcpio-${iso_name}.conf \
-g /boot/initramfs.img
@ -37,66 +64,97 @@ prepare_initramfs(){
}
prepare_boot_extras(){
cp $1/boot/amd-ucode.img $2/amd_ucode.img
cp $1/boot/intel-ucode.img $2/intel_ucode.img
cp $1/usr/share/licenses/amd-ucode/LIC* $2/amd_ucode.LICENSE
cp $1/usr/share/licenses/intel-ucode/LIC* $2/intel_ucode.LICENSE
cp $1/usr/share/licenses/intel-ucode/LICENSE $2/intel_ucode.LICENSE
cp $1/boot/memtest86+/memtest.bin $2/memtest
cp $1/usr/share/licenses/common/GPL2/license.txt $2/memtest.COPYING
}
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}"
prepare_efiboot_image(){
local efi=$1/EFI/miso boot=$2/${iso_name}/boot
prepare_dir "${efi}"
cp ${boot}/x86_64/vmlinuz ${efi}/vmlinuz.efi
cp ${boot}/x86_64/initramfs.img ${efi}/initramfs.img
if [[ -f ${boot}/intel_ucode.img ]] ; then
cp ${boot}/intel_ucode.img ${efi}/intel_ucode.img
fi
}
vars_to_boot_conf(){
sed -e "s|@ISO_NAME@|${iso_name}|g" \
-e "s|@ISO_LABEL@|${iso_label}|g" \
-e "s|@DIST_NAME@|${dist_name}|g" \
-e "s|@ARCH@|${target_arch}|g" \
-e "s|@DRV@|$2|g" \
-e "s|@SWITCH@|$3|g" \
-e "s|@BOOT_ARGS@|$(gen_boot_args)|g" \
-i $1
}
prepare_efi_loader(){
local efi_data=$1/usr/share/efi-utils efi=$2/EFI/boot
msg2 "Preparing efi loaders ..."
prepare_dir "${efi}"
cp $1/usr/share/efitools/efi/PreLoader.efi ${efi}/bootx64.efi
cp $1/usr/share/efitools/efi/HashTool.efi ${efi}
cp ${efi_data}/gummibootx64.efi ${efi}/loader.efi
cp ${efi_data}/shellx64_v{1,2}.efi $2/EFI
local entries=$2/loader/entries
msg2 "Preparing efi loader config ..."
prepare_dir "${entries}"
cp ${efi_data}/loader.conf $2/loader/loader.conf
vars_to_boot_conf $2/loader/loader.conf
cp ${efi_data}/uefi-shell-v{1,2}-x86_64.conf ${entries}
local label='free' switch="no"
cp ${efi_data}/entry-x86_64-$3.conf ${entries}/${iso_name}-x86_64.conf
vars_to_boot_conf "${entries}/${iso_name}-x86_64.conf" "$label" "$switch"
if ${nonfree_mhwd};then
label='nonfree' switch="yes"
cp ${efi_data}/entry-x86_64-$3.conf ${entries}/${iso_name}-x86_64-nonfree.conf
vars_to_boot_conf "${entries}/${iso_name}-x86_64-nonfree.conf" "$label" "$switch"
fi
}
check_syslinux_select(){
local boot=${iso_root}/${iso_name}/boot
if [[ ! -f ${boot}/x86_64/vmlinuz ]] ; then
msg2 "Configuring syslinux for i686 architecture only ..."
sed -e "s/select.cfg/i686_inc.cfg/g" -i "$1/miso.cfg"
fi
}
check_syslinux_nonfree(){
msg2 "Configuring syslinux menu ..."
sed -e "/LABEL nonfree/,/^$/d" -i "$1/miso_sys_i686.cfg"
sed -e "/LABEL nonfree/,/^$/d" -i "$1/miso_sys_x86_64.cfg"
sed -e "/nonfree/ d" -i $1/syslinux.msg
}
prepare_isolinux(){
local syslinux=$1/usr/lib/syslinux/bios
msg2 "Copying isolinux binaries ..."
cp ${syslinux}/{{isolinux,isohdpfx}.bin,ldlinux.c32} $2
msg2 "Copying isolinux.cfg ..."
cp $1/usr/share/syslinux/isolinux/isolinux.cfg $2
vars_to_boot_conf "$2/isolinux.cfg"
}
prepare_syslinux(){
local syslinux=$1/usr/lib/syslinux/bios
msg2 "Copying syslinux binaries ..."
cp ${syslinux}/{*.c32,lpxelinux.0,memdisk} $2
msg2 "Copying syslinux theme ..."
syslinux=$1/usr/share/syslinux/theme
cp ${syslinux}/* $2
for conf in $2/*.cfg; do
vars_to_boot_conf "${conf}"
done
# Check for dual-arch
check_syslinux_select "$2"
if ! ${nonfree_mhwd};then
check_syslinux_nonfree "$2"
fi
}

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,28 @@ copy_overlay(){
fi
}
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
}
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 +49,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 +65,52 @@ 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(){
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 +127,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 +172,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 +184,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(){
@ -574,24 +223,25 @@ 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]"
configure_hosts "$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]"
}
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 +258,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 ..."
@ -621,18 +271,13 @@ chroot_create(){
mkchroot ${mkchroot_args[*]} ${flag} $@
}
clean_iso_root(){
msg2 "Deleting isoroot [%s] ..." "${1##*/}"
rm -rf --one-file-system "$1"
}
chroot_clean(){
msg "Cleaning up ..."
for image in "$1"/*fs; do
[[ -d ${image} ]] || continue
local name=${image##*/}
if [[ $name != "mhwdfs" ]]; then
msg2 "Deleting chroot [%s] (%s) ..." "$name" "${1##*/}"
if [[ $name != "mhwdfs" ]];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
@ -642,26 +287,21 @@ chroot_clean(){
done
exec 9>&-
rm -rf --one-file-system "$1"
msg2 "Deleting isoroot [%s] ..." "${2##*/}"
rm -rf --one-file-system "$2"
}
clean_up_image(){
msg2 "Cleaning [%s]" "${1##*/}"
local path
if [[ ${1##*/} == 'mhwdfs' ]]; then
if [[ ${1##*/} == 'mhwdfs' ]];then
path=$1/var
if [[ -d $path/lib/mhwd ]]; then
mv $path/lib/mhwd $1 &> /dev/null
fi
if [[ -d $path ]]; then
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 +312,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,11 +324,11 @@ 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

View file

@ -9,28 +9,8 @@
# 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"
info "%s mount: [%s]" "${iso_fs}" "$5"
mount "$@" && FS_ACTIVE_MOUNTS=("$5" "${FS_ACTIVE_MOUNTS[@]}")
}
@ -59,29 +39,11 @@ mount_fs_net(){
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
if [[ -n ${FS_ACTIVE_MOUNTS[@]} ]];then
info "%s umount: [%s]" "${iso_fs}" "${FS_ACTIVE_MOUNTS[@]}"
umount "${FS_ACTIVE_MOUNTS[@]}"
unset FS_ACTIVE_MOUNTS
rm -rf "${mnt_dir}/work"
fi
mount_folders=$(grep "${work_dir}" /proc/mounts | awk '{print$2}' | sort -r)
for i in $mount_folders
do
info "umount folder: [%s]" "$i"
check_umount $i
done
}

View file

@ -49,7 +49,7 @@ run_safe() {
restoretrap=$(trap -p ERR)
trap 'error_function $func' ERR
if ${verbose}; then
if ${verbose};then
run_log "$func"
else
"$func"
@ -110,7 +110,7 @@ make_sfs() {
fi
fi
if ${persist}; then
if ${persist};then
local size=32G
local mnt="${mnt_dir}/${name}"
msg2 "Creating ext4 image of %s ..." "${size}"
@ -129,7 +129,7 @@ make_sfs() {
msg2 "Creating SquashFS image, this may take some time..."
local used_kernel=${kernel:5:1} mksfs_args=()
if ${persist}; then
if ${persist};then
mksfs_args+=(${work_dir}/${name}.img)
else
mksfs_args+=(${src})
@ -137,15 +137,14 @@ make_sfs() {
mksfs_args+=(${sfs} -noappend)
local highcomp
local highcomp="-b 256K -Xbcj x86" comp='xz'
[[ "${iso_compression}" == "xz" ]] && highcomp="-b 256K -Xbcj x86"
[[ "${iso_compression}" == "zstd" ]] && highcomp="-b 256K -Xcompression-level 20" #compression level max 22 (default 15)
mksfs_args+=(-comp ${iso_compression} ${highcomp})
if ${verbose}; then
if [[ "${name}" == "mhwdfs" && ${used_kernel} < "4" ]]; then
mksfs_args+=(-comp lz4)
else
mksfs_args+=(-comp ${comp} ${highcomp})
fi
if ${verbose};then
mksquashfs "${mksfs_args[@]}" >/dev/null
else
mksquashfs "${mksfs_args[@]}"
@ -153,7 +152,7 @@ make_sfs() {
make_checksum "${dest}" "${name}"
${persist} && rm "${src}.img"
if [[ -n ${gpgkey} ]]; then
if [[ -n ${gpgkey} ]];then
make_sig "${dest}" "${name}"
fi
@ -162,34 +161,35 @@ 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=() iso_publisher iso_app_id
if [[ -f "${iso_root}/EFI/miso/efiboot.img" ]]; then
msg2 "Setting efi args. El Torito detected."
efi_boot_args=("-eltorito-alt-boot"
"-e EFI/miso/efiboot.img"
"-isohybrid-gpt-basdat"
"-no-emul-boot")
fi
iso_publisher="$(get_osname) <$(get_disturl)>"
iso_app_id="$(get_osname) Live/Rescue CD"
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 "${iso_root}/isolinux/isohdpfx.bin" \
${efi_boot_args[@]} \
-output "${iso_dir}/${iso_file}" \
"${iso_root}/"
}
# Build ISO
@ -198,10 +198,6 @@ make_iso() {
touch "${iso_root}/.miso"
for sfs_dir in $(find "${work_dir}" -maxdepth 1 -type d); do
if [[ "${sfs_dir}" != "${work_dir}" ]]; then
if [[ -e "${sfs_dir}"/etc/pacman.d/gnupg ]]; then
msg2 "Removing '/etc/pacman.d/gnupg' folder from ${sfs_dir}"
rm -rf "${sfs_dir}"/etc/pacman.d/gnupg
fi
make_sfs "${sfs_dir}"
fi
done
@ -210,71 +206,26 @@ make_iso() {
# Sanity checks
[[ ! -d "${iso_root}" ]] && return 1
if [[ -f "${iso_dir}/${iso_file}" ]]; then
msg2 "Removing ${iso_file} related files ..."
[[ -f "${iso_dir}/${iso_file}" ]] && rm -f "${iso_dir}/${iso_file}"
[[ -f "${iso_dir}/${iso_file}.sig" ]] && rm -f "${iso_dir}/${iso_file}.sig"
[[ -f "${iso_dir}/${iso_file}.sha1" ]] && rm -f "${iso_dir}/${iso_file}.sha1"
[[ -f "${iso_dir}/${iso_file}.sha256" ]] && rm -f "${iso_dir}/${iso_file}.sha256"
[[ -f "${iso_dir}/${iso_file}.torrent" ]] && rm -f "${iso_dir}/${iso_file}.torrent"
msg2 "Removing existing bootable image..."
rm -rf "${iso_dir}/${iso_file}"
fi
assemble_iso
${permalink} && gen_permalink
msg "Done [Build ISO]"
}
gen_permalink(){
if [[ ${edition} == "community" ]] || [[ ${edition} == "manjaro" ]]; then
if [[ -f "${iso_dir}/${iso_file}" ]]; then
msg2 "Creating download link ..."
direct_url="https://osdn.net/dl/${edition}/${iso_file}"
[[ ${edition} == "community" ]] && direct_url="https://osdn.net/dl/manjaro-${edition}/${iso_file}"
## html permalink
html_doc="<!DOCTYPE HTML>"
html_doc+="<meta charset=\"UTF-8\">"
html_doc+="<meta http-equiv=\"refresh\" content=\"1; url=${direct_url}\">"
html_doc+="<script>window.location.href=\"${direct_url}\"</script>"
html_doc+="<title>Download Redirection</title>"
html_doc+="If you are not redirected automatically, follow the <a href=\"${direct_url}\">link to latest iso</a>"
## php permalink
php_doc="<?php "
php_doc+="header('Location: ' . '${direct_url}', true, 303); "
php_doc+="die(); "
php_doc+="?>"
## write files
if [[ ${extra} == "true" ]]; then
echo ${html_doc} > "${iso_dir}/.latest"
echo ${php_doc} > "${iso_dir}/.latest.php"
else
echo ${html_doc} > "${iso_dir}/.latest-minimal"
echo ${php_doc} > "${iso_dir}/.latest-minimal.php"
fi
fi
fi
}
gen_iso_fn(){
local vars=() name
vars+=("${iso_name}")
if ! ${chrootcfg}; then
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,38 +236,6 @@ 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)
make_image_root() {
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
@ -326,11 +245,6 @@ make_image_root() {
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"
copy_overlay "${profile_dir}/root-overlay" "${path}"
@ -358,21 +272,8 @@ make_image_desktop() {
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
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
clean_up_image "${path}"
: > ${work_dir}/build.${FUNCNAME}
@ -402,27 +303,12 @@ make_image_live() {
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
# Clean up GnuPG keys
rm -rf "${path}/etc/pacman.d/gnupg"
clean_up_image "${path}"
: > ${work_dir}/build.${FUNCNAME}
msg "Done [Live installation] (livefs)"
@ -446,7 +332,7 @@ 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}"
@ -459,12 +345,11 @@ make_image_mhwd() {
make_image_boot() {
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
msg "Prepare [/iso/boot]"
local boot="${iso_root}/boot"
msg "Prepare [/iso/%s/boot]" "${iso_name}"
local boot="${iso_root}/${iso_name}/boot"
mkdir -p ${boot}/${target_arch}
mkdir -p ${boot}
cp ${work_dir}/rootfs/boot/vmlinuz* ${boot}/vmlinuz-${target_arch}
cp ${work_dir}/rootfs/boot/vmlinuz* ${boot}/${target_arch}/vmlinuz
local path="${work_dir}/bootfs"
mkdir -p ${path}
@ -476,71 +361,110 @@ make_image_boot() {
fi
prepare_initcpio "${path}"
prepare_initramfs "${path}"
prepare_initramfs "${profile_dir}" "${path}"
cp ${path}/boot/initramfs.img ${boot}/initramfs-${target_arch}.img
mv ${path}/boot/initramfs.img ${boot}/${target_arch}/initramfs.img
prepare_boot_extras "${path}" "${boot}"
umount_fs
rm -R ${path}
: > ${work_dir}/build.${FUNCNAME}
msg "Done [/iso/boot]"
msg "Done [/iso/%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_usb() {
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
msg "Prepare [/iso/boot/grub]"
msg "Prepare [/iso/EFI]"
prepare_efi_loader "${work_dir}/livefs" "${iso_root}" "usb"
: > ${work_dir}/build.${FUNCNAME}
msg "Done [/iso/EFI]"
fi
}
local path="${work_dir}/livefs"
# Prepare kernel.img::/EFI for "El Torito" EFI boot mode
make_efi_dvd() {
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
msg "Prepare [/efiboot/EFI]"
local src="${iso_root}/EFI/miso"
mkdir -p "${src}"
prepare_grub "${path}" "${iso_root}"
configure_grub "${iso_root}/boot/grub/kernels.cfg"
configure_grub_theme "${iso_root}/boot/grub/variable.cfg"
local size=31M
local mnt="${mnt_dir}/efiboot" img="${src}/efiboot.img"
${pxe_boot} && size=46M
msg2 "Creating fat image of %s ..." "${size}"
truncate -s ${size} "${img}"
mkfs.fat -n MISO_EFI "${img}" &>/dev/null
mkdir -p "${mnt}"
mount_img "${img}" "${mnt}"
prepare_efiboot_image "${mnt}" "${iso_root}"
prepare_efi_loader "${work_dir}/livefs" "${mnt}" "dvd"
umount_img "${mnt}"
: > ${work_dir}/build.${FUNCNAME}
msg "Done [/iso/boot/grub]"
msg "Done [/efiboot/EFI]"
fi
}
make_isolinux() {
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
msg "Prepare [/iso/isolinux]"
local isolinux=${iso_root}/isolinux
mkdir -p ${isolinux}
prepare_isolinux "${work_dir}/livefs" "${isolinux}"
: > ${work_dir}/build.${FUNCNAME}
msg "Done [/iso/isolinux]"
fi
}
make_syslinux() {
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
msg "Prepare [/iso/${iso_name}/boot/syslinux]"
local syslinux=${iso_root}/${iso_name}/boot/syslinux
mkdir -p ${syslinux}
prepare_syslinux "${work_dir}/livefs" "${syslinux}"
mkdir -p ${syslinux}/hdt
# gzip -c -9 ${work_dir}/rootfs/usr/share/hwdata/pci.ids > ${syslinux}/hdt/pciids.gz
# gzip -c -9 ${work_dir}/livefs/usr/lib/modules/*-MANJARO/modules.alias > ${syslinux}/hdt/modalias.gz
: > ${work_dir}/build.${FUNCNAME}
msg "Done [/iso/${iso_name}/boot/syslinux]"
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
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
}
compress_images(){
local timer=$(get_timer)
run_safe "make_iso"
user_own "${cache_dir_iso}" "-R"
user_own "${iso_dir}" "-R"
show_elapsed_time "${FUNCNAME}" "${timer}"
}
@ -561,8 +485,12 @@ prepare_images(){
run_safe "make_image_mhwd"
fi
run_safe "make_image_boot"
run_safe "make_grub"
run_safe "make_isolinux"
run_safe "make_syslinux"
if [[ "${target_arch}" == "x86_64" ]]; then
run_safe "make_efi_usb"
run_safe "make_efi_dvd"
fi
show_elapsed_time "${FUNCNAME}" "${timer}"
}
@ -577,20 +505,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}" "${iso_root}"
if ${iso_only}; then
[[ ! -d ${work_dir} ]] && die "Create images: buildiso -p %s -x" "${profile}"
compress_images
@ -615,7 +530,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
@ -627,7 +542,7 @@ get_pacman_conf(){
}
load_profile(){
conf="$1/profile.conf"
conf="${profile_dir}/profile.conf"
info "Profile: [%s]" "${profile}"
@ -639,9 +554,6 @@ 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}
@ -652,15 +564,15 @@ load_profile(){
prepare_dir "${mnt_dir}"
prepare_dir "${iso_dir}"
user_own "${cache_dir_iso}" "-R"
user_own "${iso_dir}"
}
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
;;

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,58 @@
# 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() {
if [[ $1 = *-* && $2 = *-* ]]; then
# if both versions have a pkgrel, then they must be an exact match
[[ $1 = "$2" ]]
@ -113,3 +145,170 @@ 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"
[[ ! -f $src ]] && die
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[*]}
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

@ -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,27 +9,34 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
local MINIMAL
connect(){
${alt_storage} && server="storage-in" || server="storage"
local storage="@${server}.osdn.net:/storage/groups/m/ma/"
echo "${account}${storage}${project}"
create_release(){
msg "Create release (%s) ..." "${target_dir}"
rsync ${rsync_args[*]} /dev/null ${url}/${profile}/
rsync ${rsync_args[*]} /dev/null ${url}/${target_dir}/
show_elapsed_time "${FUNCNAME}" "${timer_start}"
msg "Done (%s)" "${target_dir}"
}
connect_shell(){
local shell="@shell.osdn.net:/home/groups/m/ma/"
echo "${account}${shell}${project}"
connect(){
local home="/home/frs/project"
echo "${account},${project}@frs.${host}:${home}/${project}"
}
gen_webseed(){
local webseed seed="$1"
for mirror in ${iso_mirrors[@]};do
webseed=${webseed:-}${webseed:+,}"http://${mirror}.dl.${seed}"
done
echo ${webseed}
}
make_torrent(){
find ${src_dir} -type f -name "*.torrent" -delete
if [[ -n $(find ${src_dir} -type f -name "*.iso") ]]; then
isos=$(ls ${src_dir}/*.iso)
for iso in ${isos}; do
local seed=https://${host}/dl/${project}/${iso##*/}
local mktorrent_args=(-c "${torrent_meta}" -p -l ${piece_size} -a ${tracker_url} -w ${seed})
for iso in $(ls ${src_dir}/*.iso);do
local seed=${host}/project/${project}/${target_dir}/${iso##*/}
local mktorrent_args=(-c "${torrent_meta}" -p -l ${piece_size} -a ${tracker_url} -w $(gen_webseed ${seed}))
${verbose} && mktorrent_args+=(-v)
msg2 "Creating (%s) ..." "${iso##*/}.torrent"
mktorrent ${mktorrent_args[*]} -o ${iso}.torrent ${iso}
@ -39,223 +46,22 @@ make_torrent(){
prepare_transfer(){
profile="$1"
hidden="$2"
edition=$(get_edition "${profile}")
[[ -z ${project} ]] && project="$(get_project)"
server=$(connect)
webshell=$(connect_shell)
htdocs="htdocs/${profile}"
url=$(connect)
target_dir="${profile}/${dist_release}"
src_dir="${run_dir}/${edition}/${target_dir}"
${hidden} && target_dir="${profile}/.${dist_release}"
}
start_agent(){
msg2 "Initializing SSH agent..."
ssh-agent | sed 's/^echo/#echo/' > "$1"
chmod 600 "$1"
. "$1" > /dev/null
ssh-add
}
ssh_add(){
local ssh_env="$USER_HOME/.ssh/environment"
if [ -f "${ssh_env}" ]; then
. "${ssh_env}" > /dev/null
ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
start_agent ${ssh_env};
}
else
start_agent ${ssh_env};
fi
${torrent} && make_torrent
}
sync_dir(){
count=1
max_count=10
prepare_transfer "$1" "${hidden}"
${torrent} && make_torrent
${sign} && signiso "${src_dir}"
${ssh_agent} && ssh_add
msg "Start upload [%s] to [%s] ..." "$1" "${project}"
while [[ $count -le $max_count ]]; do
rsync ${rsync_args[*]} --exclude '.latest*' --exclude 'index.html' --exclude 'links.txt' ${src_dir}/ ${server}/${target_dir}/
if [[ $? != 0 ]]; then
count=$(($count + 1))
msg "Upload failed. retrying (%s/%s) ..." "$count" "$max_count"
sleep 2
else
count=$(($max_count + 1))
${upd_homepage} && pull_hp_repo
${shell_upload} && upload_permalinks
msg "Done upload [%s]" "$1"
show_elapsed_time "${FUNCNAME}" "${timer_start}"
fi
done
}
upload_permalinks(){
## permalinks for full ISO
if [[ -f "${src_dir}/.latest" ]]; then
msg "Uploading permalinks ..."
LATEST_ISO=$(sed -e 's/\"/\n/g' < "${src_dir}/.latest" | grep -Eo 'http.*iso$' -m1 | awk '{split($0,x,"/"); print x[6]}')
PKGLIST="${LATEST_ISO/.iso/-pkgs.txt}"
## upload redirector files
[[ -f "${src_dir}/.latest" ]] && sync_latest_html
[[ -f "${src_dir}/.latest.php" ]] && sync_latest_php
## upload verification files, torrent and package list
[[ -f "${src_dir}/${LATEST_ISO}.torrent" ]] && sync_latest_torrent
[[ -f "${src_dir}/${LATEST_ISO}.sig" ]] && sync_latest_signature
[[ -f "${src_dir}/${LATEST_ISO}.sha1" ]] && sync_latest_checksum_sha1
[[ -f "${src_dir}/${LATEST_ISO}.sha256" ]] && sync_latest_checksum_sha256
[[ -f "${src_dir}/${PKGLIST}" ]] && sync_latest_pkg_list
${upd_homepage} && upd_dl_checksum
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,14 +121,14 @@ 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"
@ -169,65 +143,35 @@ write_unpack_conf(){
}
write_users_conf(){
local conf="${etc_config_dir}/users.conf"
local conf="${modules_dir}/users.conf"
msg2 "Writing %s ..." "${conf##*/}"
echo "---" > "$conf"
echo "defaultGroups:" >> "$conf"
local IFS=','
for g in ${addgroups[@]}; do
for g in ${addgroups[@]};do
echo " - $g" >> "$conf"
done
unset IFS
echo "autologinGroup: autologin" >> "$conf"
echo "doAutologin: false" >> "$conf" # can be either 'true' or 'false'
echo "sudoersGroup: wheel" >> "$conf"
echo "passwordRequirements:" >> "$conf"
echo " nonempty: true" >> "$conf" # can be either 'true' or 'false'
echo "setRootPassword: true" >> "$conf" # must be true, else some options get hidden
echo "doReusePassword: false" >> "$conf" # only used in old 'users' module
echo "availableShells: /bin/bash, /bin/zsh" >> "$conf" # only used in new 'users' module
echo "avatarFilePath: ~/.face" >> "$conf" # mostly used file-name for avatar
if [[ -n "$user_shell" ]]; then
echo "userShell: $user_shell" >> "$conf"
fi
}
write_partition_conf(){
local conf="${etc_config_dir}/partition.conf"
msg2 "Writing %s ..." "${conf##*/}"
echo "---" > "$conf"
echo "efiSystemPartition: \"/boot/efi\"" >> "$conf"
echo "userSwapChoices:" >> "$conf"
echo " - none # Create no swap, use no swap" >> "$conf"
echo " - small # Up to 4GB" >> "$conf"
echo " - suspend # At least main memory size" >> "$conf"
echo " - file # To swap file instead of partition" >> "$conf"
echo "alwaysShowPartitionLabels: true" >> "$conf"
echo "# There are four options: erase, replace, alongside, manual)," >> "$conf"
echo "# the default is \"none\"." >> "$conf"
echo "initialPartitioningChoice: erase" >> "$conf"
echo "initialSwapChoice: none" >> "$conf"
echo "defaultFileSystemType: \"ext4\"" >> "$conf"
echo "availableFileSystemTypes: [\"ext4\",\"btrfs\",\"f2fs\",\"xfs\"]" >> "$conf"
}
write_packages_conf(){
local conf="${etc_config_dir}/packages.conf"
local conf="${modules_dir}/packages.conf"
msg2 "Writing %s ..." "${conf##*/}"
echo "---" > "$conf"
echo "backend: pacman" >> "$conf"
echo '' >> "$conf"
if ${needs_internet}; then
echo "skip_if_no_internet: false" >> "$conf"
else
echo "skip_if_no_internet: true" >> "$conf"
fi
echo "update_db: true" >> "$conf"
echo "update_system: true" >> "$conf"
}
write_welcome_conf(){
local conf="${etc_config_dir}/welcome.conf"
local conf="${modules_dir}/welcome.conf"
msg2 "Writing %s ..." "${conf##*/}"
echo "---" > "$conf" >> "$conf"
echo "showSupportUrl: true" >> "$conf"
@ -248,19 +192,13 @@ write_welcome_conf(){
echo " - storage" >> "$conf"
echo " - ram" >> "$conf"
echo " - root" >> "$conf"
if ${needs_internet}; then
if ${netinstall};then
echo " - internet" >> "$conf"
fi
if ${geoip}; then
echo 'geoip:' >> "$conf"
echo ' style: "json"' >> "$conf"
echo ' url: "https://ipapi.co/json"' >> "$conf"
echo ' selector: "country"' >> "$conf"
fi
}
write_mhwdcfg_conf(){
local conf="${etc_config_dir}/mhwdcfg.conf"
local conf="${modules_dir}/mhwdcfg.conf"
msg2 "Writing %s ..." "${conf##*/}"
echo "---" > "$conf"
echo "bus:" >> "$conf"
@ -283,17 +221,17 @@ write_mhwdcfg_conf(){
${netinstall} && switch='false'
echo "local: ${switch}" >> "$conf"
echo '' >> "$conf"
echo 'repo: /opt/mhwd/pacman-mhwd.conf' >> "$conf"
echo 'repo: /opt/pacman-mhwd.conf' >> "$conf"
}
write_postcfg_conf(){
local conf="${etc_config_dir}/postcfg.conf"
local conf="${modules_dir}/postcfg.conf"
msg2 "Writing %s ..." "${conf##*/}"
echo "---" > "$conf"
echo "keyrings:" >> "$conf"
echo " - archlinux" >> "$conf"
echo " - manjaro" >> "$conf"
if [[ -n ${smb_workgroup} ]]; then
if [[ -n ${smb_workgroup} ]];then
echo "" >> "$conf"
echo "samba:" >> "$conf"
echo " - workgroup: ${smb_workgroup}" >> "$conf"
@ -302,40 +240,35 @@ write_postcfg_conf(){
get_yaml(){
local args=() yaml
if ${chrootcfg}; then
if ${chrootcfg};then
args+=("${profile}/chrootcfg")
else
args+=("${profile}/packages")
fi
args+=("systemd")
for arg in ${args[@]}; do
args+=("${initsys}")
for arg in ${args[@]};do
yaml=${yaml:-}${yaml:+-}${arg}
done
echo "${yaml}.yaml"
}
write_netinstall_conf(){
local conf="${etc_config_dir}/netinstall.conf"
local conf="${modules_dir}/netinstall.conf"
msg2 "Writing %s ..." "${conf##*/}"
echo "---" > "$conf"
echo "groupsUrl: ${netgroups}/$(get_yaml)" >> "$conf"
echo "label:" >> "$conf"
echo " sidebar: \"${netinstall_label}\"" >> "$conf"
}
write_locale_conf(){
local conf="${etc_config_dir}/locale.conf"
local conf="${modules_dir}/locale.conf"
msg2 "Writing %s ..." "${conf##*/}"
echo "---" > "$conf"
echo "localeGenPath: /etc/locale.gen" >> "$conf"
if ${geoip}; then
echo 'geoip:' >> "$conf"
echo ' style: "json"' >> "$conf"
echo ' url: "https://ipapi.co/json"' >> "$conf"
echo ' selector: "timezone"' >> "$conf"
if ${geoip};then
echo "geoipUrl: freegeoip.net" >> "$conf"
else
echo "region: America" >> "$conf"
echo "zone: New_York" >> "$conf"
echo "region: Europe" >> "$conf"
echo "zone: London" >> "$conf"
fi
}
@ -348,35 +281,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 +307,39 @@ write_settings_conf(){
fi
echo " - machineid" >> "$conf" && write_machineid_conf
echo " - fstab" >> "$conf"
if ${oem_used}; then
msg2 "Skipping to set locale, keyboard and localecfg modules."
else
echo " - locale" >> "$conf"
echo " - keyboard" >> "$conf"
echo " - localecfg" >> "$conf"
fi
echo " - locale" >> "$conf"
echo " - keyboard" >> "$conf"
echo " - localecfg" >> "$conf"
echo " - luksopenswaphookcfg" >> "$conf"
echo " - luksbootkeyfile" >> "$conf"
echo " - initcpiocfg" >> "$conf"
echo " - initcpio" >> "$conf" && write_initcpio_conf
if ${oem_used}; then
msg2 "Skipping to set users module."
if ${set_oem_user}; then
msg2 "Setup OEM user."
echo " - oemuser" >> "$conf"
fi
else
echo " - users" >> "$conf"
fi
echo " - users" >> "$conf"
echo " - displaymanager" >> "$conf" && write_displaymanager_conf
if ${mhwd_used}; then
echo " - mhwdcfg" >> "$conf" && write_mhwdcfg_conf
else
msg2 "Skipping to set mhwdcfg module."
fi
echo " - mhwdcfg" >> "$conf" && write_mhwdcfg_conf
echo " - hwclock" >> "$conf"
echo " - services" >> "$conf" && write_services_conf
case ${initsys} in
'systemd') echo " - services" >> "$conf" && write_services_conf ;;
'openrc') echo " - servicescfg" >> "$conf" && write_servicescfg_conf ;;
esac
echo " - grubcfg" >> "$conf"
echo " - bootloader" >> "$conf" && write_bootloader_conf
if ${oem_used}; then
msg2 "Skipping to set postcfg module."
else
echo " - postcfg" >> "$conf" && write_postcfg_conf
fi
echo " - 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 +366,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(){
@ -497,10 +383,10 @@ write_netgroup_yaml(){
echo " hidden: false" >> "$2"
echo " critical: false" >> "$2"
echo " packages:" >> "$2"
for p in ${packages[@]}; do
for p in ${packages[@]};do
echo " - $p" >> "$2"
done
${validate} && check_yaml "$2"
${validate} && check_yaml "$2"
}
write_pacman_group_yaml(){
@ -515,7 +401,7 @@ prepare_check(){
profile=$1
local 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,7 +411,7 @@ prepare_check(){
}
gen_fn(){
echo "${yaml_dir}/$1-${target_arch}-systemd.yaml"
echo "${yaml_dir}/$1-${target_arch}-${initsys}.yaml"
}
make_profile_yaml(){

View file

@ -183,9 +183,7 @@ load_vars() {
}
prepare_dir(){
if [[ ! -d $1 ]]; then
mkdir -p $1
fi
[[ ! -d $1 ]] && mkdir -p $1
}
# $1: chroot
@ -196,10 +194,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,7 +209,7 @@ 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'
}
@ -223,7 +219,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 +242,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}
}
@ -305,68 +301,43 @@ init_buildiso(){
[[ -z ${dist_release} ]] && dist_release=$(get_release)
[[ -z ${dist_codename} ]] && dist_codename=$(get_codename)
dist_codename=$(get_codename)
dist_name=$(get_distname)
iso_name=$(get_osid)
[[ -z ${dist_branding} ]] && dist_branding="MANJARO"
[[ -z ${dist_branding} ]] && dist_branding="MJRO"
[[ -z ${iso_compression} ]] && iso_compression='zstd'
iso_label=$(get_iso_label "${dist_branding}${dist_release//.}")
[[ -z ${kernel} ]] && kernel="linux54"
load_run_dir "${profile_repo}"
if [[ -d ${run_dir}/.git ]]; then
current_path=$(pwd)
cd ${run_dir}
branch=$(git rev-parse --abbrev-ref HEAD)
cd ${current_path}
else
[[ -z ${branch} ]] && branch="v18.0" #current branch release
fi
[[ -z ${initsys} ]] && initsys="systemd"
[[ -z ${kernel} ]] && kernel="linux49"
[[ -z ${use_overlayfs} ]] && use_overlayfs='true'
[[ -z ${gpgkey} ]] && gpgkey=''
mhwd_repo="/opt/mhwd/pkg"
mhwd_repo="/opt/pkg"
}
init_calamares(){
[[ -z ${welcomestyle} ]] && welcomestyle=false
[[ -z ${welcomelogo} ]] && welcomelogo=true
[[ -z ${windowexp} ]] && windowexp=noexpand
[[ -z ${windowsize} ]] && windowsize="800px,560px"
[[ -z ${windowplacement} ]] && windowplacement="center"
[[ -z ${sidebarbackground} ]] && sidebarbackground=#454948
[[ -z ${sidebartext} ]] && sidebartext=#efefef
[[ -z ${sidebartextselect} ]] && sidebartextselect=#4d915e
[[ -z ${sidebartexthighlight} ]] && sidebartexthighlight=#1a1c1b
}
init_deployiso(){
host="osdn.net"
host="sourceforge.net"
[[ -z ${project} ]] && project="[SetProject]"
[[ -z ${account} ]] && account="[SetUser]"
[[ -z ${alt_storage} ]] && alt_storage=false
[[ -z ${limit} ]] && limit=100
[[ -z ${tracker_url} ]] && tracker_url='udp://tracker.opentrackr.org:1337'
[[ -z ${tracker_url} ]] && tracker_url='udp://mirror.strits.dk:6969'
[[ -z ${piece_size} ]] && piece_size=21
[[ -z ${iso_mirrors[@]} ]] && iso_mirrors=('heanet' 'jaist' 'netcologne' 'iweb' 'kent')
torrent_meta="$(get_distid)"
}
@ -386,13 +357,51 @@ 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}
${plymouth_boot} && service="$service-plymouth"
echo $service
}
load_profile_config(){
[[ -f $1 ]] || return 1
@ -406,10 +415,11 @@ 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="false"
[[ -z ${nonfree_mhwd} ]] && nonfree_mhwd="true"
@ -421,52 +431,56 @@ load_profile_config(){
[[ -z ${password} ]] && password="manjaro"
[[ -z ${user_shell} ]] && user_shell='/bin/bash'
[[ -z ${login_shell} ]] && login_shell='/bin/bash'
if [[ -z ${addgroups} ]]; then
addgroups="lp,network,power,sys,wheel"
if [[ -z ${addgroups} ]];then
addgroups="video,power,storage,optical,network,lp,scanner,wheel"
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 ${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/calamares-netgroups/master"
[[ -z ${geoip} ]] && geoip='true'
[[ -z ${smb_workgroup} ]] && smb_workgroup=''
[[ -z ${basic} ]] && basic='true'
[[ -z ${extra} ]] && extra='false'
[[ ${full_iso} ]] && extra='true'
basic='true'
[[ ${extra} == 'true' ]] && basic='false'
#${basic} && extra='false'
${extra} && basic='false'
[[ -z ${office_installer} ]] && office_installer="false"
check_profile_vars
return 0
}
@ -478,25 +492,11 @@ 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 nonfree_mhwd
unset efi_boot_loader
unset hostname
@ -505,31 +505,33 @@ reset_profile(){
unset addgroups
unset enable_systemd
unset disable_systemd
unset enable_openrc
unset disable_openrc
unset enable_systemd_live
unset disable_systemd_live
unset enable_openrc_live
unset packages_desktop
unset packages_mhwd
unset user_shell
unset login_shell
unset netinstall
unset chrootcfg
unset netgroups
unset geoip
unset plymouth_boot
unset basic
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,20 +539,20 @@ check_profile(){
fi
done
for d in ${keydirs[@]}; do
if [[ -d $d ]]; then
if [[ -d $d ]];then
has_keydirs=true
else
has_keydirs=false
break
fi
done
if ! ${has_keyfiles} && ! ${has_keydirs}; then
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
[[ -f "${profile_dir}/Packages-Desktop" ]] && packages_desktop=${profile_dir}/Packages-Desktop
[[ -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"
@ -561,15 +563,27 @@ check_profile(){
load_pkgs(){
info "Loading Packages: [%s] ..." "${1##*/}"
local _init _init_rm
case "${initsys}" in
'openrc')
_init="s|>openrc||g"
_init_rm="s|>systemd.*||g"
;;
*)
_init="s|>systemd||g"
_init_rm="s|>openrc.*||g"
;;
esac
local _multi _nonfree_default _nonfree_multi _arch _arch_rm _nonfree_i686 _nonfree_x86_64 _basic _basic_rm _extra _extra_rm
if ${basic}; then
if ${basic};then
_basic="s|>basic||g"
else
_basic_rm="s|>basic.*||g"
fi
if ${extra}; then
if ${extra};then
_extra="s|>extra||g"
else
_extra_rm="s|>extra.*||g"
@ -582,7 +596,7 @@ load_pkgs(){
_multi="s|>multilib.*||g"
_nonfree_multi="s|>nonfree_multilib.*||g"
_nonfree_x86_64="s|>nonfree_x86_64.*||g"
if ${nonfree_mhwd}; then
if ${nonfree_mhwd};then
_nonfree_default="s|>nonfree_default||g"
_nonfree_i686="s|>nonfree_i686||g"
@ -595,9 +609,9 @@ load_pkgs(){
_arch="s|>x86_64||g"
_arch_rm="s|>i686.*||g"
_nonfree_i686="s|>nonfree_i686.*||g"
if ${multilib}; then
if ${multilib};then
_multi="s|>multilib||g"
if ${nonfree_mhwd}; then
if ${nonfree_mhwd};then
_nonfree_default="s|>nonfree_default||g"
_nonfree_x86_64="s|>nonfree_x86_64||g"
_nonfree_multi="s|>nonfree_multilib||g"
@ -608,7 +622,7 @@ load_pkgs(){
fi
else
_multi="s|>multilib.*||g"
if ${nonfree_mhwd}; then
if ${nonfree_mhwd};then
_nonfree_default="s|>nonfree_default||g"
_nonfree_x86_64="s|>nonfree_x86_64||g"
_nonfree_multi="s|>nonfree_multilib.*||g"
@ -621,7 +635,6 @@ load_pkgs(){
;;
esac
# We can reuse this code
local _edition _edition_rm
case "${edition}" in
'sonar')
@ -634,13 +647,6 @@ load_pkgs(){
;;
esac
local _office _office_rm
if ${office_installer}; then
_office="s|>office||g"
else
_office_rm="s|>office.*||g"
fi
local _blacklist="s|>blacklist.*||g" \
_kernel="s|KERNEL|$kernel|g" \
_used_kernel=${kernel:5:2} \
@ -654,6 +660,8 @@ load_pkgs(){
| sed "$_space" \
| sed "$_blacklist" \
| sed "$_purge" \
| sed "$_init" \
| sed "$_init_rm" \
| sed "$_arch" \
| sed "$_arch_rm" \
| sed "$_nonfree_default" \
@ -668,8 +676,6 @@ load_pkgs(){
| sed "$_basic_rm" \
| sed "$_extra" \
| sed "$_extra_rm" \
| sed "$_office" \
| sed "$_office_rm" \
| sed "$_clean")
if [[ $1 == "${packages_mhwd}" ]]; then
@ -770,6 +776,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 +799,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
}