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 #213

Merged
merged 6 commits into from
Jul 3, 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
24 changes: 8 additions & 16 deletions testing/install/installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,26 +91,15 @@ function get_language {
--stdout
)

case "${language}" in
"en-US") loadkeys fr;;
"fr-FR") loadkeys us;;
*) ;;
esac
if [ ${language} = "fr-FR" ]; then
loadkeys fr
else
loadkeys us
fi

log "Language set to '${language}'"
}


function get_machine_name {
log "Getting machine name"
machine_name="$(dialog --title "Dialog title" --inputbox "Enter machine name:" 0 0 --stdout)"

# Set machine name to 'machine_name'
log "Setting machine name..."
sudo hostname "${machine_name}"
log "Machine name set"
}

function get_informations {
exec 3>&1

Expand Down Expand Up @@ -298,6 +287,9 @@ function INSTALL_CYDRA {
if [[ ${WIRELESS} = 1 ]]; then
mv "/root/installdir/25-wireless.network" "/mnt/install/systemd/network/25-wireless.network"
fi
rm -f /mnt/install/etc/wpa_supplicant.conf
cp -r /etc/wpa_supplicant.conf /mnt/install/etc/wpa_supplicant.conf

}

# INIT SWAP #
Expand Down
10 changes: 9 additions & 1 deletion testing/iso/rootfs/etc/profile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
dmesg -n 3
cd /root
echo "WELCOME TO THE CYDRALITE INSTALLATION GUIDE. PLEASE WAIT..."
Expand All @@ -7,10 +8,17 @@ cd dialog-1.3-20240619/
./configure
make
make install
cd /root
tar xf whois-5.4.3.tar.gz
cd whois-5.4.3/
make
make prefix=/usr install-whois
make prefix=/usr install-mkpasswd
make prefix=/usr install-pos
echo "THE INSTALLATION GUIDE IS STARTING SOON!"
sleep 3
/usr/bin/installer
clear
echo "You can remove the cydralite installation guide from your computer and reboot!"
sleep 5
reboot
reboot
85 changes: 36 additions & 49 deletions testing/iso/rootfs/usr/bin/installer
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ RESET_COLOR="\e[0m"
IS_EFI=1
SWAPUSED=0
OLD_PASSWORD=""
PARTITIONS=$(cat /proc/partitions | awk '$4 == "part" { print $4, $5 }' | sed '1d')
SALT="75vv97x9QnG9MjVR"
PARTITIONS=$(cat /proc/partitions | awk 'NR > 2 && $4 !~ /^(sr0|loop0)$/ { print $4 }')
partition_list=()
while read -r line; do
size=$(echo "$line" | awk '{ print $2 }')
Expand All @@ -23,7 +24,6 @@ declare -A AVAILIBLE_LANGUAGES=(
[2]=fr-FR
)


log() {
echo -e "[${BOLD_BLUE}LOG${RESET_COLOR}] $*"
}
Expand Down Expand Up @@ -70,18 +70,6 @@ function INFORMATIONS {

# - - - - - - - - - - - - - #


function get_password {
log "Getting password"
password="$(dialog --insecure --passwordbox "Enter machine password:" 0 0 --stdout)"

# Set new root password
log "Setting password..."
[[ -n "${password}" ]] || echo -e "${OLD_PASSWORD}\n{password}\n{password}" | passwd
log "Password set"
}


function get_language {
log "Getting language"

Expand All @@ -100,17 +88,6 @@ function get_language {
log "Language set to '${language}'"
}


function get_machine_name {
log "Getting machine name"
machine_name="$(dialog --title "Dialog title" --inputbox "Enter machine name:" 0 0 --stdout)"

# Set machine name to 'machine_name'
log "Setting machine name..."
sudo hostname "${machine_name}"
log "Machine name set"
}

function get_informations {
exec 3>&1

Expand All @@ -126,8 +103,11 @@ function get_informations {

exec 3>&-
machine_name=$(echo "${GLOBALVALUES}" | awk -F: '{print $1}')
user_name=$(echo "${GLOBALVALUES}" | awk -F: '{print $2}')
username=$(echo "${GLOBALVALUES}" | awk -F: '{print $2}')
password=$(echo "${GLOBALVALUES}" | awk -F: '{print $3}')
password_encrypted=$(mkpasswd -m sha-512 ${password} ${SALT})
password_only=$(${password_encrypted} | sed 's/^.*$6$[^$]*$//')
username_encrypted="${username}:x:2130:2130:The Guest:/home/${username}:/bin/bash"
}


Expand Down Expand Up @@ -251,25 +231,25 @@ function GRUB_CONF {
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
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 @@ -286,18 +266,25 @@ function INSTALL_CYDRA {
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
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
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
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

echo ${password_encrypted} >> "/mnt/install/etc/shadow"
echo ${username_encrypted} >> "/mnt/install/etc/passwd"
echo "${username}:${password_only}:2130:" >> "/mnt/install/etc/group"

mkdir "/mnt/install/home/${username}"
chown --recursive ${username}:${username} "/mnt/install/home/${username}"
}

# INIT SWAP #
Expand Down Expand Up @@ -368,4 +355,4 @@ function err {
dialog --msgbox "The installation failed. The user did not gived all of the needed informations for the installation." 15 100
}

main "$@"
main "$@"