Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

syncro #206

Merged
merged 22 commits into from
Jun 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions COMMUNITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,5 @@ FIX /\
Ma VM qui contient l'os n'a pas assez d'espace disque et pour des raisons diverses elle refuse de m'écouté et ne veux pas augmenté son stockage je vais donc me concentré sur l'installeur et le mettre sur une autre vm avec une bonne config et pouvoir continué le dev !

L'installeur avance tres bien ! Le contenu de l'iso sera sur le github a l'exception des font grub et du fichier .sfs de l'os pour des raisons évidentes de places.

Toutes les modifications sur l'iso que j'ai fait depuis 10 jours sont portés sur github
101 changes: 86 additions & 15 deletions testing/install/installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ RESET_COLOR="\e[0m"
# VARS #

IS_EFI=1
SWAPUSED=0
OLD_PASSWORD=""
PARTITIONS=$(cat /proc/partitions | awk '$4 == "part" { print $4, $5 }' | sed '1d')
partition_list=()
Expand Down Expand Up @@ -91,8 +92,8 @@ function get_language {
)

case "${language}" in
"en-US") export LANG="en_US.UTF-8";;
"fr-FR") export LANG="fr_FR.UTF-8";;
"en-US") loadkeys fr;;
"fr-FR") loadkeys us;;
*) ;;
esac

Expand Down Expand Up @@ -140,14 +141,16 @@ function configure_network {
network_password="$(dialog --insecure --passwordbox "Enter network password:" 0 0 --stdout)"

# Activating wireless interface
log "Activating wireless interface"
log "Configuration of the network."

sudo ifconfig wlp3s0 up
sudo wpa_passphrase WLAN_NAME WLAN_PASSWORD > /etc/wpa_supplicant.conf

log "Connecting to network"
wpa_supplicant -B -i wlp3s0 -c /etc/wpa_supplicant.conf -D wext
mv "/etc/unusedwirless" "/etc/systemd/network/25-wireless.network"
log "Connected to network. Reboot necessary"
mkdir "/root/installdir"
mv "/etc/unusedwireless" "/root/installdir/25-wireless.network"
log "Network configured. Reboot necessary."
else
rm -f "/etc/unusedwirless"
fi
Expand All @@ -157,8 +160,8 @@ function configure_network {
function GET_USER_INFOS {
section "GET USER INFOS"

get_informations
get_language
get_informations
configure_network

echo -e "\n"
Expand All @@ -179,6 +182,7 @@ function DISK_PARTITION {
chosen_partition_size=$(lsblk -b -n -o SIZE -d "${chosen_partition}" | awk '{printf "%.2f", $1 / (1024 * 1024 * 1024)}')
if [ "${chosen_partition_size}" -ge "25.00" ]; then
if dialog --yesno "Do you want to create a swap partition?" 25 85 --stdout; then
SWAPUSED=0
for i in "${!partition_list[@]}"; do
if [ "${partition_list[i]}" = "${chosen_partition}" ]; then
unset 'partition_list[i]'
Expand All @@ -189,8 +193,16 @@ function DISK_PARTITION {
fi

if [ -d /sys/firmware/efi ]; then
dialog --title "Efi detected" --msgbox "EFI was been detected ! \n CydraLite will be in EFI \n\n But if you dont want disable it on the BIOS CydraLite will boot anyway"
IS_EFI = 0
if dialog --title "Efi detected" --yesno "EFI was been detected ! Do you want to create an EFI partition ?" 25 85 --stdout; then
for i in "${!partition_list[@]}"; do
if [ "${partition_list[i]}" = "${swap_partition}" ]; then
unset 'partition_list[i]'
break
fi
done
efi_partition=$(dialog --stdout --menu "Choose the swap partition" 15 60 10 "${partition_list[@]}")
IS_EFI = 0
fi
fi
else
dialog --msgbox "Error. The chosen partition is too little to contain the system. 25GB at least." 15 100
Expand All @@ -212,13 +224,52 @@ function GRUB_CONF {


if [ IS_EFI = 1 ]; then
grub-install ${chosen_partition}
mainPartitionUuid=$(blid ${chosen_partion})
if [ SWAPUSED = 0 ]; then
swapPartitionUuid=$(blid ${swap_partion})
fi
mkdir /mnt/install/boot
grub-install --root-directory=/mnt/install/boot ${chosen_partition}
else
grub-install --target=x86_64-efi --removable
mainPartitionUuid=$(blid ${chosen_partion})
if [ SWAPUSED = 0 ]; then
swapPartitionUuid=$(blid ${swap_partion})
fi
efiPartitionUuid=$(blid ${efi_partion})
mkfs.vfat ${efi_partition}
echo -e "t\n\nuefi\nw" | fdisk ${efi_partition}
mkdir /mnt/efi
mount ${efi_partition} /mnt/efi
grub-install ${efi_partition} --root-directory=/mnt/efi --target=x86_64-efi --removable
rm -f "${efi_partition}/boot/grub/grub.cfg"
fi
rm -rf /mnt/install/boot/grub/grub.cfg
grub-mkconfig –o /mnt/install/boot/grub/grub.cfg

rm -rf /mnt/efi/boot/grub/grub.cfg
touch /mnt/install/boot/grub/grub.cfg
touch /mnt/efi/boot/grub/grub.cfg
chosen_partition_suffix="${chosen_partition#/dev/sd}"
chosen_partition_letter="${chosen_partition_suffix:0:1}"
grubrootnum0=$(( $(printf "%d" "'${chosen_partition_letter}") - 96 ))
grubrootnum1="${chosen_partition_suffix:1}"
echo "set default=0" > /mnt/efi/boot/grub/grub.cfg
echo "set timeout=5" > /mnt/efi/boot/grub/grub.cfg
echo "" > /mnt/efi/boot/grub/grub.cfg
echo "insmod part_gpt" > /mnt/efi/boot/grub/grub.cfg
echo "insmod ext2" > /mnt/efi/boot/grub/grub.cfg
echo "set root=(hd${grubrootnum0},${grubrootnum1})" > /mnt/efi/boot/grub/grub.cfg
echo "" > /mnt/efi/boot/grub/grub.cfg
echo "insmod all_video" > /mnt/efi/boot/grub/grub.cfg
echo "if loadfont /boot/grub/fonts/unicode.pf2; then" > /mnt/efi/boot/grub/grub.cfg
echo " terminal_output gfxterm" > /mnt/efi/boot/grub/grub.cfg
echo "fi" > /mnt/efi/boot/grub/grub.cfg
echo "" > /mnt/efi/boot/grub/grub.cfg
echo 'menuentry "GNU/Linux, CydraLite Release V2.0" {' > /mnt/efi/boot/grub/grub.cfg
echo " linux /boot/os root=UUID=${mainPartitionUuid} ro" > /mnt/efi/boot/grub/grub.cfg
echo "}" > /mnt/efi/boot/grub/grub.cfg
echo "" > /mnt/efi/boot/grub/grub.cfg
echo "menuentry "Firmware Setup" {" > /mnt/efi/boot/grub/grub.cfg
echo " fwsetup" > /mnt/efi/boot/grub/grub.cfg
echo "}" > /mnt/efi/boot/grub/grub.cfg
}

# CYDRA INSTALLATION #
Expand All @@ -227,8 +278,26 @@ function INSTALL_CYDRA {
section "INSTALLING CYDRA"

mkdir /mnt/install
mount ${chosen_partition} /mnt/install
cp -r /* /mnt/install > /dev/null 2>&1;
mount ${chosenPartition} /mnt/install
mv "/etc/system.sfs" "/mnt/system.sfs"
mount -t squashfs "/mnt/system.sfs" /mnt/temp
cp -r "/mnt/temp/*" "/mnt/install"
rm -f /mnt/install/etc/fstab
touch /mnt/install/etc/fstab
echo "#CydraLite FSTAB File, Make a backup if you want to modify this file." > /mnt/install/etc/fstab
echo "" > /mnt/install/etc/fstab
echo "UUID=${mainPartitionUuid} / ext4 defaults 1 1" > /mnt/install/etc/fstab
if [ SWAPUSED = 0 ]; then
echo "UUID=${swapPartitionUuid} swap swap pri=1 0 0" > /mnt/install/etc/fstab
fi

if [ IS_EFI = 0 ]; then
echo "UUID=${efiPartitionUuid} /boot/efi vfat codepage=437,iocharset=iso8859-1 0 1" > /mnt/install/etc/fstab
fi

if [[ ${WIRELESS} = 1 ]]; then
mv "/root/installdir/25-wireless.network" "/mnt/install/systemd/network/25-wireless.network"
fi
}

# INIT SWAP #
Expand All @@ -243,6 +312,8 @@ function CLEAN_LIVE {
section "CLEANING LIVECD BEFORE REBOOTING"

umount /mnt/install > /dev/null 2>&1;
umount /mnt/efi > /dev/null 2>&1;
umount /mnt/temp > /dev/null 2>&1;
}


Expand Down Expand Up @@ -273,9 +344,9 @@ function main {
log "installation on '${chosen_partition}'"
if dialog --yesno "!! WARNING !! \n\n EVERY DATA ON THE DISK WILL BE ERASED.\n Do you want to continue ?" 25 85 --stdout; then
DISK_INSTALL
GRUB_CONF
INSTALL_CYDRA
INIT_SWAP
GRUB_CONF
CLEAN_LIVE

dialog --msgbox "Installation is finished, thanks for using CydraOS !" 0 0
Expand Down
Binary file added testing/iso/boot/grub/SPLASH.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed testing/iso/boot/grub/splash.png
Binary file not shown.
1 change: 1 addition & 0 deletions testing/iso/lfs/.nremovable
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

File renamed without changes.
1 change: 1 addition & 0 deletions testing/iso/rootfs/etc/HOSTNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cydralive
File renamed without changes.
5 changes: 5 additions & 0 deletions testing/iso/rootfs/etc/PASSWD
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/dev/null:/usr/bin/false
uuidd:x:80:80:UUID Generation Daemon User:/dev/null:/usr/bin/false
nobody:x:65534:65534:Unprivileged User:/dev/null:/usr/bin/false
sshd:x:50:50:sshd PrivSep:/var/lib/sshd:/bin/false
7 changes: 7 additions & 0 deletions testing/iso/rootfs/etc/SHADOW
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
root:$6$cx9IAhN36ehWALoK$JJNxBEWhVTU.vuOMu8PSuhgQpmktATG7ocphHT0Pn.Ag5SIGReF12YGgiykv/nbiPUv3OciVNKP7tYnHoidRb.:19616:0:99999:7:::
bin:x:19616:0:99999:7:::
daemon:x:19616:0:99999:7:::
messagebus:x:19616:0:99999:7:::
uuidd:x:19616:0:99999:7:::
nobody:x:19616:0:99999:7:::
sshd:!:19620:0:99999:7:::
Loading