mirror of
https://github.com/theupriser/steamify-cachyos-live-iso.git
synced 2026-10-02 15:10:26 +02:00
⚡ Better handle DE/WM
This commit is contained in:
9 files changed
+430
-264
No files matched your search
@@ -12,3 +12,4 @@ build/
|
||||
user-data
|
||||
meta-data
|
||||
*.qcow2
|
||||
archiso/packages.x86_64
|
||||
@@ -1,138 +0,0 @@
|
||||
#!/bin/bash
|
||||
echo
|
||||
echo "################################################################## "
|
||||
tput setaf 2
|
||||
echo "Phase 1 : "
|
||||
echo "- Setting General parameters"
|
||||
tput sgr0
|
||||
echo "################################################################## "
|
||||
echo
|
||||
|
||||
# setting of the general parameters
|
||||
archisoRequiredVersion="archiso 64-1"
|
||||
currentFolder=$(pwd)
|
||||
buildFolder="${currentFolder}/build"
|
||||
outFolder="${currentFolder}/out"
|
||||
archisoVersion=$(sudo pacman -Q archiso)
|
||||
|
||||
echo "################################################################## "
|
||||
echo "Build folder : "$buildFolder
|
||||
echo "Out folder : "$outFolder
|
||||
echo "################################################################## "
|
||||
|
||||
echo
|
||||
echo "################################################################## "
|
||||
tput setaf 2
|
||||
echo "Phase 2 :"
|
||||
echo "- Checking if archiso is installed"
|
||||
echo "- Making mkarchiso verbose"
|
||||
tput sgr0
|
||||
echo "################################################################## "
|
||||
echo
|
||||
|
||||
package="archiso"
|
||||
|
||||
#----------------------------------------------------------------------------------
|
||||
|
||||
#checking if application is already installed or else install with aur helpers
|
||||
if pacman -Qi $package &> /dev/null; then
|
||||
|
||||
echo "Archiso is already installed"
|
||||
|
||||
else
|
||||
|
||||
#checking which helper is installed
|
||||
if pacman -Qi yay &> /dev/null; then
|
||||
|
||||
echo "################################################################"
|
||||
echo "######### Installing with yay"
|
||||
echo "################################################################"
|
||||
yay -S --noconfirm $package
|
||||
|
||||
elif pacman -Qi trizen &> /dev/null; then
|
||||
|
||||
echo "################################################################"
|
||||
echo "######### Installing with trizen"
|
||||
echo "################################################################"
|
||||
trizen -S --noconfirm --needed --noedit $package
|
||||
|
||||
fi
|
||||
|
||||
# Just checking if installation was successful
|
||||
if pacman -Qi $package &> /dev/null; then
|
||||
|
||||
echo "################################################################"
|
||||
echo "######### "$package" has been installed"
|
||||
echo "################################################################"
|
||||
|
||||
else
|
||||
|
||||
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
||||
echo "!!!!!!!!! "$package" has NOT been installed"
|
||||
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Making mkarchiso verbose"
|
||||
sudo sed -i 's/quiet="y"/quiet="n"/g' /usr/bin/mkarchiso
|
||||
|
||||
echo
|
||||
echo "################################################################## "
|
||||
tput setaf 2
|
||||
echo "Phase 3 :"
|
||||
echo "- Deleting the build folder if one exists"
|
||||
echo "- Copying the Archiso folder to build folder"
|
||||
tput sgr0
|
||||
echo "################################################################## "
|
||||
echo
|
||||
|
||||
echo "Deleting the build folder if one exists - takes some time"
|
||||
[ -d $buildFolder ] && sudo rm -rf $buildFolder
|
||||
echo
|
||||
echo "Copying the Archiso folder to build work"
|
||||
echo
|
||||
mkdir $buildFolder
|
||||
cp -r archiso $buildFolder/archiso
|
||||
|
||||
echo
|
||||
echo "################################################################## "
|
||||
tput setaf 2
|
||||
echo "Phase 6 :"
|
||||
echo "- Cleaning the cache from /var/cache/pacman/pkg/"
|
||||
tput sgr0
|
||||
echo "################################################################## "
|
||||
echo
|
||||
|
||||
echo "Cleaning the cache from /var/cache/pacman/pkg/"
|
||||
yes | sudo pacman -Scc
|
||||
|
||||
echo
|
||||
echo "################################################################## "
|
||||
tput setaf 2
|
||||
echo "Phase 7 :"
|
||||
echo "- Building the iso - this can take a while - be patient"
|
||||
tput sgr0
|
||||
echo "################################################################## "
|
||||
echo
|
||||
|
||||
[ -d $outFolder ] || mkdir $outFolder
|
||||
cd $buildFolder/archiso/
|
||||
sudo mkarchiso -v -w $buildFolder -o $outFolder $buildFolder/archiso/
|
||||
|
||||
|
||||
echo "Moving pkglist.x86_64.txt"
|
||||
echo "########################"
|
||||
rename=$(date +%Y-%m-%d)
|
||||
cp $buildFolder/iso/arch/pkglist.x86_64.txt $outFolder/cachyos-$rename-pkglist.txt
|
||||
|
||||
echo
|
||||
echo "##################################################################"
|
||||
tput setaf 2
|
||||
echo "DONE"
|
||||
echo "- Check your out folder :"$outFolder
|
||||
tput sgr0
|
||||
echo "################################################################## "
|
||||
echo
|
||||
@@ -1,126 +0,0 @@
|
||||
#!/bin/bash
|
||||
echo
|
||||
echo "################################################################## "
|
||||
tput setaf 2
|
||||
echo "Phase 1 : "
|
||||
echo "- Setting General parameters"
|
||||
tput sgr0
|
||||
echo "################################################################## "
|
||||
echo
|
||||
|
||||
# setting of the general parameters
|
||||
archisoRequiredVersion="archiso 58-1"
|
||||
currentFolder=$(pwd)
|
||||
buildFolder="${currentFolder}/build"
|
||||
outFolder="${currentFolder}/out"
|
||||
archisoVersion=$(sudo pacman -Q archiso)
|
||||
|
||||
echo "################################################################## "
|
||||
echo "Build folder : "$buildFolder
|
||||
echo "Out folder : "$outFolder
|
||||
echo "################################################################## "
|
||||
|
||||
echo
|
||||
echo "################################################################## "
|
||||
tput setaf 2
|
||||
echo "Phase 2 :"
|
||||
echo "- Checking if archiso is installed"
|
||||
echo "- Making mkarchiso verbose"
|
||||
tput sgr0
|
||||
echo "################################################################## "
|
||||
echo
|
||||
|
||||
package="archiso"
|
||||
|
||||
#----------------------------------------------------------------------------------
|
||||
|
||||
#checking if application is already installed or else install with aur helpers
|
||||
if pacman -Qi $package &> /dev/null; then
|
||||
|
||||
echo "Archiso is already installed"
|
||||
|
||||
else
|
||||
|
||||
#checking which helper is installed
|
||||
if pacman -Qi yay &> /dev/null; then
|
||||
|
||||
echo "################################################################"
|
||||
echo "######### Installing with yay"
|
||||
echo "################################################################"
|
||||
yay -S --noconfirm $package
|
||||
|
||||
elif pacman -Qi trizen &> /dev/null; then
|
||||
|
||||
echo "################################################################"
|
||||
echo "######### Installing with trizen"
|
||||
echo "################################################################"
|
||||
trizen -S --noconfirm --needed --noedit $package
|
||||
|
||||
fi
|
||||
|
||||
# Just checking if installation was successful
|
||||
if pacman -Qi $package &> /dev/null; then
|
||||
|
||||
echo "################################################################"
|
||||
echo "######### "$package" has been installed"
|
||||
echo "################################################################"
|
||||
|
||||
else
|
||||
|
||||
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
||||
echo "!!!!!!!!! "$package" has NOT been installed"
|
||||
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Making mkarchiso verbose"
|
||||
sudo sed -i 's/quiet="y"/quiet="n"/g' /usr/bin/mkarchiso
|
||||
|
||||
echo
|
||||
echo "################################################################## "
|
||||
tput setaf 2
|
||||
echo "Phase 3 :"
|
||||
echo "- Deleting the build folder if one exists"
|
||||
echo "- Copying the Archiso folder to build folder"
|
||||
tput sgr0
|
||||
echo "################################################################## "
|
||||
echo
|
||||
|
||||
echo "Deleting the build folder if one exists - takes some time"
|
||||
[ -d $buildFolder ] && sudo rm -rf $buildFolder
|
||||
echo
|
||||
echo "Copying the Archiso folder to build work"
|
||||
echo
|
||||
mkdir $buildFolder
|
||||
cp -r archiso $buildFolder/archiso
|
||||
|
||||
echo
|
||||
echo "################################################################## "
|
||||
tput setaf 2
|
||||
echo "Phase 7 :"
|
||||
echo "- Building the iso - this can take a while - be patient"
|
||||
tput sgr0
|
||||
echo "################################################################## "
|
||||
echo
|
||||
|
||||
[ -d $outFolder ] || mkdir $outFolder
|
||||
cd $buildFolder/archiso/
|
||||
sudo mkarchiso -v -w $buildFolder -o $outFolder $buildFolder/archiso/
|
||||
|
||||
|
||||
echo "Moving pkglist.x86_64.txt"
|
||||
echo "########################"
|
||||
rename=$(date +%Y-%m-%d)
|
||||
cp $buildFolder/iso/arch/pkglist.x86_64.txt $outFolder/cachyos-$rename-pkglist.txt
|
||||
|
||||
echo
|
||||
echo "##################################################################"
|
||||
tput setaf 2
|
||||
echo "DONE"
|
||||
echo "- Check your out folder :"$outFolder
|
||||
tput sgr0
|
||||
echo "################################################################## "
|
||||
echo
|
||||
File renamed without changes.
Executable
+68
@@ -0,0 +1,68 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; version 2 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
src_dir=$(pwd)
|
||||
[[ -r ${src_dir}/util-msg.sh ]] && source ${src_dir}/util-msg.sh
|
||||
import ${src_dir}/util.sh
|
||||
|
||||
# setting of the general parameters
|
||||
work_dir="${src_dir}/build"
|
||||
outFolder="${src_dir}/out"
|
||||
|
||||
build_list_iso="kde"
|
||||
clean_first=true
|
||||
verbose=false
|
||||
|
||||
usage() {
|
||||
echo "Usage: ${0##*/} [options]"
|
||||
echo ' -c Disable clean work dir'
|
||||
echo " -p <profile> Buildset or profile [default: ${build_list_iso}]"
|
||||
echo ' -v Verbose output to log file, show profile detail (-q)'
|
||||
echo ' -h This help'
|
||||
echo ''
|
||||
echo ''
|
||||
exit $1
|
||||
}
|
||||
|
||||
orig_argv=("$@")
|
||||
|
||||
opts='p:cvh'
|
||||
|
||||
while getopts "${opts}" arg; do
|
||||
case "${arg}" in
|
||||
c) clean_first=false ;;
|
||||
p) build_list_iso="$OPTARG" ;;
|
||||
v) verbose=true ;;
|
||||
h|?) usage 0 ;;
|
||||
*) echo "invalid argument '${arg}'"; usage 1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
shift $(($OPTIND - 1))
|
||||
|
||||
timer_start=$(get_timer)
|
||||
|
||||
check_root "$0" "${orig_argv[@]}"
|
||||
|
||||
prepare_dir "${work_dir}"
|
||||
|
||||
import ${src_dir}/util-iso.sh
|
||||
import ${src_dir}/util-iso-mount.sh
|
||||
|
||||
check_requirements
|
||||
|
||||
for sig in TERM HUP QUIT; do
|
||||
trap "trap_exit $sig \"$(gettext "%s signal caught. Exiting...")\" \"$sig\"" "$sig"
|
||||
done
|
||||
trap 'trap_exit INT "$(gettext "Aborted by user! Exiting...")"' INT
|
||||
trap 'trap_exit USR1 "$(gettext "An unknown error has occurred. Exiting...")"' ERR
|
||||
|
||||
run_build "${build_list_iso}"
|
||||
Executable
+46
@@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; version 2 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
umount_img() {
|
||||
if [[ -n ${IMG_ACTIVE_MOUNTS[@]} ]]; then
|
||||
info "umount: [%s]" "${IMG_ACTIVE_MOUNTS[@]}"
|
||||
umount "${IMG_ACTIVE_MOUNTS[@]}"
|
||||
unset IMG_ACTIVE_MOUNTS
|
||||
rm -r "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
check_umount() {
|
||||
if mountpoint -q "$1"
|
||||
then
|
||||
umount -l "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
umount_fs(){
|
||||
if [[ -n ${FS_ACTIVE_MOUNTS[@]} ]]; then
|
||||
info "overlayfs umount: [%s]" "${FS_ACTIVE_MOUNTS[@]}"
|
||||
#umount "${FS_ACTIVE_MOUNTS[@]}"
|
||||
for i in "${FS_ACTIVE_MOUNTS[@]}"
|
||||
do
|
||||
info "umount overlayfs: [%s]" "$i"
|
||||
check_umount $i
|
||||
done
|
||||
unset FS_ACTIVE_MOUNTS
|
||||
rm -rf "${mnt_dir}/work"
|
||||
fi
|
||||
mount_folders=$(grep "${work_dir}" /proc/mounts | awk '{print$2}' | sort -r)
|
||||
for i in $mount_folders
|
||||
do
|
||||
info "umount folder: [%s]" "$i"
|
||||
check_umount $i
|
||||
done
|
||||
}
|
||||
Executable
+138
@@ -0,0 +1,138 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; version 2 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
error_function() {
|
||||
if [[ -p $logpipe ]]; then
|
||||
rm "$logpipe"
|
||||
fi
|
||||
# first exit all subshells, then print the error
|
||||
if (( ! BASH_SUBSHELL )); then
|
||||
error "A failure occurred in %s()." "$1"
|
||||
plain "Aborting..."
|
||||
fi
|
||||
umount_fs
|
||||
umount_img
|
||||
exit 2
|
||||
}
|
||||
|
||||
run_safe() {
|
||||
local restoretrap func="$1"
|
||||
set -e
|
||||
set -E
|
||||
restoretrap=$(trap -p ERR)
|
||||
trap 'error_function $func' ERR
|
||||
|
||||
if ${verbose}; then
|
||||
run_log "$func"
|
||||
else
|
||||
"$func"
|
||||
fi
|
||||
|
||||
eval $restoretrap
|
||||
set +E
|
||||
set +e
|
||||
}
|
||||
|
||||
check_umount() {
|
||||
if mountpoint -q "$1"
|
||||
then
|
||||
umount -l "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
trap_exit() {
|
||||
local sig=$1; shift
|
||||
error "$@"
|
||||
umount_fs
|
||||
trap -- "$sig"
|
||||
kill "-$sig" "$$"
|
||||
}
|
||||
|
||||
prepare_profile(){
|
||||
profile=$1
|
||||
|
||||
info "Profile: [%s]" "${profile}"
|
||||
|
||||
rm ${src_dir}/archiso/airootfs/etc/systemd/system/display-manager.service
|
||||
if [[$profile == "kde"]]; then
|
||||
cp ${src_dir}/archiso/packages_kde.x86_64 ${src_dir}/archiso/packages.x86_64
|
||||
ln -sf /usr/lib/systemd/system/sddm.service ${src_dir}/archiso/airootfs/etc/systemd/system/display-manager.service
|
||||
elif [[$profile == "gnome"]]; then
|
||||
rm ${src_dir}/archiso/airootfs/etc/motd
|
||||
cp ${src_dir}/archiso/packages_gnome.x86_64 ${src_dir}/archiso/packages.x86_64
|
||||
ln -sf /usr/lib/systemd/system/gdm.service ${src_dir}/archiso/airootfs/etc/systemd/system/display-manager.service
|
||||
elif [[$profile == "xfce"]]; then
|
||||
cp ${src_dir}/archiso/packages_xfce.x86_64 ${src_dir}/archiso/packages.x86_64
|
||||
ln -sf /usr/lib/systemd/system/lightdm.service ${src_dir}/archiso/airootfs/etc/systemd/system/display-manager.service
|
||||
else
|
||||
die "Unknown profile: [%s]" "${profile}"
|
||||
fi
|
||||
|
||||
iso_file=$(gen_iso_fn).iso
|
||||
}
|
||||
|
||||
run_build() {
|
||||
prepare_profile "$1"
|
||||
local _profile="$1"
|
||||
|
||||
msg "Prepare [work: ${work_dir}, out: ${outFolder}]"
|
||||
|
||||
if $verbose; then
|
||||
msg2 "Making mkarchiso verbose"
|
||||
sudo sed -i 's/quiet="y"/quiet="n"/g' /usr/bin/mkarchiso
|
||||
fi
|
||||
|
||||
if $clean_first; then
|
||||
msg2 "Deleting the build folder if one exists - takes some time"
|
||||
[ -d ${work_dir} ] && sudo rm -rf ${work_dir}
|
||||
fi
|
||||
|
||||
msg2 "Copying the Archiso folder to build work"
|
||||
mkdir ${work_dir}
|
||||
cp -r archiso ${work_dir}/archiso
|
||||
|
||||
msg "Start [Build ISO]"
|
||||
|
||||
[ -d $outFolder ] || mkdir $outFolder
|
||||
cd ${work_dir}/archiso/
|
||||
sudo mkarchiso -v -w ${work_dir} -o $outFolder ${work_dir}/archiso/
|
||||
|
||||
cp ${work_dir}/iso/arch/pkglist.x86_64.txt $outFolder/$(gen_iso_fn).pkgs.txt
|
||||
|
||||
msg "Done [Build ISO] ${iso_file}"
|
||||
msg "Finished building [%s]" "${_profile}"
|
||||
|
||||
for f in $(find . -maxdepth 1 -name '*.iso' | cut -d'/' -f2); do
|
||||
if [[ ! -e $f.sha256 ]]; then
|
||||
create_chksums $f
|
||||
elif [[ $f -nt $f.sha256 ]]; then
|
||||
create_chksums $f
|
||||
else
|
||||
info "checksums for [$f] already created"
|
||||
fi
|
||||
done
|
||||
show_elapsed_time "${FUNCNAME}" "${timer_start}"
|
||||
}
|
||||
|
||||
gen_iso_fn(){
|
||||
local vars=() name
|
||||
vars+=("cachyos")
|
||||
[[ -n ${profile} ]] && vars+=("${profile}")
|
||||
|
||||
vars+=("linux")
|
||||
vars+=("$(date +%y%m%d)")
|
||||
|
||||
for n in ${vars[@]}; do
|
||||
name=${name:-}${name:+-}${n}
|
||||
done
|
||||
|
||||
echo $name
|
||||
}
|
||||
Executable
+103
@@ -0,0 +1,103 @@
|
||||
#!/bin/bash
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; version 2 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
export LC_MESSAGES=C
|
||||
export LANG=C
|
||||
|
||||
disable_colors(){
|
||||
unset ALL_OFF BOLD BLUE GREEN RED YELLOW
|
||||
}
|
||||
|
||||
enable_colors(){
|
||||
# prefer terminal safe colored and bold text when tput is supported
|
||||
if tput setaf 0 &>/dev/null; then
|
||||
ALL_OFF="$(tput sgr0)"
|
||||
BOLD="$(tput bold)"
|
||||
RED="${BOLD}$(tput setaf 1)"
|
||||
GREEN="${BOLD}$(tput setaf 2)"
|
||||
YELLOW="${BOLD}$(tput setaf 3)"
|
||||
BLUE="${BOLD}$(tput setaf 4)"
|
||||
else
|
||||
ALL_OFF="\e[0m"
|
||||
BOLD="\e[1m"
|
||||
RED="${BOLD}\e[31m"
|
||||
GREEN="${BOLD}\e[32m"
|
||||
YELLOW="${BOLD}\e[33m"
|
||||
BLUE="${BOLD}\e[34m"
|
||||
fi
|
||||
readonly ALL_OFF BOLD BLUE GREEN RED YELLOW
|
||||
}
|
||||
|
||||
if [[ -t 2 ]]; then
|
||||
enable_colors
|
||||
else
|
||||
disable_colors
|
||||
fi
|
||||
|
||||
plain() {
|
||||
local mesg=$1; shift
|
||||
printf "${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
|
||||
}
|
||||
|
||||
msg() {
|
||||
local mesg=$1; shift
|
||||
printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
|
||||
}
|
||||
|
||||
msg2() {
|
||||
local mesg=$1; shift
|
||||
printf "${BLUE} ->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
|
||||
}
|
||||
|
||||
info() {
|
||||
local mesg=$1; shift
|
||||
printf "${YELLOW} -->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
|
||||
}
|
||||
|
||||
warning() {
|
||||
local mesg=$1; shift
|
||||
printf "${YELLOW}==> WARNING:${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
|
||||
}
|
||||
|
||||
error() {
|
||||
local mesg=$1; shift
|
||||
printf "${RED}==> ERROR:${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
|
||||
}
|
||||
|
||||
stat_busy() {
|
||||
local mesg=$1; shift
|
||||
printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}...${ALL_OFF}" >&2
|
||||
}
|
||||
|
||||
stat_done() {
|
||||
printf "${BOLD}done${ALL_OFF}\n" >&2
|
||||
}
|
||||
|
||||
cleanup() {
|
||||
exit ${1:-0}
|
||||
}
|
||||
|
||||
abort() {
|
||||
error 'Aborting...'
|
||||
cleanup 255
|
||||
}
|
||||
|
||||
die() {
|
||||
(( $# )) && error "$@"
|
||||
cleanup 255
|
||||
}
|
||||
|
||||
import(){
|
||||
if [[ -r $1 ]]; then
|
||||
source $1
|
||||
else
|
||||
die "Could not import $1"
|
||||
fi
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
#!/bin/bash
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; version 2 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
get_timer(){
|
||||
echo $(date +%s)
|
||||
}
|
||||
|
||||
# $1: start timer
|
||||
elapsed_time(){
|
||||
echo $(echo $1 $(get_timer) | awk '{ printf "%0.2f",($2-$1)/60 }')
|
||||
}
|
||||
|
||||
show_elapsed_time(){
|
||||
info "Time %s: %s minutes" "$1" "$(elapsed_time $2)"
|
||||
}
|
||||
|
||||
check_root(){
|
||||
(( EUID == 0 )) && return
|
||||
if type -P sudo >/dev/null; then
|
||||
exec sudo -- "$@"
|
||||
else
|
||||
exec su root -c "$(printf ' %q' "$@")"
|
||||
fi
|
||||
}
|
||||
|
||||
check_requirements(){
|
||||
local package="archiso"
|
||||
#checking if application is already installed or else install with aur helpers
|
||||
if ! pacman -Qi $package &> /dev/null; then
|
||||
# checking which helper is installed
|
||||
if pacman -Qi yay &> /dev/null; then
|
||||
echo "################################################################"
|
||||
echo "######### Installing with yay"
|
||||
echo "################################################################"
|
||||
yay -S --noconfirm $package
|
||||
elif pacman -Qi trizen &> /dev/null; then
|
||||
echo "################################################################"
|
||||
echo "######### Installing with trizen"
|
||||
echo "################################################################"
|
||||
trizen -S --noconfirm --needed --noedit $package
|
||||
fi
|
||||
|
||||
# Just checking if installation was successful
|
||||
if pacman -Qi $package &> /dev/null; then
|
||||
echo "################################################################"
|
||||
echo "######### "$package" has been installed"
|
||||
echo "################################################################"
|
||||
else
|
||||
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
||||
echo "!!!!!!!!! "$package" has NOT been installed"
|
||||
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
prepare_dir(){
|
||||
if [[ ! -d $1 ]]; then
|
||||
mkdir -p $1
|
||||
fi
|
||||
}
|
||||
|
||||
create_chksums() {
|
||||
msg2 "creating checksums for [$1]"
|
||||
sha1sum $1 > $1.sha1
|
||||
sha256sum $1 > $1.sha256
|
||||
}
|
||||
Reference in new issue
Block a user