1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
|
#/bin/sh
# Ubuntu - Finnish CD creation
#
# Started in 2007 based on https://help.ubuntu.com/community/LiveCDCustomization
# Updated from time to time.
#
# Ubuntu Trademark Policy requires ”Remix” suffix usage, more info at
# http://www.ubuntu.com/aboutus/trademarkpolicy
#
# Author: Timo Jyrinki
# Modifications from: Uwe Geuder
#
# License CC-BY-SA 3.0: http://creativecommons.org/licenses/by-sa/3.0/
echo
echo Ubuntu - Finnish CD creation
echo License CC-BY-SA 3.0: http://creativecommons.org/licenses/by-sa/3.0/
echo
echo Only run the commands in this script if you know what you are doing
echo
echo This script is not actually a script, copy-paste certain sections of
echo the file instead - processing stops at eg. moving into chroot.
echo And maybe it is better that way... no error checking of any kind included.
echo
read
exit
sudo apt install squashfs-tools syslinux-utils
# You may ignore all extra comment lines.
# Fetching the Ubuntu DVD, or using existing one like done here
#mkdir iso
#cd iso
#wget http://releases.ubuntu.com/12.04/${iso_file}
export iso_file=ubuntu-22.04-desktop-amd64.iso
# Extracting image and chrooting into it
mkdir mnt
sudo mount -o loop ${iso_file} mnt/
mkdir extract-cd
sudo rsync --exclude=/casper/filesystem.squashfs -a mnt/ extract-cd
mkdir squashfs
sudo mount -t squashfs -o loop mnt/casper/filesystem.squashfs squashfs
mkdir edit
sudo cp -a squashfs/* edit/
# NOTE: LiveCDCustomization wiki page uses another method nowadays
# sudo unsquashfs mnt/casper/filesystem.squashfs
# sudo mv squashfs-root edit
# I've not noticed difference in the end result, cp seems faster
sudo mount --bind /dev/ edit/dev
sudo chroot edit
mount -t proc none /proc
mount -t sysfs none /sys
mount -t devpts none /dev/pts
export HOME=/root
export LC_ALL=C
# Installing the wanted language support, optionally first removing non-wanted
# packages. We're far beyond 700MB limit anyway, the next sensible limit to
# keep under is 1GB (so that fits on 1GB USB memory).
#apt remove --purge language-pack-bn language-pack-bn-base language-pack-gnome-bn language-pack-gnome-bn-base language-pack-es language-pack-es-base language-pack-gnome-es language-pack-gnome-es-base language-pack-pt language-pack-pt-base language-pack-gnome-pt language-pack-gnome-pt-base language-pack-xh language-pack-xh-base language-pack-gnome-xh language-pack-gnome-xh-base language-pack-hi language-pack-hi-base language-pack-gnome-hi language-pack-gnome-hi-base language-pack-de language-pack-de-base language-pack-fr language-pack-fr-base language-pack-gnome-de language-pack-gnome-de-base language-pack-gnome-fr language-pack-gnome-fr-base firefox-locale-bn firefox-locale-de firefox-locale-es firefox-locale-pt language-pack-gnome-zh-hans language-pack-gnome-zh-hans-base language-pack-zh-hans language-pack-zh-hans-base firefox-locale-zh-hans
# BEGIN XXX THIS IS THE ONLY NON-COPYPASTEABLE PART OF THIS FILE XXX
#
# You may need (read: you do need) to add "nameserver 8.8.8.8" to the resolv
# file temporarily. Preferably remove the line to restore original (empty) content
# afterwards.
#
# In 16.04 LTS, the file is /run/resolvconf/resolv.conf
# In 18.04 LTS, 20.04 LTS and 22.04 LTS, the file is /run/systemd/resolve/stub-resolv.conf
#
# END XXX THIS IS THE ONLY NON-COPYPASTEABLE PART OF THIS FILE XXX
# Update repository information to find current packages
sed -i 's/restricted/restricted universe/' /etc/apt/sources.list
apt update
# this may be useful so that a compatible Firefox and its language package would be available straight after installation. as an example, in the case of 10.04.4 a new Firefox replaced the CD version almost immediately before the remix was done, and the language pack would have been "too new" for the Firefox contained on the CD
###apt install firefox
# Finnish (basic support)
apt install gnome-user-docs-fi language-pack-fi language-pack-fi-base language-pack-gnome-fi language-pack-gnome-fi-base
# Possible other languages to include on Finnish remix ie languages spoken in Finland: ruotsi (-sv), venäjä (-ru), arabia (-ar), viro (-et), somali (-so), pohjoissaami (-se)
# In Ubuntu 9.10 language-selector started handling some of the packages instead of direct dependencies
# NOTE: at one point universe repos were needed at this point, but no longer in lucid
# pre-libreoffice
##apt install mozvoikko openoffice.org-l10n-fi language-support-writing-fi openoffice.org-voikko xul-ext-mozvoikko gnome-user-guide-fi openoffice.org-help-fi
# libreoffice
# xul-ext-mozvoikko not functional anymore with Firefox 60+
apt install libreoffice-l10n-fi libreoffice-voikko libreoffice-help-fi thunderbird-locale-fi libenchant-2-voikko tmispell-voikko
# 22.04 LTS: Firefox and its translations as a snap: firefox-locale-fi
sed -i 's/restricted universe/restricted/' /etc/apt/sources.list
# note: additional installed packages:
# libenchant-voikko libvoikko1 openoffice.org-l10n-common
# openoffice.org-l10n-fi tmispell-voikko voikko-fi
# these are not needed:
# openoffice.org-java-common hunspell-dictionary-fi myspell-dictionary-fi
# openoffice.org-spellcheck-fi openoffice.org-hyphenation-fi
# openoffice.org2-thesaurus-fi ispell
#
# These are extra packages Language Support would pop up a window about if
# not included.
# (addition: it's not really avoided even with these, some packages will be
# uninstalled by the installer)
apt install libreoffice-l10n-en-gb libreoffice-help-en-gb libreoffice-l10n-en-za libreoffice-help-en-us poppler-data hyphen-fi hunspell-en-ca mythes-en-au thunderbird-locale-en-gb hyphen-en-us thunderbird-locale-en-us mythes-en-us wbritish hunspell-en-za libreoffice-l10n-en-gb hunspell-en-gb
# Cleanups
apt clean
# TODO: /var/lib/dpkg/info? it's already populated, not allowed to be cleaned
rm -rf /tmp/*
rm -rf /var/cache/apt-xapian-index/*
rm -rf /var/lib/apt/lists/*
umount /proc
umount /sys
umount /dev/pts
# Does not change ubiquity default language (for legacy boot)
#echo LANG=\"fi_FI.UTF-8\" >> /etc/default/locale
##
## You may want to put the /run/systemd/resolve/stub-resolv.conf back to zero size now
##
exit
sudo umount edit/dev
# setting default language (for legacy boot)
# 16.04 LTS: seems broken, no known solution. English is still the default.
# OTOH UEFI starts to be dominant in the in-use laptops in the 2020s
# UEFI boot default is changed further down the script
# 22.04 LTS: isolinux folder no longer exists
#echo fi | sudo tee extract-cd/isolinux/lang
# Translating Examples desktop icon in live mode LP: #441986 -> FIXED
# Re-creation of "manifest" file
sudo -s
chmod +w extract-cd/casper/filesystem.manifest
chroot edit dpkg-query -W --showformat='${Package} ${Version}\n' > extract-cd/casper/filesystem.manifest
# 10+ packages are not part of the finished installation
# earlier it was tried to recreate filesystem.manifest-desktop
# but that caused too many packages to get installed
# (of which at least casper caused side effects ie ramzswap)
# Trial & error with Lucid 10.04.1 lead to using the original
# filesystem.manifest-desktop without changes, which works!
# (apparently the language support system takes care of the
# changed packages)
#
# Pack the filesystem
mksquashfs edit extract-cd/casper/filesystem.squashfs
# Create the disk image itself
export output_file=ubuntu-22.04-desktop-amd64-finnishremix.iso
#export IMAGE_NAME="Ubuntu 12.04 LTS \"Precise Pangolin\""
export IMAGE_NAME="Ubuntu 22.04 LTS"
# README.diskdefines no longer in 22.04 LTS
#sed -i -e "s/$IMAGE_NAME/$IMAGE_NAME (Finnish Remix)/" extract-cd/README.diskdefines
sed -i -e "s/$IMAGE_NAME/$IMAGE_NAME (Finnish Remix)/" extract-cd/.disk/info
# NOTE: 14.04.3 official amd64 image has "Beta", one can change that to "Release"
cd extract-cd
# Localizing the UEFI boot
sed -i '6i loadfont /boot/grub/fonts/unicode.pf2' boot/grub/grub.cfg
sed -i '7i set locale_dir=$prefix/locale' boot/grub/grub.cfg
sed -i '8i set lang=fi_FI' boot/grub/grub.cfg
sed -i '9i insmod gettext' boot/grub/grub.cfg
# TODO: This may be the cause that somehow even though otherwise everything is correct,
# in UEFI case unfortunately default keyboard selection is incorrect ie Finnish
# need to be selected manually. This is not the case on unmodified media where the
# language is needed to be selected manually but then keyboard is automatically correct.
#sed -i 's%splash%splash locale=fi_FI console-setup/layoutcode=fi%' boot/grub/grub.cfg
# TODO: Because of the above, do not set keyboard, only language. It's a better trade-off
# to make installation smoother than have correct keyboard in testing phase.
sed -i 's%splash%splash locale=fi_FI%' boot/grub/grub.cfg
sed -i 's/Try or Install Ubuntu/Kokeile tai asenna Ubuntu/' boot/grub/grub.cfg
sed -i 's/Ubuntu (safe graphics)/Ubuntu (vikasietotila)/' boot/grub/grub.cfg
sed -i 's/OEM install (for manufacturers)/OEM-asennus (laitevalmistajille)/' boot/grub/grub.cfg
sed -i 's/Boot from next volume/Käynnistä seuraavalta levytaltiolta/' boot/grub/grub.cfg
sed -i 's/UEFI Firmware Settings/UEFI-laiteohjelmiston asetukset/' boot/grub/grub.cfg
sed -i 's/Test memory/Testaa muisti/' boot/grub/grub.cfg
mkdir -p boot/grub/locale/
mkdir -p boot/grub/fonts/
cp -a /boot/grub*/locale/fi.mo boot/grub/locale/
cp -a /boot/grub*/fonts/unicode.pf2 boot/grub/fonts/
rm -f md5sum.txt
(find -type f -print0 | xargs -0 md5sum | grep -v isolinux/boot.cat | sudo tee ../md5sum.txt)
mv -f ../md5sum.txt ./
# If the following is not done, causes an error in the boot menu disk check option
sed -i -e '/isolinux/d' md5sum.txt
# Different volume name than the IMAGE_NAME above. On the official image it's of the type Ubuntu 12.04 LTS amd64
export IMAGE_NAME="Ubuntu 22.04 LTS amd64 fi"
# 14.04 LTS
#mkisofs -r -V "$IMAGE_NAME" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o ../${output_file} .
# 16.04 LTS to 20.04 LTS
#genisoimage -r -V "$IMAGE_NAME" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -e boot/grub/efi.img -no-emul-boot -o ../${output_file} .
# cd ..
# isohybrid --uefi ${output_file}
# 22.04 LTS
orig=../ubuntu-22.04-desktop-amd64.iso
mbr=../ubuntu-22.04-desktop-amd64.mbr
efi=../ubuntu-22.04-desktop-amd64.efi
# Extract the MBR template
dd if="$orig" bs=1 count=446 of="$mbr"
# Extract EFI partition image
skip=$(/sbin/fdisk -l "$orig" | fgrep '.iso2 ' | awk '{print $2}')
size=$(/sbin/fdisk -l "$orig" | fgrep '.iso2 ' | awk '{print $4}')
dd if="$orig" bs=512 skip="$skip" count="$size" of="$efi"
# One can check original options with xorriso -indev ubuntu-22.04-desktop-amd64.iso -report_el_torito as_mkisofs
xorriso -as mkisofs -r -V "$IMAGE_NAME" -J -joliet-long -l -iso-level 3 -partition_offset 16 --grub2-mbr "$mbr" --mbr-force-bootable -append_partition 2 0xEF "$efi" -appended_part_as_gpt -c /boot.catalog -b /boot/grub/i386-pc/eltorito.img -no-emul-boot -boot-load-size 4 -boot-info-table --grub2-boot-info -eltorito-alt-boot -e '--interval:appended_partition_2:all::' -no-emul-boot -o ../${output_file} .
cd ..
umount squashfs/
umount mnt/
exit
# not in use, a more difficult way of setting the default language in boot menu
## apt source gfxboot-theme-ubuntu gfxboot dpkg-dev
## apt build-dep gfxboot-theme-ubuntu
## cd gfxboot-theme-ubuntu*/
## make DEFAULT_LANG=fi
## sudo cp -a boot/* ../extract-cd/isolinux/
## sudo cp -a langlist ../extract-cd/isolinux/
|