Skip to content

Commit 6acfca0

Browse files
authored
Merge pull request #232 from ipvych/settings
Combine conty build settings in a single file
2 parents 1d17372 + 73839e0 commit 6acfca0

File tree

4 files changed

+202
-209
lines changed

4 files changed

+202
-209
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ There are a few ways to update Conty and get the latest packages, use whichever
394394

395395
### Manual
396396

397-
1. Obtain Arch Linux bootstrap by using `create-arch-bootstrap.sh`. Before running it, you can edit the script if you want , for example, to include a different set of packages inside the container, or to include additional locales. Make sure you have enough free disk space, i recommend at least 10 GB of free space. Root rights are required for this step.
397+
1. Obtain Arch Linux bootstrap by using `create-arch-bootstrap.sh`. Before running it, you can edit variables in `settings.sh` if you want, for example, to include a different set of packages inside the container, or to include additional locales. Make sure you have enough free disk space, i recommend at least 10 GB of free space. Root rights are required for this step.
398398

399399
```
400400
# ./create-arch-bootstrap.sh
@@ -404,7 +404,7 @@ There are a few ways to update Conty and get the latest packages, use whichever
404404
```
405405
# ./enter-chroot.sh
406406
```
407-
3. Now use `create-conty.sh` to create a SquashFS (or DwarFS) image and create a ready-to-use Conty executable. Root rights are not needed for this step. By default a SquashFS image with zstd compression (level 19) will be created, however, if you want, you can edit the script and enable DwarFS, select a different compression algorithm and/or compression level.
407+
3. Now use `create-conty.sh` to create a SquashFS (or DwarFS) image and create a ready-to-use Conty executable. Root rights are not needed for this step. By default a SquashFS image with zstd compression (level 19) will be created, however, if you want, you can edit variables in `settings.sh` and enable DwarFS, select a different compression algorithm and/or compression level.
408408
409409
```
410410
$ ./create-conty.sh
@@ -416,7 +416,7 @@ For the sake of convenience, there are pre-compiled binaries (utils.tar.gz) of b
416416
417417
This repository has GitHub workflows that allows you to make GitHub automatically generate a new Conty binary of your specification, every week or at any time you want.
418418
419-
To start, first fork this repository. Then, you may edit the `create-arch-bootstrap.sh` inside the new repository, to build the packages you want. Then go to the Actions tab.
419+
To start, first fork this repository. Then, you may edit the `settings.sh` inside the new repository, to build the packages you want & change compression settings. Then go to the Actions tab.
420420
421421
In the Actions tab, go to the Conty CI section in the left-hand menu. Choose "Run Workflow". This will make GitHub make you a new Conty binary. [By default](https://github.com/Kron4ek/Conty/blob/master/.github/workflows/conty.yml#L5), it will also generate a new Conty binary every Friday (you can use a [cron time expression](https://crontab.cronhub.io/) to change the schedule).
422422

create-arch-bootstrap.sh

Lines changed: 29 additions & 167 deletions
Original file line numberDiff line numberDiff line change
@@ -2,112 +2,25 @@
22

33
# Dependencies: curl tar gzip grep coreutils
44
# Root rights are required
5+
source settings.sh
56

6-
########################################################################
7-
8-
# Package groups
9-
audio_pkgs="alsa-lib lib32-alsa-lib alsa-plugins lib32-alsa-plugins libpulse \
10-
lib32-libpulse alsa-tools alsa-utils pipewire lib32-pipewire pipewire-pulse pipewire-jack lib32-pipewire-jack"
11-
12-
core_pkgs="xorg-xwayland qt6-wayland wayland \
13-
lib32-wayland qt5-wayland xorg-server-xephyr gamescope"
14-
15-
video_pkgs="mesa lib32-mesa vulkan-radeon lib32-vulkan-radeon \
16-
vulkan-intel lib32-vulkan-intel \
17-
vulkan-icd-loader lib32-vulkan-icd-loader vulkan-mesa-layers \
18-
lib32-vulkan-mesa-layers libva-mesa-driver lib32-libva-mesa-driver \
19-
libva-intel-driver lib32-libva-intel-driver intel-media-driver \
20-
mesa-utils vulkan-tools libva-utils lib32-mesa-utils"
21-
22-
wine_pkgs="wine-staging winetricks-git wine-nine wineasio \
23-
freetype2 lib32-freetype2 libxft lib32-libxft \
24-
flex lib32-flex fluidsynth lib32-fluidsynth \
25-
libxrandr lib32-libxrandr xorg-xrandr libldap lib32-libldap \
26-
mpg123 lib32-mpg123 libxcomposite lib32-libxcomposite \
27-
libxi lib32-libxi libxinerama lib32-libxinerama libxss lib32-libxss \
28-
libxslt lib32-libxslt openal lib32-openal \
29-
krb5 lib32-krb5 libpulse lib32-libpulse alsa-plugins \
30-
lib32-alsa-plugins alsa-lib lib32-alsa-lib gnutls lib32-gnutls \
31-
giflib lib32-giflib gst-libav gst-plugin-pipewire gst-plugins-ugly \
32-
gst-plugins-bad gst-plugins-bad-libs \
33-
gst-plugins-base-libs lib32-gst-plugins-base-libs gst-plugins-base lib32-gst-plugins-base \
34-
gst-plugins-good lib32-gst-plugins-good gstreamer lib32-gstreamer \
35-
libpng lib32-libpng v4l-utils lib32-v4l-utils \
36-
libgpg-error lib32-libgpg-error libjpeg-turbo lib32-libjpeg-turbo \
37-
libgcrypt lib32-libgcrypt ncurses lib32-ncurses ocl-icd lib32-ocl-icd
38-
libxcrypt-compat lib32-libxcrypt-compat libva lib32-libva sqlite lib32-sqlite \
39-
gtk3 lib32-gtk3 vulkan-icd-loader lib32-vulkan-icd-loader \
40-
sdl2 lib32-sdl2 vkd3d lib32-vkd3d libgphoto2 \
41-
openssl-1.1 lib32-openssl-1.1 libnm lib32-libnm \
42-
cabextract wget gamemode lib32-gamemode mangohud lib32-mangohud"
43-
44-
devel_pkgs="base-devel git meson mingw-w64-gcc cmake"
45-
46-
gaming_pkgs="lutris python-protobuf steam steam-native-runtime steamtinkerlaunch \
47-
minigalaxy gamehub legendary prismlauncher bottles playonlinux obs-studio \
48-
retroarch retroarch-assets-ozone libretro-beetle-psx-hw sunshine \
49-
libretro-blastem libretro-bsnes libretro-dolphin duckstation \
50-
libretro-gambatte libretro-melonds libretro-mgba libretro-nestopia \
51-
libretro-parallel-n64 libretro-pcsx2 libretro-picodrive libretro-ppsspp \
52-
libretro-retrodream libretro-yabause pcsx2-avx-git"
53-
54-
extra_pkgs="nano ttf-dejavu ttf-liberation firefox mpv geany pcmanfm \
55-
htop qbittorrent speedcrunch gpicview file-roller openbox lxterminal \
56-
yt-dlp minizip nautilus genymotion jre17-openjdk gnome-themes-extra"
57-
58-
# Packages to install
59-
# You can add packages that you want and remove packages that you don't need
60-
# Apart from packages from the official Arch repos, you can also specify
61-
# packages from the Chaotic-AUR repo
62-
export packagelist="${audio_pkgs} ${core_pkgs} ${video_pkgs} ${wine_pkgs} ${devel_pkgs} ${gaming_pkgs} ${extra_pkgs}"
63-
64-
# If you want to install AUR packages, specify them in this variable
65-
export aur_packagelist="faugus-launcher-git"
66-
67-
# ALHP is a repository containing packages from the official Arch Linux
68-
# repos recompiled with -O3, LTO and optimizations for modern CPUs for
69-
# better performance
70-
#
71-
# When this repository is enabled, most of the packages from the official
72-
# Arch Linux repos will be replaced with their optimized versions from ALHP
73-
#
74-
# Set this variable to true, if you want to enable this repository
75-
enable_alhp_repo="false"
76-
77-
# Feature levels for ALHP. Available feature levels are 2 and 3
78-
# For level 2 you need a CPU with SSE4.2 instructions
79-
# For level 3 you need a CPU with AVX2 instructions
80-
alhp_feature_level="2"
81-
82-
########################################################################
7+
check_command_available() {
8+
for cmd in "$@"; do
9+
if ! command -v "$cmd" >&-; then
10+
echo "$cmd is required!"
11+
exit 1
12+
fi
13+
done
14+
}
15+
check_command_available curl gzip grep sha256sum
8316

8417
if [ $EUID != 0 ]; then
8518
echo "Root rights are required!"
86-
87-
exit 1
88-
fi
89-
90-
if ! command -v curl 1>/dev/null; then
91-
echo "curl is required!"
92-
exit 1
93-
fi
94-
95-
if ! command -v gzip 1>/dev/null; then
96-
echo "gzip is required!"
97-
exit 1
98-
fi
99-
100-
if ! command -v grep 1>/dev/null; then
101-
echo "grep is required!"
102-
exit 1
103-
fi
104-
105-
if ! command -v sha256sum 1>/dev/null; then
106-
echo "sha256sum is required!"
10719
exit 1
10820
fi
10921

11022
script_dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
23+
bootstrap="${script_dir}"/root.x86_64
11124

11225
mount_chroot () {
11326
# First unmount just in case
@@ -124,6 +37,7 @@ mount_chroot () {
12437

12538
rm -f "${bootstrap}"/etc/resolv.conf
12639
cp /etc/resolv.conf "${bootstrap}"/etc/resolv.conf
40+
cp "${script_dir}"/settings.sh "${bootstrap}"/conty_settings.sh
12741

12842
mkdir -p "${bootstrap}"/run/shm
12943
}
@@ -146,8 +60,9 @@ run_in_chroot () {
14660
}
14761

14862
install_packages () {
63+
source /conty_settings.sh
14964
echo "Checking if packages are present in the repos, please wait..."
150-
for p in ${packagelist}; do
65+
for p in "${PACKAGES[@]}"; do
15166
if pacman -Sp "${p}" &>/dev/null; then
15267
good_pkglist="${good_pkglist} ${p}"
15368
else
@@ -200,54 +115,15 @@ generate_pkg_licenses_file () {
200115
}
201116

202117
generate_localegen () {
203-
cat <<EOF > locale.gen
204-
ar_EG.UTF-8 UTF-8
205-
en_US.UTF-8 UTF-8
206-
en_GB.UTF-8 UTF-8
207-
en_CA.UTF-8 UTF-8
208-
en_SG.UTF-8 UTF-8
209-
es_MX.UTF-8 UTF-8
210-
zh_CN.UTF-8 UTF-8
211-
fr_FR.UTF-8 UTF-8
212-
ru_RU.UTF-8 UTF-8
213-
ru_UA.UTF-8 UTF-8
214-
es_ES.UTF-8 UTF-8
215-
de_DE.UTF-8 UTF-8
216-
pt_BR.UTF-8 UTF-8
217-
it_IT.UTF-8 UTF-8
218-
id_ID.UTF-8 UTF-8
219-
ja_JP.UTF-8 UTF-8
220-
bg_BG.UTF-8 UTF-8
221-
pl_PL.UTF-8 UTF-8
222-
da_DK.UTF-8 UTF-8
223-
ko_KR.UTF-8 UTF-8
224-
tr_TR.UTF-8 UTF-8
225-
hu_HU.UTF-8 UTF-8
226-
cs_CZ.UTF-8 UTF-8
227-
bn_IN UTF-8
228-
hi_IN UTF-8
229-
EOF
118+
printf '%s\n' "${LOCALES[@]}" > locale.gen
230119
}
231120

232121
generate_mirrorlist () {
233-
cat <<EOF > mirrorlist
234-
Server = https://mirror1.sl-chat.ru/archlinux/\$repo/os/\$arch
235-
Server = https://mirror3.sl-chat.ru/archlinux/\$repo/os/\$arch
236-
Server = https://us.mirrors.cicku.me/archlinux/\$repo/os/\$arch
237-
Server = https://mirror.osbeck.com/archlinux/\$repo/os/\$arch
238-
Server = https://md.mirrors.hacktegic.com/archlinux/\$repo/os/\$arch
239-
Server = https://geo.mirror.pkgbuild.com/\$repo/os/\$arch
240-
Server = https://mirror.qctronics.com/archlinux/\$repo/os/\$arch
241-
Server = https://arch.mirror.constant.com/\$repo/os/\$arch
242-
Server = https://america.mirror.pkgbuild.com/\$repo/os/\$arch
243-
Server = https://mirror.tmmworkshop.com/archlinux/\$repo/os/\$arch
244-
EOF
122+
printf '%s\n' "$MIRRORLIST" > mirrorlist
245123
}
246124

247125
cd "${script_dir}" || exit 1
248126

249-
bootstrap="${script_dir}"/root.x86_64
250-
251127
curl -#LO 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-keyring.pkg.tar.zst'
252128
curl -#LO 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-mirrorlist.pkg.tar.zst'
253129

@@ -257,29 +133,16 @@ if [ ! -s chaotic-keyring.pkg.tar.zst ] || [ ! -s chaotic-mirrorlist.pkg.tar.zst
257133
exit 1
258134
fi
259135

260-
bootstrap_urls=("arch.hu.fo" \
261-
"mirror.cyberbits.eu" \
262-
"mirror.osbeck.com" \
263-
"mirror.lcarilla.de" \
264-
"mirror.moson.org" \
265-
"mirror.f4st.host")
136+
for link in "${BOOTSTRAP_DOWNLOAD_URLS[@]}"; do
137+
echo "Downloading Arch Linux bootstrap from $link"
138+
curl -#LO "$link"
139+
curl -#LO "$BOOTSTRAP_SHA256SUM_FILE_URL"
266140

267-
echo "Downloading Arch Linux bootstrap"
268-
269-
for link in "${bootstrap_urls[@]}"; do
270-
curl -#LO "https://${link}/archlinux/iso/latest/archlinux-bootstrap-x86_64.tar.zst"
271-
curl -#LO "https://${link}/archlinux/iso/latest/sha256sums.txt"
272-
273-
if [ -s sha256sums.txt ]; then
274-
grep bootstrap-x86_64 sha256sums.txt > sha256.txt
275-
276-
echo "Verifying the integrity of the bootstrap"
277-
if sha256sum -c sha256.txt &>/dev/null; then
278-
bootstrap_is_good=1
279-
break
280-
fi
141+
echo "Verifying the integrity of the bootstrap"
142+
if sha256sum --ignore-missing -c sha256sums.txt &>/dev/null; then
143+
bootstrap_is_good=1
144+
break
281145
fi
282-
283146
echo "Download failed, trying again with different mirror"
284147
done
285148

@@ -317,11 +180,10 @@ mv mirrorlist "${bootstrap}"/etc/pacman.d/mirrorlist
317180
} >> "${bootstrap}"/etc/pacman.conf
318181

319182
run_in_chroot pacman-key --init
320-
echo "keyserver hkps://keyserver.ubuntu.com" >> "${bootstrap}"/etc/pacman.d/gnupg/gpg.conf
321183
run_in_chroot pacman-key --populate archlinux
322184

323185
# Add Chaotic-AUR repo
324-
run_in_chroot pacman-key --recv-key 3056513887B78AEB
186+
run_in_chroot pacman-key --recv-key 3056513887B78AEB --keyserver keyserver.ubuntu.com
325187
run_in_chroot pacman-key --lsign-key 3056513887B78AEB
326188

327189
mv chaotic-keyring.pkg.tar.zst chaotic-mirrorlist.pkg.tar.zst "${bootstrap}"/opt
@@ -344,8 +206,8 @@ sed -i 's/#NoExtract =/NoExtract = usr\/lib\/firmware\/nvidia\/\* usr\/share
344206
run_in_chroot pacman -Sy archlinux-keyring --noconfirm
345207
run_in_chroot pacman -Su --noconfirm
346208

347-
if [ "${enable_alhp_repo}" = "true" ]; then
348-
if [ "${alhp_feature_level}" -gt 2 ]; then
209+
if [ -n "$ENABLE_ALHP_REPO" ]; then
210+
if [ "${ALHP_FEATURE_LEVEL}" -gt 2 ]; then
349211
alhp_feature_level=3
350212
else
351213
alhp_feature_level=2
@@ -379,12 +241,12 @@ if [ -f "${bootstrap}"/opt/pacman_failed.txt ]; then
379241
exit 1
380242
fi
381243

382-
if [ -n "${aur_packagelist}" ]; then
244+
if [ "${#AUR_PACKAGES[@]}" -ne 0 ]; then
383245
run_in_chroot pacman --noconfirm --needed -S base-devel yay
384246
run_in_chroot useradd -m -G wheel aur
385247
echo "%wheel ALL=(ALL:ALL) NOPASSWD: ALL" >> "${bootstrap}"/etc/sudoers
386248

387-
for p in ${aur_packagelist}; do
249+
for p in "${AUR_PACKAGES[@]}"; do
388250
aur_pkgs="${aur_pkgs} aur/${p}"
389251
done
390252
export aur_pkgs

create-conty.sh

Lines changed: 10 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,13 @@
33
# Dependencies: sed, squashfs-tools or dwarfs
44

55
script_dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
6-
7-
# Enable this variable to use the system-wide mksquashfs/mkdwarfs instead
8-
# of those provided by the Conty project
9-
USE_SYS_UTILS=0
10-
11-
# Supported compression algorithms: lz4, zstd, gzip, xz, lzo
12-
# These are the algorithms supported by the integrated squashfuse
13-
# However, your squashfs-tools (mksquashfs) may not support some of them
14-
squashfs_compressor="zstd"
15-
squashfs_compressor_arguments=(-b 1M -comp ${squashfs_compressor} -Xcompression-level 19)
16-
17-
# Uncomment these variables if your mksquashfs does not support zstd or
18-
# if you want faster compression/decompression (at the cost of compression ratio)
19-
#squashfs_compressor="lz4"
20-
#squashfs_compressor_arguments=(-b 256K -comp "${squashfs_compressor}" -Xhc)
21-
22-
# Use DwarFS instead of SquashFS
23-
dwarfs="false"
24-
dwarfs_compressor_arguments=(-l7 -C zstd:level=19 --metadata-compression null \
25-
-S 21 -B 1 --order nilsimsa \
26-
-W 12 -w 4 --no-create-timestamp)
27-
28-
# Set to true to use an existing image if it exists
29-
# Otherwise the script will always create a new image
30-
use_existing_image="false"
31-
326
image_path="${script_dir}"/image
337
bootstrap="${script_dir}"/root.x86_64
348

9+
source "${bootstrap}"/settings.sh
10+
3511
launch_wrapper () {
36-
if [ "${USE_SYS_UTILS}" != 0 ]; then
12+
if [ -n "${USE_SYS_UTILS}" ]; then
3713
if ! command -v "${1}" 1>/dev/null; then
3814
echo "Please install $(echo "${1}" | tail -c +3) and run the script again"
3915
exit 1
@@ -52,12 +28,12 @@ fi
5228

5329
cd "${script_dir}" || exit 1
5430

55-
if [ "${dwarfs}" = "true" ]; then
31+
if [ -n "$USE_DWARFS" ]; then
5632
utils="utils_dwarfs.tar.gz"
57-
compressor_command=(mkdwarfs -i "${bootstrap}" -o "${image_path}" "${dwarfs_compressor_arguments[@]}")
33+
compressor_command=(mkdwarfs -i "${bootstrap}" -o "${image_path}" "${DWARFS_COMPRESSOR_ARGUMENTS[@]}")
5834
else
5935
utils="utils.tar.gz"
60-
compressor_command=(mksquashfs "${bootstrap}" "${image_path}" "${squashfs_compressor_arguments[@]}")
36+
compressor_command=(mksquashfs "${bootstrap}" "${image_path}" "${SQUASHFS_COMPRESSOR_ARGUMENTS[@]}")
6137
fi
6238

6339
if [ ! -f "${utils}" ] || [ "$(wc -c < "${utils}")" -lt 100000 ]; then
@@ -91,28 +67,23 @@ if [ $? != 0 ]; then
9167
fi
9268

9369
# Check if selected compression algorithm is supported by mksquashfs
94-
if [ "${USE_SYS_UTILS}" != 0 ] && [ "${dwarfs}" != "true" ] && command -v grep 1>/dev/null; then
95-
# mksquashfs writes its output to stderr instead of stdout
96-
mksquashfs &>mksquashfs_out.txt
97-
98-
if ! grep -q "${squashfs_compressor}" mksquashfs_out.txt; then
70+
if [ -n "${USE_SYS_UTILS}" ] && [ -z "$USE_DWARFS" ] && command -v grep 1>/dev/null; then
71+
if ! mksquashfs 2>&1 | grep -q "${SQUASHFS_COMPRESSOR}"; then
9972
echo "Seems like your mksquashfs doesn't support the selected"
100-
echo "compression algorithm (${squashfs_compressor})."
73+
echo "compression algorithm (${SQUASHFS_COMPRESSOR})."
10174
echo
10275
echo "Choose another algorithm and run the script again"
10376

10477
exit 1
10578
fi
106-
107-
rm -f mksquashfs_out.txt
10879
fi
10980

11081
echo
11182
echo "Creating Conty..."
11283
echo
11384

11485
# Create the image
115-
if [ ! -f "${image_path}" ] || [ "${use_existing_image}" != "true" ]; then
86+
if [ ! -f "${image_path}" ] || [ -z "${USE_EXISTING_IMAGE}" ]; then
11687
if [ ! -d "${bootstrap}" ]; then
11788
echo "Distro bootstrap is required!"
11889
echo "Use the create-arch-bootstrap.sh script to get it"

0 commit comments

Comments
 (0)