OSDN Git Service

c7991b61f09ff08edf217d5e5b99d6cfcba2e1d7
[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 echo "DONE"
468 echo
469 echo "Replacing Antergos mentions with RebornOS"
470 sed -i "s/Antergos/RebornOS/g" ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/advanced.py
471 sed -i "s/Antergos/RebornOS/g" ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/alongside.py
472 sed -i "s/Antergos/RebornOS/g" ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/ask.py
473 sed -i "s/Antergos/RebornOS/g" ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/automatic.py
474 sed -i "s/Antergos/RebornOS/g" ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/check.py
475 sed -i "s/Antergos/RebornOS/g" ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/gtkbasebox.py
476 sed -i "s/Antergos/RebornOS/g" ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/keymap.py
477 sed -i "s/Antergos/RebornOS/g" ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/language.py
478 sed -i "s/Antergos/RebornOS/g" ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/location.py
479 sed -i "s/Antergos/RebornOS/g" ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/installation/process.py
480 sed -i "s/Antergos/RebornOS/g" ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/slides.py
481 sed -i "s/Antergos/RebornOS/g" ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/summary.py
482 sed -i "s/Antergos/RebornOS/g" ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/timezone.py
483 sed -i "s/Antergos/RebornOS/g" ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/user_info.py
484 sed -i "s/Antergos/RebornOS/g" ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/wireless.py
485 sed -i "s/Antergos/RebornOS/g" ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/zfs.py
486 sed -i "s/Antergos/RebornOS/g" ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/desktop.py
487 # sed -i "s/gnome/deepin/g" ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/pages/desktop.py ==>> Commented to run "base" desktop preselected
488 # sed -i "s/Antergos/Reborn/g" ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/encfs.py
489 # sed -i "s/Antergos/RebornOS/g" ${work_dir}/${arch}/airootfs/usr/share/cnchi/src/main_window.py
490 echo "DONE"
491 echo
492 echo "Removing Mycroft-RebornOS's startup file from the ISO..."
493 rm -f ${work_dir}/${arch}/airootfs/etc/xdg/autostart/mycroft1.desktop
494 echo "DONE"
495 }
496 # Prepare kernel/initramfs ${install_dir}/boot/
497 make_boot() {
498     mkdir -p ${work_dir}/iso/${install_dir}/boot/${arch}
499     echo "Executed 'mkdir -p' Command Successfully"
500     cp ${work_dir}/${arch}/airootfs/boot/archiso.img ${work_dir}/iso/${install_dir}/boot/${arch}/archiso.img
501     echo "Built 'archiso.img' Successfully"
502     cp ${work_dir}/${arch}/airootfs/boot/vmlinuz-linux ${work_dir}/iso/${install_dir}/boot/${arch}/vmlinuz
503     echo "Built 'vmlinuz-linux' Successfully"
504     echo "DONE"
505     echo
506 }
507 # Add other aditional/extra files to ${install_dir}/boot/
508 make_boot_extra() {
509     cp ${work_dir}/${arch}/airootfs/boot/memtest86+/memtest.bin ${work_dir}/iso/${install_dir}/boot/memtest
510     cp ${work_dir}/${arch}/airootfs/usr/share/licenses/common/GPL2/license.txt ${work_dir}/iso/${install_dir}/boot/memtest.COPYING
511     cp ${work_dir}/${arch}/airootfs/boot/intel-ucode.img ${work_dir}/iso/${install_dir}/boot/intel_ucode.img
512     cp ${work_dir}/${arch}/airootfs/usr/share/licenses/intel-ucode/LICENSE ${work_dir}/iso/${install_dir}/boot/intel_ucode.LICENSE
513 }
514 # Prepare /${install_dir}/boot/syslinux
515 make_syslinux() {
516     mkdir -p ${work_dir}/iso/${install_dir}/boot/syslinux
517     for _cfg in ${script_path}/syslinux/*.cfg; do
518         sed "s|%ARCHISO_LABEL%|${iso_label}|g;
519              s|%INSTALL_DIR%|${install_dir}|g" ${_cfg} > ${work_dir}/iso/${install_dir}/boot/syslinux/${_cfg##*/}
520     done
521     cp ${script_path}/syslinux/splash.png ${work_dir}/iso/${install_dir}/boot/syslinux
522     cp ${work_dir}/${arch}/airootfs/usr/lib/syslinux/bios/*.c32 ${work_dir}/iso/${install_dir}/boot/syslinux
523     cp ${work_dir}/${arch}/airootfs/usr/lib/syslinux/bios/lpxelinux.0 ${work_dir}/iso/${install_dir}/boot/syslinux
524     cp ${work_dir}/${arch}/airootfs/usr/lib/syslinux/bios/memdisk ${work_dir}/iso/${install_dir}/boot/syslinux
525     mkdir -p ${work_dir}/iso/${install_dir}/boot/syslinux/hdt
526     gzip -c -9 ${work_dir}/${arch}/airootfs/usr/share/hwdata/pci.ids > ${work_dir}/iso/${install_dir}/boot/syslinux/hdt/pciids.gz
527 #    gzip -c -9 ${work_dir}/${arch}/airootfs/usr/lib/modules/*-ARCH/modules.alias > ${work_dir}/iso/${install_dir}/boot/syslinux/hdt/modalias.gz
528 }
529 # Prepare /isolinux
530 make_isolinux() {
531     mkdir -p ${work_dir}/iso/isolinux
532     sed "s|%INSTALL_DIR%|${install_dir}|g" ${script_path}/isolinux/isolinux.cfg > ${work_dir}/iso/isolinux/isolinux.cfg
533     cp ${work_dir}/${arch}/airootfs/usr/lib/syslinux/bios/isolinux.bin ${work_dir}/iso/isolinux/
534     cp ${work_dir}/${arch}/airootfs/usr/lib/syslinux/bios/isohdpfx.bin ${work_dir}/iso/isolinux/
535     cp ${work_dir}/${arch}/airootfs/usr/lib/syslinux/bios/ldlinux.c32 ${work_dir}/iso/isolinux/
536 }
537 # Prepare /EFI
538 make_efi() {
539     mkdir -p ${work_dir}/iso/EFI/boot
540     cp ${work_dir}/x86_64/airootfs/usr/share/efitools/efi/PreLoader.efi ${work_dir}/iso/EFI/boot/bootx64.efi
541     cp ${work_dir}/x86_64/airootfs/usr/share/efitools/efi/HashTool.efi ${work_dir}/iso/EFI/boot/
542     cp ${work_dir}/x86_64/airootfs/usr/lib/systemd/boot/efi/systemd-bootx64.efi ${work_dir}/iso/EFI/boot/loader.efi
543     mkdir -p ${work_dir}/iso/loader/entries
544     cp ${script_path}/efiboot/loader/loader.conf ${work_dir}/iso/loader/
545     cp ${script_path}/efiboot/loader/entries/uefi-shell-v2-x86_64.conf ${work_dir}/iso/loader/entries/
546     cp ${script_path}/efiboot/loader/entries/uefi-shell-v1-x86_64.conf ${work_dir}/iso/loader/entries/
547     sed "s|%ARCHISO_LABEL%|${iso_label}|g;
548          s|%INSTALL_DIR%|${install_dir}|g" \
549         ${script_path}/efiboot/loader/entries/archiso-x86_64-usb.conf > ${work_dir}/iso/loader/entries/archiso-x86_64.conf
550     # EFI Shell 2.0 for UEFI 2.3+
551     curl -o ${work_dir}/iso/EFI/shellx64_v2.efi https://raw.githubusercontent.com/tianocore/edk2/master/ShellBinPkg/UefiShell/X64/Shell.efi
552     # EFI Shell 1.0 for non UEFI 2.3+
553     curl -o ${work_dir}/iso/EFI/shellx64_v1.efi https://raw.githubusercontent.com/tianocore/edk2/master/EdkShellBinPkg/FullShell/X64/Shell_Full.efi
554 }
555 # Prepare efiboot.img::/EFI for "El Torito" EFI boot mode
556 make_efiboot() {
557     mkdir -p ${work_dir}/iso/EFI/archiso
558     truncate -s 40M ${work_dir}/iso/EFI/archiso/efiboot.img
559     mkfs.vfat -n ARCHISO_EFI ${work_dir}/iso/EFI/archiso/efiboot.img
560     mkdir -p ${work_dir}/efiboot
561     mount ${work_dir}/iso/EFI/archiso/efiboot.img ${work_dir}/efiboot
562     mkdir -p ${work_dir}/efiboot/EFI/archiso
563     cp ${work_dir}/iso/${install_dir}/boot/x86_64/vmlinuz ${work_dir}/efiboot/EFI/archiso/vmlinuz.efi
564     cp ${work_dir}/iso/${install_dir}/boot/x86_64/archiso.img ${work_dir}/efiboot/EFI/archiso/archiso.img
565     cp ${work_dir}/iso/${install_dir}/boot/intel_ucode.img ${work_dir}/efiboot/EFI/archiso/intel_ucode.img
566     mkdir -p ${work_dir}/efiboot/EFI/boot
567     cp ${work_dir}/x86_64/airootfs/usr/share/efitools/efi/PreLoader.efi ${work_dir}/efiboot/EFI/boot/bootx64.efi
568     cp ${work_dir}/x86_64/airootfs/usr/share/efitools/efi/HashTool.efi ${work_dir}/efiboot/EFI/boot/
569     cp ${work_dir}/x86_64/airootfs/usr/lib/systemd/boot/efi/systemd-bootx64.efi ${work_dir}/efiboot/EFI/boot/loader.efi
570     mkdir -p ${work_dir}/efiboot/loader/entries
571     cp ${script_path}/efiboot/loader/loader.conf ${work_dir}/efiboot/loader/
572     cp ${script_path}/efiboot/loader/entries/uefi-shell-v2-x86_64.conf ${work_dir}/efiboot/loader/entries/
573     cp ${script_path}/efiboot/loader/entries/uefi-shell-v1-x86_64.conf ${work_dir}/efiboot/loader/entries/
574     sed "s|%ARCHISO_LABEL%|${iso_label}|g;
575          s|%INSTALL_DIR%|${install_dir}|g" \
576         ${script_path}/efiboot/loader/entries/archiso-x86_64-cd.conf > ${work_dir}/efiboot/loader/entries/archiso-x86_64.conf
577     cp ${work_dir}/iso/EFI/shellx64_v2.efi ${work_dir}/efiboot/EFI/
578     cp ${work_dir}/iso/EFI/shellx64_v1.efi ${work_dir}/efiboot/EFI/
579     umount -d ${work_dir}/efiboot
580 }
581
582 # Build airootfs filesystem image
583 make_prepare() {
584     cp -a -l -f ${work_dir}/${arch}/airootfs ${work_dir}
585     setarch ${arch} mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" pkglist
586     setarch ${arch} mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" ${gpg_key:+-g ${gpg_key}} prepare
587     rm -rf ${work_dir}/airootfs
588     # rm -rf ${work_dir}/${arch}/airootfs (if low space, this helps)
589 }
590 # Build ISO
591 make_iso() {
592     mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" -L "${iso_label}" -o "${out_dir}" iso "${iso_name}-${iso_version}-x86_64.iso"
593 }
594 if [[ ${EUID} -ne 0 ]]; then
595     echo "This script must be run as root."
596     _usage 1
597 fi
598 if [[ ${arch} != x86_64 ]]; then
599     echo "This script needs to be run on x86_64"
600     _usage 1
601 fi
602 while getopts 'N:V:L:D:w:o:g:vh' arg; do
603     case "${arg}" in
604         N) iso_name="${OPTARG}" ;;
605         V) iso_version="${OPTARG}" ;;
606         L) iso_label="${OPTARG}" ;;
607         D) install_dir="${OPTARG}" ;;
608         w) work_dir="${OPTARG}" ;;
609         o) out_dir="${OPTARG}" ;;
610         g) gpg_key="${OPTARG}" ;;
611         v) verbose="-v" ;;
612         h) _usage 0 ;;
613         *)
614            echo "Invalid argument '${arg}'"
615            _usage 1
616            ;;
617     esac
618 done
619 mkdir -p ${work_dir}
620 run_once make_pacman_conf
621
622 for arch in x86_64; do
623     run_once make_basefs
624     run_once make_packages
625 done
626 run_once make_packages_efi
627 for arch in x86_64; do
628     run_once make_setup_mkinitcpio
629     run_once make_customize_airootfs
630 done
631 for arch in x86_64; do
632     run_once make_boot
633 done
634 # Do all stuff for iso
635 run_once make_boot_extra
636 run_once make_syslinux
637 run_once make_isolinux
638 run_once make_efi
639 run_once make_efiboot
640 run_once make_cnchi
641 run_once make_fixes
642
643 for arch in x86_64; do
644 run_once make_prepare
645 done
646 run_once make_iso