ibnstallededd

This commit is contained in:
2025-11-01 19:16:03 -06:00
parent 26aed9a9ff
commit 56dfa5549c
+50 -34
View File
@@ -13,14 +13,14 @@ tmp_customscripts_dir="$tmpDir/customscripts"
finalDir='/usr/share/customscripts' finalDir='/usr/share/customscripts'
packages="apache2 nginx build-essential cowsay iotop iptraf-ng gh btop screen byobu thefuck wget lynx zip unzip 7zip xz-utils gzip net-tools clamav php restic cifs-utils detox fdupes ripgrep avahi-daemon libnss-mdns xxd xrdp libimage-exiftool-perl kali-tools-hardware kali-tools-crypto-stego kali-tools-fuzzing kali-tools-bluetooth kali-tools-rfid kali-tools-sdr kali-tools-voip kali-tools-802-11 kali-tools-forensics samba procps snapd dotnet-sdk-9.0" packages="apache2 nginx build-essential cowsay iotop iptraf-ng gh btop screen byobu thefuck wget lynx zip unzip 7zip xz-utils gzip net-tools clamav php restic cifs-utils detox fdupes ripgrep avahi-daemon libnss-mdns xxd xrdp libimage-exiftool-perl kali-tools-hardware kali-tools-crypto-stego kali-tools-fuzzing kali-tools-bluetooth kali-tools-rfid kali-tools-sdr kali-tools-voip kali-tools-802-11 kali-tools-forensics samba procps snapd dotnet-sdk-9.0"
echo "Using Shell $SHELL" echo -e "\nSTARTING!\n\tUsing Shell $SHELL\n"
# ta get da right usermayhaps # ta get da right usermayhaps
if [[ -z $SUDO_USER ]]; then if [[ -z $SUDO_USER ]]; then
echo "Using User $USER" echo -e "\nUsing User $USER\n"
username="$USER" username="$USER"
else else
echo "Using User $SUDO_USER" echo -n "\nUsing User $SUDO_USER\n"
username="$SUDO_USER" username="$SUDO_USER"
fi fi
@@ -37,133 +37,145 @@ else
exit 1 exit 1
fi fi
echo -e "\nusing rcfile $rcfile\n"
if [ ! -z "$1" ]; then if [ ! -z "$1" ]; then
echo -e "\nFULL MODE SELECTED FULL UPGRADE AND INSTALL PACKAGES!\n"
# update and upgrade # update and upgrade
echo "Updating software lists" echo -e "\nUpdating software lists\n"
sudo apt update sudo apt update
echo "Doin full-upgrade" echo -e "\nDoin full-upgrade\n"
sudo apt full-upgrade -y sudo apt full-upgrade -y
# dotnet # dotnet
if [ ! $(which dotnet) ]; then if [ ! $(which dotnet) ]; then
echo -e "\ndotnet not found, installing\n"
## install da repo ## install da repo
echo -e "\ninstallan dotnet repo\n"
wget https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb -O /tmp/packages-microsoft-prod.deb wget https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb -O /tmp/packages-microsoft-prod.deb
sudo dpkg -i /tmp/packages-microsoft-prod.deb sudo dpkg -i /tmp/packages-microsoft-prod.deb
rm -f /tmp/packages-microsoft-prod.deb rm -f /tmp/packages-microsoft-prod.deb
## re-update ## re-update
echo -e "\nUpdating software lists\n"
sudo apt update sudo apt update
else else
echo "dotnet installed, skipping install of repo" echo -e "\ndotnet installed, skipping install of repo\n"
fi fi
# install packages # install packages
echo "Installan my packages" echo -e "\nInstallan my packages\n"
sudo bash -c "apt install $packages -y"
## dotnet ## dotnet
### haveibeenpwned-downloader ### haveibeenpwned-downloader
if [ ! $(which haveibeenpwned-downloader) ]; then if [ ! $(which haveibeenpwned-downloader) ]; then
echo -e "\nhaveibeenpwned-downloader not found, installing with dotnet\n"
sudo dotnet tool install --global haveibeenpwned-downloader sudo dotnet tool install --global haveibeenpwned-downloader
sudo bash -c "apt install $packages -y"
else else
echo "haveibeenpwned-downloader installed, skipping install" echo -e "\nhaveibeenpwned-downloader installed, skipping install\n"
fi fi
# homebrew # homebrew
if [ ! $(which brew) ]; then if [ ! $(which brew) ]; then
## install homebrew ## install homebrew
echo -e "\nlinuxbrew not found, installing\n"
test -d ~/.linuxbrew && eval "$(~/.linuxbrew/bin/brew shellenv)" test -d ~/.linuxbrew && eval "$(~/.linuxbrew/bin/brew shellenv)"
test -d /home/linuxbrew/.linuxbrew && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" test -d /home/linuxbrew/.linuxbrew && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
### add to rcfile ### add to rcfile
echo "# linuxbrew (homebrew/brew)" >> $rcfile echo "# linuxbrew (homebrew/brew)" >> $rcfile
echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >> $rcfile echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >> $rcfile
else else
echo "linuxbrew installed, skipping install" echo -e "\nlinuxbrew installed, skipping install\n"
fi fi
### install ponysay ### install ponysay
if [ ! $(which ponysay) ]; then if [ ! $(which ponysay) ]; then
echo -e "\nponysay not fonud, installiing\n"
brew install ponysay brew install ponysay
echo -e "# ponysay fix\nexport PYTHONWARNINGS=ignore::SyntaxWarning" >> $rcfile echo -e "# ponysay fix\nexport PYTHONWARNINGS=ignore::SyntaxWarning" >> $rcfile
else else
echo "ponysay already installed, skipping" echo -e "\nponysay already installed, skipping\n"
fi fi
# cleanup # cleanup
echo "cleanan upps" echo -e "\ncleanan upps\n"
sudo apt autoremove -y sudo apt autoremove -y
else else
echo "skipping package install" echo -e "\nskipping package install\n"
fi fi
# get the existing tag and webhooks if any # get the existing tag and webhooks if any
if [ -f $finalDir/tag.txt ]; then if [ -f $finalDir/tag.txt ]; then
echo "Found existing tag.txt, backing up" echo -e "\nFound existing tag.txt, backing up\n"
cp $finalDir/tag.txt /tmp/tag.txt cp $finalDir/tag.txt /tmp/tag.txt
else else
echo "no existing tag.txt, skipping backup of it" echo -e "\nno existing tag.txt, skipping backup of it\n"
fi fi
# backup webhook if present # backup webhook if present
if [ -f $finalDir/webhook.txt ]; then if [ -f $finalDir/webhook.txt ]; then
echo "Found existing webhook.txt, backing up" echo -e "\nFound existing webhook.txt, backing up\n"
cp $finalDir/webhook.txt /tmp/webhook.txt cp $finalDir/webhook.txt /tmp/webhook.txt
else else
echo "no existing webhook.txt, skipping backup of it" echo -e "\nno existing webhook.txt, skipping backup of it\n"
fi fi
# clean up any exisiting repo dir # clean up any exisiting repo dir
if [[ -d "$tmpDir" ]]; then if [[ -d "$tmpDir" ]]; then
echo "Cleaning Up Existing $tmpDir" echo "\nCleaning Up Existing $tmpDir\n"
rm -rf "$tmpDir" rm -rf "$tmpDir"
else else
echo "$tmpDir not found, skipping deleting it" echo -e "\n$tmpDir not found, skipping deleting it\n"
fi fi
# clean up any existing install # clean up any existing install
if [[ -d "$finalDir" ]]; then if [[ -d "$finalDir" ]]; then
echo "Cleaning Up Existing $finalDir" echo -e "\nCleaning Up Existing $finalDir\n"
sudo rm -rf "$finalDir" sudo rm -rf "$finalDir"
else else
echo "$finalDir not found, will create" echo -e "\n$finalDir not found, will create\n"
fi fi
# ddownload repo # ddownload repo
echo "Cloning Repo $gitRepo" echo -e "\nCloning Repo $gitRepo\n"
git clone $gitRepo $tmpDir --single-branch --depth 1 git clone $gitRepo $tmpDir --single-branch --depth 1
echo "Compiling donut" # donut
echo -e "\nCompiling donut\n"
gcc -o "$tmp_customscripts_dir/donut" "$tmp_customscripts_dir/donut.c" -lm gcc -o "$tmp_customscripts_dir/donut" "$tmp_customscripts_dir/donut.c" -lm
# put the customscripts dir into place # put the customscripts dir into place
echo "Placing in $finalDir" echo -e "\nPlacing in $finalDir\n"
sudo mv "$tmp_customscripts_dir" "$finalDir" sudo mv "$tmp_customscripts_dir" "$finalDir"
# fix ownership # fix ownership
echo "Changing ownership of $finalDir and $userhome/Rice to $username:$username recursively" echo -e "\nChanging ownership of $finalDir and $userhome/Rice to $username:$username recursively\n"
sudo chown -R $username:$username "$finalDir" sudo chown -R $username:$username "$finalDir"
sudo chown -R $username:$username $userhome/Rice sudo chown -R $username:$username $userhome/Rice
# fix perms # fix perms
echo "Setting perms of $finalDir and contents to 775" echo -e "\nSetting perms of $finalDir and contents to 775\n"
sudo chmod -R 775 "$finalDir" sudo chmod -R 775 "$finalDir"
# check if $finalDir is in $rcfile # check if $finalDir is in $rcfile
grep -q $finalDir $rcfile grep -q $finalDir $rcfile
pathgrep=$? pathgrep=$?
if [ $pathgrep -eq 0 ]; then if [ $pathgrep -eq 0 ]; then
echo "$finalDir Already in \$PATH Skipping" echo -e "\n$finalDir Already in \$PATH Skipping Append\n"
else else
echo "Adding $finalDir to $username's \$PATH by Appending to $rcfile" echo -e "\nAdding $finalDir to $username's \$PATH by Appending to $rcfile\n"
echo -e "\n\n# automatically added by customscripts installer\nexport PATH=\"\$PATH:$finalDir\"" >> "$rcfile" echo -e "\n\n# automatically added by customscripts installer\nexport PATH=\"\$PATH:$finalDir\"" >> "$rcfile"
fi fi
# install pishrink if not there # install pishrink if not there
if [ ! -f /usr/local/bin/pishrink ]; then if [ ! -f /usr/local/bin/pishrink ]; then
echo -e "\npishrink not found, installing\n"
wget https://raw.githubusercontent.com/Drewsif/PiShrink/master/pishrink.sh wget https://raw.githubusercontent.com/Drewsif/PiShrink/master/pishrink.sh
mv pishrink.sh pishrink mv pishrink.sh pishrink
chmod +x pishrink chmod +x pishrink
sudo mv pishrink /usr/local/bin sudo mv pishrink /usr/local/bin
else else
echo "Pishrink already installed, skipping" echo -e "\nPishrink already installed, skipping\n"
fi fi
# install ble.sh if not there # install ble.sh if not there
if [ ! -d $userhome/.local/share/blesh ]; then if [ ! -d $userhome/.local/share/blesh ]; then
# install ble.sh # install ble.sh
echo -e "\nble.sh not found, installing\n"
git clone --recursive --depth 1 --shallow-submodules https://github.com/akinomyoga/ble.sh.git git clone --recursive --depth 1 --shallow-submodules https://github.com/akinomyoga/ble.sh.git
make -C ble.sh install PREFIX=$userhome/.local make -C ble.sh install PREFIX=$userhome/.local
echo '# ble.sh' >> $rcfile echo '# ble.sh' >> $rcfile
@@ -171,26 +183,29 @@ if [ ! -d $userhome/.local/share/blesh ]; then
source $rcfile source $rcfile
exec "$SHELL" exec "$SHELL"
else else
echo "ble.sh already installed, skippping" echo -e "\nble.sh already installed, skippping\n"
fi fi
# appeend thefuck to rcfile if not present # appeend thefuck to rcfile if not present
grep -q thefuck $rcfile grep -q thefuck $rcfile
thefuck_present=$? thefuck_present=$?
if [ $thefuck_present -ne 0 ]; then if [ $thefuck_present -ne 0 ]; then
echo -e "\nthefuck alias not fonud in $rcfile, adding\n"
echo -e "# thefuck\neval \$(thefuck --alias fuck)" >> $rcfile echo -e "# thefuck\neval \$(thefuck --alias fuck)" >> $rcfile
else else
echo "thefuck is already in $rcfile, skipping" echo -e "\nthefuck is already in $rcfile, skipping\n"
fi fi
# copy rice if not present # copy rice if not present
if [ ! -d $userhome/Rice ]; then if [ ! -d $userhome/Rice ]; then
echo -e "\n$userhome/Rice not found, adding\n"
mv $tmpDir/Rice $userhome mv $tmpDir/Rice $userhome
else else
echo "Rice found not copying again" echo -e "\nRice found not copying again\n"
fi fi
# cleanup # cleanup
echo -e "\ncleaning up temp files\n"
## installer ## installer
sudo rm -f "$finalDir/install_script.sh" sudo rm -f "$finalDir/install_script.sh"
rm /tmp/install_script.sh rm /tmp/install_script.sh
@@ -200,9 +215,10 @@ sudo rm -rf "$tmpDir"
rm -f "$tmp_customscripts_dir/donut.c" rm -f "$tmp_customscripts_dir/donut.c"
if [ ! -z "$1" ]; then if [ ! -z "$1" ]; then
echo -e "cleaning up apt"
sudo apt autoremove -y sudo apt autoremove -y
echo "rebooting in 3 minutes" echo -e "\nrebooting in 3 minutes\n"
sudo shutdown -r +3 sudo shutdown -r +3
fi fi
echo "Done with first stage" echo -e "\nDone with first stage \n"