#!/bin/bash
# ===================================================================#
# Copyright (c) 2022 Guilherme Esmeraldo - License GPLv3+:           #
# GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.    #
# This is free software: you are free to change and redistribute it. # 
# There is NO WARRANTY, to the extent permitted by law.              #
#                                                                    #
# Version: 0.2                                                       #
#====================================================================#

PIS_DIR="/var/log/PIS"

wget https://software.jaos.org/slackpacks/slackware64-15.0/slapt-get/slapt-get-0.11.7-x86_64-1.txz -P /tmp
installpkg /tmp/slapt-get-0.11.7-x86_64-1.txz

if [ ! -f /lib64/libcrypto.so.1.1 ]
then

	dialog --stdout \
--backtitle "Slackware Post-Install Scripts v0.2" \
--title "Slapt-get - Install" \
--yesno "You have to install OpenSSL package. Would you like continue?" \
0 0
	OPTION=$?
	[ $OPTION -ne 0 ] && exit 0
	
	slackpkg install openssl
fi

[ ! -f /lib64/libcrypto.so.3 ] && ln -s /lib64/libcrypto.so.1.1 /lib64/libcrypto.so.3

[ ! -f /lib64/libcrypto.so.1 ] && ln -s /lib64/libcrypto.so.1.1 /lib64/libcrypto.so.1

sed -i "s/14\.2/15\.0/" /etc/slapt-get/slapt-getrc		

slapt-get --update	

echo "YES" > "$PIS_DIR/slapt_get_install"

dialog --backtitle "Slackware Post-Install Scripts v0.2" --msgbox "Slapt-get is ready for packages management!" 5 55

