531 lines
18 KiB
Bash
531 lines
18 KiB
Bash
|
#!/bin/bash
|
||
|
|
||
|
echo -n $( dirname -- "$( readlink -f -- "$0" )" ) > pwd.txt
|
||
|
|
||
|
CWD=$(cat pwd.txt)
|
||
|
user=$(who | grep "tty" | cut -d" " -f1)
|
||
|
group=$user
|
||
|
|
||
|
if [[ "$UID" != 0 ]]; then
|
||
|
echo "USER NOT ROOT"
|
||
|
sudo "$0"
|
||
|
exit
|
||
|
else
|
||
|
echo "USER IS ROOT"
|
||
|
fi
|
||
|
|
||
|
DELAY=1
|
||
|
|
||
|
function check_internet() {
|
||
|
SECONDS=0
|
||
|
|
||
|
ping -c 1 1.1.1.1 > /dev/null
|
||
|
have_internet="$?"
|
||
|
|
||
|
if [ "$have_internet" -ne 0 ]; then
|
||
|
echo "No internet connection"
|
||
|
exit
|
||
|
fi
|
||
|
|
||
|
ELAPSED="Elapsed: $(($SECONDS / 3600))hrs $((($SECONDS / 60) % 60))min $(($SECONDS % 60))sec"
|
||
|
echo -e "\n$ELAPSED\n"
|
||
|
}
|
||
|
|
||
|
function clean() {
|
||
|
echo "CLEAN"
|
||
|
|
||
|
if [ -n "$dir" ]; then
|
||
|
cd "$CWD/$dir"
|
||
|
echo "PWD: $(pwd)"
|
||
|
else
|
||
|
exit
|
||
|
fi
|
||
|
|
||
|
rm -v airootfs/opt/extra-drivers/*.pkg.tar.*
|
||
|
rm -v airootfs/root/packages/*.pkg.tar.*
|
||
|
rm -v airootfs/usr/share/packages/*.pkg.tar.*
|
||
|
|
||
|
cd "$CWD"
|
||
|
echo "PWD: $CWD"
|
||
|
}
|
||
|
|
||
|
function mirrorlist() {
|
||
|
SECONDS=0
|
||
|
|
||
|
echo "MIRRORLIST"
|
||
|
|
||
|
if [ -n "$dir" ]; then
|
||
|
cd "$CWD/$dir"
|
||
|
echo "PWD: $(pwd)"
|
||
|
else
|
||
|
exit
|
||
|
fi
|
||
|
|
||
|
check_internet
|
||
|
|
||
|
# cp "$CWD/$dir/mirrorlist" "/etc/pacman.d/mirrorlist.pacnew"
|
||
|
# sed -i -e "s/#Server/Server/g" /etc/pacman.d/mirrorlist.pacnew
|
||
|
# cp /etc/pacman.d/mirrorlist.pacnew /etc/pacman.d/mirrorlist
|
||
|
# reflector --save /etc/pacman.d/mirrorlist -c "CA,FI,FR,DE,IS,IE,IT,JP,KZ,LV,LU,NZ,NO,PL,PT,RU,SG,ES,SE,CH,TW,TH, " --protocol https --latest 50 --fastest 50 --sort rate
|
||
|
# rate-mirrors --save /etc/pacman.d/mirrorlist --allow-root --disable-comments-in-file --entry-country="CA,FI,FR,DE,IS,IE,IT,JP,KZ,LV,LU,NZ,NO,PL,PT,RU,SG,ES,SE,CH,TW,TH, " --protocol=https manjaro --max-delay 7200
|
||
|
|
||
|
ELAPSED="Elapsed: $(($SECONDS / 3600))hrs $((($SECONDS / 60) % 60))min $(($SECONDS % 60))sec"
|
||
|
echo -e "\n$ELAPSED\n"
|
||
|
}
|
||
|
|
||
|
function prepare() {
|
||
|
SECONDS=0
|
||
|
|
||
|
echo "PREPARE"
|
||
|
|
||
|
check_internet
|
||
|
|
||
|
if [ -n "$dir" ]; then
|
||
|
cd "$CWD/$dir"
|
||
|
echo "PWD: $(pwd)"
|
||
|
else
|
||
|
exit
|
||
|
fi
|
||
|
|
||
|
clean
|
||
|
|
||
|
if [ -n "$dir" ]; then
|
||
|
cd "$CWD/$dir"
|
||
|
echo "PWD: $(pwd)"
|
||
|
else
|
||
|
exit
|
||
|
fi
|
||
|
|
||
|
paccache -rvk 1
|
||
|
|
||
|
pacman -Sy --config pacman_sys.conf
|
||
|
pacman -Sw --config pacman_sys.conf --noconfirm r8168-dkms
|
||
|
|
||
|
for i in $(find /var/cache/pacman/pkg/ -name "r8168-dkms*")
|
||
|
do
|
||
|
echo "r8168-dkms: $i"
|
||
|
cp -vf "$i" "$CWD/$dir/airootfs/opt/extra-drivers/"
|
||
|
echo ""
|
||
|
done
|
||
|
|
||
|
rm "$CWD/$dir/airootfs/opt/extra-drivers/"*.sig
|
||
|
|
||
|
packs=(
|
||
|
dracut
|
||
|
grub-dracut
|
||
|
grub
|
||
|
systemd-boot-dracut
|
||
|
libxvmc
|
||
|
linux-api-headers
|
||
|
linux-cachyos
|
||
|
linux-cachyos-headers
|
||
|
linux-cachyos-zfs
|
||
|
melawy-dracut-initramfs
|
||
|
melawy-dracut-ukify
|
||
|
melawy-refind-menu-generator
|
||
|
melawy-refind-theme-nier-a2
|
||
|
melawy-plymouth-theme-nier-a2
|
||
|
os-prober
|
||
|
refind
|
||
|
update-grub
|
||
|
xf86-video-intel
|
||
|
)
|
||
|
|
||
|
pacman -Sw --config pacman_sys.conf --noconfirm ${packs[@]}
|
||
|
|
||
|
for pack in ${packs[@]}
|
||
|
do
|
||
|
min_length=0
|
||
|
current_elem=0
|
||
|
min_length_elem=0
|
||
|
name_of_elem=""
|
||
|
all_finded=$(find /var/cache/pacman/pkg/ -name "${pack}"*)
|
||
|
for i in ${all_finded[@]}
|
||
|
do
|
||
|
if [[ $min_length == 0 ]]; then
|
||
|
min_length=${#i}
|
||
|
min_length_elem=0
|
||
|
name_of_elem="${i}"
|
||
|
else
|
||
|
if [[ ${#i} -lt ${min_length} ]]; then
|
||
|
min_length=${#i}
|
||
|
min_length_elem=${current_elem}
|
||
|
name_of_elem="${i}"
|
||
|
fi
|
||
|
fi
|
||
|
|
||
|
echo "${current_elem} ${pack}: ${i} ${#i}"
|
||
|
echo ""
|
||
|
|
||
|
current_elem=$(( ${current_elem} + 1 ))
|
||
|
done
|
||
|
|
||
|
echo "finded ${min_length_elem} ${name_of_elem}"
|
||
|
cp -vf "${name_of_elem}" "$CWD/$dir/airootfs/usr/share/packages/"
|
||
|
echo ""
|
||
|
done
|
||
|
|
||
|
|
||
|
rm "$CWD/$dir/airootfs/usr/share/packages/"*.sig
|
||
|
|
||
|
paccache -rvk 1 --cachedir "$CWD/$dir/airootfs/opt/extra-drivers"
|
||
|
paccache -rvk 1 --cachedir "$CWD/$dir/airootfs/usr/share/packages"
|
||
|
|
||
|
chown -R $user:$group "$CWD/$dir/airootfs/opt/extra-drivers/"
|
||
|
chown -R $user:$group "$CWD/$dir/airootfs/usr/share/packages/"
|
||
|
chown -R $user:$group "$CWD/boot/iso"
|
||
|
|
||
|
cd "$CWD"
|
||
|
echo "PWD: $CWD"
|
||
|
|
||
|
ELAPSED="Elapsed: $(($SECONDS / 3600))hrs $((($SECONDS / 60) % 60))min $(($SECONDS % 60))sec"
|
||
|
echo -e "\n$ELAPSED\n"
|
||
|
}
|
||
|
|
||
|
|
||
|
function build() {
|
||
|
SECONDS=0
|
||
|
|
||
|
echo "BUILD"
|
||
|
|
||
|
check_internet
|
||
|
|
||
|
if [ -n "$dir" ]; then
|
||
|
cd "$CWD/$dir"
|
||
|
echo "PWD: $(pwd)"
|
||
|
else
|
||
|
exit
|
||
|
fi
|
||
|
|
||
|
rm -rfv "$CWD/work_${edition}"
|
||
|
|
||
|
mkdir -pv "$CWD/boot/"{fd,iso,qcow2,shell_scripts,txt} 2>/dev/null
|
||
|
chown -R $user:$group "$CWD/boot/"
|
||
|
|
||
|
mkdir -pv "$CWD/sf" 2>/dev/null
|
||
|
chown -R $user:$group "$CWD/sf"
|
||
|
|
||
|
mkdir -pv "$CWD/work_${edition}" 2>/dev/null
|
||
|
|
||
|
mkdir -pv "$CWD/sf/${iso_dir}" 2>/dev/null
|
||
|
chown -R $user:$group "$CWD/sf/${iso_dir}"
|
||
|
|
||
|
cp -vf "/etc/pacman.d/mirrorlist" "$CWD/$dir/airootfs/etc/pacman.d/"
|
||
|
|
||
|
# if [ "$dir" == "Melawy-Linux-Full-manjaro" ]; then
|
||
|
# echo 'Server = https://mirror.easyname.at/manjaro/stable/$repo/$arch' > "./airootfs/etc/pacman.d/"
|
||
|
# echo 'Server = https://ftp.gwdg.de/pub/linux/manjaro/stable/$repo/$arch' >> "./airootfs/etc/pacman.d/"
|
||
|
# echo 'Server = https://ftp.cc.uoc.gr/mirrors/linux/manjaro/stable/$repo/$arch' >> "./airootfs/etc/pacman.d/"
|
||
|
# echo 'Server = https://ftp.psnc.pl/linux/manjaro/stable/$repo/$arch' >> "./airootfs/etc/pacman.d/"
|
||
|
# echo 'Server = https://ftpmirror1.infania.net/mirror/manjaro/stable/$repo/$arch' >> "./airootfs/etc/pacman.d/"
|
||
|
# echo 'Server = https://ftp.linux.org.tr/manjaro/stable/$repo/$arch' >> "./airootfs/etc/pacman.d/"
|
||
|
# fi
|
||
|
|
||
|
if [ -f "$CWD/sf/${iso_dir}/${iso_name}.iso" ]; then
|
||
|
rm "$CWD/sf/${iso_dir}/${iso_name}.iso"
|
||
|
fi
|
||
|
|
||
|
pacman -Sw --config pacman_sys.conf --noconfirm $(grep -v '^#' ./packages.x86_64 | grep -v '^$')
|
||
|
if [ "$?" -ne 0 ]; then
|
||
|
pacman -Sw --config pacman_sys.conf --noconfirm $(grep -v '^#' ./packages.x86_64 | grep -v '^$')
|
||
|
fi
|
||
|
|
||
|
mkarchiso -v "."
|
||
|
|
||
|
cd "$CWD"
|
||
|
echo "PWD: $CWD"
|
||
|
|
||
|
ELAPSED="Elapsed: $(($SECONDS / 3600))hrs $((($SECONDS / 60) % 60))min $(($SECONDS % 60))sec"
|
||
|
echo -e "\n$ELAPSED\n"
|
||
|
}
|
||
|
|
||
|
function sign() {
|
||
|
SECONDS=0
|
||
|
|
||
|
cd "$CWD"
|
||
|
echo "PWD: $CWD"
|
||
|
|
||
|
if [ -n "$dir" ]; then
|
||
|
chown -R $user:$group "$CWD/sf/"
|
||
|
cd "$CWD/sf/${iso_dir}"
|
||
|
echo "PWD: $(pwd)"
|
||
|
else
|
||
|
exit
|
||
|
fi
|
||
|
|
||
|
if [ -f "$CWD/sf/${iso_dir}/${std_iso_name_manjaro}.iso" ] || [ -f "$CWD/sf/${iso_dir}/${iso_name}.iso" ]; then
|
||
|
std_iso_name=${std_iso_name_manjaro}
|
||
|
fi
|
||
|
|
||
|
if [ -f "$CWD/sf/${iso_dir}/${std_iso_name}.iso" ] || [ -f "$CWD/sf/${iso_dir}/${iso_name}.iso" ]; then
|
||
|
echo "SIGN, SUM, SPLIT, TORRENT"
|
||
|
|
||
|
cp -vf "$CWD/verify.sh" "."
|
||
|
|
||
|
# if [ -f "$CWD/sf/${iso_dir}/${iso_name}-pkglist.txt" ]; then
|
||
|
# rm "$CWD/sf/${iso_dir}/${iso_name}-pkglist.txt";
|
||
|
# fi
|
||
|
|
||
|
if [ -f "$CWD/work_${edition}/iso/arch/pkglist.x86_64.txt" ]; then
|
||
|
cp -vf "$CWD/work_${edition}/iso/arch/pkglist.x86_64.txt" "$CWD/sf/${iso_dir}/${iso_name}-pkglist.txt"
|
||
|
fi
|
||
|
|
||
|
if [ -f "$CWD/sf/${iso_dir}/${std_iso_name}.iso" ]; then
|
||
|
mv "$CWD/sf/${iso_dir}/${std_iso_name}.iso" "$CWD/sf/${iso_dir}/${iso_name}.iso";
|
||
|
fi
|
||
|
|
||
|
if [ -f "$CWD/sf/${iso_dir}/${iso_name}.iso.sig" ]; then
|
||
|
rm "$CWD/sf/${iso_dir}/${iso_name}.iso.sig";
|
||
|
fi
|
||
|
echo "Sign $CWD/sf/${iso_dir}/${iso_name}.iso.sig $CWD/sf/${iso_dir}/${iso_name}.iso"
|
||
|
|
||
|
su $(who | grep "tty" | cut -d" " -f1) -c "gpg --detach-sign --local-user BC8B600E8DDA1F4CB77B10D2BA803A261A5EE6B8 --output '$CWD/sf/${iso_dir}/${iso_name}.iso.sig' '${iso_name}.iso'"
|
||
|
|
||
|
if [ -f "$CWD/sf/${iso_dir}/${iso_name}.iso.md5" ]; then
|
||
|
rm "$CWD/sf/${iso_dir}/${iso_name}.iso.md5";
|
||
|
fi
|
||
|
echo "md5sum $CWD/sf/${iso_dir}/${iso_name}.iso"
|
||
|
md5sum "${iso_name}.iso" > "$CWD/sf/${iso_dir}/${iso_name}.iso.md5"
|
||
|
|
||
|
if [ -f "$CWD/sf/${iso_dir}/${iso_name}.iso.sha1" ]; then
|
||
|
rm "$CWD/sf/${iso_dir}/${iso_name}.iso.sha1";
|
||
|
fi
|
||
|
echo "sha1sum $CWD/sf/${iso_dir}/${iso_name}.iso"
|
||
|
sha1sum "${iso_name}.iso" > "$CWD/sf/${iso_dir}/${iso_name}.iso.sha1"
|
||
|
|
||
|
if [ -f "$CWD/sf/${iso_dir}/${iso_name}.iso.sha256" ]; then
|
||
|
rm "$CWD/sf/${iso_dir}/${iso_name}.iso.sha256";
|
||
|
fi
|
||
|
echo "sha256sum $CWD/sf/${iso_dir}/${iso_name}.iso"
|
||
|
sha256sum "${iso_name}.iso" > "$CWD/sf/${iso_dir}/${iso_name}.iso.sha256"
|
||
|
|
||
|
cd ".."
|
||
|
|
||
|
if [ -f "$CWD/sf/${iso_dir}/${iso_name}.torrent" ]; then
|
||
|
rm "$CWD/sf/${iso_dir}/${iso_name}.torrent"
|
||
|
fi
|
||
|
|
||
|
if [ -f "$CWD/sf/${iso_dir}/${iso_name}.iso.torrent" ]; then
|
||
|
rm "$CWD/sf/${iso_dir}/${iso_name}.iso.torrent"
|
||
|
fi
|
||
|
|
||
|
mkdir "$CWD/sf/${iso_dir}/part"
|
||
|
rm "$CWD/sf/${iso_dir}/part/${iso_name}.iso.part."*
|
||
|
split -d --bytes=1024M "$CWD/sf/${iso_dir}/${iso_name}.iso" "$CWD/sf/${iso_dir}/part/${iso_name}.iso.part."
|
||
|
cp -vf "$CWD/merge_parted_iso.sh" "$CWD/sf/${iso_dir}/part/"
|
||
|
|
||
|
baselink="https://downloads.sourceforge.net/project/melawy-linux/${iso_dir}"
|
||
|
links=""
|
||
|
|
||
|
for i in $(ls -1 ${iso_dir})
|
||
|
do
|
||
|
links+=$(echo "$baselink/$i," | grep -v "torrent" | tr -d '[:blank:]' | tr -d '[:space:]' | tr -d '[:cntrl:]' | sed 's/[/]$//' | awk '{$1=$1;print}')
|
||
|
done
|
||
|
|
||
|
links=$(echo $links | sed 's/[,]$//' | tr -d '[:blank:]' | tr -d '[:space:]' | tr -d '[:cntrl:]' | sed 's/[/]$//' | awk '{$1=$1;print}')
|
||
|
|
||
|
# mktorrent --verbose --comment="https://melawy.ru" --announce="udp://fosstorrents.com:6969/announce,udp://tracker.opentrackr.org:1337/announce,udp://opentracker.i2p.rocks:6969/announce,udp://open.demonii.com:1337/announce,udp://tracker.openbittorrent.com:6969/announce,http://tracker.openbittorrent.com:80/announce,udp://open.stealth.si:80/announce,udp://tracker.torrent.eu.org:451/announce,udp://exodus.desync.com:6969/announce,udp://tracker1.bt.moack.co.kr:80/announce,udp://tracker.moeking.me:6969/announce,udp://explodie.org:6969/announce,https://tracker.tamersunion.org:443/announce,udp://uploads.gamecoast.net:6969/announce,udp://tracker.tiny-vps.com:6969/announce,udp://tracker.bittor.pw:1337/announce,udp://retracker01-msk-virt.corbina.net:80/announce,udp://movies.zsw.ca:6969/announce,udp://isk.richardsw.club:6969/announce,https://tracker.renfei.net:443/announce,https://tr.burnabyhighstar.com:443/announce,http://fosstorrents.com:6969/announce" --web-seed="${links}" --output="${iso_dir}/${iso_name}.torrent" "${iso_dir}"
|
||
|
|
||
|
# transmission-create --anonymize --comment="https://melawy.ru" --tracker="udp://fosstorrents.com:6969/announce,udp://tracker.opentrackr.org:1337/announce,udp://opentracker.i2p.rocks:6969/announce,udp://open.demonii.com:1337/announce,udp://tracker.openbittorrent.com:6969/announce,http://tracker.openbittorrent.com:80/announce,udp://open.stealth.si:80/announce,udp://tracker.torrent.eu.org:451/announce,udp://exodus.desync.com:6969/announce,udp://tracker1.bt.moack.co.kr:80/announce,udp://tracker.moeking.me:6969/announce,udp://explodie.org:6969/announce,https://tracker.tamersunion.org:443/announce,udp://uploads.gamecoast.net:6969/announce,udp://tracker.tiny-vps.com:6969/announce,udp://tracker.bittor.pw:1337/announce,udp://retracker01-msk-virt.corbina.net:80/announce,udp://movies.zsw.ca:6969/announce,udp://isk.richardsw.club:6969/announce,https://tracker.renfei.net:443/announce,https://tr.burnabyhighstar.com:443/announce,http://fosstorrents.com:6969/announce" --webseed="${links}" --outfile="${iso_dir}/${iso_name}.torrent" "${iso_dir}"
|
||
|
|
||
|
# buildtorrent --nodate --nocreator --md5sum --show --comment="https://melawy.ru" --announce="udp://fosstorrents.com:6969/announce" --announcelist="udp://fosstorrents.com:6969/announce,udp://tracker.opentrackr.org:1337/announce,udp://opentracker.i2p.rocks:6969/announce,udp://open.demonii.com:1337/announce,udp://tracker.openbittorrent.com:6969/announce,http://tracker.openbittorrent.com:80/announce,udp://open.stealth.si:80/announce,udp://tracker.torrent.eu.org:451/announce,udp://exodus.desync.com:6969/announce,udp://tracker1.bt.moack.co.kr:80/announce,udp://tracker.moeking.me:6969/announce,udp://explodie.org:6969/announce,https://tracker.tamersunion.org:443/announce,udp://uploads.gamecoast.net:6969/announce,udp://tracker.tiny-vps.com:6969/announce,udp://tracker.bittor.pw:1337/announce,udp://retracker01-msk-virt.corbina.net:80/announce,udp://movies.zsw.ca:6969/announce,udp://isk.richardsw.club:6969/announce,https://tracker.renfei.net:443/announce,https://tr.burnabyhighstar.com:443/announce,http://fosstorrents.com:6969/announce" --webseeds="${links}" "${iso_dir}" "${iso_dir}/${iso_name}.torrent"
|
||
|
|
||
|
buildtorrent --nodate --nocreator --md5sum --show --comment="https://melawy.ru" --announce="udp://fosstorrents.com:6969/announce" --announcelist="udp://fosstorrents.com:6969/announce,udp://tracker.opentrackr.org:1337/announce,udp://opentracker.i2p.rocks:6969/announce,udp://open.demonii.com:1337/announce,udp://tracker.openbittorrent.com:6969/announce,http://tracker.openbittorrent.com:80/announce,udp://open.stealth.si:80/announce,udp://tracker.torrent.eu.org:451/announce,udp://exodus.desync.com:6969/announce,udp://tracker1.bt.moack.co.kr:80/announce,udp://tracker.moeking.me:6969/announce,udp://explodie.org:6969/announce,https://tracker.tamersunion.org:443/announce,udp://uploads.gamecoast.net:6969/announce,udp://tracker.tiny-vps.com:6969/announce,udp://tracker.bittor.pw:1337/announce,udp://retracker01-msk-virt.corbina.net:80/announce,udp://movies.zsw.ca:6969/announce,udp://isk.richardsw.club:6969/announce,https://tracker.renfei.net:443/announce,https://tr.burnabyhighstar.com:443/announce,http://fosstorrents.com:6969/announce" "${iso_dir}" "${iso_dir}/${iso_name}.torrent"
|
||
|
|
||
|
buildtorrent --nodate --nocreator --md5sum --show --comment="https://melawy.ru" --announce="udp://fosstorrents.com:6969/announce" --announcelist="udp://fosstorrents.com:6969/announce,udp://tracker.opentrackr.org:1337/announce,udp://opentracker.i2p.rocks:6969/announce,udp://open.demonii.com:1337/announce,udp://tracker.openbittorrent.com:6969/announce,http://tracker.openbittorrent.com:80/announce,udp://open.stealth.si:80/announce,udp://tracker.torrent.eu.org:451/announce,udp://exodus.desync.com:6969/announce,udp://tracker1.bt.moack.co.kr:80/announce,udp://tracker.moeking.me:6969/announce,udp://explodie.org:6969/announce,https://tracker.tamersunion.org:443/announce,udp://uploads.gamecoast.net:6969/announce,udp://tracker.tiny-vps.com:6969/announce,udp://tracker.bittor.pw:1337/announce,udp://retracker01-msk-virt.corbina.net:80/announce,udp://movies.zsw.ca:6969/announce,udp://isk.richardsw.club:6969/announce,https://tracker.renfei.net:443/announce,https://tr.burnabyhighstar.com:443/announce,http://fosstorrents.com:6969/announce" "${iso_dir}/${iso_name}.iso" "${iso_dir}/${iso_name}.iso.torrent"
|
||
|
|
||
|
chown -R $user:$group "$CWD/sf"
|
||
|
fi
|
||
|
|
||
|
cd "$CWD"
|
||
|
echo "PWD: $CWD"
|
||
|
|
||
|
ELAPSED="Elapsed: $(($SECONDS / 3600))hrs $((($SECONDS / 60) % 60))min $(($SECONDS % 60))sec"
|
||
|
echo -e "\n$ELAPSED\n"
|
||
|
}
|
||
|
|
||
|
function std_build() {
|
||
|
MAIN_SECONDS=0
|
||
|
clean
|
||
|
sleep $DELAY
|
||
|
|
||
|
prepare
|
||
|
sleep $DELAY
|
||
|
|
||
|
build
|
||
|
sleep $DELAY
|
||
|
|
||
|
sign
|
||
|
sleep $DELAY
|
||
|
|
||
|
_notify
|
||
|
sleep $DELAY
|
||
|
|
||
|
MAIN_ELAPSED="Elapsed: $(($MAIN_SECONDS / 3600))hrs $((($MAIN_SECONDS / 60) % 60))min $(($MAIN_SECONDS % 60))sec"
|
||
|
echo -e "\n$MAIN_ELAPSED\n"
|
||
|
|
||
|
exit
|
||
|
}
|
||
|
|
||
|
function get_users() { /usr/bin/users | sed 's| |\n|g' | sort | uniq ; }
|
||
|
|
||
|
_notify() {
|
||
|
local msg="Finished"
|
||
|
local title="Make"
|
||
|
|
||
|
# at TTY
|
||
|
echo "==> INFO: $msg" >&2
|
||
|
|
||
|
if command -v notify-send &> /dev/null
|
||
|
then
|
||
|
# notification
|
||
|
local user userid cmd
|
||
|
|
||
|
for user in $(get_users) ; do
|
||
|
userid=$(/usr/bin/id -u $user)
|
||
|
cmd=(
|
||
|
DISPLAY=:0
|
||
|
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$userid/bus
|
||
|
/usr/bin/notify-send
|
||
|
--expire-time=10000
|
||
|
--icon=info
|
||
|
--urgency=normal
|
||
|
"'$title'"
|
||
|
"'$msg'"
|
||
|
)
|
||
|
/usr/bin/su $user -c "${cmd[*]}"
|
||
|
done
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
|
||
|
while true; do
|
||
|
|
||
|
cd "$CWD"
|
||
|
echo "PWD: $CWD"
|
||
|
|
||
|
# clear
|
||
|
cat << _EOF_
|
||
|
Please Select:
|
||
|
|
||
|
1 - Melawy-Linux-Base-System
|
||
|
2 - Melawy-Linux-Developer-Edition
|
||
|
3 - Melawy-Linux-Developer-Edition-Full
|
||
|
4 - Melawy-Linux-NetInstall
|
||
|
0 - Exit
|
||
|
|
||
|
_EOF_
|
||
|
|
||
|
read -p "Enter selection [0-3] > "
|
||
|
|
||
|
dir=""
|
||
|
|
||
|
if [[ $REPLY =~ ^[0-4]$ ]]; then
|
||
|
case $REPLY in
|
||
|
1)
|
||
|
dir="Melawy-Linux-Base-System"
|
||
|
sleep $DELAY
|
||
|
# continue
|
||
|
;;
|
||
|
2)
|
||
|
dir="Melawy-Linux-Developer-Edition"
|
||
|
sleep $DELAY
|
||
|
# continue
|
||
|
;;
|
||
|
3)
|
||
|
dir="Melawy-Linux-Developer-Edition-Full"
|
||
|
sleep $DELAY
|
||
|
# continue
|
||
|
;;
|
||
|
4)
|
||
|
dir="Melawy-Linux-NetInstall"
|
||
|
sleep $DELAY
|
||
|
# continue
|
||
|
;;
|
||
|
0)
|
||
|
break
|
||
|
;;
|
||
|
esac
|
||
|
else
|
||
|
echo "Invalid entry."
|
||
|
sleep $DELAY
|
||
|
continue
|
||
|
fi
|
||
|
|
||
|
# clear
|
||
|
cat << _EOF_
|
||
|
Please Select:
|
||
|
|
||
|
1 - Clean
|
||
|
2 - Mirrorlist
|
||
|
3 - Prepare
|
||
|
4 - Build
|
||
|
5 - Sign
|
||
|
6 - Std build chain
|
||
|
0 - Exit
|
||
|
|
||
|
_EOF_
|
||
|
|
||
|
read -p "Enter selection [0-6] > "
|
||
|
|
||
|
edition="$(basename $(pwd)/${dir})"
|
||
|
date_tag=$(date +%Y.%m.%d)
|
||
|
std_iso_name="Melawy-Linux-${date_tag}-x86_64"
|
||
|
std_iso_name_manjaro="Melawy-Linux-manjaro-${date_tag}-x86_64"
|
||
|
iso_name="${edition}-${date_tag}-x86_64"
|
||
|
iso_dir="${edition}-${date_tag}"
|
||
|
|
||
|
if [[ $REPLY =~ ^[0-6]$ ]]; then
|
||
|
case $REPLY in
|
||
|
1)
|
||
|
clean
|
||
|
sleep $DELAY
|
||
|
continue
|
||
|
;;
|
||
|
2)
|
||
|
mirrorlist
|
||
|
sleep $DELAY
|
||
|
continue
|
||
|
;;
|
||
|
3)
|
||
|
prepare
|
||
|
sleep $DELAY
|
||
|
continue
|
||
|
;;
|
||
|
4)
|
||
|
build
|
||
|
sleep $DELAY
|
||
|
continue
|
||
|
;;
|
||
|
5)
|
||
|
sign
|
||
|
sleep $DELAY
|
||
|
continue
|
||
|
;;
|
||
|
6)
|
||
|
std_build
|
||
|
sleep $DELAY
|
||
|
continue
|
||
|
;;
|
||
|
0)
|
||
|
break
|
||
|
;;
|
||
|
esac
|
||
|
else
|
||
|
echo "Invalid entry."
|
||
|
sleep $DELAY
|
||
|
continue
|
||
|
fi
|
||
|
done
|
||
|
|
||
|
# notify-send -a "$(basename $(pwd)): Make" -t 10000 "finished" "$(date '+%Y.%m.%d %H:%M:%S')"
|
||
|
|
||
|
_notify
|
||
|
|
||
|
echo "Ready"
|
||
|
#
|
||
|
# if [ "$status" == 0 ]; then
|
||
|
# sleep 5
|
||
|
# kill $(ps x | grep konsole | grep $0 | awk '{print $1}')
|
||
|
# fi
|