OSDN Git Service

2021.01.14 Update
[rebornos/cnchi-gnome-osdn.git] / build.sh
1 #!/usr/bin/bash
2
3 set -e -u
4
5
6 if [ -f config ]; then
7     source ./config
8 else
9     # No config file!
10     exit 1
11 fi
12
13 iso_name=RebornOS
14 iso_label="RebornOS_$(date +%Y%m)"
15 iso_version=$(date +%Y.%m.%d)
16 install_dir=arch
17 work_dir=work
18 out_dir=out
19 gpg_key=
20
21 arch=$(uname -m)
22 verbose=""
23 script_path=$(readlink -f ${0%/*})
24
25 if [ -d ${script_path}/work ]; then
26      echo "Removing build directory for you. Please be patient..."
27      rm -rf ${script_path}/work
28     echo "######################################################"
29     echo "######################## DONE ########################"
30     echo "######################################################"
31 fi
32
33
34 _usage ()
35 {
36     echo "usage ${0} [options]"
37     echo
38     echo " General options:"
39     echo "    -N <iso_name>      Set an iso filename (prefix)"
40     echo "                        Default: ${iso_name}"
41     echo "    -V <iso_version>   Set an iso version (in filename)"
42     echo "                        Default: ${iso_version}"
43     echo "    -L <iso_label>     Set an iso label (disk label)"
44     echo "                        Default: ${iso_label}"
45     echo "    -D <install_dir>   Set an install_dir (directory inside iso)"
46     echo "                        Default: ${install_dir}"
47     echo "    -w <work_dir>      Set the working directory"
48     echo "                        Default: ${work_dir}"
49     echo "    -o <out_dir>       Set the output directory"
50     echo "                        Default: ${out_dir}"
51     echo "    -v                 Enable verbose output"
52     echo "    -h                 This help message"
53     exit ${1}
54 }
55
56 # Helper function to run make_*() only one time per architecture.
57 run_once() {
58     if [[ ! -e ${work_dir}/build.${1}_${arch} ]]; then
59         $1
60         touch ${work_dir}/build.${1}_${arch}
61     fi
62 }
63
64 # Setup custom pacman.conf with current cache directories.
65 make_pacman_conf() {
66     local _cache_dirs
67     _cache_dirs=($(pacman -v 2>&1 | grep '^Cache Dirs:' | sed 's/Cache Dirs:\s*//g'))
68 sed -r "s|^#?\\s*CacheDir.+|CacheDir = $(echo -n ${_cache_dirs[@]})|g" ${script_path}/pacman.conf > ${work_dir}/pacman.conf
69 }
70
71 # Base installation, plus needed packages (airootfs)
72 make_basefs() {
73     setarch ${arch} mkarchiso ${verbose} -w "${work_dir}/${arch}" -C "${work_dir}/pacman.conf" -D "${install_dir}" init
74     setarch ${arch} mkarchiso ${verbose} -w "${work_dir}/${arch}" -C "${work_dir}/pacman.conf" -D "${install_dir}" -p "haveged intel-ucode memtest86+ mkinitcpio-nfs-utils nbd" install
75 }
76
77 # Additional packages (airootfs)
78 make_packages() {
79      setarch ${arch} mkarchiso ${verbose} -w "${work_dir}/${arch}" -C "${work_dir}/pacman.conf" -D "${install_dir}" -p "$(grep -h -v ^# ${script_path}/packages.{both,${arch}})" install
80 }
81
82 # Needed packages for x86_64 EFI boot
83 make_packages_efi() {
84     setarch ${arch} mkarchiso ${verbose} -w "${work_dir}/${arch}" -C "${work_dir}/pacman.conf" -D "${install_dir}" -p "efitools efibootmgr" install
85 }
86 # Copy mkinitcpio archiso hooks and build initramfs (airootfs)
87 make_setup_mkinitcpio() {
88     local _hook
89     mkdir -p ${work_dir}/${arch}/airootfs/etc/initcpio/hooks
90     mkdir -p ${work_dir}/${arch}/airootfs/etc/initcpio/install
91     for _hook in archiso archiso_shutdown archiso_pxe_common archiso_pxe_nbd archiso_pxe_http archiso_pxe_nfs archiso_loop_mnt; do
92         cp /usr/lib/initcpio/hooks/${_hook} ${work_dir}/${arch}/airootfs/etc/initcpio/hooks
93         cp /usr/lib/initcpio/install/${_hook} ${work_dir}/${arch}/airootfs/etc/initcpio/install
94     done
95     sed -i "s|/usr/lib/initcpio/|/etc/initcpio/|g" ${work_dir}/${arch}/airootfs/etc/initcpio/install/archiso_shutdown
96     cp /usr/lib/initcpio/install/archiso_kms ${work_dir}/${arch}/airootfs/etc/initcpio/install
97     cp /usr/lib/initcpio/archiso_shutdown ${work_dir}/${arch}/airootfs/etc/initcpio
98     cp ${script_path}/mkinitcpio.conf ${work_dir}/${arch}/airootfs/etc/mkinitcpio-archiso.conf
99     gnupg_fd=
100     if [[ ${gpg_key} ]]; then
101       gpg --export ${gpg_key} >${work_dir}/gpgkey
102       exec 17<>${work_dir}/gpgkey
103     fi
104     ARCHISO_GNUPG_FD=${gpg_key:+17} setarch ${arch} mkarchiso ${verbose} -w "${work_dir}/${arch}" -C "${work_dir}/pacman.conf" -D "${install_dir}" -r 'mkinitcpio -c /etc/mkinitcpio-archiso.conf -k /boot/vmlinuz-linux -g /boot/archiso.img' run
105     if [[ ${gpg_key} ]]; then
106       exec 17<&-
107     fi
108 }
109 # Customize installation (airootfs)
110 make_customize_airootfs() {
111    cp -af ${script_path}/airootfs ${work_dir}/${arch}
112     curl -o ${work_dir}/${arch}/airootfs/etc/pacman.d/mirrorlist 'https://www.archlinux.org/mirrorlist/?country=all&protocol=http&use_mirror_status=on'
113     lynx -dump -nolist 'https://wiki.archlinux.org/index.php/Installation_Guide?action=render' >> ${work_dir}/${arch}/airootfs/root/install.txt
114     setarch ${arch} mkarchiso ${verbose} -w "${work_dir}/${arch}" -C "${work_dir}/pacman.conf" -D "${install_dir}" -r '/root/customize_airootfs.sh' run
115     rm ${work_dir}/${arch}/airootfs/root/customize_airootfs.sh
116     rm -f ${work_dir}/${arch}airootfs/etc/xdg/autostart/vboxclient.desktop
117         if [ -f "${work_dir}/${arch}/airootfs/etc/xdg/autostart/pamac-tray.desktop" ]; then
118             rm ${work_dir}/${arch}/airootfs/etc/xdg/autostart/pamac-tray.desktop
119         fi
120         ln -sf /usr/share/zoneinfo/UTC ${work_dir}/${arch}/airootfs/etc/localtime
121         chmod 750 ${work_dir}/${arch}/airootfs/etc/sudoers.d
122         chmod 440 ${work_dir}/${arch}/airootfs/etc/sudoers.d/g_wheel
123 cp -L ${script_path}/set_password ${work_dir}/${arch}/airootfs/usr/bin
124 }
125 ####################################################################################
126 # Install cnchi installer from Git
127 make_cnchi() {
128 # Install iso_hotfix_utility files to root-image
129 #    echo
130 #    echo ">>> Installing iso-hotfix-utility..."
131 #    echo
132 #    wget "${ISO_HOTFIX_UTILITY_URL}" -O ${script_path}/iso-hotfix-utility.tar.gz
133 #    tar xfz ${script_path}/iso-hotfix-utility.tar.gz -C ${script_path}
134 #    rm -f ${script_path}/iso-hotfix-utility.tar.gz
135 #    mv "${script_path}/iso-hotfix-utility-${ISO_HOTFIX_UTILITY_VERSION}" ${script_path}/iso-hotfix-utility
136 #    cp "${script_path}/iso-hotfix-utility/iso-hotfix-utility" "${work_dir}/${arch}/airootfs/usr/bin/pacman-boot"
137 #    chmod 755 "${work_dir}/${arch}/airootfs/usr/bin/pacman-boot"
138 #    mkdir -p "${work_dir}/${arch}/airootfs/etc/iso-hotfix-utility.d"
139 #    for _file in ${script_path}/iso-hotfix-utility/dist/**
140 #    do
141 #        install -m755 -t "${work_dir}/${arch}/airootfs/etc/iso-hotfix-utility.d" "${_file}"
142 #    done
143 #    for fpath in ${script_path}/iso-hotfix-utility/po/*; do
144 #        if [[ -f "${fpath}" ]] && [[ "${fpath}" != 'po/CNCHI_UPDATER.po' ]]; then
145 #            STRING_PO=`echo ${fpath#*/}`
146 #            STRING=`echo ${STRING_PO%.po}`
147 #            mkdir -p "${work_dir}/${arch}/airootfs/usr/share/locale/${STRING}/LC_MESSAGES"
148 #            msgfmt "${fpath}" -o "${work_dir}/${arch}/airootfs/usr/share/locale/${STRING}/LC_MESSAGES/CNCHI_UPDATER.mo"
149 #            echo "${STRING} installed..."
150 #            echo "ISO-HOTFIX-UTILITY IS NOW BUILT"
151 #        fi
152 #    done
153 #    rm -rf ${script_path}/iso-hotfix-utility
154 #
155     echo
156 #   echo ">>> Warning! Installing Cnchi Installer from GIT (${CNCHI_GIT_BRANCH} branch)"
157 #   wget "${CNCHI_GIT_URL}" -O ${script_path}/cnchi-git.zip
158     # The two previous line (commented) performed the download from Antergos Github.
159     # Now it's downloaded from our server:
160     echo "Downloading cnchi from our server:"
161     wget "${CNCHI_REBORNOS_URL}" -O ${script_path}/cnchi-git.zip
162     unzip ${script_path}/cnchi-git.zip -d ${script_path}
163     rm -f ${script_path}/cnchi-git.zip
164     CNCHI_SRC="${script_path}/Cnchi-${CNCHI_GIT_BRANCH}"
165         install -d ${work_dir}/${arch}/airootfs/usr/share/{cnchi,locale}
166         install -Dm755 "${CNCHI_SRC}/bin/cnchi" "${work_dir}/${arch}/airootfs/usr/bin/cnchi"
167          echo
168          echo "COPIED STARTUP FILE OVER"
169          echo
170         install -Dm755 "${CNCHI_SRC}/cnchi.desktop" "${work_dir}/${arch}/airootfs/usr/share/applications/cnchi.desktop"
171          echo
172          echo "COPIED DESKTOP FILE OVER"
173          echo
174         install -Dm644 "${CNCHI_SRC}/data/images/antergos/antergos-icon.png" "${work_dir}/${arch}/airootfs/usr/share/pixmaps/cnchi.png"
175          echo
176          echo "COPIED CNCHI ICON OVER"
177          echo
178     # TODO: This should be included in Cnchi's src code as a separate file
179     # (as both files are needed to run cnchi)
180     sed -r -i 's|\/usr.+ -v|pkexec /usr/share/cnchi/bin/cnchi -s bugsnag|g' "${work_dir}/${arch}/airootfs/usr/bin/cnchi"
181     echo
182     echo "MODIFIED STARTUP COMMAND FOR CNCHI"
183     echo
184     for i in ${CNCHI_SRC}/src ${CNCHI_SRC}/bin ${CNCHI_SRC}/data ${CNCHI_SRC}/scripts ${CNCHI_SRC}/ui; do
185         cp -R ${i} "${work_dir}/${arch}/airootfs/usr/share/cnchi/"
186         echo
187         echo "COPIED CNCHI'S MAIN SUBDIRECTORIES OVER TO BUILD FOLDER"
188         echo
189     done
190     echo
191     echo "REMOVED UNNECESARY .PO FILE"
192     rm -f ${CNCHI_SRC}/po/update_po.sh
193     echo
194     for files in ${CNCHI_SRC}/po/*; do
195         if [[ -f "$files" ]] && [[ "$files" != 'po/cnchi.pot' ]]; then
196             STRING_PO=`echo ${files#*/}`
197             STRING=`echo ${STRING_PO%.po}`
198             mkdir -p ${work_dir}/${arch}/airootfs/usr/share/locale/${STRING}/LC_MESSAGES
199             msgfmt $files -o ${work_dir}/${arch}/airootfs/usr/share/locale/${STRING}/LC_MESSAGES/cnchi.mo
200             echo "${STRING} installed..."
201             echo "CNCHI IS NOW BUILT"
202         fi
203     done
204 rm -rf ${script_path}/Cnchi-${CNCHI_GIT_BRANCH}
205             echo
206             echo "##################################################################"
207             echo "WRAPPED UP LOOSE ENDS - WILL BE MOVING ON NOW TO CUSTOMIZATIONS..."
208             echo "##################################################################"
209             echo
210             echo
211 }
212 ########################################################################################
213
214 make_fixes() {
215         # Remove Antergos gsettings file
216 #       rm ${work_dir}/${arch}/airootfs/usr/share/glib-2.0/schemas/90_deepin-default-gsettings.gschema.override
217         echo "ANTERGOS GSETTINGS REMOVED"
218         # Setup gsettings if gsettings folder exists
219         if [ -d ${script_path}/gsettings ]; then
220             # Copying GSettings XML schema files
221             mkdir -p ${work_dir}/${arch}/airootfs/usr/share/glib-2.0/schemas
222             for _schema in ${script_path}/gsettings/*.gschema.override; do
223                 echo ">>> Will use ${_schema}"
224                 cp ${_schema} ${work_dir}/${arch}/airootfs/usr/share/glib-2.0/schemas
225             done
226             # Compile GSettings XML schema files
227             # rm ${work_dir}/${arch}/airootfs/usr/share/glib-2.0/schemas/98_gnome.gschema.override
228             # rm ${work_dir}/${arch}/airootfs/usr/share/glib-2.0/schemas/95_budgie.gschema.override
229             echo "REMOVED APRICITY GSETTINGS"
230             ${work_dir}/${arch}/airootfs/usr/bin/glib-compile-schemas ${work_dir}/${arch}/airootfs/usr/share/glib-2.0/schemas
231           echo
232           echo "GENERATED REBORNOS GSETTINGS"
233           echo
234         fi
235 #Use lightdm.conf from local direcectory instead of default one
236 echo "Removing unnecessary lightdm.conf"
237 rm ${work_dir}/${arch}/airootfs/etc/lightdm/lightdm.conf
238 echo "Copying correct lightdm.conf file over"
239 cp ${script_path}/airootfs/etc/lightdm/lightdm.conf ${work_dir}/${arch}/airootfs/etc/lightdm/
240 echo "DONE"
241 echo
242 #Use sddm.conf from local direcectory instead of default one
243 echo "Removing unnecessary sddm.conf"
244 rm ${work_dir}/${arch}/airootfs/etc/sddm.conf
245 echo "Copying correct sddm.conf file over"
246 cp ${script_path}/airootfs/etc/sddm.conf ${work_dir}/${arch}/airootfs/etc/
247 echo "DONE"
248 echo
249 #Copy RebornOS Mirrorlist
250 echo "Setting up RebornOS Mirrorlist"
251 mkdir -p ${work_dir}/${arch}/airootfs/etc/pacman.d
252 cp ${script_path}/airootfs/etc/reborn-mirrorlist ${work_dir}/${arch}/airootfs/etc/pacman.d/
253 echo "DONE"
254 echo
255 #Copy pacman-init.service over
256 #echo "Copying pacman-init.service"
257 #cp ${script_path}/pacman-init.service ${work_dir}/${arch}/airootfs/etc/systemd/system/
258 echo "DONE"
259 echo
260 #Replace pacman.conf with RebornOS's
261 echo "Replacing pacman.conf with RebornOS's"
262 rm ${work_dir}/${arch}/airootfs/etc/pacman.conf
263 cp ${script_path}/Cnchi/pacman.conf ${work_dir}/${arch}/airootfs/etc/
264 cp ${script_path}/Cnchi/pacman.conf ${work_dir}/${arch}/airootfs/usr/share/cnchi/
265 cp ${script_path}/Cnchi/pacman2.conf ${work_dir}/${arch}/airootfs/
266 mv ${work_dir}/${arch}/airootfs/pacman2.conf ${work_dir}/${arch}/airootfs/tmp/pacman.conf
267 echo "DONE"
268 echo
269 #Editting Cnchi
270 echo "Moving Cnchi files over..."
271 rm ${work_dir}/${arch}/airootfs/usr/share/applications/cnchi.desktop
272 rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/features.py
273 cp ${script_path}/Cnchi/features.py ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/
274 rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/desktop_info.py
275 cp ${script_path}/Cnchi/desktop_info.py ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/
276 #rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/encfs.py
277 #cp ${script_path}/Cnchi/encfs.py ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/
278 rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/installation/boot/grub2.py
279 cp ${script_path}/Cnchi/grub2.py ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/installation/boot/
280 rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/scripts/10_antergos
281 cp ${script_path}/Cnchi/10_antergos ${work_dir}/${arch}/airootfs/usr/share/cnchi/scripts/
282 rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/installation/boot/systemd_boot.py
283 cp ${script_path}/Cnchi/systemd_boot.py ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/installation/boot/
284 rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/scripts/postinstall.sh
285 cp ${script_path}/Cnchi/postinstall.sh ${work_dir}/${arch}/airootfs/usr/share/cnchi/scripts/
286 #rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/main_window.py
287 #cp ${script_path}/Cnchi/main_window.py ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/
288 rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/show_message.py
289 cp ${script_path}/Cnchi/show_message.py ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/
290 rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/slides.py
291 cp ${script_path}/Cnchi/slides.py ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/
292 #rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/ask.py
293 #cp ${script_path}/Cnchi/ask.py ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/
294 rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/check.py
295 cp ${script_path}/Cnchi/check.py ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/
296 #rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/timezone.py
297 #cp ${script_path}/Cnchi/timezone.py ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/
298 rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/welcome.py
299 cp ${script_path}/Cnchi/welcome.py ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/
300 #rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/download/metalink.py
301 #cp ${script_path}/Cnchi/metalink.py ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/download/
302 #rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/installation/pac.py
303 #cp ${script_path}/Cnchi/pac.py ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/installation/
304 # Changing logo images
305 rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/images/antergos/antergos-logo-mini2.png
306 cp ${script_path}/Cnchi/antergos-logo-mini2.png ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/images/antergos/
307 rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/images/antergos/antergos-for-everyone-black1.png
308 cp ${script_path}/Cnchi/antergos-for-everyone-black1.png ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/images/antergos/
309 rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/images/antergos/antergos-for-everyone-white1.png
310 cp ${script_path}/Cnchi/antergos-for-everyone-white1.png ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/images/antergos/
311 rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/images/antergos/antergos-logo.png
312 cp ${script_path}/Cnchi/antergos-logo.png ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/images/antergos/
313 rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/images/antergos/antergos-logo-mini.png
314 cp ${script_path}/Cnchi/antergos-logo-mini.png ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/images/antergos/
315 rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/images/antergos/antergos-logo-mini2-OLD.png
316 cp ${script_path}/Cnchi/antergos-logo-mini2-OLD.png ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/images/antergos/
317 cp ${script_path}/Cnchi/20-intel.conf ${work_dir}/${arch}/airootfs/usr/share/cnchi/
318 cp ${script_path}/Cnchi/lightdm-webkit2-greeter.conf ${work_dir}/${arch}/airootfs/usr/share/cnchi/
319 rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/images/slides/1.png
320 cp ${script_path}/Cnchi/1.png ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/images/slides/
321 rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/images/slides/2.png
322 cp ${script_path}/Cnchi/2.png ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/images/slides/
323 rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/images/slides/3.png
324 cp ${script_path}/Cnchi/3.png ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/images/slides/
325 # cp ${script_path}/Cnchi/4.png ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/images/slides/
326 cp ${script_path}/Cnchi/sddm.conf ${work_dir}/${arch}/airootfs/usr/share/cnchi/
327 rm ${work_dir}/${arch}/airootfs/usr/share/pixmaps/cnchi.png
328 cp ${script_path}/airootfs/usr/share/applications/cnchi.png ${work_dir}/${arch}/airootfs/usr/share/pixmaps/
329 rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/images/antergos/antergos-icon.png
330 cp ${script_path}/Cnchi/antergos-icon.png ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/images/antergos/antergos-icon.png
331 cp ${script_path}/scripts/tint2-start.desktop ${work_dir}/${arch}/airootfs/usr/share/cnchi/
332 cp ${script_path}/scripts/conky-start.desktop ${work_dir}/${arch}/airootfs/usr/share/cnchi/
333 cp ${script_path}/scripts/obmenu-gen.desktop ${work_dir}/${arch}/airootfs/usr/share/cnchi/
334 cp ${script_path}/scripts/plymouth-reborn.desktop ${work_dir}/${arch}/airootfs/usr/share/cnchi/
335 cp ${script_path}/scripts/mate-panel.desktop ${work_dir}/${arch}/airootfs/usr/share/cnchi/
336 cp ${script_path}/scripts/plymouth.sh ${work_dir}/${arch}/airootfs/usr/share/cnchi/
337 cp ${script_path}/scripts/flatpak.sh ${work_dir}/${arch}/airootfs/usr/share/cnchi/
338 cp ${script_path}/scripts/pkcon.sh ${work_dir}/${arch}/airootfs/usr/share/cnchi/
339 cp ${script_path}/scripts/pkcon2.sh ${work_dir}/${arch}/airootfs/usr/share/cnchi/
340 cp ${script_path}/scripts/flatpak.desktop ${work_dir}/${arch}/airootfs/usr/share/cnchi/
341 #cp ${script_path}/Cnchi/pacman2.conf ${work_dir}/${arch}/airootfs/usr/share/cnchi/
342 cp ${script_path}/scripts/update.desktop ${work_dir}/${arch}/airootfs/usr/share/cnchi/
343 cp ${script_path}/scripts/openbox-config.sh ${work_dir}/${arch}/airootfs/usr/share/cnchi/
344 cp ${script_path}/scripts/deepin-fix.sh ${work_dir}/${arch}/airootfs/usr/share/cnchi/
345 cp ${script_path}/scripts/deepin-fix.service ${work_dir}/${arch}/airootfs/usr/share/cnchi/
346 cp ${script_path}/images/pantheon.png ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/images/desktops/
347 rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/images/desktops/deepin.png
348 rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/images/desktops/kde.png
349 rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/images/desktops/lxqt.png
350 rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/images/desktops/openbox.png
351 rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/images/desktops/xfce.png
352 cp ${script_path}/images/apricity.png ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/images/desktops/
353 cp ${script_path}/images/deepin.png ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/images/desktops/
354 cp ${script_path}/images/cinnamon.png ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/images/desktops/
355 cp ${script_path}/images/windows.png ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/images/desktops/
356 cp ${script_path}/images/kde.png ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/images/desktops/
357 cp ${script_path}/images/i3.png ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/images/desktops/
358 cp ${script_path}/images/lxqt.png ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/images/desktops/
359 cp ${script_path}/images/openbox.png ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/images/desktops/
360 cp ${script_path}/images/enlightenment.png ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/images/desktops/
361 cp ${script_path}/images/xfce.png ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/images/desktops/
362 cp ${script_path}/images/desktop-environment-apricity.svg ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/icons/scalable/
363 cp ${script_path}/images/desktop-environment-pantheon.svg ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/icons/scalable/
364 cp ${script_path}/images/desktop-environment-windows.svg ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/icons/scalable/
365 cp ${script_path}/images/desktop-environment-budgie.svg ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/icons/scalable/
366 cp ${script_path}/images/desktop-environment-i3.svg ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/icons/scalable/
367 cp ${script_path}/Cnchi/reborn-mirrorlist ${work_dir}/${arch}/airootfs/etc/pacman.d/
368 #
369 # ===>>> Replacement made by Rafael from RebornOS <<<=== #
370 #
371 rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/pacman.conf
372 cp ${script_path}/Cnchi/pacman.conf ${work_dir}/${arch}/airootfs/usr/share/cnchi/
373 rm ${work_dir}/${arch}/airootfs/etc/pacman.conf
374 cp ${script_path}/Cnchi/pacman.conf ${work_dir}/${arch}/airootfs/etc/
375 chmod 644 /etc/pacman.conf
376 chmod 644 /etc/pacman.d/reborn-mirrorlist
377 rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/pacman.tmpl
378 cp ${script_path}/Cnchi/pacman.tmpl ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/
379 rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/info.py
380 cp ${script_path}/Cnchi/info.py ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/
381 rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/update_db.py
382 cp ${script_path}/Cnchi/update_db.py ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/
383 rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/cnchi.py
384 cp ${script_path}/Cnchi/cnchi.py ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/
385 rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/rank_mirrors.py
386 cp ${script_path}/Cnchi/rank_mirrors.py ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/
387 rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/features_info.py
388 cp ${script_path}/Cnchi/features_info.py ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/
389 rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/packages.xml
390 cp ${script_path}/Cnchi/packages.xml ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/
391 rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/mirrors.py
392 cp ${script_path}/Cnchi/mirrors.py ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/
393 rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/installation/post_install.py
394 cp ${script_path}/Cnchi/post_install.py ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/installation/
395 rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/installation/install.py
396 cp ${script_path}/Cnchi/install.py ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/installation/
397 rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/installation/select_packages.py
398 cp ${script_path}/Cnchi/select_packages.py ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/installation/
399 rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/download/metalink.py
400 cp ${script_path}/Cnchi/metalink.py ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/download/
401 rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/logging_utils.py
402 cp ${script_path}/Cnchi/logging_utils.py ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/
403 rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/slides.py
404 cp ${script_path}/Cnchi/slides.py ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/
405 rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pacman/pac.py
406 cp ${script_path}/Cnchi/pac.py ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pacman/
407 # ===>>> Use neofetch to show in terminal RebornOS logo and info <<<=== #
408 rm ${work_dir}/${arch}/airootfs/home/rebornos/.bashrc
409 cp ${script_path}/Cnchi/bashrc ${work_dir}/${arch}/airootfs/home/rebornos/.bashrc
410 # ===>>> Correct GeoIP timeout <<<=== #
411 rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/geoip.py
412 cp ${script_path}/Cnchi/geoip.py ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/
413 # ===>>> cnchi-start.sh is modified in its original location <<<=== #
414 # rm ${work_dir}/${arch}/airootfs/usr/bin/cnchi-start.sh
415 # cp ${script_path}/Cnchi/cnchi-start.sh ${work_dir}/${arch}/airootfs/usr/bin/
416 # ===>>> Replace access to the RebornOS installer with another one with "sudo" <<<=== #
417 rm ${work_dir}/${arch}/airootfs/usr/share/applications/antergos-install.desktop
418 cp ${script_path}/Cnchi/rebornos-install.desktop ${work_dir}/${arch}/airootfs/usr/share/applications/
419 # ===>>> Add new cnchi icon for RebornOS Installer (change her name from reborn to rebornos) <<<=== #
420 rm ${work_dir}/${arch}/airootfs/usr/share/pixmaps/cnchi.png
421 cp ${script_path}/Cnchi/cnchi.png ${work_dir}/${arch}/airootfs/usr/share/pixmaps/
422 cp ${script_path}/Cnchi/rebornos-icon-new.png ${work_dir}/${arch}/airootfs/usr/share/pixmaps/
423 cp ${script_path}/Cnchi/cnchi.png ${work_dir}/${arch}/airootfs/usr/share/applications/
424 # ===>>> Add new wallpaper for RebornOS Live <<<=== #
425 rm ${work_dir}/${arch}/airootfs/usr/share/backgrounds/gnome/adwaita-day.jpg
426 cp ${script_path}/Cnchi/adwaita-day.jpg ${work_dir}/${arch}/airootfs/usr/share/backgrounds/gnome/
427 rm ${work_dir}/${arch}/airootfs/usr/share/backgrounds/gnome/adwaita-morning.jpg
428 cp ${script_path}/Cnchi/adwaita-day.jpg ${work_dir}/${arch}/airootfs/usr/share/backgrounds/gnome/adwaita-morning.jpg
429 rm ${work_dir}/${arch}/airootfs/usr/share/backgrounds/gnome/adwaita-night.jpg
430 cp ${script_path}/Cnchi/adwaita-day.jpg ${work_dir}/${arch}/airootfs/usr/share/backgrounds/gnome/adwaita-night.jpg
431 # ===>>> Delete refresh.desktop in ~/.config/autostart and add new refresh-keys.desktop
432 # to refresh keys and run cnchi-start.sh when Live start <<<=== #
433 rm ${work_dir}/${arch}/airootfs/home/rebornos/.config/autostart/refresh.desktop
434 cp ${script_path}/Cnchi/refresh-keys.desktop ${work_dir}/${arch}/airootfs/home/rebornos/.config/autostart/
435 # ===>>> Add refresh-keys.sh to /usr/bin (called by install.desktop)
436 # In the end, call cnchi-start.sh <<<=== #
437 cp ${script_path}/Cnchi/refresh-keys.sh ${work_dir}/${arch}/airootfs/usr/bin/
438 rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/scripts/10_antergos
439 cp ${script_path}/Cnchi/10_antergos ${work_dir}/${arch}/airootfs/usr/share/cnchi/scripts/
440 # ===>>> Uncomplicated Firewall Workaround <<<=== #
441 cp ${script_path}/Cnchi/gufw.png ${work_dir}/${arch}/airootfs/usr/share/cnchi/
442 cp ${script_path}/Cnchi/gufw.svg ${work_dir}/${arch}/airootfs/usr/share/cnchi/
443 cp ${script_path}/Cnchi/gufw.desktop ${work_dir}/${arch}/airootfs/usr/share/cnchi/
444 # ===>>> Cinnamon gschema <<<=== #
445 cp ${script_path}/Cnchi/95_cinnamon.gschema.override ${work_dir}/${arch}/airootfs/usr/share/cnchi/
446 # ===>>> Gnome gschema <<<=== #
447 cp ${script_path}/Cnchi/101_gnome.gschema.override ${work_dir}/${arch}/airootfs/usr/share/cnchi/
448 # ===>>> auto_partition.py modifications (change AntergosRoot by RebornOSRoot and others things...) <<<=== #
449 rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/installation/auto_partition.py
450 cp ${script_path}/Cnchi/auto_partition.py ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/installation/
451 # ===>>> Replace desktop.py to start with the default "base" desktop <<<=== #
452 rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/desktop.py
453 cp ${script_path}/Cnchi/desktop.py ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/
454 # ===>>> Change main_window.py with new rebornos-logo-mini2.png and rebornos-icon.png <<<=== #
455 rm ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/main_window.py
456 cp ${script_path}/Cnchi/main_window.py ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/
457 # ===>>> Add new png files used by modify main_window.py  <<<=== #
458 cp ${script_path}/Cnchi/rebornos-logo-mini2.png ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/images/antergos/
459 cp ${script_path}/Cnchi/rebornos-icon.png ${work_dir}/${arch}/airootfs/usr/share/cnchi/data/images/antergos/
460 # ===>>> Files to configure lightdm with RebornOS and lightdm-gtk-greeter <<<=== #
461 cp ${script_path}/Cnchi/lightdm.conf ${work_dir}/${arch}/airootfs/usr/share/cnchi/
462 cp ${script_path}/Cnchi/lightdm-gtk-greeter.conf ${work_dir}/${arch}/airootfs/usr/share/cnchi/
463 # To be used by os-release in its LOGO = braces line
464 cp ${script_path}/Cnchi/rebornos.png ${work_dir}/${arch}/airootfs/usr/share/cnchi/
465 cp ${script_path}/Cnchi/rebornos.svg ${work_dir}/${arch}/airootfs/usr/share/cnchi/
466 cp ${script_path}/Cnchi/os-release ${work_dir}/${arch}/airootfs/usr/share/cnchi/
467 # Delete old mirrorlist (Arch) and add new one
468 rm ${work_dir}/${arch}/airootfs/etc/pacman.d/mirrorlist
469 cp ${script_path}/Cnchi/mirrorlist ${work_dir}/${arch}/airootfs/etc/pacman.d/
470 chmod 644 ${work_dir}/${arch}/airootfs/etc/pacman.d/mirrorlist
471 # New sddm theme config file for kde (Breeze)
472 cp ${script_path}/Cnchi/kde_settings.conf ${work_dir}/${arch}/airootfs/usr/share/cnchi/
473 echo "DONE"
474 echo
475 echo "Replacing Antergos mentions with RebornOS"
476 sed -i "s/Antergos/RebornOS/g" ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/advanced.py
477 sed -i "s/Antergos/RebornOS/g" ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/alongside.py
478 sed -i "s/Antergos/RebornOS/g" ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/ask.py
479 sed -i "s/Antergos/RebornOS/g" ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/automatic.py
480 sed -i "s/Antergos/RebornOS/g" ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/check.py
481 sed -i "s/Antergos/RebornOS/g" ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/gtkbasebox.py
482 sed -i "s/Antergos/RebornOS/g" ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/keymap.py
483 sed -i "s/Antergos/RebornOS/g" ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/language.py
484 sed -i "s/Antergos/RebornOS/g" ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/location.py
485 sed -i "s/Antergos/RebornOS/g" ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/installation/process.py
486 sed -i "s/Antergos/RebornOS/g" ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/slides.py
487 sed -i "s/Antergos/RebornOS/g" ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/summary.py
488 sed -i "s/Antergos/RebornOS/g" ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/timezone.py
489 sed -i "s/Antergos/RebornOS/g" ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/user_info.py
490 sed -i "s/Antergos/RebornOS/g" ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/wireless.py
491 sed -i "s/Antergos/RebornOS/g" ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/zfs.py
492 sed -i "s/Antergos/RebornOS/g" ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/desktop.py
493 # sed -i "s/gnome/deepin/g" ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/desktop.py ==>> Commented to run "base" desktop preselected
494 # sed -i "s/Antergos/Reborn/g" ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/encfs.py
495 # sed -i "s/Antergos/RebornOS/g" ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/main_window.py
496 echo "DONE"
497 echo
498 echo "Removing Mycroft-RebornOS's startup file from the ISO..."
499 rm -f ${work_dir}/${arch}/airootfs/etc/xdg/autostart/mycroft1.desktop
500 echo "DONE"
501 }
502 # Prepare kernel/initramfs ${install_dir}/boot/
503 make_boot() {
504     mkdir -p ${work_dir}/iso/${install_dir}/boot/${arch}
505     echo "Executed 'mkdir -p' Command Successfully"
506     cp ${work_dir}/${arch}/airootfs/boot/archiso.img ${work_dir}/iso/${install_dir}/boot/${arch}/archiso.img
507     echo "Built 'archiso.img' Successfully"
508     cp ${work_dir}/${arch}/airootfs/boot/vmlinuz-linux ${work_dir}/iso/${install_dir}/boot/${arch}/vmlinuz
509     echo "Built 'vmlinuz-linux' Successfully"
510     echo "DONE"
511     echo
512 }
513 # Add other aditional/extra files to ${install_dir}/boot/
514 make_boot_extra() {
515     cp ${work_dir}/${arch}/airootfs/boot/memtest86+/memtest.bin ${work_dir}/iso/${install_dir}/boot/memtest
516     cp ${work_dir}/${arch}/airootfs/usr/share/licenses/common/GPL2/license.txt ${work_dir}/iso/${install_dir}/boot/memtest.COPYING
517     cp ${work_dir}/${arch}/airootfs/boot/intel-ucode.img ${work_dir}/iso/${install_dir}/boot/intel_ucode.img
518     cp ${work_dir}/${arch}/airootfs/usr/share/licenses/intel-ucode/LICENSE ${work_dir}/iso/${install_dir}/boot/intel_ucode.LICENSE
519 }
520 # Prepare /${install_dir}/boot/syslinux
521 make_syslinux() {
522     mkdir -p ${work_dir}/iso/${install_dir}/boot/syslinux
523     for _cfg in ${script_path}/syslinux/*.cfg; do
524         sed "s|%ARCHISO_LABEL%|${iso_label}|g;
525              s|%INSTALL_DIR%|${install_dir}|g" ${_cfg} > ${work_dir}/iso/${install_dir}/boot/syslinux/${_cfg##*/}
526     done
527     cp ${script_path}/syslinux/splash.png ${work_dir}/iso/${install_dir}/boot/syslinux
528     cp ${work_dir}/${arch}/airootfs/usr/lib/syslinux/bios/*.c32 ${work_dir}/iso/${install_dir}/boot/syslinux
529     cp ${work_dir}/${arch}/airootfs/usr/lib/syslinux/bios/lpxelinux.0 ${work_dir}/iso/${install_dir}/boot/syslinux
530     cp ${work_dir}/${arch}/airootfs/usr/lib/syslinux/bios/memdisk ${work_dir}/iso/${install_dir}/boot/syslinux
531     mkdir -p ${work_dir}/iso/${install_dir}/boot/syslinux/hdt
532     gzip -c -9 ${work_dir}/${arch}/airootfs/usr/share/hwdata/pci.ids > ${work_dir}/iso/${install_dir}/boot/syslinux/hdt/pciids.gz
533 #    gzip -c -9 ${work_dir}/${arch}/airootfs/usr/lib/modules/*-ARCH/modules.alias > ${work_dir}/iso/${install_dir}/boot/syslinux/hdt/modalias.gz
534 }
535 # Prepare /isolinux
536 make_isolinux() {
537     mkdir -p ${work_dir}/iso/isolinux
538     sed "s|%INSTALL_DIR%|${install_dir}|g" ${script_path}/isolinux/isolinux.cfg > ${work_dir}/iso/isolinux/isolinux.cfg
539     cp ${work_dir}/${arch}/airootfs/usr/lib/syslinux/bios/isolinux.bin ${work_dir}/iso/isolinux/
540     cp ${work_dir}/${arch}/airootfs/usr/lib/syslinux/bios/isohdpfx.bin ${work_dir}/iso/isolinux/
541     cp ${work_dir}/${arch}/airootfs/usr/lib/syslinux/bios/ldlinux.c32 ${work_dir}/iso/isolinux/
542 }
543 # Prepare /EFI
544 make_efi() {
545     mkdir -p ${work_dir}/iso/EFI/boot
546     cp ${work_dir}/x86_64/airootfs/usr/share/efitools/efi/PreLoader.efi ${work_dir}/iso/EFI/boot/bootx64.efi
547     cp ${work_dir}/x86_64/airootfs/usr/share/efitools/efi/HashTool.efi ${work_dir}/iso/EFI/boot/
548     cp ${work_dir}/x86_64/airootfs/usr/lib/systemd/boot/efi/systemd-bootx64.efi ${work_dir}/iso/EFI/boot/loader.efi
549     mkdir -p ${work_dir}/iso/loader/entries
550     cp ${script_path}/efiboot/loader/loader.conf ${work_dir}/iso/loader/
551     cp ${script_path}/efiboot/loader/entries/uefi-shell-v2-x86_64.conf ${work_dir}/iso/loader/entries/
552     cp ${script_path}/efiboot/loader/entries/uefi-shell-v1-x86_64.conf ${work_dir}/iso/loader/entries/
553     sed "s|%ARCHISO_LABEL%|${iso_label}|g;
554          s|%INSTALL_DIR%|${install_dir}|g" \
555         ${script_path}/efiboot/loader/entries/archiso-x86_64-usb.conf > ${work_dir}/iso/loader/entries/archiso-x86_64.conf
556     # EFI Shell 2.0 for UEFI 2.3+
557     curl -o ${work_dir}/iso/EFI/shellx64_v2.efi https://raw.githubusercontent.com/tianocore/edk2/master/ShellBinPkg/UefiShell/X64/Shell.efi
558     # EFI Shell 1.0 for non UEFI 2.3+
559     curl -o ${work_dir}/iso/EFI/shellx64_v1.efi https://raw.githubusercontent.com/tianocore/edk2/master/EdkShellBinPkg/FullShell/X64/Shell_Full.efi
560 }
561 # Prepare efiboot.img::/EFI for "El Torito" EFI boot mode
562 make_efiboot() {
563     mkdir -p ${work_dir}/iso/EFI/archiso
564     truncate -s 40M ${work_dir}/iso/EFI/archiso/efiboot.img
565     mkfs.vfat -n ARCHISO_EFI ${work_dir}/iso/EFI/archiso/efiboot.img
566     mkdir -p ${work_dir}/efiboot
567     mount ${work_dir}/iso/EFI/archiso/efiboot.img ${work_dir}/efiboot
568     mkdir -p ${work_dir}/efiboot/EFI/archiso
569     cp ${work_dir}/iso/${install_dir}/boot/x86_64/vmlinuz ${work_dir}/efiboot/EFI/archiso/vmlinuz.efi
570     cp ${work_dir}/iso/${install_dir}/boot/x86_64/archiso.img ${work_dir}/efiboot/EFI/archiso/archiso.img
571     cp ${work_dir}/iso/${install_dir}/boot/intel_ucode.img ${work_dir}/efiboot/EFI/archiso/intel_ucode.img
572     mkdir -p ${work_dir}/efiboot/EFI/boot
573     cp ${work_dir}/x86_64/airootfs/usr/share/efitools/efi/PreLoader.efi ${work_dir}/efiboot/EFI/boot/bootx64.efi
574     cp ${work_dir}/x86_64/airootfs/usr/share/efitools/efi/HashTool.efi ${work_dir}/efiboot/EFI/boot/
575     cp ${work_dir}/x86_64/airootfs/usr/lib/systemd/boot/efi/systemd-bootx64.efi ${work_dir}/efiboot/EFI/boot/loader.efi
576     mkdir -p ${work_dir}/efiboot/loader/entries
577     cp ${script_path}/efiboot/loader/loader.conf ${work_dir}/efiboot/loader/
578     cp ${script_path}/efiboot/loader/entries/uefi-shell-v2-x86_64.conf ${work_dir}/efiboot/loader/entries/
579     cp ${script_path}/efiboot/loader/entries/uefi-shell-v1-x86_64.conf ${work_dir}/efiboot/loader/entries/
580     sed "s|%ARCHISO_LABEL%|${iso_label}|g;
581          s|%INSTALL_DIR%|${install_dir}|g" \
582         ${script_path}/efiboot/loader/entries/archiso-x86_64-cd.conf > ${work_dir}/efiboot/loader/entries/archiso-x86_64.conf
583     cp ${work_dir}/iso/EFI/shellx64_v2.efi ${work_dir}/efiboot/EFI/
584     cp ${work_dir}/iso/EFI/shellx64_v1.efi ${work_dir}/efiboot/EFI/
585     umount -d ${work_dir}/efiboot
586 }
587
588 # Build airootfs filesystem image
589 make_prepare() {
590     cp -a -l -f ${work_dir}/${arch}/airootfs ${work_dir}
591     setarch ${arch} mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" pkglist
592     setarch ${arch} mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" ${gpg_key:+-g ${gpg_key}} prepare
593     rm -rf ${work_dir}/airootfs
594     # rm -rf ${work_dir}/${arch}/airootfs (if low space, this helps)
595 }
596 # Build ISO
597 make_iso() {
598     mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" -L "${iso_label}" -o "${out_dir}" iso "${iso_name}-${iso_version}-x86_64.iso"
599 }
600 if [[ ${EUID} -ne 0 ]]; then
601     echo "This script must be run as root."
602     _usage 1
603 fi
604 if [[ ${arch} != x86_64 ]]; then
605     echo "This script needs to be run on x86_64"
606     _usage 1
607 fi
608 while getopts 'N:V:L:D:w:o:g:vh' arg; do
609     case "${arg}" in
610         N) iso_name="${OPTARG}" ;;
611         V) iso_version="${OPTARG}" ;;
612         L) iso_label="${OPTARG}" ;;
613         D) install_dir="${OPTARG}" ;;
614         w) work_dir="${OPTARG}" ;;
615         o) out_dir="${OPTARG}" ;;
616         g) gpg_key="${OPTARG}" ;;
617         v) verbose="-v" ;;
618         h) _usage 0 ;;
619         *)
620            echo "Invalid argument '${arg}'"
621            _usage 1
622            ;;
623     esac
624 done
625 mkdir -p ${work_dir}
626 run_once make_pacman_conf
627
628 for arch in x86_64; do
629     run_once make_basefs
630     run_once make_packages
631 done
632 run_once make_packages_efi
633 for arch in x86_64; do
634     run_once make_setup_mkinitcpio
635     run_once make_customize_airootfs
636 done
637 for arch in x86_64; do
638     run_once make_boot
639 done
640 # Do all stuff for iso
641 run_once make_boot_extra
642 run_once make_syslinux
643 run_once make_isolinux
644 run_once make_efi
645 run_once make_efiboot
646 run_once make_cnchi
647 run_once make_fixes
648
649 for arch in x86_64; do
650 run_once make_prepare
651 done
652 run_once make_iso