Skip to content

Commit a028da7

Browse files
committed
Merge branch 'no-rebuild' into dev
2 parents 89b0dea + 83dfd4d commit a028da7

11 files changed

Lines changed: 68 additions & 302 deletions

File tree

build.sh

Lines changed: 66 additions & 148 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ set -eu
1818
script_path="$( cd -P "$( dirname "$(readlink -f "${0}")" )" && pwd )"
1919
defaultconfig="${script_path}/default.conf"
2020
tools_dir="${script_path}/tools"
21-
rebuild=false
2221
customized_username=false
2322
customized_password=false
2423
customized_kernel=false
@@ -170,9 +169,6 @@ _usage () {
170169
echo_blank "$(( ${blank} - 3 - $(echo ${_dirname%.add} | wc -m) ))"
171170
"${tools_dir}/channel.sh" --nocheck desc "${_dirname%.add}"
172171
done
173-
echo -ne " rebuild"
174-
echo_blank "$(( ${blank} - 11 ))"
175-
echo -ne "Build from the point where it left off using the previous build settings.\n"
176172

177173
echo
178174
echo " Debug options: Please use at your own risk."
@@ -375,7 +371,7 @@ prepare_env() {
375371
[[ ! -d "${work_dir}" ]] && mkdir -p "${work_dir}"
376372

377373
# Check work dir
378-
if [[ -n $(ls -a "${work_dir}" 2> /dev/null | grep -xv ".." | grep -xv ".") ]] && [[ ! "${rebuild}" = true ]]; then
374+
if [[ -n $(ls -a "${work_dir}" 2> /dev/null | grep -xv ".." | grep -xv ".") ]]; then
379375
umount_chroot_advance
380376
msg_info "Deleting the contents of ${work_dir}..."
381377
remove "${work_dir%/}"/*
@@ -420,61 +416,6 @@ show_settings() {
420416
trap 'umount_trap' 1 2 3 15
421417
}
422418

423-
# Save vars
424-
prepare_rebuild() {
425-
# Save build options
426-
local _write_rebuild_file
427-
_write_rebuild_file() {
428-
local out_file="${rebuildfile}"
429-
echo -e "${@}" >> "${out_file}"
430-
}
431-
432-
local _save_var
433-
_save_var() {
434-
local out_file="${rebuildfile}" i
435-
for i in ${@}; do echo "${i}=\"$(eval echo -n '$'${i})\"" >> "${out_file}"; done
436-
}
437-
438-
# Save the value of the variable for use in rebuild.
439-
remove "${rebuildfile}"
440-
_write_rebuild_file "#!/usr/bin/env bash"
441-
_write_rebuild_file "# Build options are stored here."
442-
443-
_write_rebuild_file "\n# OS Info"
444-
_save_var arch os_name iso_name iso_label iso_publisher iso_application iso_version iso_filename channel_name
445-
446-
_write_rebuild_file "\n# Environment Info"
447-
_save_var channel_dir airootfs_dir share_dir extra_dir isofs_dir install_dir work_dir out_dir gpg_key
448-
449-
_write_rebuild_file "\n# Live User Info"
450-
_save_var username password usershell
451-
452-
_write_rebuild_file "\n# Plymouth Info"
453-
_save_var boot_splash theme_name
454-
455-
_write_rebuild_file "\n# Language Info"
456-
_save_var locale_name locale_gen_name locale_version locale_time locale_fullname
457-
458-
_write_rebuild_file "\n# Kernel Info"
459-
_save_var kernel kernel_filename kernel_mkinitcpio_profile
460-
461-
_write_rebuild_file "\n# Squashfs Info"
462-
_save_var sfs_comp sfs_comp_opt
463-
464-
_write_rebuild_file "\n# Debug Info"
465-
_save_var noaur gitversion noloopmod bash_debug debug nosigcheck
466-
467-
_write_rebuild_file "\n# Channel Info"
468-
_save_var build_pacman_conf defaultconfig include_extra defaultusername customized_username customized_password customized_kernel
469-
_save_var memtest86
470-
471-
_write_rebuild_file "\n# mkalteriso Info"
472-
_save_var mkalteriso shmkalteriso mkalteriso_option tarball
473-
474-
_write_rebuild_file "\n# depend package"
475-
_write_rebuild_file "dependence=(${dependence[*]})"
476-
}
477-
478419

479420
# Preparation for build
480421
prepare_build() {
@@ -485,87 +426,75 @@ prepare_build() {
485426
cd - > /dev/null 2>&1
486427
fi
487428

488-
if [[ "${rebuild}" = false ]]; then
489-
# Pacman configuration file used only when building
490-
# If there is pacman.conf for each channel, use that for building
491-
if [[ -f "${channel_dir}/pacman-${arch}.conf" ]]; then
492-
build_pacman_conf="${channel_dir}/pacman-${arch}.conf"
493-
else
494-
build_pacman_conf="${script_path}/system/pacman-${arch}.conf"
495-
fi
496-
497-
# Set dirs
498-
airootfs_dir="${work_dir}/${arch}/airootfs"
499-
share_dir="${script_path}/channels/share"
500-
extra_dir="${script_path}/channels/share-extra"
501-
isofs_dir="${work_dir}/iso"
502-
503-
# If there is config for channel. load that.
504-
load_config "${share_dir}/config.any" "${share_dir}/share/config.${arch}"
505-
load_config "${channel_dir}/config.any" "${channel_dir}/config.${arch}"
506-
if [[ "${include_extra}" = true ]]; then
507-
load_config "${extra_dir}/config.any" "${extra_dir}/share/config.${arch}"
508-
fi
429+
# Pacman configuration file used only when building
430+
# If there is pacman.conf for each channel, use that for building
431+
if [[ -f "${channel_dir}/pacman-${arch}.conf" ]]; then
432+
build_pacman_conf="${channel_dir}/pacman-${arch}.conf"
433+
else
434+
build_pacman_conf="${script_path}/system/pacman-${arch}.conf"
435+
fi
509436

510-
# Set kernel
511-
if [[ "${customized_kernel}" = false ]]; then
512-
kernel="${defaultkernel}"
513-
fi
437+
# Set dirs
438+
airootfs_dir="${work_dir}/${arch}/airootfs"
439+
share_dir="${script_path}/channels/share"
440+
extra_dir="${script_path}/channels/share-extra"
441+
isofs_dir="${work_dir}/iso"
514442

515-
# Parse files
516-
eval $(bash "${tools_dir}/locale.sh" -s -a "${arch}" get "${locale_name}")
517-
eval $(bash "${tools_dir}/kernel.sh" -s -c "${channel_name}" -a "${arch}" get "${kernel}")
443+
# If there is config for channel. load that.
444+
load_config "${share_dir}/config.any" "${share_dir}/share/config.${arch}"
445+
load_config "${channel_dir}/config.any" "${channel_dir}/config.${arch}"
446+
if [[ "${include_extra}" = true ]]; then
447+
load_config "${extra_dir}/config.any" "${extra_dir}/share/config.${arch}"
448+
fi
518449

519-
# Set username
520-
if [[ "${customized_username}" = false ]]; then
521-
username="${defaultusername}"
522-
fi
450+
# Set kernel
451+
if [[ "${customized_kernel}" = false ]]; then
452+
kernel="${defaultkernel}"
453+
fi
523454

524-
# Set password
525-
if [[ "${customized_password}" = false ]]; then
526-
password="${defaultpassword}"
527-
fi
455+
# Parse files
456+
eval $(bash "${tools_dir}/locale.sh" -s -a "${arch}" get "${locale_name}")
457+
eval $(bash "${tools_dir}/kernel.sh" -s -c "${channel_name}" -a "${arch}" get "${kernel}")
528458

529-
# gitversion
530-
if [[ "${gitversion}" = true ]]; then
531-
cd "${script_path}"
532-
iso_version=${iso_version}-$(git rev-parse --short HEAD)
533-
cd - > /dev/null 2>&1
534-
fi
459+
# Set username
460+
if [[ "${customized_username}" = false ]]; then
461+
username="${defaultusername}"
462+
fi
535463

536-
# Generate iso file name.
537-
local _channel_name="${channel_name%.add}-${locale_version}"
538-
if [[ "${nochname}" = true ]]; then
539-
iso_filename="${iso_name}-${iso_version}-${arch}.iso"
540-
else
541-
iso_filename="${iso_name}-${_channel_name}-${iso_version}-${arch}.iso"
542-
fi
543-
msg_debug "Iso filename is ${iso_filename}"
464+
# Set password
465+
if [[ "${customized_password}" = false ]]; then
466+
password="${defaultpassword}"
467+
fi
544468

545-
# Debug mode
546-
mkalteriso_option="-a ${arch} -v"
547-
if [[ "${bash_debug}" = true ]]; then
548-
set -x -v
549-
mkalteriso_option="${mkalteriso_option} -x"
550-
fi
551-
if [[ "${noaur}" = false ]]; then
552-
mkalteriso_option="${mkalteriso_option} --aur"
553-
fi
469+
# gitversion
470+
if [[ "${gitversion}" = true ]]; then
471+
cd "${script_path}"
472+
iso_version=${iso_version}-$(git rev-parse --short HEAD)
473+
cd - > /dev/null 2>&1
474+
fi
554475

555-
prepare_rebuild
476+
# Generate iso file name.
477+
local _channel_name="${channel_name%.add}-${locale_version}"
478+
if [[ "${nochname}" = true ]]; then
479+
iso_filename="${iso_name}-${iso_version}-${arch}.iso"
556480
else
557-
# Load rebuild file
558-
load_config "${rebuildfile}"
559-
msg_debug "Iso filename is ${iso_filename}"
481+
iso_filename="${iso_name}-${_channel_name}-${iso_version}-${arch}.iso"
482+
fi
483+
msg_debug "Iso filename is ${iso_filename}"
560484

561-
# Mount airootfs.img
562-
if [[ "${noaur}" = false ]] && [[ -f "${work_dir}/${arch}/airootfs.img" ]]; then
563-
mount_airootfs
564-
fi
485+
# Debug mode
486+
mkalteriso_option="-a ${arch} -v"
487+
if [[ "${bash_debug}" = true ]]; then
488+
set -x -v
489+
mkalteriso_option="${mkalteriso_option} -x"
490+
fi
491+
if [[ "${noaur}" = false ]]; then
492+
mkalteriso_option="${mkalteriso_option} --aur"
565493
fi
566494

495+
567496
# check bool
568-
check_bool boot_splash cleaning noconfirm nodepend shmkalteriso customized_username customized_password noloopmod nochname tarball noiso noaur customized_syslinux norescue_entry rebuild debug bash_debug nocolor msgdebug noefi include_extra nosigcheck
497+
check_bool boot_splash cleaning noconfirm nodepend shmkalteriso customized_username customized_password noloopmod nochname tarball noiso noaur customized_syslinux norescue_entry debug bash_debug nocolor msgdebug noefi include_extra nosigcheck
569498

570499
# Check architecture for each channel
571500
if [[ ! "$(bash "${tools_dir}/channel.sh" -a ${arch} -n -b check "${channel_name}")" = "correct" ]]; then
@@ -724,11 +653,11 @@ make_customize_airootfs() {
724653
# -t : Set plymouth theme.
725654
# -u <username> : Set live user name.
726655
# -x : Enable bash debug mode.
727-
# -r : Enable rebuild.
728656
# -z <locale_time> : Set the time zone.
729657
# -l <locale_name> : Set language.
730658
#
731659
# -j is obsolete in AlterISO3 and cannot be used.
660+
# -r is obsolete due to the removal of rebuild.
732661
# -k changed in AlterISO3 from passing kernel name to passing kernel configuration.
733662

734663

@@ -737,7 +666,6 @@ make_customize_airootfs() {
737666
[[ "${boot_splash}" = true ]] && _airootfs_script_options="${_airootfs_script_options} -b"
738667
[[ "${debug}" = true ]] && _airootfs_script_options="${_airootfs_script_options} -d"
739668
[[ "${bash_debug}" = true ]] && _airootfs_script_options="${_airootfs_script_options} -x"
740-
[[ "${rebuild}" = true ]] && _airootfs_script_options="${_airootfs_script_options} -r"
741669

742670

743671
_main_script="root/customize_airootfs.sh"
@@ -1306,9 +1234,6 @@ unset DEFAULT_ARGUMENT ARGUMENT
13061234
msg_debug "Use the default configuration file (${defaultconfig})."
13071235
[[ -f "${script_path}/custom.conf" ]] && msg_debug "The default settings have been overridden by custom.conf"
13081236

1309-
# Set rebuild config file
1310-
rebuildfile="${work_dir}/alteriso_config"
1311-
13121237
# Debug mode
13131238
if [[ "${bash_debug}" = true ]]; then set -x -v; fi
13141239

@@ -1335,12 +1260,6 @@ fi
13351260
if [[ -d "${channel_dir}.add" ]]; then
13361261
channel_name="${1}"
13371262
channel_dir="${channel_dir}.add"
1338-
elif [[ "${channel_name}" = "rebuild" ]]; then
1339-
if [[ -f "${rebuildfile}" ]]; then
1340-
rebuild=true
1341-
else
1342-
msg_error "The previous build information is not in the working directory." "1"
1343-
fi
13441263
elif [[ "${channel_name}" = "clean" ]]; then
13451264
"${tools_dir}/clean.sh" -w $(realpath "${work_dir}") $([[ "${debug}" = true ]] && echo -n "-d")
13461265
exit 0
@@ -1349,18 +1268,17 @@ else
13491268
fi
13501269

13511270
# Check channel version
1352-
if [[ ! "${channel_name}" = "rebuild" ]]; then
1353-
msg_debug "channel path is ${channel_dir}"
1354-
if [[ ! "$(cat "${channel_dir}/alteriso" 2> /dev/null)" = "alteriso=${alteriso_version}" ]] && [[ "${nochkver}" = false ]]; then
1355-
msg_error "This channel does not support Alter ISO 3."
1356-
if [[ -d "${script_path}/.git" ]]; then
1357-
msg_error "Please run \"git checkout alteriso-2\"" "1"
1358-
else
1359-
msg_error "Please download Alter ISO 2 here.\nhttps://github.com/FascodeNet/alterlinux/archive/alteriso-2.zip" "1"
1360-
fi
1271+
msg_debug "channel path is ${channel_dir}"
1272+
if [[ ! "$(cat "${channel_dir}/alteriso" 2> /dev/null)" = "alteriso=${alteriso_version}" ]] && [[ "${nochkver}" = false ]]; then
1273+
msg_error "This channel does not support Alter ISO 3."
1274+
if [[ -d "${script_path}/.git" ]]; then
1275+
msg_error "Please run \"git checkout alteriso-2\"" "1"
1276+
else
1277+
msg_error "Please download Alter ISO 2 here.\nhttps://github.com/FascodeNet/alterlinux/archive/alteriso-2.zip" "1"
13611278
fi
13621279
fi
13631280

1281+
13641282
set -eu
13651283

13661284
prepare_env

channels/i3/airootfs.any/root/customize_airootfs_i3.sh

Lines changed: 0 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -7,79 +7,6 @@
77
# (c) 2019-2021 Fascode Network.
88
#
99

10-
set -e -u
11-
12-
13-
# Default value
14-
# All values can be changed by arguments.
15-
password=alter
16-
boot_splash=false
17-
kernel_config_line=("zen" "vmlinuz-linux-zen" "linux-zen")
18-
theme_name=alter-logo
19-
rebuild=false
20-
username='alter'
21-
os_name="Alter Linux"
22-
install_dir="alter"
23-
usershell="/bin/bash"
24-
debug=false
25-
timezone="UTC"
26-
localegen="en_US\\.UTF-8\\"
27-
language="en"
28-
29-
30-
# Parse arguments
31-
while getopts 'p:bt:k:rxu:o:i:s:da:g:z:l:' arg; do
32-
case "${arg}" in
33-
p) password="${OPTARG}" ;;
34-
b) boot_splash=true ;;
35-
t) theme_name="${OPTARG}" ;;
36-
k) kernel_config_line=(${OPTARG}) ;;
37-
r) rebuild=true ;;
38-
u) username="${OPTARG}" ;;
39-
o) os_name="${OPTARG}" ;;
40-
i) install_dir="${OPTARG}" ;;
41-
s) usershell="${OPTARG}" ;;
42-
d) debug=true ;;
43-
x) debug=true; set -xv ;;
44-
a) arch="${OPTARG}" ;;
45-
g) localegen="${OPTARG/./\\.}\\" ;;
46-
z) timezone="${OPTARG}" ;;
47-
l) language="${OPTARG}" ;;
48-
esac
49-
done
50-
51-
52-
# Parse kernel
53-
kernel="${kernel_config_line[0]}"
54-
kernel_filename="${kernel_config_line[1]}"
55-
kernel_mkinitcpio_profile="${kernel_config_line[2]}"
56-
57-
58-
# Delete file only if file exists
59-
# remove <file1> <file2> ...
60-
function remove () {
61-
local _list
62-
local _file
63-
_list=($(echo "$@"))
64-
for _file in "${_list[@]}"; do
65-
if [[ -f ${_file} ]]; then
66-
rm -f "${_file}"
67-
elif [[ -d ${_file} ]]; then
68-
rm -rf "${_file}"
69-
fi
70-
echo "${_file} was deleted."
71-
done
72-
}
73-
74-
75-
# Replace wallpaper.
76-
if [[ -f /usr/share/backgrounds/xfce/xfce-stripes.png ]]; then
77-
remove /usr/share/backgrounds/xfce/xfce-stripes.png
78-
ln -s /usr/share/backgrounds/alter.png /usr/share/backgrounds/xfce/xfce-stripes.png
79-
fi
80-
[[ -f /usr/share/backgrounds/alter.png ]] && chmod 644 /usr/share/backgrounds/alter.png
81-
82-
8310
# Bluetooth
8411
#rfkill unblock all
8512
#systemctl enable bluetooth

0 commit comments

Comments
 (0)