Fix keyboard console
All checks were successful
PikaOS Package Build & Release (amd64-v3) / build (push) Successful in 1m55s

This commit is contained in:
Ward from fusion-voyager-3 2024-08-25 00:23:39 +03:00
parent 15f66ebc48
commit f8f51e6fee
14 changed files with 447 additions and 321 deletions

View File

@ -1 +1 @@
2
3

View File

@ -15,10 +15,10 @@ install:
mkdir -p $(DESTDIR)/usr/lib/pika/pika-installer-gtk4/scripts/
mkdir -p $(DESTDIR)/usr/share/glib-2.0/schemas/
cp -rvf data/scripts/*.sh $(DESTDIR)/usr/lib/pika/pika-installer-gtk4/scripts/
cp -rvf data/scripts/*.py $(DESTDIR)/usr/lib/pika/pika-installer-gtk4/scripts/
#cp -rvf data/scripts/*.py $(DESTDIR)/usr/lib/pika/pika-installer-gtk4/scripts/
cp data/*.xml $(DESTDIR)/usr/share/glib-2.0/schemas/
chmod 755 $(DESTDIR)/usr/lib/pika/pika-installer-gtk4/scripts/*.sh
chmod 755 $(DESTDIR)/usr/lib/pika/pika-installer-gtk4/scripts/*.py
#chmod 755 $(DESTDIR)/usr/lib/pika/pika-installer-gtk4/scripts/*.py
mkdir -p $(DESTDIR)/usr/share/applications
mkdir -p $(DESTDIR)/usr/share/icons/hicolor/scalable/apps
cp -vf data/com.github.pikaos-linux.pikainstallergtk4.desktop $(DESTDIR)/usr/share/applications/
@ -33,10 +33,10 @@ install_no_build_debug:
mkdir -p $(DESTDIR)/usr/lib/pika/pika-installer-gtk4/scripts/
mkdir -p $(DESTDIR)/usr/share/glib-2.0/schemas/
cp -rvf data/scripts/*.sh $(DESTDIR)/usr/lib/pika/pika-installer-gtk4/scripts/
cp -rvf data/scripts/*.py $(DESTDIR)/usr/lib/pika/pika-installer-gtk4/scripts/
#cp -rvf data/scripts/*.py $(DESTDIR)/usr/lib/pika/pika-installer-gtk4/scripts/
cp data/*.xml $(DESTDIR)/usr/share/glib-2.0/schemas/
chmod 755 $(DESTDIR)/usr/lib/pika/pika-installer-gtk4/scripts/*.sh
chmod 755 $(DESTDIR)/usr/lib/pika/pika-installer-gtk4/scripts/*.py
#chmod 755 $(DESTDIR)/usr/lib/pika/pika-installer-gtk4/scripts/*.py
mkdir -p $(DESTDIR)/usr/share/applications
mkdir -p $(DESTDIR)/usr/share/icons/hicolor/scalable/apps
cp -vf data/com.github.pikaos-linux.pikainstallergtk4.desktop $(DESTDIR)/usr/share/applications/

View File

@ -1,161 +0,0 @@
#! /bin/bash
set -e
S_DISK="$(cat "/tmp/pika-installer-gtk4-target-auto.txt")"
S_LOCALE="$(cat "/tmp/pika-installer-gtk4-lang.txt").UTF-8"
S_KEYBOARD="$(cat "/tmp/pika-installer-gtk4-keyboard.txt")"
S_TIMEZONE="$(cat "/tmp/pika-installer-gtk4-timezone.txt")"
p3_size=$(echo "scale=2 ; $(cat /tmp/pika-installer-p3-size.txt) / 1024 / 1024" | bc | cut -f1 -d".")
touch "/tmp/pika-installer-gtk4-status-parting.txt"
if [[ ! -f "/tmp/pika-installer-gtk4-target-automatic-luks.txt" ]]
then
for part in $(sudo /usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh get_partitions | grep ${S_DISK}); do
PARTITION="/dev/$part"
sudo swapoff $PARTITION || true
done
wipefs -af /dev/${S_DISK}
# Partition the drives
parted -s -a optimal /dev/${S_DISK} mklabel gpt \
mkpart "linux-efi" 1MiB 513Mib \
mkpart "linux-boot" 513Mib 1537Mib \
mkpart "linux-root" 1537Mib "$p3_size"Mib \
mkpart "linux-home" "$p3_size"Mib 100% \
print
# add p to partition if it's nvme
if echo ${S_DISK} | grep -i "nvme"
then
#
sleep 10
# Add filesystems
yes | mkfs -t vfat -F 32 /dev/${S_DISK}p1
yes | mkfs -t ext4 /dev/${S_DISK}p2
yes | mkfs.btrfs -f /dev/${S_DISK}p3
yes | mkfs.btrfs -f /dev/${S_DISK}p4
sleep 2
# Begin Mounting
mkdir -p /var/cache/root-mnt
mount /dev/${S_DISK}p3 /var/cache/root-mnt
btrfs subvolume create /var/cache/root-mnt/@
#
mkdir -p /var/cache/home-mnt
mount /dev/${S_DISK}p4 /var/cache/home-mnt
btrfs subvolume create /var/cache/home-mnt/@
#
mkdir -p /media/pika-install-mount
mount /dev/${S_DISK}p3 /media/pika-install-mount/ -o subvol=@
mkdir -p /media/pika-install-mount/home
mount /dev/${S_DISK}p4 /media/pika-install-mount/home -o subvol=@
mkdir -p /media/pika-install-mount/boot
mount /dev/${S_DISK}p2 /media/pika-install-mount/boot
mkdir -p /media/pika-install-mount/boot/efi
mount /dev/${S_DISK}p1 /media/pika-install-mount/boot/efi
pikainstall -r /media/pika-install-mount/ -l ${S_LOCALE} -k ${S_KEYBOARD} -t ${S_TIMEZONE} && touch /tmp/pika-installer-gtk4-successful.txt || touch /tmp/pika-installer-gtk4-fail.txt && exit 1
else
sleep 10
# Add filesystems
yes | mkfs -t vfat -F 32 /dev/${S_DISK}1
yes | mkfs -t ext4 /dev/${S_DISK}2
yes | mkfs.btrfs -f /dev/${S_DISK}3
yes | mkfs.btrfs -f /dev/${S_DISK}4
sleep 2
# Begin Mounting
mkdir -p /var/cache/root-mnt
mount /dev/${S_DISK}3 /var/cache/root-mnt
btrfs subvolume create /var/cache/root-mnt/@
#
mkdir -p /var/cache/home-mnt
mount /dev/${S_DISK}4 /var/cache/home-mnt
btrfs subvolume create /var/cache/home-mnt/@
#
mkdir -p /media/pika-install-mount
mount /dev/${S_DISK}3 /media/pika-install-mount/ -o subvol=@
mkdir -p /media/pika-install-mount/home
mount /dev/${S_DISK}4 /media/pika-install-mount/home -o subvol=@
mkdir -p /media/pika-install-mount/boot
mount /dev/${S_DISK}2 /media/pika-install-mount/boot
mkdir -p /media/pika-install-mount/boot/efi
mount /dev/${S_DISK}1 /media/pika-install-mount/boot/efi
pikainstall -r /media/pika-install-mount/ -l ${S_LOCALE} -k ${S_KEYBOARD} -t ${S_TIMEZONE} && touch /tmp/pika-installer-gtk4-successful.txt || touch /tmp/pika-installer-gtk4-fail.txt && exit 1
fi
else
S_LUKS_KEY="$(cat "/tmp/pika-installer-gtk4-target-automatic-luks.txt")"
for part in $(sudo /usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh get_partitions | grep ${S_DISK}); do
PARTITION="/dev/$part"
sudo swapoff $PARTITION || true
done
wipefs -af /dev/${S_DISK}
# Partition the drives
parted -s -a optimal /dev/${S_DISK} mklabel gpt \
mkpart "linux-efi" 1MiB 513Mib \
mkpart "linux-boot" 513Mib 1537Mib \
mkpart "linux-root" 1537Mib "$p3_size"Mib \
mkpart "linux-home" "$p3_size"Mib 100% \
print
# add p to partition if it's nvme
if echo ${S_DISK} | grep -i "nvme"
then
sleep 10
# Add filesystems
yes | mkfs -t vfat -F 32 /dev/${S_DISK}p1
yes | mkfs -t ext4 /dev/${S_DISK}p2
printf ${S_LUKS_KEY} | cryptsetup -q -v --type luks2 luksFormat /dev/${S_DISK}p3
printf ${S_LUKS_KEY} | cryptsetup -q -v --type luks2 luksFormat /dev/${S_DISK}p4
printf ${S_LUKS_KEY} | cryptsetup -q -v luksOpen /dev/${S_DISK}p3 crypt_root
printf ${S_LUKS_KEY} | cryptsetup -q -v luksOpen /dev/${S_DISK}p4 crypt_home
yes | mkfs.btrfs -f /dev/mapper/crypt_root
yes | mkfs.btrfs -f /dev/mapper/crypt_home
sleep 2
# Begin Mounting
mkdir -p /var/cache/root-mnt
mount /dev/mapper/crypt_root /var/cache/root-mnt
btrfs subvolume create /var/cache/root-mnt/@
#
mkdir -p /var/cache/home-mnt
mount /dev/mapper/crypt_home /var/cache/home-mnt
btrfs subvolume create /var/cache/home-mnt/@
#
mkdir -p /media/pika-install-mount
mount /dev/mapper/crypt_root /media/pika-install-mount/ -o subvol=@
mkdir -p /media/pika-install-mount/home
mount /dev/mapper/crypt_home /media/pika-install-mount/home -o subvol=@
mkdir -p /media/pika-install-mount/boot
mount /dev/${S_DISK}p2 /media/pika-install-mount/boot
mkdir -p /media/pika-install-mount/boot/efi
mount /dev/${S_DISK}p1 /media/pika-install-mount/boot/efi
pikainstall -r /media/pika-install-mount/ -c ${S_LUKS_KEY} -l ${S_LOCALE} -k ${S_KEYBOARD} -t ${S_TIMEZONE} && touch /tmp/pika-installer-gtk4-successful.txt || touch /tmp/pika-installer-gtk4-fail.txt && exit 1
else
sleep 10
# Add filesystems
yes | mkfs -t vfat -F 32 /dev/${S_DISK}1
yes | mkfs -t ext4 /dev/${S_DISK}2
printf ${S_LUKS_KEY} | cryptsetup -q -v --type luks2 luksFormat /dev/${S_DISK}3
printf ${S_LUKS_KEY} | cryptsetup -q -v --type luks2 luksFormat /dev/${S_DISK}4
printf ${S_LUKS_KEY} | cryptsetup -q -v luksOpen /dev/${S_DISK}3 crypt_root
printf ${S_LUKS_KEY} | cryptsetup -q -v luksOpen /dev/${S_DISK}4 crypt_home
yes | mkfs.btrfs -f /dev/mapper/crypt_root
yes | mkfs.btrfs -f /dev/mapper/crypt_home
sleep 2
# Begin Mounting
mkdir -p /var/cache/root-mnt
mount /dev/mapper/crypt_root /var/cache/root-mnt
btrfs subvolume create /var/cache/root-mnt/@
#
mkdir -p /var/cache/home-mnt
mount /dev/mapper/crypt_home /var/cache/home-mnt
btrfs subvolume create /var/cache/home-mnt/@
#
mkdir -p /media/pika-install-mount
mount /dev/mapper/crypt_root /media/pika-install-mount/ -o subvol=@
mkdir -p /media/pika-install-mount/home
mount /dev/mapper/crypt_home /media/pika-install-mount/home -o subvol=@
mkdir -p /media/pika-install-mount/boot
mount /dev/${S_DISK}2 /media/pika-install-mount/boot
mkdir -p /media/pika-install-mount/boot/efi
mount /dev/${S_DISK}1 /media/pika-install-mount/boot/efi
pikainstall -r /media/pika-install-mount/ -c ${S_LUKS_KEY} -l ${S_LOCALE} -k ${S_KEYBOARD} -t ${S_TIMEZONE} && touch /tmp/pika-installer-gtk4-successful.txt || touch /tmp/pika-installer-gtk4-fail.txt && exit 1
fi
fi

View File

@ -1,15 +0,0 @@
#! /bin/bash
exec &> >(tee /tmp/pika-installer-gtk4-log)
if [[ -f /tmp/pika-installer-gtk4-target-manual.txt ]]
then
sudo /usr/lib/pika/pika-installer-gtk4/scripts/manual-partition-install.sh || sudo touch /tmp/pika-installer-gtk4-fail.txt
else
if [[ -f /tmp/pika-installer-gtk4-target-auto.txt ]]
then
sudo /usr/lib/pika/pika-installer-gtk4/scripts/automatic-partition-install.sh || sudo touch /tmp/pika-installer-gtk4-fail.txt
else
echo "critical installer error" && sudo touch /tmp/pika-installer-gtk4-fail.txt && exit 1
fi
fi

View File

@ -1,13 +0,0 @@
#! /usr/bin/python3
import gi
gi.require_version('GnomeDesktop', '4.0')
from gi.repository import GnomeDesktop
import sys
locale_name = GnomeDesktop.get_language_from_locale(sys.argv[1], None)
if locale_name is not None:
print(locale_name, end="")
else:
print("Unknown Language", end="")

View File

@ -1,61 +0,0 @@
#! /bin/bash
set -e
S_LOCALE="$(cat "/tmp/pika-installer-gtk4-lang.txt").UTF-8"
S_KEYBOARD="$(cat "/tmp/pika-installer-gtk4-keyboard.txt")"
S_TIMEZONE="$(cat "/tmp/pika-installer-gtk4-timezone.txt")"
touch "/tmp/pika-installer-gtk4-status-parting.txt"
rm -rf /tmp/pika-installer-gtk4-swaplist || true
if ls /tmp/pika-installer-gtk4-target-manual-luks-p*.json
then
rm -rf /tmp/pika-installer-gtk4-crypttab || true
touch /tmp/pika-installer-gtk4-crypttab
for cryptentry in /tmp/pika-installer-gtk4-target-manual-luks-p*.json; do
if [[ -z $(jq -r .password $cryptentry) ]]
then
LUKS=$(jq -r .partition $cryptentry)
MAP=$(jq -r .partition $cryptentry | cut -d "/" -f2-)
UUID="$(blkid "$(lsblk -sJp | jq -r --arg dsk /dev/"$LUKS" '.blockdevices | .[] | select(.name == $dsk) | .children | .[0] | .name')" -s UUID -o value)"
echo "$MAP UUID="$UUID" none luks,discard" >> /tmp/pika-installer-gtk4-crypttab
else
LUKS=$(jq -r .partition $cryptentry)
MAP=$(jq -r .partition $cryptentry | cut -d "/" -f2-)
UUID="$(blkid "$(lsblk -sJp | jq -r --arg dsk /dev/"$LUKS" '.blockdevices | .[] | select(.name == $dsk) | .children | .[0] | .name')" -s UUID -o value)"
LUKS_PASSWD=$(jq -r .password $cryptentry)
echo "$MAP UUID="$UUID" /key-"$MAP".txt luks" >> /tmp/pika-installer-gtk4-crypttab
touch /key-"$MAP".txt
openssl genrsa > /key-"$MAP".txt
echo $LUKS_PASSWD | cryptsetup luksAddKey UUID=$UUID /key-"$MAP".txt -
fi
done
fi
for drivemount in /tmp/pika-installer-gtk4-target-manual-p*.json; do
PARTITION="/dev/$(jq -r .partition $drivemount)"
MOUNTPOINT="/media/pika-install-mount/$(jq -r .mountpoint $drivemount)"
MOUNTOPT=$(jq -r .mountopt $drivemount)
if [[ $MOUNTPOINT = '/media/pika-install-mount/[SWAP]' ]]
then
touch /tmp/pika-installer-gtk4-swaplist
echo $PARTITION > /tmp/pika-installer-gtk4-swaplist
elif [[ -z $MOUNTOPT ]]
then
mkdir -p $MOUNTPOINT
mount $PARTITION $MOUNTPOINT
else
mkdir -p $MOUNTPOINT
mount -o $MOUNTOPT $PARTITION $MOUNTPOINT
fi
done
if [[ ! -f "/tmp/pika-installer-gtk4-crypttab" ]]
then
pikainstall -r /media/pika-install-mount/ --manual 1 -l ${S_LOCALE} -k ${S_KEYBOARD} -t ${S_TIMEZONE} && touch /tmp/pika-installer-gtk4-successful.txt || touch /tmp/pika-installer-gtk4-fail.txt && exit 1
else
pikainstall -r /media/pika-install-mount/ --manual 2 -l ${S_LOCALE} -k ${S_KEYBOARD} -t ${S_TIMEZONE} && touch /tmp/pika-installer-gtk4-successful.txt || touch /tmp/pika-installer-gtk4-fail.txt && exit 1
fi

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
pika-installer-gtk4 (2.0.0-101pika1) pika; urgency=low
pika-installer-gtk4 (2.0.0-101pika2) pika; urgency=low
* First Release of new installer

4
debian/rules vendored
View File

@ -32,10 +32,10 @@ override_dh_install:
mkdir -p debian/pika-installer-gtk4/usr/lib/pika/pika-installer-gtk4/scripts/
mkdir -p debian/pika-installer-gtk4/usr/share/glib-2.0/schemas/
cp -rvf data/scripts/*.sh debian/pika-installer-gtk4/usr/lib/pika/pika-installer-gtk4/scripts/
cp -rvf data/scripts/*.py debian/pika-installer-gtk4/usr/lib/pika/pika-installer-gtk4/scripts/
#cp -rvf data/scripts/*.py debian/pika-installer-gtk4/usr/lib/pika/pika-installer-gtk4/scripts/
cp data/*.xml debian/pika-installer-gtk4/usr/share/glib-2.0/schemas/
chmod 755 debian/pika-installer-gtk4/usr/lib/pika/pika-installer-gtk4/scripts/*.sh
chmod 755 debian/pika-installer-gtk4/usr/lib/pika/pika-installer-gtk4/scripts/*.py
#chmod 755 debian/pika-installer-gtk4/usr/lib/pika/pika-installer-gtk4/scripts/*.py
mkdir -p debian/pika-installer-gtk4/usr/share/applications
mkdir -p debian/pika-installer-gtk4/usr/share/icons/hicolor/scalable/apps
cp -vf data/com.github.pikaos-linux.pikainstallergtk4.desktop debian/pika-installer-gtk4/usr/share/applications/

View File

@ -30,7 +30,7 @@
"progress_log_button_content_tooltip": "View Logs",
"eula_page_subtitle": "PikaOS User License Agreement",
"please_read_eula": "Please carefully read and make sure you consent to the following before installing PikaOS:",
"eula_buffer_text": "There are a few things to keep in mind: \n 1 - You understand that this distribution is -NOT- to be considered an Ubuntu Flavor. \n 2 - This is a hobby distribution, so we will try our best to provide formal support but it will -NOT- be guaranteed. \n 3 - Although PikaOS might provide identical patches and user experience to the Nobara project, we are -NOT- directly a part of them so questions and bug reports should not be sent directly to them (they dont have to deal with it!) \n 4 - While the installer is running DO NOT INTERRUPT IT! or you will end up with a corrupted system. \n 5 - Try to use pikman instead of apt when using the terminal, it is much faster! \n 6 - You understand the xone driver downloads needed binaries locally and does not directly package or distribute any copyrighted firmware or other related data. \n 7 - Automatic partitioning will format all partitons on a drive, so if you want to dualboot make a separate EFI partition for PikaOS and use manual partitioning \n 8 - In case you need the login info for this session: \n - username: pikaos \n - password: \n MEANING: JUST PRESS ENTER",
"eula_buffer_text": "There are a few things to keep in mind: \n 1 - PikaOS is not affiliated with Debian. Debian is a registered trademark owned by Software in the Public Interest, Inc. \n 2 - This is a hobby distribution, so we will try our best to provide formal support but it will -NOT- be guaranteed. \n 3 - Although PikaOS might provide identical patches or user experience to the Nobara project, we are -NOT- directly a part of them so questions and bug reports should not be sent directly to them (they dont have to deal with it!) \n 4 - While the installer is running DO NOT INTERRUPT IT! or you will end up with a corrupted system. \n 5 - Try to use pikman instead of apt when using the terminal, it is much faster! \n 6 - You understand the xone driver downloads needed binaries locally and does not directly package or distribute any copyrighted firmware or other related data. \n 7 - Automatic partitioning will format all partitons on a drive, so if you want to dualboot make a separate EFI partition for PikaOS and use manual partitioning \n 8 - In case you need the login info for this session: \n - username: pikaos \n - password: \n MEANING: JUST PRESS ENTER",
"eula_accept_checkbutton_label": "I Agree and Accept the User license Agreement",
"eula_page_title": "EULA",
"efi_error_header_text_label": "Un-Supported Boot Platform",

View File

@ -19,9 +19,15 @@ pub struct PikaLocale {
/// Keyboard Data types
#[derive(Default, Clone, Debug)]
pub struct PikaKeymap {
pub name: String,
pub variant: Option<String>,
pub struct KBDMap {
pub console: String,
pub layout: String,
pub variant: String
}
#[derive(Default, Clone, Debug)]
pub struct PikaKeymap {
pub kbdmap: KBDMap,
pub pretty_name: String,
}
@ -107,8 +113,8 @@ pub fn build_ui(app: &adw::Application) {
.icon_name("calamares")
.width_request(700)
.height_request(500)
.default_width(700)
.default_height(500)
.default_width(1000)
.default_height(700)
.deletable(false)
.content(&toolbarview)
.startup_id(APP_ID)

View File

@ -16,20 +16,20 @@ blockdev --rereadpt /dev/"$PIKA_INSTALL_AUTO_TARGET_DISK"
pub const AUTOMATIC_OPEN_PART_PIKAINSTALL_PROG: &str = r###"
if [ -z $PIKA_INSTALL_KEYMAP_VARIANT ]
if [ -z $PIKA_INSTALL_XKB_VARIANT ]
then
pikainstall -r $PIKA_INSTALL_CHROOT_PATH -l $PIKA_INSTALL_LOCALE -k $PIKA_INSTALL_KEYMAP_BASE -t $PIKA_INSTALL_TIMEZONE
pikainstall -r $PIKA_INSTALL_CHROOT_PATH -l $PIKA_INSTALL_LOCALE -k $PIKA_INSTALL_KEYMAP -kl $PIKA_INSTALL_XKB_LAYOUT -t $PIKA_INSTALL_TIMEZONE
else
pikainstall -r $PIKA_INSTALL_CHROOT_PATH -l $PIKA_INSTALL_LOCALE -k $PIKA_INSTALL_KEYMAP_BASE -t $PIKA_INSTALL_TIMEZONE -kv $PIKA_INSTALL_KEYMAP_VARIANT
pikainstall -r $PIKA_INSTALL_CHROOT_PATH -l $PIKA_INSTALL_LOCALE -k $PIKA_INSTALL_KEYMAP -kl $PIKA_INSTALL_XKB_LAYOUT -t $PIKA_INSTALL_TIMEZONE -kv $PIKA_INSTALL_XKB_VARIANT
fi
"###;
pub const AUTOMATIC_LOCKED_PART_PIKAINSTALL_PROG: &str = r###"
if [ -z $PIKA_INSTALL_KEYMAP_VARIANT ]
if [ -z $PIKA_INSTALL_XKB_VARIANT ]
then
pikainstall -c $PIKA_INSTALL_AUTO_LUKS_PASSWORD -r $PIKA_INSTALL_CHROOT_PATH -l $PIKA_INSTALL_LOCALE -k $PIKA_INSTALL_KEYMAP_BASE -t $PIKA_INSTALL_TIMEZONE
pikainstall -c $PIKA_INSTALL_AUTO_LUKS_PASSWORD -r $PIKA_INSTALL_CHROOT_PATH -l $PIKA_INSTALL_LOCALE -k $PIKA_INSTALL_KEYMAP -kl $PIKA_INSTALL_XKB_LAYOUT -t $PIKA_INSTALL_TIMEZONE
else
pikainstall -c $PIKA_INSTALL_AUTO_LUKS_PASSWORD -r $PIKA_INSTALL_CHROOT_PATH -l $PIKA_INSTALL_LOCALE -k $PIKA_INSTALL_KEYMAP_BASE -t $PIKA_INSTALL_TIMEZONE -kv $PIKA_INSTALL_KEYMAP_VARIANT
pikainstall -c $PIKA_INSTALL_AUTO_LUKS_PASSWORD -r $PIKA_INSTALL_CHROOT_PATH -l $PIKA_INSTALL_LOCALE -k $PIKA_INSTALL_KEYMAP -kl $PIKA_INSTALL_XKB_LAYOUT -t $PIKA_INSTALL_TIMEZONE -kv $PIKA_INSTALL_XKB_VARIANT
fi
"###;

View File

@ -30,20 +30,20 @@ echo '{LUKS_PASSWD}' | cryptsetup luksAddKey UUID='{UUID}' /tmp/PIKA_CRYPT/key-{
pub const MANUAL_OPEN_PART_PIKAINSTALL_PROG: &str = r###"
if [ -z $PIKA_INSTALL_KEYMAP_VARIANT ]
if [ -z $PIKA_INSTALL_XKB_VARIANT ]
then
pikainstall --manual 1 -r $PIKA_INSTALL_CHROOT_PATH -l $PIKA_INSTALL_LOCALE -k $PIKA_INSTALL_KEYMAP_BASE -t $PIKA_INSTALL_TIMEZONE
pikainstall --manual 1 -r $PIKA_INSTALL_CHROOT_PATH -l $PIKA_INSTALL_LOCALE -k $PIKA_INSTALL_KEYMAP -kl $PIKA_INSTALL_XKB_LAYOUT -t $PIKA_INSTALL_TIMEZONE
else
pikainstall --manual 1 -r $PIKA_INSTALL_CHROOT_PATH -l $PIKA_INSTALL_LOCALE -k $PIKA_INSTALL_KEYMAP_BASE -t $PIKA_INSTALL_TIMEZONE -kv $PIKA_INSTALL_KEYMAP_VARIANT
pikainstall --manual 1 -r $PIKA_INSTALL_CHROOT_PATH -l $PIKA_INSTALL_LOCALE -k $PIKA_INSTALL_KEYMAP -kl $PIKA_INSTALL_XKB_LAYOUT -t $PIKA_INSTALL_TIMEZONE -kv $PIKA_INSTALL_XKB_VARIANT
fi
"###;
pub const MANUAL_LOCKED_PART_PIKAINSTALL_PROG: &str = r###"
if [ -z $PIKA_INSTALL_KEYMAP_VARIANT ]
if [ -z $PIKA_INSTALL_XKB_VARIANT ]
then
pikainstall --manual 2 -r $PIKA_INSTALL_CHROOT_PATH -l $PIKA_INSTALL_LOCALE -k $PIKA_INSTALL_KEYMAP_BASE -t $PIKA_INSTALL_TIMEZONE
pikainstall --manual 2 -r $PIKA_INSTALL_CHROOT_PATH -l $PIKA_INSTALL_LOCALE -k $PIKA_INSTALL_KEYMAP -kl $PIKA_INSTALL_XKB_LAYOUT -t $PIKA_INSTALL_TIMEZONE
else
pikainstall --manual 2 -r $PIKA_INSTALL_CHROOT_PATH -l $PIKA_INSTALL_LOCALE -k $PIKA_INSTALL_KEYMAP_BASE -t $PIKA_INSTALL_TIMEZONE -kv $PIKA_INSTALL_KEYMAP_VARIANT
pikainstall --manual 2 -r $PIKA_INSTALL_CHROOT_PATH -l $PIKA_INSTALL_LOCALE -k $PIKA_INSTALL_KEYMAP -kl $PIKA_INSTALL_XKB_LAYOUT -t $PIKA_INSTALL_TIMEZONE -kv $PIKA_INSTALL_XKB_VARIANT
fi
"###;

View File

@ -17,8 +17,9 @@ rm -rf /tmp/PIKA_CRYPT
PIKA_INSTALL_CHROOT_PATH='{CHROOT_PATH}'
PIKA_INSTALL_LOCALE='{LOCALE}.UTF-8'
PIKA_INSTALL_KEYMAP_BASE='{KEYMAP_BASE}'
PIKA_INSTALL_KEYMAP_VARIANT='{KEYMAP_VARIANT}'
PIKA_INSTALL_KEYMAP='{KEYMAP}'
PIKA_INSTALL_XKB_LAYOUT='{XKB_LAYOUT}'
PIKA_INSTALL_XKB_VARIANT='{XKB_VARIANT}'
PIKA_INSTALL_TIMEZONE='{TIMEZONE}'
"###;
@ -38,13 +39,6 @@ pub fn create_installation_script(
partition_method_manual_crypttab_entry_array_refcell: &Rc<RefCell<Vec<CrypttabEntry>>>,
) -> String {
let mut final_script = String::new();
let variant = match keymap_selection_text_refcell.borrow().clone().variant {
Some(t) => {
t.replace("'", r###"'"'"'"###)
}
None => "".to_string(),
};
let standard_installation_format = strfmt::strfmt(
STANDARD_INSTALLATION_PROG,
@ -55,12 +49,16 @@ pub fn create_installation_script(
language_selection_text_refcell.borrow().name.replace("'", r###"'"'"'"###).as_str(),
),
(
"KEYMAP_BASE".to_string(),
keymap_selection_text_refcell.borrow().name.replace("'", r###"'"'"'"###).as_str(),
"KEYMAP".to_string(),
keymap_selection_text_refcell.borrow().kbdmap.console.replace("'", r###"'"'"'"###).as_str(),
),
(
"KEYMAP_VARIANT".to_string(),
variant.as_str()
"XKB_LAYOUT".to_string(),
keymap_selection_text_refcell.borrow().kbdmap.layout.replace("'", r###"'"'"'"###).as_str(),
),
(
"XKB_VARIANT".to_string(),
keymap_selection_text_refcell.borrow().kbdmap.variant.replace("'", r###"'"'"'"###).as_str(),
),
(
"TIMEZONE".to_string(),

View File

@ -1,4 +1,4 @@
use crate::{build_ui::PikaKeymap, installer_stack_page};
use crate::{build_ui::{PikaKeymap, KBDMap}, installer_stack_page};
use adw::prelude::*;
use gnome_desktop::XkbInfoExt;
use gtk::{gio, glib};
@ -65,43 +65,408 @@ pub fn keyboard_page(
let current_keymap = "us";
let current_keymap_variant: Option<String> = None;
let kbd_map_list = [
KBDMap {
console: "sg".to_string(),
layout: "ch".to_string(),
variant: "de_nodeadkeys".to_string()
},
KBDMap {
console: "nl".to_string(),
layout: "nl".to_string(),
variant: "".to_string()
},
KBDMap {
console: "mk-utf".to_string(),
layout: "mk".to_string(),
variant: "".to_string()
},
KBDMap {
console: "trq".to_string(),
layout: "tr".to_string(),
variant: "".to_string()
},
KBDMap {
console: "trf".to_string(),
layout: "tr".to_string(),
variant: "f".to_string()
},
KBDMap {
console: "uk".to_string(),
layout: "gb".to_string(),
variant: "".to_string()
},
KBDMap {
console: "is-latin1".to_string(),
layout: "is".to_string(),
variant: "".to_string()
},
KBDMap {
console: "de".to_string(),
layout: "de".to_string(),
variant: "".to_string()
},
KBDMap {
console: "la-latin1".to_string(),
layout: "latam".to_string(),
variant: "".to_string()
},
KBDMap {
console: "us".to_string(),
layout: "us".to_string(),
variant: "".to_string()
},
KBDMap {
console: "ko".to_string(),
layout: "kr".to_string(),
variant: "".to_string()
},
KBDMap {
console: "ro_std".to_string(),
layout: "ro".to_string(),
variant: "std".to_string()
},
KBDMap {
console: "slovene".to_string(),
layout: "si".to_string(),
variant: "".to_string()
},
KBDMap {
console: "hu".to_string(),
layout: "hu".to_string(),
variant: "".to_string()
},
KBDMap {
console: "jp106".to_string(),
layout: "jp".to_string(),
variant: "".to_string()
},
KBDMap {
console: "croat".to_string(),
layout: "hr".to_string(),
variant: "".to_string()
},
KBDMap {
console: "hu101".to_string(),
layout: "hu".to_string(),
variant: "qwerty".to_string()
},
KBDMap {
console: "sr-latin".to_string(),
layout: "rs".to_string(),
variant: "latin".to_string()
},
KBDMap {
console: "fi".to_string(),
layout: "fi".to_string(),
variant: "".to_string()
},
KBDMap {
console: "fr_CH".to_string(),
layout: "ch".to_string(),
variant: "fr".to_string()
},
KBDMap {
console: "dk-latin1".to_string(),
layout: "dk".to_string(),
variant: "".to_string()
},
KBDMap {
console: "fr".to_string(),
layout: "fr".to_string(),
variant: "".to_string()
},
KBDMap {
console: "ua-utf".to_string(),
layout: "ua".to_string(),
variant: "".to_string()
},
KBDMap {
console: "fr-latin9".to_string(),
layout: "fr".to_string(),
variant: "latin9".to_string()
},
KBDMap {
console: "sg-latin1".to_string(),
layout: "ch".to_string(),
variant: "de_nodeadkeys".to_string()
},
KBDMap {
console: "be-latin1".to_string(),
layout: "be".to_string(),
variant: "".to_string()
},
KBDMap {
console: "dk".to_string(),
layout: "dk".to_string(),
variant: "".to_string()
},
KBDMap {
console: "bg_pho-utf8".to_string(),
layout: "bg".to_string(),
variant: "phonetic".to_string()
},
KBDMap {
console: "it-ibm".to_string(),
layout: "it".to_string(),
variant: "ibm".to_string()
},
KBDMap {
console: "cz-us-qwertz".to_string(),
layout: "cz".to_string(),
variant: "".to_string()
},
KBDMap {
console: "cz-qwerty".to_string(),
layout: "cz".to_string(),
variant: "qwerty".to_string()
},
KBDMap {
console: "br".to_string(),
layout: "br".to_string(),
variant: "".to_string()
},
KBDMap {
console: "ro".to_string(),
layout: "ro".to_string(),
variant: "".to_string()
},
KBDMap {
console: "us-acentos".to_string(),
layout: "us".to_string(),
variant: "intl".to_string()
},
KBDMap {
console: "pt-latin1".to_string(),
layout: "pt".to_string(),
variant: "".to_string()
},
KBDMap {
console: "tj_alt-UTF8".to_string(),
layout: "tj".to_string(),
variant: "".to_string()
},
KBDMap {
console: "de-latin1-nodeadkeys".to_string(),
layout: "de".to_string(),
variant: "nodeadkeys".to_string()
},
KBDMap {
console: "no".to_string(),
layout: "no".to_string(),
variant: "".to_string()
},
KBDMap {
console: "bg_bds-utf8".to_string(),
layout: "bg".to_string(),
variant: "".to_string()
},
KBDMap {
console: "dvorak".to_string(),
layout: "us".to_string(),
variant: "dvorak".to_string()
},
KBDMap {
console: "ru".to_string(),
layout: "ru".to_string(),
variant: "".to_string()
},
KBDMap {
console: "cz-lat2".to_string(),
layout: "cz".to_string(),
variant: "qwerty".to_string()
},
KBDMap {
console: "pl".to_string(),
layout: "pl".to_string(),
variant: "".to_string()
},
KBDMap {
console: "es".to_string(),
layout: "es".to_string(),
variant: "".to_string()
},
KBDMap {
console: "ie".to_string(),
layout: "ie".to_string(),
variant: "".to_string()
},
KBDMap {
console: "et".to_string(),
layout: "ee".to_string(),
variant: "".to_string()
},
KBDMap {
console: "sk-qwerty".to_string(),
layout: "sk".to_string(),
variant: "qwerty".to_string()
},
KBDMap {
console: "sk-qwertz".to_string(),
layout: "sk".to_string(),
variant: "".to_string()
},
KBDMap {
console: "fr-latin9".to_string(),
layout: "fr".to_string(),
variant: "latin9".to_string()
},
KBDMap {
console: "fr_CH-latin1".to_string(),
layout: "ch".to_string(),
variant: "fr".to_string()
},
KBDMap {
console: "cf".to_string(),
layout: "ca".to_string(),
variant: "".to_string()
},
KBDMap {
console: "sv-latin1".to_string(),
layout: "se".to_string(),
variant: "".to_string()
},
KBDMap {
console: "sr-cy".to_string(),
layout: "rs".to_string(),
variant: "".to_string()
},
KBDMap {
console: "gr".to_string(),
layout: "gr".to_string(),
variant: "".to_string()
},
KBDMap {
console: "by".to_string(),
layout: "by".to_string(),
variant: "".to_string()
},
KBDMap {
console: "il".to_string(),
layout: "il".to_string(),
variant: "".to_string()
},
KBDMap {
console: "kazakh".to_string(),
layout: "kz".to_string(),
variant: "".to_string()
},
KBDMap {
console: "lt".to_string(),
layout: "lt".to_string(),
variant: "".to_string()
},
KBDMap {
console: "khmer".to_string(),
layout: "kh".to_string(),
variant: "".to_string()
},
KBDMap {
console: "dvorak-es".to_string(),
layout: "es".to_string(),
variant: "dvorak".to_string()
},
KBDMap {
console: "lv".to_string(),
layout: "lv".to_string(),
variant: "apostrophe".to_string()
},
KBDMap {
console: "lv-tilde".to_string(),
layout: "lv".to_string(),
variant: "tilde".to_string()
}];
let xkbinfo = gnome_desktop::XkbInfo::new();
let keymap_list = gnome_desktop::XkbInfo::all_layouts(&xkbinfo);
let mut sorted_keymap_vec = Vec::new();
for keymap in keymap_list.iter() {
let keymap_split: Vec<String> = keymap.split("+").map(|s| s.into()).collect();
let keymap_base = keymap_split.first().unwrap().clone();
let mut keymap_variant = String::new();
let mut split_index = 0;
for split in keymap_split {
split_index += 1;
if split_index == 1 {
continue;
}
keymap_variant.push_str(&split)
for kbd_map in kbd_map_list {
let map = kbd_map.clone();
if map.variant.is_empty() {
sorted_keymap_vec.push(PikaKeymap {
kbdmap: kbd_map,
pretty_name: xkbinfo.layout_info(&map.layout).unwrap().0.unwrap().to_string(),
})
} else {
sorted_keymap_vec.push(PikaKeymap {
kbdmap: kbd_map,
pretty_name: xkbinfo.layout_info(format!("{}+{}", map.layout, map.variant).as_str()).unwrap().0.unwrap().to_string(),
})
}
sorted_keymap_vec.push(PikaKeymap {
name: keymap_base,
pretty_name: xkbinfo.layout_info(keymap).unwrap().0.unwrap().to_string(),
variant: {
if keymap_variant.is_empty() {
None
} else {
Some(keymap_variant)
}
},
})
}
sorted_keymap_vec.sort_by_key(|k| k.pretty_name.clone());
for pika_keymap in sorted_keymap_vec {
let keymap_clone0 = pika_keymap.clone();
let keymap_clone1 = pika_keymap.clone();
let keymap = pika_keymap.name;
let keymap = pika_keymap.kbdmap.layout;
let keymap_name = pika_keymap.pretty_name;
let keymap_variant = pika_keymap.variant;
let keymap_variant = if pika_keymap.kbdmap.variant.is_empty() {
None
} else {
Some(pika_keymap.kbdmap.variant)
};
let keymap_variant_clone0 = keymap_variant.clone();
let keymap_checkbutton = gtk::CheckButton::builder()
.valign(gtk::Align::Center)
.can_focus(false)
@ -109,8 +474,15 @@ pub fn keyboard_page(
let keymap_row = adw::ActionRow::builder()
.activatable_widget(&keymap_checkbutton)
.title(keymap_name)
.subtitle(keymap.clone())
.build();
match &keymap_variant {
Some(v) => {
keymap_row.set_subtitle(&format!("{}+{}", keymap, v).to_string());
}
None => {
keymap_row.set_subtitle(&keymap);
}
}
keymap_row.add_prefix(&keymap_checkbutton);
keymap_checkbutton.set_group(Some(&null_checkbutton));
keyboard_selection_row_viewport_listbox.append(&keymap_row);
@ -131,7 +503,7 @@ pub fn keyboard_page(
Some(t) => {
Command::new("setxkbmap")
.arg("-layout")
.arg(&keymap_clone0.name)
.arg(&keymap)
.arg("-variant")
.arg(t)
.spawn()
@ -140,7 +512,7 @@ pub fn keyboard_page(
None => {
Command::new("setxkbmap")
.arg("-layout")
.arg(&keymap_clone0.name)
.arg(&keymap)
.spawn()
.expect("keyboard failed to start");
}
@ -148,7 +520,7 @@ pub fn keyboard_page(
}
}
));
if current_keymap == keymap_clone1.name && current_keymap_variant == keymap_clone1.variant {
if current_keymap == keymap_clone0.kbdmap.layout && current_keymap_variant == keymap_variant_clone0 {
keymap_checkbutton.set_active(true);
}
}