mirror of
https://gitlab.com/JKANetwork/JKArch.git
synced 2026-02-22 13:03:45 +01:00
Trying things
This commit is contained in:
@@ -1,27 +1,70 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
## Note: Some text editors in some lines its wrong the "markup color" because much '"'($) things.
|
## Note: Some text editors in some lines its wrong the "markup color" because much '"'($) things.
|
||||||
|
|
||||||
|
## This function runs (non interactive) commands, and have various arguments, and logs it in $log file
|
||||||
|
## $1 -> Sentence to show
|
||||||
|
## $2 -> If it has to be silent (0->Show, 1/not 0->Silent)
|
||||||
|
## $3 -> Where to run (sudo: sudo $3, chroot: in the chroot as root, chuser: in chroot as the created user
|
||||||
|
## $4 -> Command to run
|
||||||
|
## $5 -> Is a "various-sentence command"? (1 -> First / Not lastest, 2 -> Last )
|
||||||
|
function comm {
|
||||||
|
# First complete the command, if necessary
|
||||||
|
if [[ $3 == "chroot" ]];then
|
||||||
|
$4 = "chroot /mnt /bin/bash -c \"$4\""
|
||||||
|
else if [[ $3 == "chuser" ]];then
|
||||||
|
$4 = "chroot /mnt /bin/bash -c \"su $nameuser -c \"$4\" \" "
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Make silent if it has to be
|
||||||
|
if [[ $2 != "0" ]];then
|
||||||
|
$4 = "$4 >/dev/null"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check for multisentence command and run
|
||||||
|
if [[ $multiSentence == "0" ]];then
|
||||||
|
echo "[ RUNNING ] $1"
|
||||||
|
fi
|
||||||
|
#Run command. (Command is $4)
|
||||||
|
$4
|
||||||
|
|
||||||
|
# Update multiSentence var
|
||||||
|
if [[ $5 == "1" ]]
|
||||||
|
multiSentence="1"
|
||||||
|
fi
|
||||||
|
if [[ $5 == "2" ]]
|
||||||
|
multiSentence="0"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# When command finish, know if it ran succesfully
|
||||||
|
if [[ $? != "0" ]];then
|
||||||
|
echo "[ ERROR ] $1"
|
||||||
|
echo "[ ERROR ] $1" >> /tmp/install.log
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $? == "0" && $5 != "1" ]]
|
||||||
|
echo "[ OK ] $1"
|
||||||
|
echo "[ OK ] $1" >> /tmp/install.log
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if [[ ! -f "jkarch" ]];then
|
if [[ ! -f "jkarch" ]];then
|
||||||
#Prepare system before install
|
#Prepare system before install
|
||||||
dialog --title "JKArch install script" --msgbox "Starting installation, please wait" 15 60
|
dialog --title "JKArch install script" --msgbox "Starting installation, please wait" 15 60
|
||||||
# First add exec permisson to me
|
# First add exec permisson to me
|
||||||
chmod +x installer.sh
|
chmod +x installer.sh
|
||||||
# Grow cowspace
|
# Grow cowspace
|
||||||
echo "[ RUN ] Grow cowspace for installer"
|
comm "Grow cowspace for installer" "1" "sudo" "mount -o remount,size=700M /run/archiso/cowspace"
|
||||||
sudo -S mount -o remount,size=700M /run/archiso/cowspace
|
|
||||||
echo "[ OK ] Grow cowspace for installer"
|
|
||||||
|
|
||||||
#Enable pacman
|
#Enable pacman
|
||||||
echo "[ RUN ] Configuring pacman"
|
comm "Configuring pacman" "1" "sudo" "pacman-key --init" "1"
|
||||||
sudo pacman-key --init >/dev/null
|
comm "Configuring pacman" "1" "sudo" "pacman-key --populate" "1"
|
||||||
sudo pacman-key --populate >/dev/null
|
comm "Configuring pacman" "1" "sudo" "pacman -Sy archlinux-keyring --noconfirm" "2"
|
||||||
sudo pacman -Sy archlinux-keyring --noconfirm
|
|
||||||
echo "[ OK ] Configuring pacman"
|
comm "Selecting mirrors" "1" "sudo" "pacman -S reflector --noconfirm" "1"
|
||||||
|
comm "Selecting mirrors" "1" "sudo" "reflector --verbose -l 6 --sort rate --save /etc/pacman.d/mirrorlist" "2"
|
||||||
|
|
||||||
echo "[ RUN ] Selecting mirrors"
|
|
||||||
sudo pacman -S reflector --noconfirm >/dev/null
|
|
||||||
sudo reflector --verbose -l 6 --sort rate --save /etc/pacman.d/mirrorlist >/dev/null
|
|
||||||
echo "[ OK ] Selecting mirrors"
|
|
||||||
#Delete programs (For not updating it)
|
#Delete programs (For not updating it)
|
||||||
sudo pacman -R clonezilla darkhttpd diffutils grml-zsh-config irssi linux-atm lvm2 man-db man-pages mc ndisc6 nmap smartmontools testdisk vi vim vim-runtime openconnect pcsclite python2 python reflector --noconfirm
|
sudo pacman -R clonezilla darkhttpd diffutils grml-zsh-config irssi linux-atm lvm2 man-db man-pages mc ndisc6 nmap smartmontools testdisk vi vim vim-runtime openconnect pcsclite python2 python reflector --noconfirm
|
||||||
sudo rm -rf /var/cache/pacman/pkg/*
|
sudo rm -rf /var/cache/pacman/pkg/*
|
||||||
|
|||||||
Reference in New Issue
Block a user