+++ /dev/null
-#!/bin/bash
-
-function help() {
-
- echo "immudex_crypt - script used for listing, open and close crypt_LUKS ppartitions";
- echo "morketsmerke.net COPYLEFT @ 2022";
- echo "Options:";
- echo " list - displaing list of opened and available crypt_LUKS devices";
- echo " open - opening crypt_LUKS device, after this device is ready to mount";
- echo " close - unmount and closing crypt_LUKS devices";
- echo "Using:";
- echo "$ immudex_crypt list";
- echo "$ immudex_crypt open <crypt_LUKS device>";
- echo "$ immudex_crypt close immudex_crypt[0-9] | ic[0-9] | [0-9]";
-}
-
-function list() {
-
- mapperDeviceList=$(ls /dev/mapper --hide=control | awk '{printf $1" "}');
-
- echo "==============================================================";
- echo -e "Opened devices:";
- echo "==============================================================";
- echo -e "Device:\t\tMapper name:\t\tMount point:";
-
- if [ "$mapperDeviceList" ]; then
- for dmDevice in $mapperDeviceList; do
- if sudo cryptsetup status /dev/mapper/${dmDevice} > /dev/null 2>&1; then
- mountPoint=$(df --output=source,target /dev/mapper/${dmDevice} | tail -n 1 | awk '{printf $2}');
- device=$(sudo cryptsetup status /dev/mapper/${dmDevice} | grep "device" | awk '{printf $2}');
- if [ "$mountPoint" ] && [ "$mountPoint" != "/dev" ]; then
- echo -e "$device\t /dev/mapper/${dmDevice}\t$mountPoint";
- else
- echo -e "$device\t /dev/mapper/${dmDevice}\tNot mounted";
- fi
- fi
- done
- else
- echo -e "No opened crypt devices was found";
- fi
- echo "==============================================================";
-
- luksDevicesList=$(sudo blkid | grep 'LUKS' | cut -d ":" -f 1 | awk '{printf $1" "}');
-
- echo "==============================================================";
- echo -e "crypt_LUKS devices:";
- echo "==============================================================";
- echo -e "Device:\t\tMapper name:\t\tMount point:";
-
- if [ "$luksDevicesList" ]; then
- for lDevice in $luksDevicesList; do
- echo -e "$lDevice";
- done
- else
- echo "No crypt device was found";
- fi
- echo "==============================================================";
-}
-
-function open() {
-
- if [ $# -lt 1 ]; then help; exit 1;
- else
- index=$(ls --hide=control /dev/mapper | grep "immudex_crypt" | grep -o "[0-9]*$"| tail -1);
- if [ "$index" ]; then
- index=$((index + 1));
- else
- index=0;
- fi
- sudo cryptsetup open $1 immudex_crypt${index};
- sudo mkdir -p /media/${USER}/immudex_crypt${index};
- dmDevice=$(ls -l /dev/mapper/immudex_crypt${index} | awk '{printf $10}' | cut -d "/" -f 2);
- if ! $(sudo file -s /dev/${dmDevice} | grep -q 'ext4'); then
- echo "Could not determine filesystem of unlocked device.";
- echo -n "Format this device to ext4? (y/n): "
- read format;
- if [ "$format" = "y" ]; then
- sudo mkfs.ext4 /dev/mapper/immudex_crypt${index};
- else
- echo "Refuse to mount.";
- sudo cryptsetup close immudex_crypt${index};
- exit 1;
- fi
- fi
- sudo mount /dev/mapper/immudex_crypt${index} /media/${USER}/immudex_crypt${index};
- if [ ! -e /ic${index} ]; then
- sudo ln -s /media/${USER}/immudex_crypt${index} /ic${index};
- fi
- fi
-
-}
-
-function close() {
-
- if [ $# -lt 1 ]; then help; exit 1;
- else
- if [ $1 -ge 0 ] 2> /dev/null; then
- cryptfsName="immudex_crypt${1}";
- elif echo $1 | grep -q 'ic'; then
- cryptfsName="immudex_crypt$(echo $1 | grep -o '[0-9]')";
- else
- cryptfsName=$1;
- fi
- if sudo cryptsetup status /dev/mapper/${cryptfsName} > /dev/null 2>&1; then
- mountPoint=$(df --output=source,target /dev/mapper/${cryptfsName} | tail -1 | awk '{printf $2}');
- if [ "$mountPoint" ] && [ "$mountPoint" != "/dev" ]; then
- sudo umount -R $mountPoint;
- sudo cryptsetup close ${cryptfsName};
- else
- sudo cryptsetup close ${cryptfsName};
- fi
- else
- echo "Given devices isn't opened crypt device or it was closed before";
- fi
- fi
-}
-
-if [ "$1" ]; then
-
- case $1 in
- "list") list;;
- "open") if [ "$2" ]; then open $2;
- else help; exit 1;
- fi;;
- "close") if [ "$2" ]; then close $2;
- else help; exit 1;
- fi;;
- *) help;;
- esac
-else
- help; exit 1;
-fi
+++ /dev/null
-#!/bin/bash
-
-function R() {
-
- if [ "$path" ]; then path=${path}/${1};
- else path=$1;
- fi
-
- fileList=$(ls $path);
- for file in $fileList; do
- if [ -d ${path}/${file} ]; then R ${file};
- else
- sed -i 's@https://morketsmerke.github.io/@/usr/share/doc/morketsmerke/index.html@' ${path}/${file};
- sed -i 's@https://morketsmerke.github.io@/usr/share/doc/morketsmerke/index.html@' ${path}/${file};
- sed -i 's@/style.css@/usr/share/doc/morketsmerke/style.css@' ${path}/${file};
- fi
- done
- path=$(echo $path | sed "s@/$1@@")
-
-}
-
-function install_morketsmerke() {
-
- if [ -d morketsmerke.github.io ]; then rm -rf morketsmerke.github.io; fi
- if [ ! -d morketsmerke.github.io ]; then
- git clone https://github.com/morketsmerke/morketsmerke.github.io;
- else
- exit 1;
- fi
-
- R morketsmerke.github.io
-
- if [ -d /usr/share/doc/morketsmerke ]; then
- sudo rm -rf /usr/share/doc/morketsmerke;
- fi
-
- sudo mv morketsmerke.github.io /usr/share/doc/morketsmerke
-
-}
-
-/usr/bin/ping -c 1 wp.pl >> /dev/null 2>&1;
-if [ $? -eq 0 ]; then install_morketsmerke; fi
-
-morketsmerke_path=/usr/share/doc/morketsmerke;
-
-if [ "$1" ] && [ "$1" = "--browser" ]; then
- xdg-open ${morketsmerke_path}/index.html;
-else
- w3m -M ${morketsmerke_path}/index.html;
-fi
+++ /dev/null
-#!/bin/bash
-
-launcher="/home/${USER}/.config/xfce4/panel/launcher-24/16713025402.desktop";
-
-function main_unlock() {
- /usr/local/bin/immudex_crypt open $1;
- index=$(basename $(/usr/local/bin/immudex_crypt list | grep "$1" | head -1 | awk '{printf $2}' | grep -o '[0-9]'));
- #sudo mkdir -p /media/${USER}/$devName;
- #sudo mount /dev/mapper/$devName /media/${USER}/$devName;
-
- xfce4-terminal --default-working-directory=/ic${index};
- sed -i 's/--unlock/--lock/' ${launcher};
- sed -i 's/padlock.png/unlocked.png/' ${launcher};
-}
-
-function unlock() {
-
- cryptParts=$(sudo blkid | grep 'LUKS' | sed 's/://g' | awk '{printf $1" "}');
- if [ "$cryptParts" ]; then
- if [ $(echo $cryptParts | wc -w) -gt 1 ]; then
- select cryptPart in $cryptParts; do
- main_unlock $cryptPart;
- break;
- done
- else
- main_unlock $cryptParts;
- fi
- else
- echo -e "\e[31mThere is no LUKS partition to open.\e[0m";
- sleep 3;
- fi
-}
-
-function lock() {
-
- mapperDeviceList=$(ls /dev/mapper --hide=control | awk '{printf $1" "}');
-
- if [ "$mapperDeviceList" ]; then
- for dmDevice in $mapperDeviceList; do
- if sudo cryptsetup status /dev/mapper/${dmDevice} > /dev/null 2>&1; then
- mountPoint=$(df --output=source,target /dev/mapper/${dmDevice} | tail -n 1 | awk '{printf $2}');
- if [ "$mountPoint" ]; then
- if $(sudo lsof $mountPoint > /dev/null 2>&1); then
- notify-send "Padlock" "The /dev/mapper/${dmDevice} cannot be unmount, because there are opened file or running proceses." --icon=dialog-error;
- else
- sudo umount $mountPoint;
- if [ $? -ne 0 ]; then
- notify-send "Padlock" "The /dev/mapper/${dmDevice} cannot be unmount, because there are other filesystem is mounted in." --icon=dialog-error;
- fi
- sudo cryptsetup close /dev/mapper/${dmDevice};
- fi
- else
- sudo cryptsetup close /dev/mapper/${dmDevice};
- fi
- fi
- done
- fi
- if ! $(df -h | grep -q '/dev/mapper'); then
- sed -i 's/--lock/--unlock/' ${launcher};
- sed -i 's/unlocked.png/padlock.png/' ${launcher};
- fi
-}
-
-if [ "$1" ] && [ "$1" = "--unlock" ]; then unlock;
-elif [ "$1" ] && [ "$1" = "--lock" ]; then lock;
-fi
+++ /dev/null
-#!/bin/bash
-
-GREEN="\e[32m";
-YELLOW="\e[33m";
-BLUE="\e[34m";
-ENDCOLOR="\e[0m";
-
-function help() {
- echo "ytplay - script which could play a video or audio track from youtube";
- echo "morketsmerke.net COPYLEFT @ 2022";
- echo "Options:";
- echo " -s - search given keyword on youtube.";
- echo " -v - play youtube video."
- echo " -a - play only youtube video audiotrack";
- echo "Ommiting -s option, assume you are give a yt video link.";
- echo "You have to put -v or -a before you paste a yt video link";
- echo "When you put keywords in -s option, you need to choose";
- echo "that you want listening an audiotrack (-a) oraz watch video (-v)";
- echo "Usage:";
- echo " $ ytplay -s -a [-f ytdl-format] 'lofi'";
- echo " $ ytplay -v https://youtube.com/watch?v=... [-f ytdl-format]";
- echo " $ ytplay -a https://youtube.com/watch?v=... [-f ytdl-format]";
-}
-
-if [ "$1" ]; then
- if [ "$1" = "-a" ] || [ "$1" = "-v" ]; then
- mode=$1;
- shift;
- link=$(echo $1 | sed 's@https://@@');
- if [ $# -gt 1 ]; then
- shift;
- if [ "$1" = "-f" ]; then
- shift;
- if [ "$mode" = "-a" ]; then
- format="--ytdl-format=bestaudio";
- else
- format="--ytdl-format=${1}";
- fi
- fi
- fi
- elif [ "$1" = "-s" ]; then
- if [ -f /tmp/yt.html ]; then rm /tmp/yt.html; fi
- if [ -f /tmp/yt.csv ]; then rm /tmp/yt.csv; fi
-
- shift;
- mode=$1;
- if ! ([ "$mode" = "-v" ] || [ "$mode" = "-a" ]); then help; exit 1; fi
- shift;
- if [ "$1" = "-f" ]; then
- shift;
- if [ "$mode" = "-a" ]; then
- format="--ytdl-format=bestaudio";
- else
- format="--ytdl-format=${1}";
- fi
- fi
- query=$(echo $* | sed 's/ /+/g');
- echo -n "Getting youtube site with search results...";
- wget https://youtube.com/results?search_query=$query -O /tmp/yt.html 2> /dev/null
- if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi
-
- sed -i 's/,/\n/g' /tmp/yt.html;
-
- listOfVideos=$(grep -n '^{\"url' /tmp/yt.html | cut -d ":" -f 1 | awk '{printf $1" "}');
-
- numberOfListElements=$(echo $listOfVideos | wc -w);
- i=1;
- lp=1;
- while [ $i -le $numberOfListElements ]; do
- if [ $i -eq $numberOfListElements ]; then
- ln1=$(echo $listOfVideos | cut -d " " -f $i);
- ln2='$';
- else
- j=$((i + 1));
- ln1=$(echo $listOfVideos | cut -d " " -f $i);
- ln2=$(echo $listOfVideos | cut -d " " -f $j);
- fi
- #if sed -n "${ln1},${ln2}p" /tmp/yt.html | grep -q '"iconType":"LIVE"'; then
- # i=$((i + 1)); continue;
- #else
- title=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'title' | head -1 | cut -d '"' -f 8);
- channel=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'ownerText' | head -1 | cut -d '"' -f 8);
- duration=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'simpleText' | sed -n '2p' | cut -d '"' -f 4);
- if [ "$duration" = "simpleText" ]; then duration="\e[31mLive\e[0m"; fi
- videoid=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'videoId' | sed -n '2p' | cut -d '"' -f 4);
- if [ "$title" ] && [ "$channel" ] && [ "$duration" ] && [ "$videoid" ] && [ "$duration" != "SHORTS" ]; then
- echo -e "${lp}. ${GREEN}${title}${ENDCOLOR}";
- echo -e " Channel: ${YELLOW}${channel}${ENDCOLOR} Duration: ${BLUE}${duration}${ENDCOLOR}";
- echo "${lp},${videoid},${title},${channel},${duration}" >> /tmp/yt.csv;
- else
- i=$((i + 1)); continue;
- fi
- #fi
- i=$((i + 1));
- lp=$((lp + 1));
- done
- echo -n "Put number of which video you want to hear/watch: ";
- read numberOfVideo;
- title=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 3);
- channel=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 4);
- duration=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 5);
- videoId=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 2);
- clear;
- echo -e "Title: ${GREEN}${title}${ENDCOLOR}";
- echo -e "Channel: ${YELLOW}${channel}${ENDCOLOR} Duration: ${BLUE}${duration}${ENDCOLOR}";
- echo "====================================================================";
- link=${videoId};
- else
- help;
- exit 1;
- fi
-
- if [ "$mode" = "-a" ]; then
- if [ ! "$format" ]; then format="--ytdl-format=bestaudio"; fi
- mpv ${format} ytdl://${link};
- elif [ "$mode" = "-v" ]; then mpv ${format} ytdl://${link}; fi
-else
- help;
- exit 1;
-fi
+++ /dev/null
-#!/bin/bash
-
-GREEN="\e[32m";
-YELLOW="\e[33m";
-ENDCOLOR="\e[0m";
-
-function help() {
- echo "create_media - script used for write iso image to usb drive(mainly)";
- echo "morketsmerke.net COPYLEFT @ 2022";
- echo "Options:";
- echo " --i386-efi - creating 32-bit EFI usb drive with iso image";
- echo " (comapatible with immudex only iso images)";
- echo "Usage:";
- echo " $ create_media [--i386-efi] <usb_disk> <iso_image>";
-}
-
-if [ "$1" ] && [ "$1" = "--i386-efi" ]; then target="i386-efi"; shift; fi
-if [ "$1" ] && echo $1 | grep -Eq '/dev/(sd[a-z]|vd[a-z]|mmcblk[0-9])'; then
- disk=$1; shift;
-else
- help;
- exit 1;
-fi
-if [ "$1" ] && file $1 | grep -q 'ISO 9660'; then
- iso=$1;
-else
- help;
- exit 1;
-fi
-
-if [ "$target" ]; then
- echo -n "Writing zeros to 1st megabyte on disk...";
- sudo dd if=/dev/zero bs=1M of=$disk count=1 > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Creating MS-DOS partitionig scheme on disk...";
- sudo parted $disk mklabel msdos > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Creating FAT-32 partition...";
- sudo parted $disk mkpart primary fat32 1 100%Free > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Creating VFAT filesystem on partition...";
- sudo mkfs.vfat ${disk}1 > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Creating /mnt/usb directory...";
- sudo mkdir /mnt/usb > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]";
- else echo -e "[${YELLOW}Directory exist!${ENDCOLOR}]"; fi
-
- echo -n "Mounting VFAT partition on /mnt/usb...";
- sudo mount ${disk}1 /mnt/usb > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Instalation GRUB on disk...";
- sudo grub-install --target=i386-efi --efi-directory=/mnt/usb --boot-directory=/mnt/usb/boot --bootloader-id=boot --removable > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Creating /mnt/iso directory...";
- sudo mkdir /mnt/iso > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]";
- else echo -e "[${YELLOW}Directory exist!${ENDCOLOR}]"; fi
-
- echo -n "Mounting iso file on /mnt/iso...";
- sudo mount $iso /mnt/iso > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Copying grub config files to the disk...";
- sudo cp /mnt/iso/boot/grub/font.pf2 /mnt/usb/boot/grub > /dev/null 2>&1;
- sudo cp /mnt/iso/boot/grub/grub.cfg /mnt/usb/boot/grub > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Copying immudex files to the disk...";
- sudo cp -r /mnt/iso/live /mnt/usb > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Creating empty DEBIAN file...";
- sudo touch /mnt/usb/DEBIAN > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Umounting all mounted filesystems...";
- sudo umount /mnt/* > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-else
- echo -n "Writing iso image to the disk..."
- sudo dd if=$iso bs=1M of=$disk > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-fi
+++ /dev/null
-#!/bin/bash
-
-function help() {
-
- echo "immudex_crypt - script used for listing, open and close crypt_LUKS ppartitions";
- echo "morketsmerke.net COPYLEFT @ 2022";
- echo "Options:";
- echo " list - displaing list of opened and available crypt_LUKS devices";
- echo " open - opening crypt_LUKS device, after this device is ready to mount";
- echo " close - unmount and closing crypt_LUKS devices";
- echo "Using:";
- echo "$ immudex_crypt list";
- echo "$ immudex_crypt open <crypt_LUKS device>";
- echo "$ immudex_crypt close immudex_crypt[0-9] | ic[0-9] | [0-9]";
-}
-
-function list() {
-
- mapperDeviceList=$(ls /dev/mapper --hide=control | awk '{printf $1" "}');
-
- echo "==============================================================";
- echo -e "Opened devices:";
- echo "==============================================================";
- echo -e "Device:\t\tMapper name:\t\tMount point:";
-
- if [ "$mapperDeviceList" ]; then
- for dmDevice in $mapperDeviceList; do
- if sudo cryptsetup status /dev/mapper/${dmDevice} > /dev/null 2>&1; then
- mountPoint=$(df --output=source,target /dev/mapper/${dmDevice} | tail -n 1 | awk '{printf $2}');
- device=$(sudo cryptsetup status /dev/mapper/${dmDevice} | grep "device" | awk '{printf $2}');
- if [ "$mountPoint" ] && [ "$mountPoint" != "/dev" ]; then
- echo -e "$device\t /dev/mapper/${dmDevice}\t$mountPoint";
- else
- echo -e "$device\t /dev/mapper/${dmDevice}\tNot mounted";
- fi
- fi
- done
- else
- echo -e "No opened crypt devices was found";
- fi
- echo "==============================================================";
-
- luksDevicesList=$(sudo blkid | grep 'LUKS' | cut -d ":" -f 1 | awk '{printf $1" "}');
-
- echo "==============================================================";
- echo -e "crypt_LUKS devices:";
- echo "==============================================================";
- echo -e "Device:\t\tMapper name:\t\tMount point:";
-
- if [ "$luksDevicesList" ]; then
- for lDevice in $luksDevicesList; do
- echo -e "$lDevice";
- done
- else
- echo "No crypt device was found";
- fi
- echo "==============================================================";
-}
-
-function open() {
-
- if [ $# -lt 1 ]; then help; exit 1;
- else
- index=$(ls --hide=control /dev/mapper | grep "immudex_crypt" | grep -o "[0-9]*$"| tail -1);
- if [ "$index" ]; then
- index=$((index + 1));
- else
- index=0;
- fi
- sudo cryptsetup open $1 immudex_crypt${index};
- sudo mkdir -p /media/${USER}/immudex_crypt${index};
- dmDevice=$(ls -l /dev/mapper/immudex_crypt${index} | awk '{printf $10}' | cut -d "/" -f 2);
- if ! $(sudo file -s /dev/${dmDevice} | grep -q 'ext4'); then
- echo "Could not determine filesystem of unlocked device.";
- echo -n "Format this device to ext4? (y/n): "
- read format;
- if [ "$format" = "y" ]; then
- sudo mkfs.ext4 /dev/mapper/immudex_crypt${index};
- else
- echo "Refuse to mount.";
- sudo cryptsetup close immudex_crypt${index};
- exit 1;
- fi
- fi
- sudo mount /dev/mapper/immudex_crypt${index} /media/${USER}/immudex_crypt${index};
- if [ ! -e /ic${index} ]; then
- sudo ln -s /media/${USER}/immudex_crypt${index} /ic${index};
- fi
- fi
-
-}
-
-function close() {
-
- if [ $# -lt 1 ]; then help; exit 1;
- else
- if [ $1 -ge 0 ] 2> /dev/null; then
- cryptfsName="immudex_crypt${1}";
- elif echo $1 | grep -q 'ic'; then
- cryptfsName="immudex_crypt$(echo $1 | grep -o '[0-9]')";
- else
- cryptfsName=$1;
- fi
- if sudo cryptsetup status /dev/mapper/${cryptfsName} > /dev/null 2>&1; then
- mountPoint=$(df --output=source,target /dev/mapper/${cryptfsName} | tail -1 | awk '{printf $2}');
- if [ "$mountPoint" ] && [ "$mountPoint" != "/dev" ]; then
- sudo umount -R $mountPoint;
- sudo cryptsetup close ${cryptfsName};
- else
- sudo cryptsetup close ${cryptfsName};
- fi
- else
- echo "Given devices isn't opened crypt device or it was closed before";
- fi
- fi
-}
-
-if [ "$1" ]; then
-
- case $1 in
- "list") list;;
- "open") if [ "$2" ]; then open $2;
- else help; exit 1;
- fi;;
- "close") if [ "$2" ]; then close $2;
- else help; exit 1;
- fi;;
- *) help;;
- esac
-else
- help; exit 1;
-fi
+++ /dev/null
-#!/bin/bash
-
-RED="\e[31m";
-GREEN="\e[32m";
-ENDCOLOR="\e[0m";
-
-while [ true ]; do
- echo -e "${RED}This script will install immudex on first disk on your machine.${ENDCOLOR}";
- echo -e "${RED}It could be destructive for data placed on this disk${ENDCOLR}";
- echo -en "${RED}Are you sure that you want contiune? (y/n): ${ENDCOLOR}";
- read ans;
- if [ "$ans" = "y" ]; then break; fi
-done
-
-set -e
-
-function selectDisk() {
- disks=$(lsblk | grep 'disk' | awk '{printf $1" "}');
- if [ $(echo $disks | wc -w) -gt 1 ]; then
- select drive in $disks; do
- echo $drive;
- break;
- done
- else
- echo $disks | awk '{printf $1}';
- fi
-}
-
-if $(sudo efibootmgr > /dev/null 2>&1); then
-#uefi installation
- #partitioning
- echo -n "Installation immudex in EFI mode ... ";
- disk=$(selectDisk);
- originDisk=$disk;
- if [ ! "$disk" ]; then exit 1; fi
-
- sudo dd if=/dev/zero bs=1M of=/dev/$disk count=1 2> /dev/null
-
- sudo parted /dev/$disk mklabel msdos > /dev/null 2>&1;
- sudo parted /dev/$disk mkpart primary 1 101M > /dev/null 2>&1;
- sudo parted /dev/$disk set 1 boot on > /dev/null 2>&1;
- sudo parted /dev/$disk mkpart primary 101M 4G > /dev/null 2>&1;
-
- if $(echo $disk | egrep -qo "mmc|nve"); then disk="${disk}p"; fi
-
- #formatting
- sudo mkfs.vfat -F32 /dev/${disk}1 > /dev/null 2>&1;
- sudo mkfs.ext4 /dev/${disk}2 > /dev/null 2>&1;
-
- #Setting label for partition
- sudo e2label /dev/${disk}2 "immudex" > /dev/null 2>&1;
-
- #mount root partition
- sudo mount /dev/${disk}2 /media > /dev/null 2>&1;
-
- #creating directories for efi partition
- sudo mkdir -p /media/boot/efi > /dev/null 2>&1;
-
- #mount efi partition
- sudo mount /dev/${disk}1 /media/boot/efi > /dev/null 2>&1;
-
- #mount iso image in /mnt directory
- #sudo mount /dev/sr0 /mnt > /dev/null 2>&1;
-
- #copying whole iso image to the second partition
- sudo cp -rvv /run/live/medium/* /media > /dev/null 2>&1;
-
- #removing unnecessary directories from second partition
- sudo rm -rf /media/isolinux > /dev/null 2>&1;
- sudo rm -rf /media/EFI > /dev/null 2>&1;
-
- #GRUB Installation
- if [ -f /usr/lib/live/mount/medium/EFI/BOOT/BOOTIA32.EFI ]; then
- target="i386-efi";
- else
- target="x86_64-efi";
- fi
- sudo grub-install --target=${target} --root-directory=/media --boot-directory=/media/boot --efi-directory=/media/boot/efi --bootloader-id=debian --removable > /dev/null 2>&1;
-
- #Adding entry to EFI Firmware
- sudo efibootmgr -c -d /dev/${originDisk} -p 1 -L "Debian" -l '\EFI\BOOT\grubx64.efi' > /dev/null 2>&1;
-
- #Umount all mounted filesystems
- sudo umount -R /media > /dev/null 2>&1;
-
- if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi
-
-else
-#mbr installation
- echo -n "Installation immudex in BIOS mode ... ";
-
- #partitioning
- disk=$(selectDisk);
- if [ ! "$disk" ]; then exit 1; fi
-
- sudo dd if=/dev/zero bs=1M of=/dev/$disk count=1 2> /dev/null
-
- sudo parted /dev/$disk mklabel msdos > /dev/null 2>&1;
- sudo parted /dev/$disk mkpart primary 1 4G > /dev/null 2>&1;
- sudo parted /dev/$disk set 1 boot on > /dev/null 2>&1;
-
- if $(echo $disk | egrep -qo "mmc|nve"); then disk="${disk}p"; fi
-
- #formatting
- sudo mkfs.ext4 /dev/${disk}1 > /dev/null 2>&1;
-
- #Setting label for partition is necessary for extlinux bootloader
- sudo e2label /dev/${disk}1 "immudex" > /dev/null 2>&1;
-
- #mount partition in /media directory
- sudo mount /dev/${disk}1 /media > /dev/null 2>&1;
-
- #Creating directory for extlinux
- sudo mkdir /media/extlinux > /dev/null 2>&1;
-
- #Instalation extlinux files in abovementioned directory
- sudo extlinux --install /media/extlinux > /dev/null 2>&1;
-
- #mount iso image in /mnt directory
- #sudo mount /dev/sr0 /mnt > /dev/null 2>&1;
-
- #copying live directory from iso image to partition
- sudo cp -rvv /run/live/medium/live /media > /dev/null; 2>&1;
-
- #installation extlinux MBR on first sector of hard drive (whole device)
- sudo dd if=/usr/lib/EXTLINUX/mbr.bin of=/dev/${disk} > /dev/null 2>&1;
-
- #creating extlinux configuration file
- cat > extlinux.conf <<EOF
-default immudex
-label immudex
-kernel /live/vmlinuz
-append quiet initrd=/live/initrd boot=live overlay-size=25% apparmor=1 security=apparmor
-EOF
- sudo cp extlinux.conf /media/extlinux > /dev/null 2>&1;
-
- #Unmounting filesystems
- sudo umount /media > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi
-fi
+++ /dev/null
-#!/bin/bash
-
-GREEN="\e[32m";
-YELLOW="\e[33m";
-BLUE="\e[34m";
-ENDCOLOR="\e[0m";
-
-function help() {
- echo "ytplay - script which could play a video or audio track from youtube";
- echo "morketsmerke.net COPYLEFT @ 2022";
- echo "Options:";
- echo " -s - search given keyword on youtube.";
- echo " -v - play youtube video."
- echo " -a - play only youtube video audiotrack";
- echo "Ommiting -s option, assume you are give a yt video link.";
- echo "You have to put -v or -a before you paste a yt video link";
- echo "When you put keywords in -s option, you need to choose";
- echo "that you want listening an audiotrack (-a) oraz watch video (-v)";
- echo "Usage:";
- echo " $ ytplay -s -a [-f ytdl-format] 'lofi'";
- echo " $ ytplay -v https://youtube.com/watch?v=... [-f ytdl-format]";
- echo " $ ytplay -a https://youtube.com/watch?v=... [-f ytdl-format]";
-}
-
-if [ "$1" ]; then
- if [ "$1" = "-a" ] || [ "$1" = "-v" ]; then
- mode=$1;
- shift;
- link=$(echo $1 | sed 's@https://@@');
- if [ $# -gt 1 ]; then
- shift;
- if [ "$1" = "-f" ]; then
- shift;
- if [ "$mode" = "-a" ]; then
- format="--ytdl-format=bestaudio";
- else
- format="--ytdl-format=${1}";
- fi
- fi
- fi
- elif [ "$1" = "-s" ]; then
- if [ -f /tmp/yt.html ]; then rm /tmp/yt.html; fi
- if [ -f /tmp/yt.csv ]; then rm /tmp/yt.csv; fi
-
- shift;
- mode=$1;
- if ! ([ "$mode" = "-v" ] || [ "$mode" = "-a" ]); then help; exit 1; fi
- shift;
- if [ "$1" = "-f" ]; then
- shift;
- if [ "$mode" = "-a" ]; then
- format="--ytdl-format=bestaudio";
- else
- format="--ytdl-format=${1}";
- fi
- fi
- query=$(echo $* | sed 's/ /+/g');
- echo -n "Getting youtube site with search results...";
- wget https://youtube.com/results?search_query=$query -O /tmp/yt.html 2> /dev/null
- if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi
-
- sed -i 's/,/\n/g' /tmp/yt.html;
-
- listOfVideos=$(grep -n '^{\"url' /tmp/yt.html | cut -d ":" -f 1 | awk '{printf $1" "}');
-
- numberOfListElements=$(echo $listOfVideos | wc -w);
- i=1;
- lp=1;
- while [ $i -le $numberOfListElements ]; do
- if [ $i -eq $numberOfListElements ]; then
- ln1=$(echo $listOfVideos | cut -d " " -f $i);
- ln2='$';
- else
- j=$((i + 1));
- ln1=$(echo $listOfVideos | cut -d " " -f $i);
- ln2=$(echo $listOfVideos | cut -d " " -f $j);
- fi
- #if sed -n "${ln1},${ln2}p" /tmp/yt.html | grep -q '"iconType":"LIVE"'; then
- # i=$((i + 1)); continue;
- #else
- title=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'title' | head -1 | cut -d '"' -f 8);
- channel=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'ownerText' | head -1 | cut -d '"' -f 8);
- duration=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'simpleText' | sed -n '2p' | cut -d '"' -f 4);
- if [ "$duration" = "simpleText" ]; then duration="\e[31mLive\e[0m"; fi
- videoid=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'videoId' | sed -n '2p' | cut -d '"' -f 4);
- if [ "$title" ] && [ "$channel" ] && [ "$duration" ] && [ "$videoid" ] && [ "$duration" != "SHORTS" ]; then
- echo -e "${lp}. ${GREEN}${title}${ENDCOLOR}";
- echo -e " Channel: ${YELLOW}${channel}${ENDCOLOR} Duration: ${BLUE}${duration}${ENDCOLOR}";
- echo "${lp},${videoid},${title},${channel},${duration}" >> /tmp/yt.csv;
- else
- i=$((i + 1)); continue;
- fi
- #fi
- i=$((i + 1));
- lp=$((lp + 1));
- done
- echo -n "Put number of which video you want to hear/watch: ";
- read numberOfVideo;
- title=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 3);
- channel=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 4);
- duration=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 5);
- videoId=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 2);
- clear;
- echo -e "Title: ${GREEN}${title}${ENDCOLOR}";
- echo -e "Channel: ${YELLOW}${channel}${ENDCOLOR} Duration: ${BLUE}${duration}${ENDCOLOR}";
- echo "====================================================================";
- link=${videoId};
- else
- help;
- exit 1;
- fi
-
- if [ "$mode" = "-a" ]; then
- if [ ! "$format" ]; then format="--ytdl-format=bestaudio"; fi
- mpv ${format} ytdl://${link};
- elif [ "$mode" = "-v" ]; then mpv ${format} ytdl://${link}; fi
-else
- help;
- exit 1;
-fi
+++ /dev/null
-#!/bin/bash
-
-set -e
-
-RED="\e[31m";
-GREEN="\e[32m";
-YELLOW="\e[33m";
-ENDCOLOR="\e[0m";
-root="/run/live/medium";
-
-function help() {
- echo "immudex_upgrade - script for searching upgrades and upgrade immudex";
- echo "morketsmerke.net @ 2022";
- echo "Options:";
- echo " --check --print - check there are upgrades for immudex";
- echo " --upgrade - check there are upgrades for immudex and install them.";
- echo " If there is no new version, script will propose refreshing";
- echo " current immudex installation, its helpful when you tried";
- echo " remaster immudex and you get any trouble with this".
-}
-
-function get_debian_branch() {
- if grep -q '\/sid' /etc/os-release; then
- echo "testing";
- else
- echo "stable";
- fi
-}
-
-function get_machine_arch() {
- arch=$(uname -m);
- if [ "$arch" = "i686" ]; then
- echo "32";
- else
- echo "64";
- fi
-}
-
-function main_upgrade() {
- set -e
- ARCH=$(get_machine_arch);
- BRANCH=$(get_debian_branch);
- rootPart=$(grep "${1}" /etc/mtab | head -1 | awk '{printf $1}');
- sudo mount $rootPart $1 -o remount,rw;
- sudo rm -f ${1}/live/*;
- sudo wget -q https://ftp.morketsmerke.net/immudex/${BRANCH}/upgrades/${2}/${ARCH}/filesystem.squashfs/download -O ${1}/live/filesystem.squashfs;
- sudo wget -q https://ftp.morketsmerke.net/immudex/${BRANCH}/upgrades/${2}/${ARCH}/initrd/download -O ${1}/live/initrd;
- sudo wget -q https://ftp.morketsmerke.net/immudex/${BRANCH}/upgrades/${2}/${ARCH}/vmlinuz/download -O ${1}/live/vmlinuz;
- echo "$2" > /tmp/version;
- sudo cp /tmp/version ${1}/live;
-}
-
-#function check(){
-# set -e
-# if [ -d ${root}/live ]; then
-# if [ -f ${root}/live/version ]; then
-# version=$(cat ${root}/live/version | sed 's/\.//g');
-# else version="000";
-# fi
-# if [ ! -f /tmp/feed.xml ]; then
-# wget -q https://sourceforge.net/p/immudex/activity/feed -O /tmp/feed.xml
-# fi
-# if [ ! -s /tmp/feed.xml ]; then sudo rm /tmp/feed.xml; return 255; fi;
-# newVersionTxt=$(grep -o "[0-9]\.[0-9]\.[0-9]" /tmp/feed.xml | head -1);
-# newVersionInt=$(echo $newVersionTxt | sed 's/\.//g');
-# if [ $version -lt $newVersionInt ]; then
-# exitcode=0;
-# else
-# exitcode=1;
-# fi
-# else
-# exitcode=255;
-# fi
-# if [ "$1" ] && [ "$1" = "--print" ]; then
-# echo $newVersionTxt;
-# return 0;
-# fi
-# return $exitcode;
-#}
-
-function check() {
- set -e
- if [ -d ${root}/live ]; then
- if [ -f ${root}/live/version ]; then
- version=$(cat ${root}/live/version | sed 's/\.//g');
- else version="000";
- fi
- BRANCH=$(get_debian_branch);
- ARCH=$(get_machine_arch);
- if [ ! -f /tmp/ltver ]; then
- wget -q https://ftp.morketsmerke.net/immudex/${BRANCH}/upgrades/latest/${ARCH}/version -O /tmp/ltver;
- fi
- if [ ! -s /tmp/ltver ]; then sudo rm /tmp/ltver; return 255; fi;
- newVersionTxt=$(cat /tmp/ltver);
- newVersionInt=$(echo $newVersionTxt | sed 's/\.//g');
- if [ $version -lt $newVersionInt ]; then
- exitcode=0;
- else
- exitcode=1;
- fi
- else
- exitcode=255;
- fi
- if [ "$1" ] && [ "$1" = "--print" ]; then
- echo $newVersionTxt;
- return 0;
- fi
- return $exitcode;
-}
-
-if [ "$1" ] && [ "$1" = "--check" ]; then
- if [ "$2" ] && [ "$2" = "--print" ]; then
- newVersion=$(check --print);
- if check; then
- echo -e "${YELLOW}New version (${ENDCOLOR}${RED}$newVersion${ENDCOLOR}${YELLOW}) of immudex is available to upgrade.${ENDCOLOR}";
- else
- echo -e "${YELLOW}This (${ENDCOLOR}${GREEN}$newVersion${ENDCOLOR}${YELLOW}) is the latest version of immudex.${ENDCOLOR}";
- fi
- fi
-elif [ "$1" ] && [ "$1" = "--upgrade" ]; then
- newVersionTxt=$(check --print);
- newVersionInt=$(echo $newVersionTxt | sed 's/\.//g');
- if check; then
- echo -en "${YELLOW}New version "
- echo -en "(${ENDCOLOR}${RED}${newVersionTxt}${ENDCOLOR}${YELLOW}) "
- echo -e "of immudex is available.${ENDCOLOR}";
- echo -e "${RED}Warning, reboot maybe necessary to continue work on this machine${ENDCOLOR}";
- echo -en "${YELLOW}Do you want upgrade this system? (y/n):${ENDCOLOR} ";
- read commit;
- if [ $commit = "y" ]; then
- echo -n "Upgrading immudex to the newest version...";
- main_upgrade $root $newVersionTxt;
- if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi
- else
- exit 1;
- fi
- else
- echo -e "${GREEN}There is no newer version of immudex,${ENDCOLOR}";
- echo -e "${YELLOW}but you can copy fresh system files from latest iso image";
- echo -e "${RED}Warning, reboot maybe necessary to continue work on this machine${ENDCOLOR}";
- echo -en "${YELLOW}Do you want refresh this system? (y/n):${ENDCOLOR} ";
- read commit;
- if [ $commit = "y" ]; then
- echo -n "Refreshing immudex to the latest iso image...";
- main_upgrade $root $newVersionTxt;
- if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi
- else
- exit 1;
- fi
- exit 0;
- fi
-else
- help;
- exit 1;
-fi
+++ /dev/null
-#!/bin/bash
-
-/usr/bin/figlet immudex;
-echo;
-echo "Today is: $(date)";
-echo;
-echo "System summary: ";
-cpuIdle=$(vmstat | tail -1 | awk '{printf $15}');
-cpuUsage=$((100 - $cpuIdle));
-echo -e " \tCPU: ${cpuUsage}%";
-echo -e " \tMEM: $(free -h | sed -n '2p' | awk '{printf $7}' | sed 's/i//') Free";
-if $(df -h 2> /dev/null | grep -q '/dev/mapper'); then
- i=1;
- echo -e " \tCRYPT_PARTi: Free/Total (Usage%)";
- amountOfDisks=$(df -h 2> /dev/null | grep '/dev/mapper' | wc -l | awk '{printf $1}');
- while [ $i -le $amountOfDisks ]; do
- diskSize=$(df -h 2> /dev/null | grep '/dev/mapper' | sed -n "${i}p" | awk '{printf $2}');
- diskFree=$(df -h 2> /dev/null | grep '/dev/mapper' | sed -n "${i}p" | awk '{printf $4}');
- diskUsage_perc=$(df -h 2> /dev/null | grep '/dev/mapper' | sed -n "${i}p" | sed 's/%//' | awk '{printf $5}');
- #FCP = First Crypt Partition
- echo -e " \tCRYPT_PART${i}: ${diskFree}/${diskSize} (${diskUsage_perc}%)";
- i=$((i + 1));
- done
-else
- echo -e " \tCRYPT_PART: N/A";
-fi
-echo -e " \tPROCESSES: $(ps -aux | wc -l | awk '{printf $1}')";
-utime=$(uptime | awk '{printf $3}' | sed 's/,//');
-if $(echo $utime | grep -q ":"); then
- echo -e " \tUPTIME: ${utime}";
-else
- echo -e " \tUPTIME: 0:${utime}";
-fi
-echo -e " \t$(uptime | grep -o "load.*$" | tr [a-z] [A-Z])";
-echo;
-echo -e "morketsmerke.net @ 2023 https://github.com/xf0r3m/immudex";
-echo;
-/usr/local/bin/immudex_upgrade --check --print;
-if [ $? -ne 0 ]; then
- echo -e "\e[31mThere is no internet connection or internal error.\e[0m";
- if [ -f /tmp/feed.xml ] && [ ! -s /tmp/feed.xml ]; then
- rm -f /tmp/feed.xml;
- fi
-else
- if [ "$USER" = "xf0r3m" ]; then
- sudo apt update > /tmp/update.log 2>&1 && tail -1 /tmp/update.log;
- fi
-fi
-echo "====================================================================";
+++ /dev/null
-#!/bin/bash
-
-GREEN="\e[32m";
-YELLOW="\e[33m";
-BLUE="\e[34m";
-ENDCOLOR="\e[0m";
-
-function help() {
- echo "ytplay - script which could play a video or audio track from youtube";
- echo "morketsmerke.net COPYLEFT @ 2022";
- echo "Options:";
- echo " -s - search given keyword on youtube.";
- echo " -v - play youtube video."
- echo " -a - play only youtube video audiotrack";
- echo "Ommiting -s option, assume you are give a yt video link.";
- echo "You have to put -v or -a before you paste a yt video link";
- echo "When you put keywords in -s option, you need to choose";
- echo "that you want listening an audiotrack (-a) oraz watch video (-v)";
- echo "Usage:";
- echo " $ ytplay -s -a [-f ytdl-format] 'lofi'";
- echo " $ ytplay -v https://youtube.com/watch?v=... [-f ytdl-format]";
- echo " $ ytplay -a https://youtube.com/watch?v=... [-f ytdl-format]";
- echo "You can search again the same keywords puting 'r' or 'R' instead";
- echo "of video numer";
-}
-
-function yt_search() {
- query=$(echo $* | sed 's/ /+/g');
- echo -n "Getting youtube site with search results...";
- wget https://youtube.com/results?search_query=$query -O /tmp/yt.html 2> /dev/null
- if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi
-
- sed -i 's/,/\n/g' /tmp/yt.html;
-
- listOfVideos=$(grep -n '^{\"url' /tmp/yt.html | cut -d ":" -f 1 | awk '{printf $1" "}');
-
- numberOfListElements=$(echo $listOfVideos | wc -w);
- i=1;
- lp=1;
- while [ $i -le $numberOfListElements ]; do
- if [ $i -eq $numberOfListElements ]; then
- ln1=$(echo $listOfVideos | cut -d " " -f $i);
- ln2='$';
- else
- j=$((i + 1));
- ln1=$(echo $listOfVideos | cut -d " " -f $i);
- ln2=$(echo $listOfVideos | cut -d " " -f $j);
- fi
- #if sed -n "${ln1},${ln2}p" /tmp/yt.html | grep -q '"iconType":"LIVE"'; then
- # i=$((i + 1)); continue;
- #else
- title=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'title' | head -1 | cut -d '"' -f 8);
- channel=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'ownerText' | head -1 | cut -d '"' -f 8);
- duration=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'simpleText' | sed -n '2p' | cut -d '"' -f 4);
- if [ "$duration" = "simpleText" ]; then duration="\e[31mLive\e[0m"; fi
- videoid=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'videoId' | sed -n '2p' | cut -d '"' -f 4);
- if [ "$title" ] && [ "$channel" ] && [ "$duration" ] && [ "$videoid" ] && [ "$duration" != "SHORTS" ]; then
- echo -e "${lp}. ${GREEN}${title}${ENDCOLOR}";
- echo -e " Channel: ${YELLOW}${channel}${ENDCOLOR} Duration: ${BLUE}${duration}${ENDCOLOR}";
- echo "${lp},${videoid},${title},${channel},${duration}" >> /tmp/yt.csv;
- else
- i=$((i + 1)); continue;
- fi
- #fi
- i=$((i + 1));
- lp=$((lp + 1));
- done
-}
-
-if [ "$1" ]; then
- if [ "$1" = "-a" ] || [ "$1" = "-v" ]; then
- mode=$1;
- shift;
- link=$(echo $1 | sed 's@https://@@');
- if [ $# -gt 1 ]; then
- shift;
- if [ "$1" = "-f" ]; then
- shift;
- if [ "$mode" = "-a" ]; then
- format="--ytdl-format=bestaudio";
- else
- format="--ytdl-format=${1}";
- fi
- fi
- fi
- elif [ "$1" = "-s" ]; then
- if [ -f /tmp/yt.html ]; then rm /tmp/yt.html; fi
- if [ -f /tmp/yt.csv ]; then rm /tmp/yt.csv; fi
-
- shift;
- mode=$1;
- if ! ([ "$mode" = "-v" ] || [ "$mode" = "-a" ]); then help; exit 1; fi
- shift;
- if [ "$1" = "-f" ]; then
- shift;
- if [ "$mode" = "-a" ]; then
- format="--ytdl-format=bestaudio";
- else
- format="--ytdl-format=${1}";
- fi
- fi
- while [ true ]; do
- yt_search $*;
- echo -n "Put number of which video you want to hear/watch: ";
- read numberOfVideo;
- if [[ $numberOfVideo -gt 0 ]]; then break;
- elif [ "$numberOfVideo" = "r" ] || [ "$numberOfVideo" = "R" ]; then
- continue;
- else
- help;
- exit 1;
- fi
- done
- title=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 3);
- channel=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 4);
- duration=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 5);
- videoId=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 2);
- clear;
- echo -e "Title: ${GREEN}${title}${ENDCOLOR}";
- echo -e "Channel: ${YELLOW}${channel}${ENDCOLOR} Duration: ${BLUE}${duration}${ENDCOLOR}";
- echo "====================================================================";
- link=${videoId};
- else
- help;
- exit 1;
- fi
-
- if [ "$mode" = "-a" ]; then
- if [ ! "$format" ]; then format="--ytdl-format=bestaudio"; fi
- mpv ${format} ytdl://${link};
- elif [ "$mode" = "-v" ]; then mpv ${format} ytdl://${link}; fi
-else
- help;
- exit 1;
-fi
+++ /dev/null
-#!/bin/bash
-
-set -e
-
-source library.sh
-
-RED="\e[31m";
-GREEN="\e[32m";
-YELLOW="\e[33m";
-ENDCOLOR="\e[0m";
-root="/run/live/medium";
-
-function help() {
- echo "immudex_upgrade - script for searching upgrades and upgrade immudex";
- echo "morketsmerke.net @ 2022";
- echo "Options:";
- echo " --check --print - check there are upgrades for immudex";
- echo " --upgrade - check there are upgrades for immudex and install them.";
- echo " If there is no new version, script will propose refreshing";
- echo " current immudex installation, its helpful when you tried";
- echo " remaster immudex and you get any trouble with this".
-}
-
-function main_upgrade() {
- set -e
- ARCH=$(get_machine_arch);
- BRANCH=$(get_debian_branch);
- rootPart=$(grep "${1}" /etc/mtab | head -1 | awk '{printf $1}');
- sudo mount $rootPart $1 -o remount,rw;
- sudo rm -f ${1}/live/*;
- sudo wget -q https://ftp.morketsmerke.net/immudex/${BRANCH}/upgrades/${2}/${ARCH}/filesystem.squashfs/download -O ${1}/live/filesystem.squashfs;
- sudo wget -q https://ftp.morketsmerke.net/immudex/${BRANCH}/upgrades/${2}/${ARCH}/initrd/download -O ${1}/live/initrd;
- sudo wget -q https://ftp.morketsmerke.net/immudex/${BRANCH}/upgrades/${2}/${ARCH}/vmlinuz/download -O ${1}/live/vmlinuz;
- echo "$2" > /tmp/version;
- sudo cp /tmp/version ${1}/live;
-}
-
-if [ "$1" ] && [ "$1" = "--check" ]; then
- if [ "$2" ] && [ "$2" = "--print" ]; then
- newVersion=$(check_distro_version --print);
- if check_distro_version; then
- echo -e "${YELLOW}New version (${ENDCOLOR}${RED}$newVersion${ENDCOLOR}${YELLOW}) of immudex is available to upgrade.${ENDCOLOR}";
- else
- echo -e "${YELLOW}This (${ENDCOLOR}${GREEN}$newVersion${ENDCOLOR}${YELLOW}) is the latest version of immudex.${ENDCOLOR}";
- fi
- fi
-elif [ "$1" ] && [ "$1" = "--upgrade" ]; then
- newVersionTxt=$(check_distro_version --print);
- newVersionInt=$(echo $newVersionTxt | sed 's/\.//g');
- if check_distro_version; then
- echo -en "${YELLOW}New version "
- echo -en "(${ENDCOLOR}${RED}${newVersionTxt}${ENDCOLOR}${YELLOW}) "
- echo -e "of immudex is available.${ENDCOLOR}";
- echo -e "${RED}Warning, reboot maybe necessary to continue work on this machine${ENDCOLOR}";
- echo -en "${YELLOW}Do you want upgrade this system? (y/n):${ENDCOLOR} ";
- read commit;
- if [ $commit = "y" ]; then
- echo -n "Upgrading immudex to the newest version...";
- main_upgrade $root $newVersionTxt;
- if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi
- else
- exit 1;
- fi
- else
- echo -e "${GREEN}There is no newer version of immudex,${ENDCOLOR}";
- echo -e "${YELLOW}but you can copy fresh system files from latest iso image";
- echo -e "${RED}Warning, reboot maybe necessary to continue work on this machine${ENDCOLOR}";
- echo -en "${YELLOW}Do you want refresh this system? (y/n):${ENDCOLOR} ";
- read commit;
- if [ $commit = "y" ]; then
- echo -n "Refreshing immudex to the latest iso image...";
- main_upgrade $root $newVersionTxt;
- if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi
- else
- exit 1;
- fi
- exit 0;
- fi
-else
- help;
- exit 1;
-fi
+++ /dev/null
-#!/bin/bash
-
-function get_debian_branch() {
- if grep -q '\/sid' /etc/os-release; then
- echo "testing";
- else
- echo "stable";
- fi
-}
-
-function get_machine_arch() {
- arch=$(uname -m);
- if [ "$arch" = "i686" ]; then
- echo "32";
- else
- echo "64";
- fi
-}
-
-function check_distro_version() {
- set -e
- root="/run/live/medium";
- if [ -d ${root}/live ]; then
- if [ -f ${root}/live/version ]; then
- version=$(cat ${root}/live/version | sed 's/\.//g');
- else version="000";
- fi
- BRANCH=$(get_debian_branch);
- ARCH=$(get_machine_arch);
- if [ ! -f /tmp/ltver ]; then
- wget -q https://ftp.morketsmerke.net/immudex/${BRANCH}/upgrades/latest/${ARCH}/version -O /tmp/ltver;
- fi
- if [ ! -s /tmp/ltver ]; then sudo rm /tmp/ltver; return 255; fi;
- newVersionTxt=$(cat /tmp/ltver);
- newVersionInt=$(echo $newVersionTxt | sed 's/\.//g');
- if [ $version -lt $newVersionInt ]; then
- exitcode=0;
- else
- exitcode=1;
- fi
- else
- exitcode=255;
- fi
- if [ "$1" ] && [ "$1" = "--print" ]; then
- echo $newVersionTxt;
- return 0;
- fi
- return $exitcode;
-}
+++ /dev/null
-#!/bin/bash
-
-/usr/bin/figlet immudex;
-echo;
-echo "Today is: $(date)";
-echo;
-echo "System summary: ";
-cpuIdle=$(vmstat | tail -1 | awk '{printf $15}');
-cpuUsage=$((100 - $cpuIdle));
-echo -e " \tCPU: ${cpuUsage}%";
-echo -e " \tMEM: $(free -h | sed -n '2p' | awk '{printf $7}' | sed 's/i//') Free";
-if $(df -h 2> /dev/null | grep -q '/dev/mapper'); then
- i=1;
- echo -e " \tCRYPT_PARTi: Free/Total (Usage%)";
- amountOfDisks=$(df -h 2> /dev/null | grep '/dev/mapper' | wc -l | awk '{printf $1}');
- while [ $i -le $amountOfDisks ]; do
- diskSize=$(df -h 2> /dev/null | grep '/dev/mapper' | sed -n "${i}p" | awk '{printf $2}');
- diskFree=$(df -h 2> /dev/null | grep '/dev/mapper' | sed -n "${i}p" | awk '{printf $4}');
- diskUsage_perc=$(df -h 2> /dev/null | grep '/dev/mapper' | sed -n "${i}p" | sed 's/%//' | awk '{printf $5}');
- #FCP = First Crypt Partition
- echo -e " \tCRYPT_PART${i}: ${diskFree}/${diskSize} (${diskUsage_perc}%)";
- i=$((i + 1));
- done
-else
- echo -e " \tCRYPT_PART: N/A";
-fi
-echo -e " \tPROCESSES: $(ps -aux | wc -l | awk '{printf $1}')";
-utime=$(uptime | awk '{printf $3}' | sed 's/,//');
-if $(echo $utime | grep -q ":"); then
- echo -e " \tUPTIME: ${utime}";
-else
- echo -e " \tUPTIME: 0:${utime}";
-fi
-echo -e " \t$(uptime | grep -o "load.*$" | tr [a-z] [A-Z])";
-echo;
-echo -e "morketsmerke.net @ 2023 https://github.com/xf0r3m/immudex";
-echo;
-#/usr/local/bin/immudex_upgrade --check --print;
-#if [ $? -ne 0 ]; then
-# echo -e "\e[31mThere is no internet connection or internal error.\e[0m";
-# if [ -f /tmp/feed.xml ] && [ ! -s /tmp/feed.xml ]; then
-# rm -f /tmp/feed.xml;
-# fi
-#else
-# if [ "$USER" = "xf0r3m" ]; then
-# sudo apt update > /tmp/update.log 2>&1 && tail -1 /tmp/update.log;
-# fi
-#fi
-echo "====================================================================";
+++ /dev/null
-#!/bin/bash
-
-set -e
-
-source library.sh
-
-RED="\e[31m";
-GREEN="\e[32m";
-YELLOW="\e[33m";
-ENDCOLOR="\e[0m";
-root="/run/live/medium";
-
-function help() {
- echo "immudex_upgrade - script for searching upgrades and upgrade immudex";
- echo "morketsmerke.net @ 2022";
- echo "Options:";
- echo " --check --print - check there are upgrades for immudex";
- echo " --upgrade - check there are upgrades for immudex and install them.";
- echo " If there is no new version, script will propose refreshing";
- echo " current immudex installation, its helpful when you tried";
- echo " remaster immudex and you get any trouble with this".
-}
-
-function main_upgrade() {
- set -e
- ARCH=$(get_machine_arch);
- BRANCH=$(get_debian_branch);
- rootPart=$(grep "${1}" /etc/mtab | head -1 | awk '{printf $1}');
- sudo mount $rootPart $1 -o remount,rw;
- sudo rm -f ${1}/live/*;
- sudo wget -q https://ftp.morketsmerke.org/immudex/${BRANCH}/upgrades/${2}/${ARCH}/filesystem.squashfs -O ${1}/live/filesystem.squashfs;
- sudo wget -q https://ftp.morketsmerke.org/immudex/${BRANCH}/upgrades/${2}/${ARCH}/initrd -O ${1}/live/initrd;
- sudo wget -q https://ftp.morketsmerke.org/immudex/${BRANCH}/upgrades/${2}/${ARCH}/vmlinuz -O ${1}/live/vmlinuz;
- echo "$2" > /tmp/version;
- sudo cp /tmp/version ${1}/live;
-}
-
-if [ "$1" ] && [ "$1" = "--check" ]; then
- if [ "$2" ] && [ "$2" = "--print" ]; then
- newVersion=$(check_distro_version --print);
- if check_distro_version; then
- echo -e "${YELLOW}New version (${ENDCOLOR}${RED}$newVersion${ENDCOLOR}${YELLOW}) of immudex is available to upgrade.${ENDCOLOR}";
- else
- echo -e "${YELLOW}This (${ENDCOLOR}${GREEN}$newVersion${ENDCOLOR}${YELLOW}) is the latest version of immudex.${ENDCOLOR}";
- fi
- fi
-elif [ "$1" ] && [ "$1" = "--upgrade" ]; then
- newVersionTxt=$(check_distro_version --print);
- newVersionInt=$(echo $newVersionTxt | sed 's/\.//g');
- if check_distro_version; then
- echo -en "${YELLOW}New version "
- echo -en "(${ENDCOLOR}${RED}${newVersionTxt}${ENDCOLOR}${YELLOW}) "
- echo -e "of immudex is available.${ENDCOLOR}";
- echo -e "${RED}Warning, reboot maybe necessary to continue work on this machine${ENDCOLOR}";
- echo -en "${YELLOW}Do you want upgrade this system? (y/n):${ENDCOLOR} ";
- read commit;
- if [ $commit = "y" ]; then
- echo -n "Upgrading immudex to the newest version...";
- main_upgrade $root $newVersionTxt;
- if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi
- else
- exit 1;
- fi
- else
- echo -e "${GREEN}There is no newer version of immudex,${ENDCOLOR}";
- echo -e "${YELLOW}but you can copy fresh system files from latest iso image";
- echo -e "${RED}Warning, reboot maybe necessary to continue work on this machine${ENDCOLOR}";
- echo -en "${YELLOW}Do you want refresh this system? (y/n):${ENDCOLOR} ";
- read commit;
- if [ $commit = "y" ]; then
- echo -n "Refreshing immudex to the latest iso image...";
- main_upgrade $root $newVersionTxt;
- if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi
- else
- exit 1;
- fi
- exit 0;
- fi
-else
- help;
- exit 1;
-fi
+++ /dev/null
-#!/bin/bash
-
-function get_debian_branch() {
- if grep -q '\/sid' /etc/os-release; then
- echo "testing";
- else
- echo "stable";
- fi
-}
-
-function get_machine_arch() {
- arch=$(uname -m);
- if [ "$arch" = "i686" ]; then
- echo "32";
- else
- echo "64";
- fi
-}
-
-function check_distro_version() {
- set -e
- root="/run/live/medium";
- if [ -d ${root}/live ]; then
- if [ -f ${root}/live/version ]; then
- version=$(cat ${root}/live/version | sed 's/\.//g');
- else version="000";
- fi
- BRANCH=$(get_debian_branch);
- ARCH=$(get_machine_arch);
- if [ ! -f /tmp/ltver ]; then
- wget -q https://ftp.morketsmerke.org/immudex/${BRANCH}/upgrades/latest/${ARCH}/version -O /tmp/ltver;
- fi
- if [ ! -s /tmp/ltver ]; then sudo rm /tmp/ltver; return 255; fi;
- newVersionTxt=$(cat /tmp/ltver);
- newVersionInt=$(echo $newVersionTxt | sed 's/\.//g');
- if [ $version -lt $newVersionInt ]; then
- exitcode=0;
- else
- exitcode=1;
- fi
- else
- exitcode=255;
- fi
- if [ "$1" ] && [ "$1" = "--print" ]; then
- echo $newVersionTxt;
- return 0;
- fi
- return $exitcode;
-}
+++ /dev/null
-#!/bin/bash
-
-GREEN="\e[32m";
-YELLOW="\e[33m";
-ENDCOLOR="\e[0m";
-
-function help() {
- echo "create_media - script used for write iso image to usb drive(mainly)";
- echo "morketsmerke.net COPYLEFT @ 2022";
- echo "Options:";
- echo " --i386-efi - creating 32-bit EFI usb drive with iso image";
- echo " (comapatible with immudex only iso images)";
- echo "Usage:";
- echo " $ create_media [--i386-efi] <usb_disk> <iso_image>";
-}
-
-if [ "$1" ] && [ "$1" = "--i386-efi" ]; then target="i386-efi"; shift; fi
-if [ "$1" ] && echo $1 | grep -Eq '/dev/(sd[a-z]|vd[a-z]|mmcblk[0-9])'; then
- disk=$1; shift;
-else
- help;
- exit 1;
-fi
-if [ "$1" ] && file $1 | grep -q 'ISO 9660'; then
- iso=$1;
-else
- help;
- exit 1;
-fi
-
-if [ "$target" ]; then
- echo -n "Writing zeros to 1st megabyte on disk...";
- sudo dd if=/dev/zero bs=1M of=$disk count=1 > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Creating MS-DOS partitionig scheme on disk...";
- sudo parted $disk mklabel msdos > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Creating FAT-32 partition...";
- sudo parted $disk mkpart primary fat32 1 100%Free > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Creating VFAT filesystem on partition...";
- sudo mkfs.vfat ${disk}1 > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Creating /mnt/usb directory...";
- sudo mkdir /mnt/usb > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]";
- else echo -e "[${YELLOW}Directory exist!${ENDCOLOR}]"; fi
-
- echo -n "Mounting VFAT partition on /mnt/usb...";
- sudo mount ${disk}1 /mnt/usb > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Instalation GRUB on disk...";
- sudo grub-install --target=i386-efi --efi-directory=/mnt/usb --boot-directory=/mnt/usb/boot --bootloader-id=boot --removable > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Creating /mnt/iso directory...";
- sudo mkdir /mnt/iso > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]";
- else echo -e "[${YELLOW}Directory exist!${ENDCOLOR}]"; fi
-
- echo -n "Mounting iso file on /mnt/iso...";
- sudo mount $iso /mnt/iso > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Copying grub config files to the disk...";
- sudo cp /mnt/iso/boot/grub/font.pf2 /mnt/usb/boot/grub > /dev/null 2>&1;
- sudo cp /mnt/iso/boot/grub/grub.cfg /mnt/usb/boot/grub > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Copying immudex files to the disk...";
- sudo cp -r /mnt/iso/live /mnt/usb > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Creating empty DEBIAN file...";
- sudo touch /mnt/usb/DEBIAN > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Umounting all mounted filesystems...";
- sudo umount /mnt/* > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-else
- echo -n "Writing iso image to the disk..."
- sudo dd if=$iso bs=1M of=$disk > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-fi
+++ /dev/null
-#!/bin/bash
-
-function help() {
-
- echo "immudex_crypt - script used for listing, open and close crypt_LUKS ppartitions";
- echo "morketsmerke.net COPYLEFT @ 2022";
- echo "Options:";
- echo " list - displaing list of opened and available crypt_LUKS devices";
- echo " open - opening crypt_LUKS device, after this device is ready to mount";
- echo " close - unmount and closing crypt_LUKS devices";
- echo "Using:";
- echo "$ immudex_crypt list";
- echo "$ immudex_crypt open <crypt_LUKS device>";
- echo "$ immudex_crypt close immudex_crypt[0-9] | ic[0-9] | [0-9]";
-}
-
-function list() {
-
- mapperDeviceList=$(ls /dev/mapper --hide=control | awk '{printf $1" "}');
-
- echo "==============================================================";
- echo -e "Opened devices:";
- echo "==============================================================";
- echo -e "Device:\t\tMapper name:\t\tMount point:";
-
- if [ "$mapperDeviceList" ]; then
- for dmDevice in $mapperDeviceList; do
- if sudo cryptsetup status /dev/mapper/${dmDevice} > /dev/null 2>&1; then
- mountPoint=$(df --output=source,target /dev/mapper/${dmDevice} | tail -n 1 | awk '{printf $2}');
- device=$(sudo cryptsetup status /dev/mapper/${dmDevice} | grep "device" | awk '{printf $2}');
- if [ "$mountPoint" ] && [ "$mountPoint" != "/dev" ]; then
- echo -e "$device\t /dev/mapper/${dmDevice}\t$mountPoint";
- else
- echo -e "$device\t /dev/mapper/${dmDevice}\tNot mounted";
- fi
- fi
- done
- else
- echo -e "No opened crypt devices was found";
- fi
- echo "==============================================================";
-
- luksDevicesList=$(sudo blkid | grep 'LUKS' | cut -d ":" -f 1 | awk '{printf $1" "}');
-
- echo "==============================================================";
- echo -e "crypt_LUKS devices:";
- echo "==============================================================";
- echo -e "Device:\t\tMapper name:\t\tMount point:";
-
- if [ "$luksDevicesList" ]; then
- for lDevice in $luksDevicesList; do
- echo -e "$lDevice";
- done
- else
- echo "No crypt device was found";
- fi
- echo "==============================================================";
-}
-
-function open() {
-
- if [ $# -lt 1 ]; then help; exit 1;
- else
- index=$(ls --hide=control /dev/mapper | grep "immudex_crypt" | grep -o "[0-9]*$"| tail -1);
- if [ "$index" ]; then
- index=$((index + 1));
- else
- index=0;
- fi
- sudo cryptsetup open $1 immudex_crypt${index};
- sudo mkdir -p /media/${USER}/immudex_crypt${index};
- dmDevice=$(ls -l /dev/mapper/immudex_crypt${index} | awk '{printf $10}' | cut -d "/" -f 2);
- if ! $(sudo file -s /dev/${dmDevice} | grep -q 'ext4'); then
- echo "Could not determine filesystem of unlocked device.";
- echo -n "Format this device to ext4? (y/n): "
- read format;
- if [ "$format" = "y" ]; then
- sudo mkfs.ext4 /dev/mapper/immudex_crypt${index};
- else
- echo "Refuse to mount.";
- sudo cryptsetup close immudex_crypt${index};
- exit 1;
- fi
- fi
- sudo mount /dev/mapper/immudex_crypt${index} /media/${USER}/immudex_crypt${index};
- if [ ! -e /ic${index} ]; then
- sudo ln -s /media/${USER}/immudex_crypt${index} /ic${index};
- fi
- fi
-
-}
-
-function close() {
-
- if [ $# -lt 1 ]; then help; exit 1;
- else
- if [ $1 -ge 0 ] 2> /dev/null; then
- cryptfsName="immudex_crypt${1}";
- elif echo $1 | grep -q 'ic'; then
- cryptfsName="immudex_crypt$(echo $1 | grep -o '[0-9]')";
- else
- cryptfsName=$1;
- fi
- if sudo cryptsetup status /dev/mapper/${cryptfsName} > /dev/null 2>&1; then
- mountPoint=$(df --output=source,target /dev/mapper/${cryptfsName} | tail -1 | awk '{printf $2}');
- if [ "$mountPoint" ] && [ "$mountPoint" != "/dev" ]; then
- sudo umount -R $mountPoint;
- sudo cryptsetup close ${cryptfsName};
- else
- sudo cryptsetup close ${cryptfsName};
- fi
- else
- echo "Given devices isn't opened crypt device or it was closed before";
- fi
- fi
-}
-
-if [ "$1" ]; then
-
- case $1 in
- "list") list;;
- "open") if [ "$2" ]; then open $2;
- else help; exit 1;
- fi;;
- "close") if [ "$2" ]; then close $2;
- else help; exit 1;
- fi;;
- *) help;;
- esac
-else
- help; exit 1;
-fi
+++ /dev/null
-#!/bin/bash
-
-RED="\e[31m";
-GREEN="\e[32m";
-ENDCOLOR="\e[0m";
-
-while [ true ]; do
- echo -e "${RED}This script will install immudex on first disk on your machine.${ENDCOLOR}";
- echo -e "${RED}It could be destructive for data placed on this disk${ENDCOLR}";
- echo -en "${RED}Are you sure that you want contiune? (y/n): ${ENDCOLOR}";
- read ans;
- if [ "$ans" = "y" ]; then break; fi
-done
-
-set -e
-
-function selectDisk() {
- disks=$(lsblk | grep 'disk' | awk '{printf $1" "}');
- if [ $(echo $disks | wc -w) -gt 1 ]; then
- select drive in $disks; do
- echo $drive;
- break;
- done
- else
- echo $disks | awk '{printf $1}';
- fi
-}
-
-if $(sudo efibootmgr > /dev/null 2>&1); then
-#uefi installation
- #partitioning
- echo -n "Installation immudex in EFI mode ... ";
- disk=$(selectDisk);
- originDisk=$disk;
- if [ ! "$disk" ]; then exit 1; fi
-
- sudo dd if=/dev/zero bs=1M of=/dev/$disk count=1 2> /dev/null
-
- sudo parted /dev/$disk mklabel msdos > /dev/null 2>&1;
- sudo parted /dev/$disk mkpart primary 1 101M > /dev/null 2>&1;
- sudo parted /dev/$disk set 1 boot on > /dev/null 2>&1;
- sudo parted /dev/$disk mkpart primary 101M 4G > /dev/null 2>&1;
-
- if $(echo $disk | egrep -qo "mmc|nve"); then disk="${disk}p"; fi
-
- #formatting
- sudo mkfs.vfat -F32 /dev/${disk}1 > /dev/null 2>&1;
- sudo mkfs.ext4 /dev/${disk}2 > /dev/null 2>&1;
-
- #Setting label for partition
- sudo e2label /dev/${disk}2 "immudex" > /dev/null 2>&1;
-
- #mount root partition
- sudo mount /dev/${disk}2 /media > /dev/null 2>&1;
-
- #creating directories for efi partition
- sudo mkdir -p /media/boot/efi > /dev/null 2>&1;
-
- #mount efi partition
- sudo mount /dev/${disk}1 /media/boot/efi > /dev/null 2>&1;
-
- #mount iso image in /mnt directory
- #sudo mount /dev/sr0 /mnt > /dev/null 2>&1;
-
- #copying whole iso image to the second partition
- sudo cp -rvv /run/live/medium/* /media > /dev/null 2>&1;
-
- #removing unnecessary directories from second partition
- sudo rm -rf /media/isolinux > /dev/null 2>&1;
- sudo rm -rf /media/EFI > /dev/null 2>&1;
-
- #GRUB Installation
- if [ -f /usr/lib/live/mount/medium/EFI/BOOT/BOOTIA32.EFI ]; then
- target="i386-efi";
- else
- target="x86_64-efi";
- fi
- sudo grub-install --target=${target} --root-directory=/media --boot-directory=/media/boot --efi-directory=/media/boot/efi --bootloader-id=debian --removable > /dev/null 2>&1;
-
- #Adding entry to EFI Firmware
- sudo efibootmgr -c -d /dev/${originDisk} -p 1 -L "Debian" -l '\EFI\BOOT\grubx64.efi' > /dev/null 2>&1;
-
- #Umount all mounted filesystems
- sudo umount -R /media > /dev/null 2>&1;
-
- if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi
-
-else
-#mbr installation
- echo -n "Installation immudex in BIOS mode ... ";
-
- #partitioning
- disk=$(selectDisk);
- if [ ! "$disk" ]; then exit 1; fi
-
- sudo dd if=/dev/zero bs=1M of=/dev/$disk count=1 2> /dev/null
-
- sudo parted /dev/$disk mklabel msdos > /dev/null 2>&1;
- sudo parted /dev/$disk mkpart primary 1 4G > /dev/null 2>&1;
- sudo parted /dev/$disk set 1 boot on > /dev/null 2>&1;
-
- if $(echo $disk | egrep -qo "mmc|nve"); then disk="${disk}p"; fi
-
- #formatting
- sudo mkfs.ext4 /dev/${disk}1 > /dev/null 2>&1;
-
- #Setting label for partition is necessary for extlinux bootloader
- sudo e2label /dev/${disk}1 "immudex" > /dev/null 2>&1;
-
- #mount partition in /media directory
- sudo mount /dev/${disk}1 /media > /dev/null 2>&1;
-
- #Creating directory for extlinux
- sudo mkdir /media/extlinux > /dev/null 2>&1;
-
- #Instalation extlinux files in abovementioned directory
- sudo extlinux --install /media/extlinux > /dev/null 2>&1;
-
- #mount iso image in /mnt directory
- #sudo mount /dev/sr0 /mnt > /dev/null 2>&1;
-
- #copying live directory from iso image to partition
- sudo cp -rvv /run/live/medium/live /media > /dev/null; 2>&1;
-
- #installation extlinux MBR on first sector of hard drive (whole device)
- sudo dd if=/usr/lib/EXTLINUX/mbr.bin of=/dev/${disk} > /dev/null 2>&1;
-
- #creating extlinux configuration file
- cat > extlinux.conf <<EOF
-default immudex
-label immudex
-kernel /live/vmlinuz
-append quiet initrd=/live/initrd boot=live overlay-size=25% apparmor=1 security=apparmor
-EOF
- sudo cp extlinux.conf /media/extlinux > /dev/null 2>&1;
-
- #Unmounting filesystems
- sudo umount /media > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi
-fi
+++ /dev/null
-#!/bin/bash
-
-set -e
-
-source library.sh
-
-RED="\e[31m";
-GREEN="\e[32m";
-YELLOW="\e[33m";
-ENDCOLOR="\e[0m";
-root="/run/live/medium";
-
-function help() {
- echo "immudex_upgrade - script for searching upgrades and upgrade immudex";
- echo "morketsmerke.net @ 2022";
- echo "Options:";
- echo " --check --print - check there are upgrades for immudex";
- echo " --upgrade - check there are upgrades for immudex and install them.";
- echo " If there is no new version, script will propose refreshing";
- echo " current immudex installation, its helpful when you tried";
- echo " remaster immudex and you get any trouble with this".
-}
-
-function main_upgrade() {
- set -e
- ARCH=$(get_machine_arch);
- BRANCH=$(get_debian_branch);
- rootPart=$(grep "${1}" /etc/mtab | head -1 | awk '{printf $1}');
- sudo mount $rootPart $1 -o remount,rw;
- sudo rm -f ${1}/live/*;
- sudo wget -q https://ftp.morketsmerke.org/immudex/${BRANCH}/upgrades/${2}/${ARCH}/filesystem.squashfs -O ${1}/live/filesystem.squashfs;
- sudo wget -q https://ftp.morketsmerke.org/immudex/${BRANCH}/upgrades/${2}/${ARCH}/initrd -O ${1}/live/initrd;
- sudo wget -q https://ftp.morketsmerke.org/immudex/${BRANCH}/upgrades/${2}/${ARCH}/vmlinuz -O ${1}/live/vmlinuz;
- echo "$2" > /tmp/version;
- sudo cp /tmp/version ${1}/live;
-}
-
-if [ "$1" ] && [ "$1" = "--check" ]; then
- if [ "$2" ] && [ "$2" = "--print" ]; then
- newVersion=$(check_distro_version --print);
- if check_distro_version; then
- echo -e "${YELLOW}New version (${ENDCOLOR}${RED}$newVersion${ENDCOLOR}${YELLOW}) of immudex is available to upgrade.${ENDCOLOR}";
- else
- echo -e "${YELLOW}This (${ENDCOLOR}${GREEN}$newVersion${ENDCOLOR}${YELLOW}) is the latest version of immudex.${ENDCOLOR}";
- fi
- fi
-elif [ "$1" ] && [ "$1" = "--upgrade" ]; then
- newVersionTxt=$(check_distro_version --print);
- newVersionInt=$(echo $newVersionTxt | sed 's/\.//g');
- if check_distro_version; then
- echo -en "${YELLOW}New version "
- echo -en "(${ENDCOLOR}${RED}${newVersionTxt}${ENDCOLOR}${YELLOW}) "
- echo -e "of immudex is available.${ENDCOLOR}";
- echo -e "${RED}Warning, reboot maybe necessary to continue work on this machine${ENDCOLOR}";
- echo -en "${YELLOW}Do you want upgrade this system? (y/n):${ENDCOLOR} ";
- read commit;
- if [ $commit = "y" ]; then
- echo -n "Upgrading immudex to the newest version...";
- main_upgrade $root $newVersionTxt;
- if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi
- else
- exit 1;
- fi
- else
- echo -e "${GREEN}There is no newer version of immudex,${ENDCOLOR}";
- echo -e "${YELLOW}but you can copy fresh system files from latest iso image";
- echo -e "${RED}Warning, reboot maybe necessary to continue work on this machine${ENDCOLOR}";
- echo -en "${YELLOW}Do you want refresh this system? (y/n):${ENDCOLOR} ";
- read commit;
- if [ $commit = "y" ]; then
- echo -n "Refreshing immudex to the latest iso image...";
- main_upgrade $root $newVersionTxt;
- if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi
- else
- exit 1;
- fi
- exit 0;
- fi
-else
- help;
- exit 1;
-fi
+++ /dev/null
-#!/bin/bash
-
-if [ -f ~/public.gpg ] && [ -f ~/private.gpg ]; then
- gpg --import ~/public.gpg
- gpg --import ~/private.gpg
- userId=$(gpg --list-keys | sed -nr 's/.+<(.*)>$/\1/p');
- gpg --edit-key $userId;
-fi
+++ /dev/null
-#!/bin/bash
-
-function get_debian_branch() {
- if grep -q '\/sid' /etc/os-release; then
- echo "testing";
- else
- echo "stable";
- fi
-}
-
-function get_machine_arch() {
- arch=$(uname -m);
- if [ "$arch" = "i686" ]; then
- echo "32";
- else
- echo "64";
- fi
-}
-
-function check_distro_version() {
- set -e
- root="/run/live/medium";
- if [ -d ${root}/live ]; then
- if [ -f ${root}/live/version ]; then
- version=$(cat ${root}/live/version | sed 's/\.//g');
- else version="000";
- fi
- BRANCH=$(get_debian_branch);
- ARCH=$(get_machine_arch);
- if [ ! -f /tmp/ltver ]; then
- wget -q https://ftp.morketsmerke.org/immudex/${BRANCH}/upgrades/latest/${ARCH}/version -O /tmp/ltver;
- fi
- if [ ! -s /tmp/ltver ]; then sudo rm /tmp/ltver; return 255; fi;
- newVersionTxt=$(cat /tmp/ltver);
- newVersionInt=$(echo $newVersionTxt | sed 's/\.//g');
- if [ $version -lt $newVersionInt ]; then
- exitcode=0;
- else
- exitcode=1;
- fi
- else
- exitcode=255;
- fi
- if [ "$1" ] && [ "$1" = "--print" ]; then
- echo $newVersionTxt;
- return 0;
- fi
- return $exitcode;
-}
+++ /dev/null
-#!/bin/bash
-
-function help() {
- echo "======================================================================";
- echo "morketsmerke - script for fetch and adjust morketsmerke.net site";
- echo "as offline available source of information.";
- echo "morketsmerke.net COPYLEFT @ 2022";
- echo;
- echo "Options:";
- echo " --browser - launching fetched site in default application for open"
- echo " html sites";
- echo " -[-]<any_other_chars_or_strings> - print this message";
- echo "By default script open downloaded site in terminal via W3M browser with";
- echo "monochrome mode";
- echo;
- echo "Usage:";
- echo " $ morketsmerke [--browser]";
-}
-
-function R() {
-
- if [ "$path" ]; then path=${path}/${1};
- else path=$1;
- fi
-
- fileList=$(ls $path);
- for file in $fileList; do
- if [ -d ${path}/${file} ]; then R ${file};
- else
- sed -i 's@https://morketsmerke.github.io/@/usr/share/doc/morketsmerke/index.html@' ${path}/${file};
- sed -i 's@https://morketsmerke.github.io@/usr/share/doc/morketsmerke/index.html@' ${path}/${file};
- sed -i 's@/style.css@/usr/share/doc/morketsmerke/style.css@' ${path}/${file};
- fi
- done
- path=$(echo $path | sed "s@/$1@@")
-
-}
-
-function install_morketsmerke() {
-
- if [ -d morketsmerke.github.io ]; then rm -rf morketsmerke.github.io; fi
- if [ ! -d morketsmerke.github.io ]; then
- git clone https://github.com/morketsmerke/morketsmerke.github.io;
- else
- exit 1;
- fi
-
- R morketsmerke.github.io
-
- if [ -d /usr/share/doc/morketsmerke ]; then
- sudo rm -rf /usr/share/doc/morketsmerke;
- fi
-
- sudo mv morketsmerke.github.io /usr/share/doc/morketsmerke
-
-}
-
-/usr/bin/ping -c 1 wp.pl >> /dev/null 2>&1;
-if [ $? -eq 0 ]; then install_morketsmerke; fi
-
-morketsmerke_path=/usr/share/doc/morketsmerke;
-
-if [ "$1" ] && [ "$1" = "--browser" ]; then
- xdg-open ${morketsmerke_path}/index.html;
-elif [ "$1" ]; then
- help;
- exit 1;
-else
- w3m -M ${morketsmerke_path}/index.html;
-fi
+++ /dev/null
-#!/bin/bash
-
-/usr/bin/figlet immudex;
-echo;
-echo "Today is: $(date)";
-echo;
-echo "System summary: ";
-cpuIdle=$(vmstat | tail -1 | awk '{printf $15}');
-cpuUsage=$((100 - $cpuIdle));
-echo -e " \tCPU: ${cpuUsage}%";
-echo -e " \tMEM: $(free -h | sed -n '2p' | awk '{printf $7}' | sed 's/i//') Free";
-if $(df -h 2> /dev/null | grep -q '/dev/mapper'); then
- i=1;
- echo -e " \tCRYPT_PARTi: Free/Total (Usage%)";
- amountOfDisks=$(df -h 2> /dev/null | grep '/dev/mapper' | wc -l | awk '{printf $1}');
- while [ $i -le $amountOfDisks ]; do
- diskSize=$(df -h 2> /dev/null | grep '/dev/mapper' | sed -n "${i}p" | awk '{printf $2}');
- diskFree=$(df -h 2> /dev/null | grep '/dev/mapper' | sed -n "${i}p" | awk '{printf $4}');
- diskUsage_perc=$(df -h 2> /dev/null | grep '/dev/mapper' | sed -n "${i}p" | sed 's/%//' | awk '{printf $5}');
- #FCP = First Crypt Partition
- echo -e " \tCRYPT_PART${i}: ${diskFree}/${diskSize} (${diskUsage_perc}%)";
- i=$((i + 1));
- done
-else
- echo -e " \tCRYPT_PART: N/A";
-fi
-echo -e " \tPROCESSES: $(ps -aux | wc -l | awk '{printf $1}')";
-utime=$(uptime | awk '{printf $3}' | sed 's/,//');
-if $(echo $utime | grep -q ":"); then
- echo -e " \tUPTIME: ${utime}";
-else
- echo -e " \tUPTIME: 0:${utime}";
-fi
-echo -e " \t$(uptime | grep -o "load.*$" | tr [a-z] [A-Z])";
-echo;
-echo -e "morketsmerke.org @ 2023 https://github.com/xf0r3m/immudex";
-echo;
-#/usr/local/bin/immudex_upgrade --check --print;
-#if [ $? -ne 0 ]; then
-# echo -e "\e[31mThere is no internet connection or internal error.\e[0m";
-# if [ -f /tmp/feed.xml ] && [ ! -s /tmp/feed.xml ]; then
-# rm -f /tmp/feed.xml;
-# fi
-#else
-# if [ "$USER" = "xf0r3m" ]; then
-# sudo apt update > /tmp/update.log 2>&1 && tail -1 /tmp/update.log;
-# fi
-#fi
-echo "====================================================================";
+++ /dev/null
-#!/bin/bash
-
-function help() {
- echo "newsfeed - fetch and browse news feed from rss and atom channels";
- echo "morketsmerke.net; COPYLEFT @ 2022";
- echo;
- echo "Options:";
- echo " --list - shows numbered list of names, saved in ~/.newsfeed names and";
- echo " URL of rss channels";
- echo " --check - fetching new rss channel file from source";
- echo " --show <number_of_channel> - shows numbered list of news titles.";
- echo " Number of channel you can get from --list option.";
- echo " --open <number_of_title> - open web browser on link, which are under";
- echo " titles of news on rss channel. Number of title you can get";
- echo " from --show option. This option based on the last showed rss";
- echo " channel feed.";
- echo;
- echo "The ~/.newsfeed file:";
- echo " This file is simple csv (semicolon separated values) file which";
- echo " store rss channels in one line. One by one. The one line";
- echo " contains: name and URL of rss feed. For example:";
- echo;
- echo " News Feed;https://newsfeed.example.org/rss";
-}
-if [ ! -s ~/.newsfeed ]; then
- help;
- exit 1;
-else
- if [ ! "$1" ] || ([ "$1" != "--list" ] && \
- [ "$1" != "--check" ] && \
- [ "$1" != "--show" ] && \
- [ "$1" != "--open" ]); then
- help;
- exit 1;
- fi
- amountOfSubscriptions=$(cat ~/.newsfeed | wc -l);
- i=1;
- while [ $i -le $amountOfSubscriptions ]; do
- newsfeedLine=$(sed -n "${i}p" ~/.newsfeed);
- nameOfSubscription=$(echo $newsfeedLine | cut -d ";" -f 1);
- rssLink=$(echo $newsfeedLine | cut -d ";" -f 2);
- if [ "$1" ] && [ "$1" = "--list" ]; then
- echo -e "${i}. ${nameOfSubscription}";
- elif [ "$1" ] && [ "$1" = "--check" ]; then
- echo -e "${i}. ${nameOfSubscription}";
- echo -n "Getting news feed...";
- wget $rssLink -O /tmp/new_newsfeed_${i}.xml 2>/dev/null;
- if [ $? -eq 0 ]; then echo "[ OK ]";
- else echo -e "\nThere is no Internet connection"; exit 1; fi
- if [ -s /tmp/newsfeed_${i}.xml ]; then
- amountOfNewNewses=$(diff /tmp/new_newsfeed_${i}.xml /tmp/newsfeed_${i}.xml | grep '<title>' | wc -l);
- if [ $amountOfNewNewses -gt 0 ]; then
- notify-send "$nameOfSubscription" "New $amountOfNewNewses newses" --icon=/usr/share/icons/rss.png;
- j=1;
- sleep 1;
- while [ $j -le $amountOfNewNewses ]; do
- news=$(diff /tmp/new_newsfeed_${i}.xml /tmp/newsfeed_${i}.xml | \
- grep '<title>' | sed -n "${j}p" | sed 's/<title>//' | \
- sed 's/<\/title>//' | sed 's/[<>]//' | \
- sed 's/^[[:space:]]*//g');
- notify-send "newsfeed" "${nameOfSubscription}: ${news}" -t 10000 --icon=/usr/share/icons/rss.png;
- sleep 1;
- j=$((j + 1));
- done
- fi
- mv /tmp/new_newsfeed_${i}.xml /tmp/newsfeed_${i}.xml;
- else
- mv /tmp/new_newsfeed_${i}.xml /tmp/newsfeed_${i}.xml;
- amountOfNews=$(grep '<title>' /tmp/newsfeed_${i}.xml | sed -n '2,$p' | wc -l);
- if [ $amountOfNews -eq 0 ]; then
- compressed=1;
- amountOfNews=$(sed 's/<\/title>/\n/g' /tmp/newsfeed_${i}.xml | sed 's/<item>/\n/g' | grep '<title>' | wc -l)
- fi
- notify-send "$nameOfSubscription" "New $amountOfNews newses" --icon=/usr/share/icons/rss.png;
- fi
- fi
- i=$((i + 1));
- done
- if [ "$1" ] && [ "$1" = "--show" ] && [ "$2" ] && [ $2 -gt 0 ]; then
-
- #Parsing
- #Thanks to the linuxhint.com for command:
- #sed 's/^[[:space]]*//g'
- #https://linuxhint.com/trim_string_bash
-
- if grep -q 'CDATA' /tmp/newsfeed_${2}.xml; then
- sed 's/<\/title>/\n/g' /tmp/newsfeed_${2}.xml | \
- sed 's/<item>/\n/g' | grep '<title>' | sed -n '2,$p' | \
- sed 's/<title>//' | sed 's/"/"/g' | \
- sed 's/<!\[CDATA\[//g' | sed 's/\]\]>//g' | \
- sed 's/^[[:space:]]*//g' | nl | less;
- else
- sed 's/<\/title>/\n/g' /tmp/newsfeed_${2}.xml | \
- sed 's/<item>/\n/g' | grep '<title>' | sed -n '2,$p' | \
- sed 's/<title>//' | sed 's/"/"/g' | \
- sed 's/^[[:space:]]*//g' | nl | less;
- fi
- echo $2 > /tmp/lastShowedNewsFeed;
- elif [ "$1" ] && [ "$1" = "--open" ] && [ "$2" ] && [ $2 -gt 0 ]; then
- subscriptionNumber=$(cat /tmp/lastShowedNewsFeed);
- if ! grep -q 'CDATA' /tmp/newsfeed_${subscriptionNumber}.xml; then
- link=$(sed 's/<\/link>/\n/g' /tmp/newsfeed_${subscriptionNumber}.xml | sed 's/<\/title>/\n/g' | grep '<link>' | sed -n '2,$p' | sed 's/<link>//g' | sed -n "${2}p")
- else
- link=$(sed 's/<\/link>/\n/g' /tmp/newsfeed_${subscriptionNumber}.xml | sed 's/<\/description>/\n/g' | grep '<link>' | sed -n '2,$p' | sed 's/<link>//g' | sed -n "${2}p")
- fi
- exo-open --launch WebBrowser "$link";
- fi
-fi
+++ /dev/null
-#!/bin/bash
-
-source library.sh;
-
-if [ "$1" ]; then
- case $1 in
- "distro") if check_distro_version; then
- msg=$(check_distro_version --print);
- notify-send -i software-update-urgent "Distribution update" "New version (${msg}) of immudex is available to upgrade.";
- else
- msg=$(check_distro_version --print);
- notify-send -i apply "Distribution update" "This (${msg}) is the latest version of immudex.";
- fi;;
- "packages") msg=$(sudo apt update > /tmp/update.log 2>&1 && tail -1 /tmp/update.log;);
- notify-send -i software-update-available "Packages update" "$msg";;
- esac
-fi
-
+++ /dev/null
-#!/bin/bash
-
-launcher="/home/${USER}/Pulpit/Padlock.desktop";
-
-function main_unlock() {
- /usr/local/bin/immudex_crypt open $1;
- index=$(basename $(/usr/local/bin/immudex_crypt list | grep "$1" | head -1 | awk '{printf $2}' | grep -o '[0-9]'));
- #sudo mkdir -p /media/${USER}/$devName;
- #sudo mount /dev/mapper/$devName /media/${USER}/$devName;
-
- xfce4-terminal --default-working-directory=/ic${index};
- #sed -i 's/prevent/allow/' ${launcher};
- sudo rm /usr/share/icons/padlock-icon.png;
- sudo ln -s /usr/share/icons/changes-allow.png /usr/share/icons/padlock-icon.png;
-
-}
-
-function unlock() {
-
- cryptParts=$(sudo blkid | grep 'LUKS' | sed 's/://g' | awk '{printf $1" "}');
- if [ "$cryptParts" ]; then
- if [ $(echo $cryptParts | wc -w) -gt 1 ]; then
- select cryptPart in $cryptParts; do
- main_unlock $cryptPart;
- break;
- done
- else
- main_unlock $cryptParts;
- fi
- else
- echo -e "\e[31mThere is no LUKS partition to open.\e[0m";
- sleep 3;
- fi
-}
-
-function lock() {
-
- mapperDeviceList=$(ls /dev/mapper --hide=control | awk '{printf $1" "}');
-
- if [ "$mapperDeviceList" ]; then
- for dmDevice in $mapperDeviceList; do
- if sudo cryptsetup status /dev/mapper/${dmDevice} > /dev/null 2>&1; then
- mountPoint=$(df --output=source,target /dev/mapper/${dmDevice} | tail -n 1 | awk '{printf $2}');
- if [ "$mountPoint" ]; then
- if $(sudo lsof $mountPoint > /dev/null 2>&1); then
- notify-send "Padlock" "The /dev/mapper/${dmDevice} cannot be unmount, because there are opened file or running proceses." --icon=dialog-error;
- else
- sudo umount $mountPoint;
- if [ $? -ne 0 ]; then
- notify-send "Padlock" "The /dev/mapper/${dmDevice} cannot be unmount, because there are other filesystem is mounted in." --icon=dialog-error;
- fi
- sudo cryptsetup close /dev/mapper/${dmDevice};
- fi
- else
- sudo cryptsetup close /dev/mapper/${dmDevice};
- fi
- fi
- done
- fi
- if ! $(df -h | grep -q '/dev/mapper'); then
- #sed -i 's/allow/prevent/' ${launcher};
- sudo rm /usr/share/icons/padlock-icon.png;
- sudo ln -s /usr/share/icons/changes-prevent.png /usr/share/icons/padlock-icon.png;
- fi
-}
-
-mapperDeviceList=$(ls /dev/mapper --hide=control | awk '{printf $1" "}');
-
-if [ "$mapperDeviceList" ]; then lock;
-else unlock;
-fi
+++ /dev/null
-#!/bin/bash
-
-if [ ! -d /tmp/${USER} ]; then
- mkdir /tmp/${USER}
- cp -prvv /home/${USER}/.mozilla /tmp/${USER}
-fi
-
-eth0=$(ip route show | grep 'default' | awk '{printf $5}');
-firejail --private=/tmp/${USER} --net=$eth0 /usr/bin/firefox
+++ /dev/null
-#!/bin/bash
-
-GREEN="\e[32m";
-YELLOW="\e[33m";
-BLUE="\e[34m";
-ENDCOLOR="\e[0m";
-
-function help() {
- echo "ytplay - script which could play a video or audio track from youtube";
- echo "morketsmerke.net COPYLEFT @ 2022";
- echo "Options:";
- echo " -s - search given keyword on youtube.";
- echo " -v - play youtube video."
- echo " -a - play only youtube video audiotrack";
- echo "Ommiting -s option, assume you are give a yt video link.";
- echo "You have to put -v or -a before you paste a yt video link";
- echo "When you put keywords in -s option, you need to choose";
- echo "that you want listening an audiotrack (-a) oraz watch video (-v)";
- echo "Usage:";
- echo " $ ytplay -s -a [-f ytdl-format] 'lofi'";
- echo " $ ytplay -v https://youtube.com/watch?v=... [-f ytdl-format]";
- echo " $ ytplay -a https://youtube.com/watch?v=... [-f ytdl-format]";
- echo "You can search again the same keywords puting 'r' or 'R' instead";
- echo "of video numer";
-}
-
-function yt_search() {
- query=$(echo $* | sed 's/ /+/g');
- echo -n "Getting youtube site with search results...";
- wget https://youtube.com/results?search_query=$query -O /tmp/yt.html 2> /dev/null
- if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi
-
- sed -i 's/,/\n/g' /tmp/yt.html;
-
- listOfVideos=$(grep -n '^{\"url' /tmp/yt.html | cut -d ":" -f 1 | awk '{printf $1" "}');
-
- numberOfListElements=$(echo $listOfVideos | wc -w);
- i=1;
- lp=1;
- while [ $i -le $numberOfListElements ]; do
- if [ $i -eq $numberOfListElements ]; then
- ln1=$(echo $listOfVideos | cut -d " " -f $i);
- ln2='$';
- else
- j=$((i + 1));
- ln1=$(echo $listOfVideos | cut -d " " -f $i);
- ln2=$(echo $listOfVideos | cut -d " " -f $j);
- fi
- #if sed -n "${ln1},${ln2}p" /tmp/yt.html | grep -q '"iconType":"LIVE"'; then
- # i=$((i + 1)); continue;
- #else
- title=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'title' | head -1 | cut -d '"' -f 8);
- channel=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'ownerText' | head -1 | cut -d '"' -f 8);
- duration=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'simpleText' | sed -n '2p' | cut -d '"' -f 4);
- if [ "$duration" = "simpleText" ]; then duration="\e[31mLive\e[0m"; fi
- videoid=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'videoId' | sed -n '2p' | cut -d '"' -f 4);
- if [ "$title" ] && [ "$channel" ] && [ "$duration" ] && [ "$videoid" ] && [ "$duration" != "SHORTS" ]; then
- echo -e "${lp}. ${GREEN}${title}${ENDCOLOR}";
- echo -e " Channel: ${YELLOW}${channel}${ENDCOLOR} Duration: ${BLUE}${duration}${ENDCOLOR}";
- echo "${lp},${videoid},${title},${channel},${duration}" >> /tmp/yt.csv;
- else
- i=$((i + 1)); continue;
- fi
- #fi
- i=$((i + 1));
- lp=$((lp + 1));
- done
-}
-
-if [ "$1" ]; then
- if [ "$1" = "-a" ] || [ "$1" = "-v" ]; then
- mode=$1;
- shift;
- link=$(echo $1 | sed 's@https://@@');
- if [ $# -gt 1 ]; then
- shift;
- if [ "$1" = "-f" ]; then
- shift;
- if [ "$mode" = "-a" ]; then
- format="--ytdl-format=bestaudio";
- else
- format="--ytdl-format=${1}";
- fi
- fi
- fi
- elif [ "$1" = "-s" ]; then
- if [ -f /tmp/yt.html ]; then rm /tmp/yt.html; fi
- if [ -f /tmp/yt.csv ]; then rm /tmp/yt.csv; fi
-
- shift;
- mode=$1;
- if ! ([ "$mode" = "-v" ] || [ "$mode" = "-a" ]); then help; exit 1; fi
- shift;
- if [ "$1" = "-f" ]; then
- shift;
- if [ "$mode" = "-a" ]; then
- format="--ytdl-format=bestaudio";
- else
- format="--ytdl-format=${1}";
- fi
- fi
- while [ true ]; do
- yt_search $*;
- echo -n "Put number of which video you want to hear/watch: ";
- read numberOfVideo;
- if [[ $numberOfVideo -gt 0 ]]; then break;
- elif [ "$numberOfVideo" = "r" ] || [ "$numberOfVideo" = "R" ]; then
- continue;
- else
- help;
- exit 1;
- fi
- done
- title=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 3);
- channel=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 4);
- duration=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 5);
- videoId=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 2);
- clear;
- echo -e "Title: ${GREEN}${title}${ENDCOLOR}";
- echo -e "Channel: ${YELLOW}${channel}${ENDCOLOR} Duration: ${BLUE}${duration}${ENDCOLOR}";
- echo "====================================================================";
- link=${videoId};
- else
- help;
- exit 1;
- fi
-
- if [ "$mode" = "-a" ]; then
- if [ ! "$format" ]; then format="--ytdl-format=bestaudio"; fi
- mpv ${format} ytdl://${link};
- elif [ "$mode" = "-v" ]; then mpv ${format} ytdl://${link}; fi
-else
- help;
- exit 1;
-fi
+++ /dev/null
-#!/bin/bash
-
-GREEN="\e[32m";
-YELLOW="\e[33m";
-BLUE="\e[34m";
-ENDCOLOR="\e[0m";
-
-function help() {
- echo "ytplay - script which could play a video or audio track from youtube";
- echo "morketsmerke.net COPYLEFT @ 2022";
- echo "Options:";
- echo " -s - search given keyword on youtube.";
- echo " -v - play youtube video."
- echo " -a - play only youtube video audiotrack";
- echo "Ommiting -s option, assume you are give a yt video link.";
- echo "You have to put -v or -a before you paste a yt video link";
- echo "When you put keywords in -s option, you need to choose";
- echo "that you want listening an audiotrack (-a) oraz watch video (-v)";
- echo "Usage:";
- echo " $ ytplay -s -a [-f ytdl-format] 'lofi'";
- echo " $ ytplay -v https://youtube.com/watch?v=... [-f ytdl-format]";
- echo " $ ytplay -a https://youtube.com/watch?v=... [-f ytdl-format]";
- echo "You can search again the same keywords puting 'r' or 'R' instead";
- echo "of video numer";
-}
-
-function yt_search() {
- query=$(echo $* | sed 's/ /+/g');
- echo -n "Getting youtube site with search results...";
- wget https://youtube.com/results?search_query=$query -O /tmp/yt.html 2> /dev/null
- if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi
-
- sed -i 's/,/\n/g' /tmp/yt.html;
-
- listOfVideos=$(grep -n '^{\"url' /tmp/yt.html | cut -d ":" -f 1 | awk '{printf $1" "}');
-
- numberOfListElements=$(echo $listOfVideos | wc -w);
- i=1;
- lp=1;
- while [ $i -le $numberOfListElements ]; do
- if [ $i -eq $numberOfListElements ]; then
- ln1=$(echo $listOfVideos | cut -d " " -f $i);
- ln2='$';
- else
- j=$((i + 1));
- ln1=$(echo $listOfVideos | cut -d " " -f $i);
- ln2=$(echo $listOfVideos | cut -d " " -f $j);
- fi
- #if sed -n "${ln1},${ln2}p" /tmp/yt.html | grep -q '"iconType":"LIVE"'; then
- # i=$((i + 1)); continue;
- #else
- title=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'title' | head -1 | cut -d '"' -f 8);
- channel=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'ownerText' | head -1 | cut -d '"' -f 8);
- duration=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'simpleText' | sed -n '2p' | cut -d '"' -f 4);
- if [ "$duration" = "simpleText" ]; then duration="\e[31mLive\e[0m"; fi
- videoid=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'videoId' | sed -n '2p' | cut -d '"' -f 4);
- if [ "$title" ] && [ "$channel" ] && [ "$duration" ] && [ "$videoid" ] && [ "$duration" != "SHORTS" ]; then
- echo -e "${lp}. ${GREEN}${title}${ENDCOLOR}";
- echo -e " Channel: ${YELLOW}${channel}${ENDCOLOR} Duration: ${BLUE}${duration}${ENDCOLOR}";
- echo "${lp},${videoid},${title},${channel},${duration}" >> /tmp/yt.csv;
- else
- i=$((i + 1)); continue;
- fi
- #fi
- i=$((i + 1));
- lp=$((lp + 1));
- done
-}
-
-if [ "$1" ]; then
- if [ "$1" = "-a" ] || [ "$1" = "-v" ]; then
- mode=$1;
- shift;
- link=$(echo $1 | sed 's@https://@@');
- if [ $# -gt 1 ]; then
- shift;
- if [ "$1" = "-f" ]; then
- shift;
- if [ "$mode" = "-a" ]; then
- format="--no-video --ytdl-format=${1}";
- else
- format="--ytdl-format=${1}";
- fi
- fi
- fi
- elif [ "$1" = "-s" ]; then
- if [ -f /tmp/yt.html ]; then rm /tmp/yt.html; fi
- if [ -f /tmp/yt.csv ]; then rm /tmp/yt.csv; fi
-
- shift;
- mode=$1;
- if ! ([ "$mode" = "-v" ] || [ "$mode" = "-a" ]); then help; exit 1; fi
- shift;
- if [ "$1" = "-f" ]; then
- shift;
- if [ "$mode" = "-a" ]; then
- format="--no-video --ytdl-format=${1}";
- else
- format="--ytdl-format=${1}";
- fi
- fi
- while [ true ]; do
- yt_search $*;
- echo -n "Put number of which video you want to hear/watch: ";
- read numberOfVideo;
- if [[ $numberOfVideo -gt 0 ]]; then break;
- elif [ "$numberOfVideo" = "r" ] || [ "$numberOfVideo" = "R" ]; then
- continue;
- else
- help;
- exit 1;
- fi
- done
- title=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 3);
- channel=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 4);
- duration=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 5);
- videoId=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 2);
- clear;
- echo -e "Title: ${GREEN}${title}${ENDCOLOR}";
- echo -e "Channel: ${YELLOW}${channel}${ENDCOLOR} Duration: ${BLUE}${duration}${ENDCOLOR}";
- echo "====================================================================";
- link=${videoId};
- else
- help;
- exit 1;
- fi
-
- if [ "$mode" = "-a" ]; then
- if [ ! "$format" ]; then format="--ytdl-format=bestaudio"; fi
- mpv ${format} ytdl://${link};
- elif [ "$mode" = "-v" ]; then mpv ${format} ytdl://${link}; fi
-else
- help;
- exit 1;
-fi
+++ /dev/null
-#!/bin/bash
-
-function get_debian_branch() {
- if grep -q 'bookworm' /etc/os-release; then
- echo "testing";
- else
- echo "stable";
- fi
-}
-
-function get_machine_arch() {
- arch=$(uname -m);
- if [ "$arch" = "i686" ]; then
- echo "32";
- else
- echo "64";
- fi
-}
-
-function check_distro_version() {
- set -e
- root="/run/live/medium";
- if [ -d ${root}/live ]; then
- if [ -f ${root}/live/version ]; then
- version=$(cat ${root}/live/version | sed 's/\.//g');
- else version="000";
- fi
- BRANCH=$(get_debian_branch);
- ARCH=$(get_machine_arch);
- if [ ! -f /tmp/ltver ]; then
- wget -q https://ftp.morketsmerke.org/immudex/${BRANCH}/upgrades/latest/${ARCH}/version -O /tmp/ltver;
- fi
- if [ ! -s /tmp/ltver ]; then sudo rm /tmp/ltver; return 255; fi;
- newVersionTxt=$(cat /tmp/ltver);
- newVersionInt=$(echo $newVersionTxt | sed 's/\.//g');
- if [ $version -lt $newVersionInt ]; then
- exitcode=0;
- else
- exitcode=1;
- fi
- else
- exitcode=255;
- fi
- if [ "$1" ] && [ "$1" = "--print" ]; then
- echo $newVersionTxt;
- return 0;
- fi
- return $exitcode;
-}
+++ /dev/null
-#!/bin/bash
-
-export HOME=/ic0;
-thunderbird;
+++ /dev/null
-#!/bin/bash
-
-function help() {
-
- echo "immudex_crypt - script used for listing, open and close crypt_LUKS ppartitions";
- echo "morketsmerke.org COPYLEFT @ 2023";
- echo "Options:";
- echo " list - displaing list of opened and available crypt_LUKS devices";
- echo " create - formatting device for crypt_LUKS";
- echo " open - opening crypt_LUKS device, after this device is ready to mount";
- echo " close - unmount and closing crypt_LUKS devices";
- echo "Using:";
- echo "$ immudex_crypt list";
- echo "$ immudex_crypt create <disk partition>";
- echo "$ immudex_crypt open <crypt_LUKS device>";
- echo "$ immudex_crypt close immudex_crypt[0-9] | ic[0-9] | [0-9]";
-}
-
-function list() {
-
- mapperDeviceList=$(ls /dev/mapper --hide=control | awk '{printf $1" "}');
-
- echo "==============================================================";
- echo -e "Opened devices:";
- echo "==============================================================";
- echo -e "Device:\t\tMapper name:\t\tMount point:";
-
- if [ "$mapperDeviceList" ]; then
- for dmDevice in $mapperDeviceList; do
- if sudo cryptsetup status /dev/mapper/${dmDevice} > /dev/null 2>&1; then
- mountPoint=$(df --output=source,target /dev/mapper/${dmDevice} | tail -n 1 | awk '{printf $2}');
- device=$(sudo cryptsetup status /dev/mapper/${dmDevice} | grep "device" | awk '{printf $2}');
- if [ "$mountPoint" ] && [ "$mountPoint" != "/dev" ]; then
- echo -e "$device\t /dev/mapper/${dmDevice}\t$mountPoint";
- else
- echo -e "$device\t /dev/mapper/${dmDevice}\tNot mounted";
- fi
- fi
- done
- else
- echo -e "No opened crypt devices was found";
- fi
- echo "==============================================================";
-
- luksDevicesList=$(sudo blkid | grep 'LUKS' | cut -d ":" -f 1 | awk '{printf $1" "}');
-
- echo "==============================================================";
- echo -e "crypt_LUKS devices:";
- echo "==============================================================";
- echo -e "Device:\t\tMapper name:\t\tMount point:";
-
- if [ "$luksDevicesList" ]; then
- for lDevice in $luksDevicesList; do
- echo -e "$lDevice";
- done
- else
- echo "No crypt device was found";
- fi
- echo "==============================================================";
-}
-
-function open() {
-
- if [ $# -lt 1 ]; then help; exit 1;
- else
- index=$(ls --hide=control /dev/mapper | grep "immudex_crypt" | grep -o "[0-9]*$"| tail -1);
- if [ "$index" ]; then
- index=$((index + 1));
- else
- index=0;
- fi
- sudo cryptsetup open $1 immudex_crypt${index};
- sudo mkdir -p /media/${USER}/immudex_crypt${index};
- dmDevice=$(ls -l /dev/mapper/immudex_crypt${index} | awk '{printf $10}' | cut -d "/" -f 2);
- if ! $(sudo file -s /dev/${dmDevice} | grep -q 'ext4'); then
- echo "Could not determine filesystem of unlocked device.";
- echo -n "Format this device to ext4? (y/n): "
- read format;
- if [ "$format" = "y" ]; then
- sudo mkfs.ext4 /dev/mapper/immudex_crypt${index};
- else
- echo "Refuse to mount.";
- sudo cryptsetup close immudex_crypt${index};
- exit 1;
- fi
- fi
- sudo mount /dev/mapper/immudex_crypt${index} /media/${USER}/immudex_crypt${index};
- if [ ! -e /ic${index} ]; then
- sudo ln -s /media/${USER}/immudex_crypt${index} /ic${index};
- fi
- fi
-
-}
-
-function close() {
-
- if [ $# -lt 1 ]; then help; exit 1;
- else
- if [ $1 -ge 0 ] 2> /dev/null; then
- cryptfsName="immudex_crypt${1}";
- elif echo $1 | grep -q 'ic'; then
- cryptfsName="immudex_crypt$(echo $1 | grep -o '[0-9]')";
- else
- cryptfsName=$1;
- fi
- if sudo cryptsetup status /dev/mapper/${cryptfsName} > /dev/null 2>&1; then
- mountPoint=$(df --output=source,target /dev/mapper/${cryptfsName} | tail -1 | awk '{printf $2}');
- if [ "$mountPoint" ] && [ "$mountPoint" != "/dev" ]; then
- sudo umount -R $mountPoint;
- sudo cryptsetup close ${cryptfsName};
- else
- sudo cryptsetup close ${cryptfsName};
- fi
- else
- echo "Given devices isn't opened crypt device or it was closed before";
- fi
- fi
-}
-
-function create() {
- if [ $# -lt 1 ]; then help; exit 1;
- else
- sudo cryptsetup -y -v luksFormat $1;
- fi
-}
-
-if [ "$1" ]; then
-
- case $1 in
- "list") list;;
- "open") if [ "$2" ]; then open $2;
- else help; exit 1;
- fi;;
- "close") if [ "$2" ]; then close $2;
- else help; exit 1;
- fi;;
- "create") if [ "$2" ]; then create $2 && open $2;
- else help; exit 1;
- fi;;
- *) help;;
- esac
-else
- help; exit 1;
-fi
+++ /dev/null
-#!/bin/bash
-
-RED="\e[31m";
-GREEN="\e[32m";
-ENDCOLOR="\e[0m";
-
-while [ true ]; do
- echo -e "${RED}This script will install immudex on first disk on your machine.${ENDCOLOR}";
- echo -e "${RED}It could be destructive for data placed on this disk${ENDCOLR}";
- echo -en "${RED}Are you sure that you want contiune? (y/n): ${ENDCOLOR}";
- read ans;
- if [ "$ans" = "y" ]; then break;
- elif [ "$ans" = "n" ]; then exit 1;
- fi
-done
-
-set -e
-
-function selectDisk() {
- disks=$(lsblk | grep 'disk' | awk '{printf $1" "}');
- if [ $(echo $disks | wc -w) -gt 1 ]; then
- select drive in $disks; do
- echo $drive;
- break;
- done
- else
- echo $disks | awk '{printf $1}';
- fi
-}
-
-if $(sudo efibootmgr > /dev/null 2>&1); then
-#uefi installation
- #partitioning
- echo -n "Installation immudex in EFI mode ... ";
- disk=$(selectDisk);
- originDisk=$disk;
- if [ ! "$disk" ]; then exit 1; fi
-
- sudo dd if=/dev/zero bs=1M of=/dev/$disk count=1 2> /dev/null
-
- sudo parted /dev/$disk mklabel msdos > /dev/null 2>&1;
- sudo parted /dev/$disk mkpart primary 1 101M > /dev/null 2>&1;
- sudo parted /dev/$disk set 1 boot on > /dev/null 2>&1;
- sudo parted /dev/$disk mkpart primary 101M 4G > /dev/null 2>&1;
-
- if $(echo $disk | egrep -qo "mmc|nvme"); then disk="${disk}p"; fi
-
- #formatting
- sudo mkfs.vfat -F32 /dev/${disk}1 > /dev/null 2>&1;
- sudo mkfs.ext4 /dev/${disk}2 > /dev/null 2>&1;
-
- #Setting label for partition
- sudo e2label /dev/${disk}2 "immudex" > /dev/null 2>&1;
-
- #mount root partition
- sudo mount /dev/${disk}2 /media > /dev/null 2>&1;
-
- #creating directories for efi partition
- sudo mkdir -p /media/boot/efi > /dev/null 2>&1;
-
- #mount efi partition
- sudo mount /dev/${disk}1 /media/boot/efi > /dev/null 2>&1;
-
- #mount iso image in /mnt directory
- #sudo mount /dev/sr0 /mnt > /dev/null 2>&1;
-
- #copying whole iso image to the second partition
- sudo cp -rvv /run/live/medium/* /media > /dev/null 2>&1;
-
- #removing unnecessary directories from second partition
- sudo rm -rf /media/isolinux > /dev/null 2>&1;
- sudo rm -rf /media/EFI > /dev/null 2>&1;
-
- #GRUB Installation
- if [ -f /usr/lib/live/mount/medium/EFI/BOOT/BOOTIA32.EFI ]; then
- target="i386-efi";
- else
- target="x86_64-efi";
- fi
- sudo grub-install --target=${target} --root-directory=/media --boot-directory=/media/boot --efi-directory=/media/boot/efi --bootloader-id=debian --removable > /dev/null 2>&1;
-
- #Adding entry to EFI Firmware
- sudo efibootmgr -c -d /dev/${originDisk} -p 1 -L "Debian" -l '\EFI\BOOT\grubx64.efi' > /dev/null 2>&1;
-
- #Umount all mounted filesystems
- sudo umount -R /media > /dev/null 2>&1;
-
- if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi
-
-else
-#mbr installation
- echo -n "Installation immudex in BIOS mode ... ";
-
- #partitioning
- disk=$(selectDisk);
- if [ ! "$disk" ]; then exit 1; fi
-
- sudo dd if=/dev/zero bs=1M of=/dev/$disk count=1 2> /dev/null
-
- sudo parted /dev/$disk mklabel msdos > /dev/null 2>&1;
- sudo parted /dev/$disk mkpart primary 1 4G > /dev/null 2>&1;
- sudo parted /dev/$disk set 1 boot on > /dev/null 2>&1;
-
- if $(echo $disk | egrep -qo "mmc|nvme"); then disk="${disk}p"; fi
-
- #formatting
- sudo mkfs.ext4 /dev/${disk}1 > /dev/null 2>&1;
-
- #Setting label for partition is necessary for extlinux bootloader
- sudo e2label /dev/${disk}1 "immudex" > /dev/null 2>&1;
-
- #mount partition in /media directory
- sudo mount /dev/${disk}1 /media > /dev/null 2>&1;
-
- #Creating directory for extlinux
- sudo mkdir /media/extlinux > /dev/null 2>&1;
-
- #Instalation extlinux files in abovementioned directory
- sudo extlinux --install /media/extlinux > /dev/null 2>&1;
-
- #mount iso image in /mnt directory
- #sudo mount /dev/sr0 /mnt > /dev/null 2>&1;
-
- #copying live directory from iso image to partition
- sudo cp -rvv /run/live/medium/live /media > /dev/null; 2>&1;
-
- #installation extlinux MBR on first sector of hard drive (whole device)
- sudo dd if=/usr/lib/EXTLINUX/mbr.bin of=/dev/${disk} > /dev/null 2>&1;
-
- #creating extlinux configuration file
- cat > extlinux.conf <<EOF
-default immudex
-label immudex
-kernel /live/vmlinuz
-append quiet initrd=/live/initrd boot=live overlay-size=25% apparmor=1 security=apparmor
-EOF
- sudo cp extlinux.conf /media/extlinux > /dev/null 2>&1;
- rm extlinux.conf;
-
- #Unmounting filesystems
- sudo umount /media > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi
-fi
+++ /dev/null
-#!/bin/bash
-
-set -e
-
-source library.sh
-
-RED="\e[31m";
-GREEN="\e[32m";
-YELLOW="\e[33m";
-ENDCOLOR="\e[0m";
-root="/run/live/medium";
-
-function help() {
- echo "immudex_upgrade - script for searching upgrades and upgrade immudex";
- echo "morketsmerke.org @ 2023";
- echo "Options:";
- echo " --check --print - check there are upgrades for immudex";
- echo " --upgrade - check there are upgrades for immudex and install them.";
- echo " If there is no new version, script will propose refreshing";
- echo " current immudex installation, its helpful when you tried";
- echo " remaster immudex and you get any trouble with this".
- echo " --version - getting latest version of immudex";
- echo " --branch <stable/testing> - change immudex branch";
- echo " Switch between stable or testing version and vice versa"
-}
-
-function main_upgrade() {
- set -e
- ARCH=$(get_machine_arch);
- if [ ! "$BRANCH" ]; then
- BRANCH=$(get_debian_branch);
- fi
- rootPart=$(grep "${1}" /etc/mtab | head -1 | awk '{printf $1}');
- sudo mount $rootPart $1 -o remount,rw;
- sudo rm -f ${1}/live/*;
- sudo wget -q https://ftp.morketsmerke.org/immudex/${BRANCH}/upgrades/${2}/${ARCH}/filesystem.squashfs -O ${1}/live/filesystem.squashfs;
- sudo wget -q https://ftp.morketsmerke.org/immudex/${BRANCH}/upgrades/${2}/${ARCH}/initrd -O ${1}/live/initrd;
- sudo wget -q https://ftp.morketsmerke.org/immudex/${BRANCH}/upgrades/${2}/${ARCH}/vmlinuz -O ${1}/live/vmlinuz;
- echo "$2" > /tmp/version;
- sudo cp /tmp/version ${1}/live;
-}
-
-if [ "$1" ] && [ "$1" = "--check" ]; then
- if [ "$2" ] && [ "$2" = "--print" ]; then
- newVersion=$(check_distro_version --print);
- if check_distro_version; then
- echo -e "${YELLOW}New version (${ENDCOLOR}${RED}$newVersion${ENDCOLOR}${YELLOW}) of immudex is available to upgrade.${ENDCOLOR}";
- else
- echo -e "${YELLOW}This (${ENDCOLOR}${GREEN}$newVersion${ENDCOLOR}${YELLOW}) is the latest version of immudex.${ENDCOLOR}";
- fi
- fi
-elif [ "$1" ] && [ "$1" = "--upgrade" ]; then
- newVersionTxt=$(check_distro_version --print);
- newVersionInt=$(echo $newVersionTxt | sed 's/\.//g');
- if check_distro_version; then
- echo -en "${YELLOW}New version "
- echo -en "(${ENDCOLOR}${RED}${newVersionTxt}${ENDCOLOR}${YELLOW}) "
- echo -e "of immudex is available.${ENDCOLOR}";
- echo -e "${RED}Warning, reboot maybe necessary to continue work on this machine${ENDCOLOR}";
- echo -en "${YELLOW}Do you want upgrade this system? (y/n):${ENDCOLOR} ";
- read commit;
- if [ $commit = "y" ]; then
- echo -n "Upgrading immudex to the newest version...";
- main_upgrade $root $newVersionTxt;
- if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi
- else
- exit 1;
- fi
- else
- echo -e "${GREEN}There is no newer version of immudex,${ENDCOLOR}";
- echo -e "${YELLOW}but you can copy fresh system files from latest iso image";
- echo -e "${RED}Warning, reboot maybe necessary to continue work on this machine${ENDCOLOR}";
- echo -en "${YELLOW}Do you want refresh this system? (y/n):${ENDCOLOR} ";
- read commit;
- if [ $commit = "y" ]; then
- echo -n "Refreshing immudex to the latest iso image...";
- main_upgrade $root $newVersionTxt;
- if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi
- else
- exit 1;
- fi
- exit 0;
- fi
-elif [ "$1" ] && [ "$1" = "--version" ]; then
- stable64=$(curl https://ftp.morketsmerke.org/immudex/stable/upgrades/latest/64/version 2>/dev/null)
- stable32=$(curl https://ftp.morketsmerke.org/immudex/stable/upgrades/latest/32/version 2>/dev/null)
- testing64=$(curl https://ftp.morketsmerke.org/immudex/testing/upgrades/latest/64/version 2>/dev/null)
- testing32=$(curl https://ftp.morketsmerke.org/immudex/testing/upgrades/latest/32/version 2>/dev/null)
- branch=$(get_debian_branch);
- localVer=$(cat /run/live/medium/live/version);
- if [ "$(uname -m)" = "x86_64" ]; then
- arch="amd64";
- stable=$stable64;
- testing=$testing64;
- else
- arch="i386";
- stable=$stable32;
- testing=$testing32;
- fi
- echo "Arch: $arch";
- echo "Local: ${localVer} (${branch})";
- echo "Stable: $stable";
- echo "Testing: $testing";
-elif [ "$1" ] && [ "$1" = "--branch" ]; then
- if [ "$2" ] && ([ "$2" = "stable" ] || [ "$2" = "testing" ]); then
- BRANCH=$2;
- ARCH=$(get_machine_arch);
- export $BRANCH;
- echo -en "${YELLOW}Do you really want change immudex branch (y/n):${ENDCOLOR} ";
- read commit;
- if [ $commit = "y" ]; then
- echo -n "Changing immudex branch to ${BRANCH}...";
- newVersionTxt=$(curl https://ftp.morketsmerke.org/immudex/${BRANCH}/upgrades/latest/${ARCH}/version 2>/dev/null);
- main_upgrade $root $newVersionTxt;
- if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi
- else
- exit 1;
- fi
- else
- help; exit 1;
- fi
-else
- help;
- exit 1;
-fi
+++ /dev/null
-#!/bin/bash
-
-GREEN="\e[32m";
-YELLOW="\e[33m";
-ENDCOLOR="\e[0m";
-
-function help() {
- echo "create_media - script used for write iso image to usb drive(mainly)";
- echo "morketsmerke.net COPYLEFT @ 2022";
- echo "Options:";
- echo " --i386-efi - creating 32-bit EFI usb drive with iso image";
- echo " (comapatible with immudex only iso images)";
- echo "Usage:";
- echo " $ create_media [--i386-efi] <usb_disk> <iso_image>";
-}
-
-if [ "$1" ] && [ "$1" = "--i386-efi" ]; then target="i386-efi"; shift; fi
-if [ "$1" ] && echo $1 | grep -Eq '/dev/(sd[a-z]|vd[a-z]|mmcblk[0-9])'; then
- disk=$1; shift;
-else
- help;
- exit 1;
-fi
-if [ "$1" ] && file $1 | grep -q 'ISO 9660'; then
- iso=$1;
-else
- help;
- exit 1;
-fi
-
-if [ "$target" ]; then
- echo -n "Writing zeros to 1st megabyte on disk...";
- sudo dd if=/dev/zero bs=1M of=$disk count=1 > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Creating MS-DOS partitionig scheme on disk...";
- sudo parted $disk mklabel msdos > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Creating FAT-32 partition...";
- sudo parted $disk mkpart primary fat32 1 100%Free > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Creating VFAT filesystem on partition...";
- sudo mkfs.vfat ${disk}1 > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Creating /mnt/usb directory...";
- sudo mkdir /mnt/usb > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]";
- else echo -e "[${YELLOW}Directory exist!${ENDCOLOR}]"; fi
-
- echo -n "Mounting VFAT partition on /mnt/usb...";
- sudo mount ${disk}1 /mnt/usb > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Instalation GRUB on disk...";
- sudo grub-install --target=i386-efi --efi-directory=/mnt/usb --boot-directory=/mnt/usb/boot --bootloader-id=boot --removable > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Creating /mnt/iso directory...";
- sudo mkdir /mnt/iso > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]";
- else echo -e "[${YELLOW}Directory exist!${ENDCOLOR}]"; fi
-
- echo -n "Mounting iso file on /mnt/iso...";
- sudo mount $iso /mnt/iso > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Copying grub config files to the disk...";
- sudo cp /mnt/iso/boot/grub/font.pf2 /mnt/usb/boot/grub > /dev/null 2>&1;
- sudo cp /mnt/iso/boot/grub/grub.cfg /mnt/usb/boot/grub > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Copying immudex files to the disk...";
- sudo cp -r /mnt/iso/live /mnt/usb > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Creating empty DEBIAN file...";
- sudo touch /mnt/usb/DEBIAN > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Umounting all mounted filesystems...";
- sudo umount /mnt/* > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-else
- echo -n "Writing zeros to 1st megabyte on disk...";
- sudo dd if=/dev/zero bs=1M of=$disk count=1 > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Writing iso image to the disk..."
- sudo dd if=$iso bs=1M of=$disk > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-fi
+++ /dev/null
-#!/bin/bash
-
-RED="\e[31m";
-GREEN="\e[32m";
-ENDCOLOR="\e[0m";
-
-while [ true ]; do
- echo -e "${RED}This script will install immudex on first disk on your machine.${ENDCOLOR}";
- echo -e "${RED}It could be destructive for data placed on this disk${ENDCOLR}";
- echo -en "${RED}Are you sure that you want contiune? (y/n): ${ENDCOLOR}";
- read ans;
- if [ "$ans" = "y" ]; then break;
- elif [ "$ans" = "n" ]; then exit 1;
- fi
-done
-
-set -e
-
-function selectDisk() {
- disks=$(lsblk | grep 'disk' | awk '{printf $1" "}');
- if [ $(echo $disks | wc -w) -gt 1 ]; then
- select drive in $disks; do
- echo $drive;
- break;
- done
- else
- echo $disks | awk '{printf $1}';
- fi
-}
-
-if $(sudo efibootmgr > /dev/null 2>&1); then
-#uefi installation
- #partitioning
- echo -n "Installation immudex in EFI mode ... ";
- disk=$(selectDisk);
- originDisk=$disk;
- if [ ! "$disk" ]; then exit 1; fi
-
- sudo dd if=/dev/zero bs=1M of=/dev/$disk count=1 2> /dev/null
-
- sudo parted /dev/$disk mklabel msdos > /dev/null 2>&1;
- sudo parted /dev/$disk mkpart primary 1 101M > /dev/null 2>&1;
- sudo parted /dev/$disk set 1 boot on > /dev/null 2>&1;
- sudo parted /dev/$disk mkpart primary 101M 4G > /dev/null 2>&1;
-
- if $(echo $disk | egrep -qo "mmc|nvme"); then disk="${disk}p"; fi
-
- #formatting
- sudo mkfs.vfat -F32 /dev/${disk}1 > /dev/null 2>&1;
- sudo mkfs.ext4 /dev/${disk}2 > /dev/null 2>&1;
-
- #Setting label for partition
- sudo e2label /dev/${disk}2 "immudex" > /dev/null 2>&1;
-
- #mount root partition
- sudo mount /dev/${disk}2 /media > /dev/null 2>&1;
-
- #creating directories for efi partition
- sudo mkdir -p /media/boot/efi > /dev/null 2>&1;
-
- #mount efi partition
- sudo mount /dev/${disk}1 /media/boot/efi > /dev/null 2>&1;
-
- #mount iso image in /mnt directory
- #sudo mount /dev/sr0 /mnt > /dev/null 2>&1;
-
- #copying whole iso image to the second partition
- sudo cp -rvv /run/live/medium/* /media > /dev/null 2>&1;
-
- sudo sed -i 's/bootfrom=removable //g' /media/boot/grub/grub.cfg;
-
- #removing unnecessary directories from second partition
- sudo rm -rf /media/isolinux > /dev/null 2>&1;
- sudo rm -rf /media/EFI > /dev/null 2>&1;
-
- #GRUB Installation
- if [ -f /usr/lib/live/mount/medium/EFI/BOOT/BOOTIA32.EFI ]; then
- target="i386-efi";
- else
- target="x86_64-efi";
- fi
- sudo grub-install --target=${target} --root-directory=/media --boot-directory=/media/boot --efi-directory=/media/boot/efi --bootloader-id=debian --removable > /dev/null 2>&1;
-
- #Adding entry to EFI Firmware
- sudo efibootmgr -c -d /dev/${originDisk} -p 1 -L "Debian" -l '\EFI\BOOT\grubx64.efi' > /dev/null 2>&1;
-
- #Umount all mounted filesystems
- sudo umount -R /media > /dev/null 2>&1;
-
- if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi
-
-else
-#mbr installation
- echo -n "Installation immudex in BIOS mode ... ";
-
- #partitioning
- disk=$(selectDisk);
- if [ ! "$disk" ]; then exit 1; fi
-
- sudo dd if=/dev/zero bs=1M of=/dev/$disk count=1 2> /dev/null
-
- sudo parted /dev/$disk mklabel msdos > /dev/null 2>&1;
- sudo parted /dev/$disk mkpart primary 1 4G > /dev/null 2>&1;
- sudo parted /dev/$disk set 1 boot on > /dev/null 2>&1;
-
- if $(echo $disk | egrep -qo "mmc|nvme"); then disk="${disk}p"; fi
-
- #formatting
- sudo mkfs.ext4 /dev/${disk}1 > /dev/null 2>&1;
-
- #Setting label for partition is necessary for extlinux bootloader
- sudo e2label /dev/${disk}1 "immudex" > /dev/null 2>&1;
-
- #mount partition in /media directory
- sudo mount /dev/${disk}1 /media > /dev/null 2>&1;
-
- #Creating directory for extlinux
- sudo mkdir /media/extlinux > /dev/null 2>&1;
-
- #Instalation extlinux files in abovementioned directory
- sudo extlinux --install /media/extlinux > /dev/null 2>&1;
-
- #mount iso image in /mnt directory
- #sudo mount /dev/sr0 /mnt > /dev/null 2>&1;
-
- #copying live directory from iso image to partition
- sudo cp -rvv /run/live/medium/live /media > /dev/null; 2>&1;
-
- #installation extlinux MBR on first sector of hard drive (whole device)
- sudo dd if=/usr/lib/EXTLINUX/mbr.bin of=/dev/${disk} > /dev/null 2>&1;
-
- #creating extlinux configuration file
- cat > extlinux.conf <<EOF
-default immudex
-label immudex
-kernel /live/vmlinuz
-append quiet initrd=/live/initrd boot=live overlay-size=25% apparmor=1 security=apparmor
-EOF
- sudo cp extlinux.conf /media/extlinux > /dev/null 2>&1;
- rm extlinux.conf;
-
- #Unmounting filesystems
- sudo umount /media > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi
-fi
+++ /dev/null
-#!/bin/bash
-
-function help() {
- echo "meteo - prognoza pogody z meteo.icm.edu.pl"
- echo "morketsmerke.org @ 2023";
- echo "Opcje:";
- echo " -h - legenda, pozwalająca na odczytanie prognozy";
- echo "Użycie:";
- echo "$ meteo <miasto>";
-}
-
-rm /tmp/meteo*;
-
-if [ "$1" ] && [ "$1" = "-h" ]; then
- xdg-open /usr/share/meteo/leg60.png;
-elif [ "$1" ]; then
- if [ ! "$2" ]; then prognoza=60;
- else prognoza=$2; fi
-
- miasto=$(echo "$1" | sed -e 's/ą/a/g' -e 's/ę/e/g' -e 's/ć/c/g' -e 's/ż/z/g' -e 's/ś/s/g' -e 's/ź/z/g' -e 's/ń/n/g' -e 's/ó/o/g' -e 's/ł/l/g');
- #miasto=${miasto^};
-
- wget m.meteo.pl/${miasto}/${prognoza} -O /tmp/meteo 2>/dev/null;
- link=$(grep "image_${prognoza}" /tmp/meteo | cut -d '"' -f 2);
- wget $link -O /tmp/meteo_${miasto}.png 2>/dev/null;
- xdg-open /tmp/meteo_${miasto}.png;
-else
- help;
- exit 1;
-fi
+++ /dev/null
-#!/bin/bash
-
-RED="\e[31m";
-GREEN="\e[32m";
-ENDCOLOR="\e[0m";
-
-while [ true ]; do
- echo -e "${RED}This script will install immudex on first disk on your machine.${ENDCOLOR}";
- echo -e "${RED}It could be destructive for data placed on this disk${ENDCOLR}";
- echo -en "${RED}Are you sure that you want contiune? (y/n): ${ENDCOLOR}";
- read ans;
- if [ "$ans" = "y" ]; then break;
- elif [ "$ans" = "n" ]; then exit 1;
- fi
-done
-
-set -e
-
-function selectDisk() {
- disks=$(lsblk | grep 'disk' | awk '{printf $1" "}');
- if [ $(echo $disks | wc -w) -gt 1 ]; then
- select drive in $disks; do
- echo $drive;
- break;
- done
- else
- echo $disks | awk '{printf $1}';
- fi
-}
-
-if $(sudo efibootmgr > /dev/null 2>&1); then
-#uefi installation
- #partitioning
- echo -n "Installation immudex in EFI mode ... ";
- disk=$(selectDisk);
- originDisk=$disk;
- if [ ! "$disk" ]; then exit 1; fi
-
- sudo dd if=/dev/zero bs=1M of=/dev/$disk count=1 2> /dev/null
-
- sudo parted /dev/$disk mklabel msdos > /dev/null 2>&1;
- sudo parted /dev/$disk mkpart primary 1 101M > /dev/null 2>&1;
- sudo parted /dev/$disk set 1 boot on > /dev/null 2>&1;
- sudo parted /dev/$disk mkpart primary 101M 4G > /dev/null 2>&1;
-
- if $(echo $disk | egrep -qo "mmc|nvme"); then disk="${disk}p"; fi
-
- #formatting
- sudo mkfs.vfat -F32 /dev/${disk}1 > /dev/null 2>&1;
- sudo mkfs.ext4 /dev/${disk}2 > /dev/null 2>&1;
-
- #Setting label for partition
- sudo e2label /dev/${disk}2 "immudex" > /dev/null 2>&1;
-
- #mount root partition
- sudo mount /dev/${disk}2 /media > /dev/null 2>&1;
-
- #creating directories for efi partition
- sudo mkdir -p /media/boot/efi > /dev/null 2>&1;
-
- #mount efi partition
- sudo mount /dev/${disk}1 /media/boot/efi > /dev/null 2>&1;
-
- #mount iso image in /mnt directory
- #sudo mount /dev/sr0 /mnt > /dev/null 2>&1;
-
- #copying whole iso image to the second partition
- sudo cp -rvv /run/live/medium/* /media > /dev/null 2>&1;
-
- sudo sed -i '/set\ timeout=/ s/30/5/' /media/boot/grub/grub.cfg;
- sudo sed -i 's/bootfrom=removable //g' /media/boot/grub/grub.cfg;
-
- #removing unnecessary directories from second partition
- sudo rm -rf /media/isolinux > /dev/null 2>&1;
- sudo rm -rf /media/EFI > /dev/null 2>&1;
-
- #GRUB Installation
- if [ -f /usr/lib/live/mount/medium/EFI/BOOT/BOOTIA32.EFI ]; then
- target="i386-efi";
- else
- target="x86_64-efi";
- fi
- sudo grub-install --target=${target} --root-directory=/media --boot-directory=/media/boot --efi-directory=/media/boot/efi --bootloader-id=debian --removable > /dev/null 2>&1;
-
- #Adding entry to EFI Firmware
- sudo efibootmgr -c -d /dev/${originDisk} -p 1 -L "Debian" -l '\EFI\BOOT\grubx64.efi' > /dev/null 2>&1;
-
- #Umount all mounted filesystems
- sudo umount -R /media > /dev/null 2>&1;
-
- if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi
-
-else
-#mbr installation
- echo -n "Installation immudex in BIOS mode ... ";
-
- #partitioning
- disk=$(selectDisk);
- if [ ! "$disk" ]; then exit 1; fi
-
- sudo dd if=/dev/zero bs=1M of=/dev/$disk count=1 2> /dev/null
-
- sudo parted /dev/$disk mklabel msdos > /dev/null 2>&1;
- sudo parted /dev/$disk mkpart primary 1 4G > /dev/null 2>&1;
- sudo parted /dev/$disk set 1 boot on > /dev/null 2>&1;
-
- if $(echo $disk | egrep -qo "mmc|nvme"); then disk="${disk}p"; fi
-
- #formatting
- sudo mkfs.ext4 /dev/${disk}1 > /dev/null 2>&1;
-
- #Setting label for partition is necessary for extlinux bootloader
- sudo e2label /dev/${disk}1 "immudex" > /dev/null 2>&1;
-
- #mount partition in /media directory
- sudo mount /dev/${disk}1 /media > /dev/null 2>&1;
-
- #Creating directory for extlinux
- sudo mkdir /media/extlinux > /dev/null 2>&1;
-
- #Instalation extlinux files in abovementioned directory
- sudo extlinux --install /media/extlinux > /dev/null 2>&1;
-
- #mount iso image in /mnt directory
- #sudo mount /dev/sr0 /mnt > /dev/null 2>&1;
-
- #copying live directory from iso image to partition
- sudo cp -rvv /run/live/medium/live /media > /dev/null; 2>&1;
-
- #installation extlinux MBR on first sector of hard drive (whole device)
- sudo dd if=/usr/lib/EXTLINUX/mbr.bin of=/dev/${disk} > /dev/null 2>&1;
-
- #creating extlinux configuration file
- cat > extlinux.conf <<EOF
-default immudex
-label immudex
-kernel /live/vmlinuz
-append quiet initrd=/live/initrd boot=live overlay-size=25% apparmor=1 security=apparmor
-EOF
- sudo cp extlinux.conf /media/extlinux > /dev/null 2>&1;
- rm extlinux.conf;
-
- #Unmounting filesystems
- sudo umount /media > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi
-fi
+++ /dev/null
-#!/bin/bash
-
-GREEN="\e[32m";
-YELLOW="\e[33m";
-ENDCOLOR="\e[0m";
-
-function help() {
- echo "create_media - script used for write iso image to usb drive(mainly)";
- echo "morketsmerke.net COPYLEFT @ 2022";
- echo "Options:";
- echo " --i386-efi - creating 32-bit EFI usb drive with iso image";
- echo " (comapatible with immudex only iso images)";
- echo "Usage:";
- echo " $ create_media [--i386-efi] <usb_disk> <iso_image>";
-}
-
-if [ "$1" ] && [ "$1" = "--i386-efi" ]; then target="i386-efi"; shift; fi
-if [ "$1" ] && echo $1 | grep -Eq '/dev/(sd[a-z]|vd[a-z]|mmcblk[0-9])'; then
- disk=$1; shift;
-else
- help;
- exit 1;
-fi
-if [ "$1" ] && file $1 | grep -q 'ISO 9660'; then
- iso=$1;
-else
- help;
- exit 1;
-fi
-
-if [ "$target" ]; then
- echo -n "Writing zeros to 1st megabyte on disk...";
- sudo dd if=/dev/zero bs=1M of=$disk count=1 > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Creating MS-DOS partitionig scheme on disk...";
- sudo parted $disk mklabel msdos > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Creating FAT-32 partition...";
- sudo parted $disk mkpart primary fat32 1 100%Free > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Creating VFAT filesystem on partition...";
- sudo mkfs.vfat ${disk}1 > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Creating /mnt/usb directory...";
- sudo mkdir /mnt/usb > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]";
- else echo -e "[${YELLOW}Directory exist!${ENDCOLOR}]"; fi
-
- echo -n "Mounting VFAT partition on /mnt/usb...";
- sudo mount ${disk}1 /mnt/usb > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Instalation GRUB on disk...";
- sudo grub-install --target=i386-efi --efi-directory=/mnt/usb --boot-directory=/mnt/usb/boot --bootloader-id=boot --removable > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Creating /mnt/iso directory...";
- sudo mkdir /mnt/iso > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]";
- else echo -e "[${YELLOW}Directory exist!${ENDCOLOR}]"; fi
-
- echo -n "Mounting iso file on /mnt/iso...";
- sudo mount $iso /mnt/iso > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Copying grub config files to the disk...";
- sudo cp /mnt/iso/boot/grub/font.pf2 /mnt/usb/boot/grub > /dev/null 2>&1;
- sudo cp /mnt/iso/boot/grub/grub.cfg /mnt/usb/boot/grub > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Copying immudex files to the disk...";
- sudo cp -r /mnt/iso/live /mnt/usb > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Creating empty DEBIAN file...";
- sudo touch /mnt/usb/DEBIAN > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Umounting all mounted filesystems...";
- sudo umount /mnt/* > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-else
- echo -n "Writing zeros to 1st megabyte on disk...";
- sudo dd if=/dev/zero bs=1M of=$disk count=1 > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Writing iso image to the disk..."
- sudo dd if=$iso bs=1M of=$disk > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-fi
+++ /dev/null
-#!/bin/bash
-
-if grep -q 'bookworm' /etc/os-release; then
- echo -n '-testing';
-else
- echo -n '-stable';
-fi
+++ /dev/null
-#!/bin/bash
-
-function help() {
-
- echo "immudex_crypt - script used for listing, open and close crypt_LUKS ppartitions";
- echo "morketsmerke.org COPYLEFT @ 2023";
- echo "Options:";
- echo " list - displaing list of opened and available crypt_LUKS devices";
- echo " create - formatting device for crypt_LUKS";
- echo " open - opening crypt_LUKS device, after this device is ready to mount";
- echo " close - unmount and closing crypt_LUKS devices";
- echo "Using:";
- echo "$ immudex_crypt list";
- echo "$ immudex_crypt create <disk partition>";
- echo "$ immudex_crypt open <crypt_LUKS device>";
- echo "$ immudex_crypt close immudex_crypt[0-9] | ic[0-9] | [0-9]";
-}
-
-function list() {
-
- mapperDeviceList=$(ls /dev/mapper --hide=control | awk '{printf $1" "}');
-
- echo "==============================================================";
- echo -e "Opened devices:";
- echo "==============================================================";
- echo -e "Device:\t\tMapper name:\t\tMount point:";
-
- if [ "$mapperDeviceList" ]; then
- for dmDevice in $mapperDeviceList; do
- if sudo cryptsetup status /dev/mapper/${dmDevice} > /dev/null 2>&1; then
- mountPoint=$(df --output=source,target /dev/mapper/${dmDevice} | tail -n 1 | awk '{printf $2}');
- device=$(sudo cryptsetup status /dev/mapper/${dmDevice} | grep "device" | awk '{printf $2}');
- if [ "$mountPoint" ] && [ "$mountPoint" != "/dev" ]; then
- echo -e "$device\t /dev/mapper/${dmDevice}\t$mountPoint";
- else
- echo -e "$device\t /dev/mapper/${dmDevice}\tNot mounted";
- fi
- fi
- done
- else
- echo -e "No opened crypt devices was found";
- fi
- echo "==============================================================";
-
- luksDevicesList=$(sudo blkid | grep 'LUKS' | cut -d ":" -f 1 | awk '{printf $1" "}');
-
- echo "==============================================================";
- echo -e "crypt_LUKS devices:";
- echo "==============================================================";
- echo -e "Device:\t\tMapper name:\t\tMount point:";
-
- if [ "$luksDevicesList" ]; then
- for lDevice in $luksDevicesList; do
- echo -e "$lDevice";
- done
- else
- echo "No crypt device was found";
- fi
- echo "==============================================================";
-}
-
-function open() {
-
- if [ $# -lt 1 ]; then help; exit 1;
- else
- index=$(ls --hide=control /dev/mapper | grep "immudex_crypt" | grep -o "[0-9]*$"| tail -1);
- if [ "$index" ]; then
- index=$((index + 1));
- else
- index=0;
- fi
- sudo cryptsetup open $1 immudex_crypt${index};
- sudo mkdir -p /media/${USER}/immudex_crypt${index};
- dmDevice=$(ls -l /dev/mapper/immudex_crypt${index} | awk '{printf $10}' | cut -d "/" -f 2);
- if ! $(sudo file -s /dev/${dmDevice} | grep -q 'ext4'); then
- echo "Could not determine filesystem of unlocked device.";
- echo -n "Format this device to ext4? (y/n): "
- read format;
- if [ "$format" = "y" ]; then
- sudo mkfs.ext4 /dev/mapper/immudex_crypt${index};
- else
- echo "Refuse to mount.";
- sudo cryptsetup close immudex_crypt${index};
- exit 1;
- fi
- fi
- sudo mount /dev/mapper/immudex_crypt${index} /media/${USER}/immudex_crypt${index};
- if [ ! -e /ic${index} ]; then
- sudo ln -s /media/${USER}/immudex_crypt${index} /ic${index};
- fi
- fi
-
-}
-
-function close() {
-
- if [ $# -lt 1 ]; then help; exit 1;
- else
- if [ $1 -ge 0 ] 2> /dev/null; then
- cryptfsName="immudex_crypt${1}";
- elif echo $1 | grep -q 'ic'; then
- cryptfsName="immudex_crypt$(echo $1 | grep -o '[0-9]')";
- else
- cryptfsName=$1;
- fi
- if sudo cryptsetup status /dev/mapper/${cryptfsName} > /dev/null 2>&1; then
- mountPoint=$(df --output=source,target /dev/mapper/${cryptfsName} | tail -1 | awk '{printf $2}');
- if [ "$mountPoint" ] && [ "$mountPoint" != "/dev" ]; then
- sudo umount -R $mountPoint;
- sudo cryptsetup close ${cryptfsName};
- else
- sudo cryptsetup close ${cryptfsName};
- fi
- else
- echo "Given devices isn't opened crypt device or it was closed before";
- fi
- fi
-}
-
-function create() {
- if [ $# -lt 1 ]; then help; exit 1;
- else
- sudo cryptsetup -y -v luksFormat $1;
- fi
-}
-
-if [ "$1" ]; then
-
- case $1 in
- "list") list;;
- "open") if [ "$2" ]; then open $2;
- else help; exit 1;
- fi;;
- "close") if [ "$2" ]; then close $2;
- else help; exit 1;
- fi;;
- "create") if [ "$2" ]; then create $2 && open $2;
- else help; exit 1;
- fi;;
- *) help;;
- esac
-else
- help; exit 1;
-fi
+++ /dev/null
-#!/bin/bash
-
-set -e
-
-source library.sh
-
-RED="\e[31m";
-GREEN="\e[32m";
-YELLOW="\e[33m";
-ENDCOLOR="\e[0m";
-root="/run/live/medium";
-
-function help() {
- echo "immudex_upgrade - script for searching upgrades and upgrade immudex";
- echo "morketsmerke.org @ 2023";
- echo "Options:";
- echo " --check --print - check there are upgrades for immudex";
- echo " --upgrade - check there are upgrades for immudex and install them.";
- echo " If there is no new version, script will propose refreshing";
- echo " current immudex installation, its helpful when you tried";
- echo " remaster immudex and you get any trouble with this".
- echo " --version - getting latest version of immudex";
- echo " --branch <stable/testing> - change immudex branch";
- echo " Switch between stable or testing version and vice versa"
-}
-
-function main_upgrade() {
- set -e
- ARCH=$(get_machine_arch);
- if [ ! "$BRANCH" ]; then
- BRANCH=$(get_debian_branch);
- fi
- MIRROR=$(check_mirror);
- rootPart=$(grep "${1}" /etc/mtab | head -1 | awk '{printf $1}');
- sudo mount $rootPart $1 -o remount,rw;
- sudo rm -f ${1}/live/*;
- sudo wget -q ${MIRROR}/immudex/${BRANCH}/upgrades/${2}/${ARCH}/filesystem.squashfs -O ${1}/live/filesystem.squashfs;
- sudo wget -q ${MIRROR}/immudex/${BRANCH}/upgrades/${2}/${ARCH}/initrd -O ${1}/live/initrd;
- sudo wget -q ${MIRROR}/immudex/${BRANCH}/upgrades/${2}/${ARCH}/vmlinuz -O ${1}/live/vmlinuz;
- echo "$2" > /tmp/version;
- sudo cp /tmp/version ${1}/live;
-}
-
-function check_mirror() {
- mirrorList=("sourceforge.net=https://sourceforge.net/projects/immudex/files", "plikownia.zsgronowo.edu.pl=https://plikownia.zsgronowo.edu.pl/pliki/Nauczyciele/Administrator/files", "ftp.morketsmerke.org=https://ftp.morketsmerke.org");
- for i in ${mirrorList[@]}; do
- name=$(echo $i | cut -d "=" -f 1);
- address=$(echo $i | cut -d "=" -f 2 | sed 's/,//');
- echo -en "Checking is ${YELLOW}${name}${ENDCOLOR} available..." 1>&2;
- curl ${address}/immudex/stable/upgrades/latest/64/version > /dev/null 2>&1;
- if [ $? -eq 0 ]; then
- echo -e "[ ${GREEN}OK${ENDCOLOR} ]" 1>&2;
- mirror=$address;
- mirror_name=$name;
- else
- echo -e "[ ${RED}FAIL${ENDCOLOR} ]" 1>&2;
- fi
- done
- if [ "$mirror" ]; then
- echo "Choosing $mirror_name" 1>&2;
- echo $mirror;
- else exit 1; fi
-}
-
-if [ "$1" ] && [ "$1" = "--check" ]; then
- if [ "$2" ] && [ "$2" = "--print" ]; then
- newVersion=$(check_distro_version --print);
- if check_distro_version; then
- echo -e "${YELLOW}New version (${ENDCOLOR}${RED}$newVersion${ENDCOLOR}${YELLOW}) of immudex is available to upgrade.${ENDCOLOR}";
- else
- echo -e "${YELLOW}This (${ENDCOLOR}${GREEN}$newVersion${ENDCOLOR}${YELLOW}) is the latest version of immudex.${ENDCOLOR}";
- fi
- elif [ "$2" = "--mirror" ]; then
- mirror=$(check_mirror);
- echo $mirror;
- fi
-elif [ "$1" ] && [ "$1" = "--upgrade" ]; then
- newVersionTxt=$(check_distro_version --print);
- newVersionInt=$(echo $newVersionTxt | sed 's/\.//g');
- if check_distro_version; then
- echo -en "${YELLOW}New version "
- echo -en "(${ENDCOLOR}${RED}${newVersionTxt}${ENDCOLOR}${YELLOW}) "
- echo -e "of immudex is available.${ENDCOLOR}";
- echo -e "${RED}Warning, reboot maybe necessary to continue work on this machine${ENDCOLOR}";
- echo -en "${YELLOW}Do you want upgrade this system? (y/n):${ENDCOLOR} ";
- read commit;
- if [ $commit = "y" ]; then
- echo "Upgrading immudex to the newest version...";
- main_upgrade $root $newVersionTxt;
- if [ $? -eq 0 ]; then echo -e "Upgrading immudex to the newest version...[ ${GREEN}OK${ENDCOLOR} ]"; fi
- else
- exit 1;
- fi
- else
- echo -e "${GREEN}There is no newer version of immudex,${ENDCOLOR}";
- echo -e "${YELLOW}but you can copy fresh system files from latest iso image";
- echo -e "${RED}Warning, reboot maybe necessary to continue work on this machine${ENDCOLOR}";
- echo -en "${YELLOW}Do you want refresh this system? (y/n):${ENDCOLOR} ";
- read commit;
- if [ $commit = "y" ]; then
- echo "Refreshing immudex to the latest iso image...";
- main_upgrade $root $newVersionTxt;
- if [ $? -eq 0 ]; then echo -e "Refreshing immudex to the latest iso image...[ ${GREEN}OK${ENDCOLOR} ]"; fi
- else
- exit 1;
- fi
- exit 0;
- fi
-elif [ "$1" ] && [ "$1" = "--version" ]; then
- MIRROR=$(check_mirror);
- stable64=$(curl ${MIRROR}/immudex/stable/upgrades/latest/64/version 2>/dev/null)
- stable32=$(curl ${MIRROR}/immudex/stable/upgrades/latest/32/version 2>/dev/null)
- testing64=$(curl ${MIRROR}/immudex/testing/upgrades/latest/64/version 2>/dev/null)
- testing32=$(curl ${MIRROR}/immudex/testing/upgrades/latest/32/version 2>/dev/null)
- branch=$(get_debian_branch);
- localVer=$(cat /run/live/medium/live/version);
- if [ "$(uname -m)" = "x86_64" ]; then
- arch="amd64";
- stable=$stable64;
- testing=$testing64;
- else
- arch="i386";
- stable=$stable32;
- testing=$testing32;
- fi
- echo "Arch: $arch";
- echo "Local: ${localVer} (${branch})";
- echo "Stable: $stable";
- echo "Testing: $testing";
-elif [ "$1" ] && [ "$1" = "--branch" ]; then
- if [ "$2" ] && ([ "$2" = "stable" ] || [ "$2" = "testing" ]); then
- BRANCH=$2;
- ARCH=$(get_machine_arch);
- export $BRANCH;
- echo -en "${YELLOW}Do you really want change immudex branch (y/n):${ENDCOLOR} ";
- read commit;
- if [ $commit = "y" ]; then
- echo "Changing immudex branch to ${BRANCH}...";
- newVersionTxt=$(curl https://ftp.morketsmerke.org/immudex/${BRANCH}/upgrades/latest/${ARCH}/version 2>/dev/null);
- main_upgrade $root $newVersionTxt;
- if [ $? -eq 0 ]; then echo -e "Changing immudex branch to ${BRANCH}...[ ${GREEN}OK${ENDCOLOR} ]"; fi
- else
- exit 1;
- fi
- else
- help; exit 1;
- fi
-else
- help;
- exit 1;
-fi
+++ /dev/null
-#!/bin/bash
-
-if [ -f ~/public.gpg ] && [ -f ~/private.gpg ]; then
- gpg --import ~/public.gpg
- gpg --import ~/private.gpg
- userId=$(gpg --list-keys | sed -nr 's/.+<(.*)>$/\1/p');
- gpg --edit-key $userId;
-fi
+++ /dev/null
-#!/bin/bash
-
-if $(ls $HOME | grep -q '.*_rsa.*'); then
- if [ -d /home/$USER/.ssh ]; then
- cp -v ~/*_rsa* /home/$USER/.ssh;
- else
- mkdir /home/$USER/.ssh;
- chmod 700 /home/$USER/.ssh;
- cp -v ~/*_rsa* /home/$USER/.ssh;
- fi
-fi
-
+++ /dev/null
-#!/bin/bash
-
-function get_debian_branch() {
- if grep -q 'bookworm' /etc/os-release; then
- echo "testing";
- else
- echo "stable";
- fi
-}
-
-function get_machine_arch() {
- arch=$(uname -m);
- if [ "$arch" = "i686" ]; then
- echo "32";
- else
- echo "64";
- fi
-}
-
-function check_distro_version() {
- set -e
- root="/run/live/medium";
- if [ -d ${root}/live ]; then
- if [ -f ${root}/live/version ]; then
- version=$(cat ${root}/live/version | sed 's/\.//g');
- else version="000";
- fi
- BRANCH=$(get_debian_branch);
- ARCH=$(get_machine_arch);
- if [ ! -f /tmp/ltver ]; then
- wget -q https://ftp.morketsmerke.org/immudex/${BRANCH}/upgrades/latest/${ARCH}/version -O /tmp/ltver;
- fi
- if [ ! -s /tmp/ltver ]; then sudo rm /tmp/ltver; return 255; fi;
- newVersionTxt=$(cat /tmp/ltver);
- newVersionInt=$(echo $newVersionTxt | sed 's/\.//g');
- if [ $version -lt $newVersionInt ]; then
- exitcode=0;
- else
- exitcode=1;
- fi
- else
- exitcode=255;
- fi
- if [ "$1" ] && [ "$1" = "--print" ]; then
- echo $newVersionTxt;
- return 0;
- fi
- return $exitcode;
-}
+++ /dev/null
-#!/bin/bash
-
-function help() {
- echo "meteo - prognoza pogody z meteo.icm.edu.pl"
- echo "morketsmerke.org @ 2023";
- echo "Opcje:";
- echo " -h - legenda, pozwalająca na odczytanie prognozy";
- echo "Użycie:";
- echo "$ meteo <miasto>";
-}
-
-rm /tmp/meteo*;
-
-if [ "$1" ] && [ "$1" = "-h" ]; then
- xdg-open /usr/share/meteo/leg60.png;
-elif [ "$1" ]; then
- if [ ! "$2" ]; then prognoza=60;
- else prognoza=$2; fi
-
- miasto=$(echo "$1" | sed -e 's/ą/a/g' -e 's/ę/e/g' -e 's/ć/c/g' -e 's/ż/z/g' -e 's/ś/s/g' -e 's/ź/z/g' -e 's/ń/n/g' -e 's/ó/o/g' -e 's/ł/l/g');
- #miasto=${miasto^};
-
- wget m.meteo.pl/${miasto}/${prognoza} -O /tmp/meteo 2>/dev/null;
- link=$(grep "image_${prognoza}" /tmp/meteo | cut -d '"' -f 2);
- wget $link -O /tmp/meteo_${miasto}.png 2>/dev/null;
- xdg-open /tmp/meteo_${miasto}.png;
-else
- help;
- exit 1;
-fi
+++ /dev/null
-#!/bin/bash
-
-function help() {
- echo "======================================================================";
- echo "morketsmerke - script for fetch and adjust morketsmerke.net site";
- echo "as offline available source of information.";
- echo "morketsmerke.net COPYLEFT @ 2022";
- echo;
- echo "Options:";
- echo " --browser - launching fetched site in default application for open"
- echo " html sites";
- echo " -[-]<any_other_chars_or_strings> - print this message";
- echo "By default script open downloaded site in terminal via W3M browser with";
- echo "monochrome mode";
- echo;
- echo "Usage:";
- echo " $ morketsmerke [--browser]";
-}
-
-function R() {
-
- if [ "$path" ]; then path=${path}/${1};
- else path=$1;
- fi
-
- fileList=$(ls $path);
- for file in $fileList; do
- if [ -d ${path}/${file} ]; then R ${file};
- else
- sed -i 's@https://morketsmerke.github.io/@/usr/share/doc/morketsmerke/index.html@' ${path}/${file};
- sed -i 's@https://morketsmerke.github.io@/usr/share/doc/morketsmerke/index.html@' ${path}/${file};
- sed -i 's@/style.css@/usr/share/doc/morketsmerke/style.css@' ${path}/${file};
- fi
- done
- path=$(echo $path | sed "s@/$1@@")
-
-}
-
-function install_morketsmerke() {
-
- if [ -d morketsmerke.github.io ]; then rm -rf morketsmerke.github.io; fi
- if [ ! -d morketsmerke.github.io ]; then
- git clone https://github.com/morketsmerke/morketsmerke.github.io;
- else
- exit 1;
- fi
-
- R morketsmerke.github.io
-
- if [ -d /usr/share/doc/morketsmerke ]; then
- sudo rm -rf /usr/share/doc/morketsmerke;
- fi
-
- sudo mv morketsmerke.github.io /usr/share/doc/morketsmerke
-
-}
-
-/usr/bin/ping -c 1 wp.pl >> /dev/null 2>&1;
-if [ $? -eq 0 ]; then install_morketsmerke; fi
-
-morketsmerke_path=/usr/share/doc/morketsmerke;
-
-if [ "$1" ] && [ "$1" = "--browser" ]; then
- xdg-open ${morketsmerke_path}/index.html;
-elif [ "$1" ]; then
- help;
- exit 1;
-else
- w3m -M ${morketsmerke_path}/index.html;
-fi
+++ /dev/null
-#!/bin/bash
-
-/usr/bin/figlet immudex;
-echo;
-echo "Today is: $(date)";
-echo;
-echo "System summary: ";
-cpuIdle=$(vmstat | tail -1 | awk '{printf $15}');
-cpuUsage=$((100 - $cpuIdle));
-echo -e " \tCPU: ${cpuUsage}%";
-echo -e " \tMEM: $(free -h | sed -n '2p' | awk '{printf $7}' | sed 's/i//') Free";
-if $(df -h 2> /dev/null | grep -q '/dev/mapper'); then
- i=1;
- echo -e " \tCRYPT_PARTi: Free/Total (Usage%)";
- amountOfDisks=$(df -h 2> /dev/null | grep '/dev/mapper' | wc -l | awk '{printf $1}');
- while [ $i -le $amountOfDisks ]; do
- diskSize=$(df -h 2> /dev/null | grep '/dev/mapper' | sed -n "${i}p" | awk '{printf $2}');
- diskFree=$(df -h 2> /dev/null | grep '/dev/mapper' | sed -n "${i}p" | awk '{printf $4}');
- diskUsage_perc=$(df -h 2> /dev/null | grep '/dev/mapper' | sed -n "${i}p" | sed 's/%//' | awk '{printf $5}');
- #FCP = First Crypt Partition
- echo -e " \tCRYPT_PART${i}: ${diskFree}/${diskSize} (${diskUsage_perc}%)";
- i=$((i + 1));
- done
-else
- echo -e " \tCRYPT_PART: N/A";
-fi
-echo -e " \tPROCESSES: $(ps -aux | wc -l | awk '{printf $1}')";
-utime=$(uptime | awk '{printf $3}' | sed 's/,//');
-if $(echo $utime | grep -q ":"); then
- echo -e " \tUPTIME: ${utime}";
-else
- echo -e " \tUPTIME: 0:${utime}";
-fi
-echo -e " \t$(uptime | grep -o "load.*$" | tr [a-z] [A-Z])";
-echo;
-echo -e "morketsmerke.org @ 2023 https://github.com/xf0r3m/immudex";
-echo;
-#/usr/local/bin/immudex_upgrade --check --print;
-#if [ $? -ne 0 ]; then
-# echo -e "\e[31mThere is no internet connection or internal error.\e[0m";
-# if [ -f /tmp/feed.xml ] && [ ! -s /tmp/feed.xml ]; then
-# rm -f /tmp/feed.xml;
-# fi
-#else
-# if [ "$USER" = "xf0r3m" ]; then
-# sudo apt update > /tmp/update.log 2>&1 && tail -1 /tmp/update.log;
-# fi
-#fi
-echo "====================================================================";
+++ /dev/null
-#!/bin/bash
-
-function help() {
- echo "newsfeed - fetch and browse news feed from rss and atom channels";
- echo "morketsmerke.net; COPYLEFT @ 2022";
- echo;
- echo "Options:";
- echo " --list - shows numbered list of names, saved in ~/.newsfeed names and";
- echo " URL of rss channels";
- echo " --check - fetching new rss channel file from source";
- echo " --show <number_of_channel> - shows numbered list of news titles.";
- echo " Number of channel you can get from --list option.";
- echo " --open <number_of_title> - open web browser on link, which are under";
- echo " titles of news on rss channel. Number of title you can get";
- echo " from --show option. This option based on the last showed rss";
- echo " channel feed.";
- echo;
- echo "The ~/.newsfeed file:";
- echo " This file is simple csv (semicolon separated values) file which";
- echo " store rss channels in one line. One by one. The one line";
- echo " contains: name and URL of rss feed. For example:";
- echo;
- echo " News Feed;https://newsfeed.example.org/rss";
-}
-if [ ! -s ~/.newsfeed ]; then
- help;
- exit 1;
-else
- if [ ! "$1" ] || ([ "$1" != "--list" ] && \
- [ "$1" != "--check" ] && \
- [ "$1" != "--show" ] && \
- [ "$1" != "--open" ]); then
- help;
- exit 1;
- fi
- amountOfSubscriptions=$(cat ~/.newsfeed | wc -l);
- i=1;
- while [ $i -le $amountOfSubscriptions ]; do
- newsfeedLine=$(sed -n "${i}p" ~/.newsfeed);
- nameOfSubscription=$(echo $newsfeedLine | cut -d ";" -f 1);
- rssLink=$(echo $newsfeedLine | cut -d ";" -f 2);
- if [ "$1" ] && [ "$1" = "--list" ]; then
- echo -e "${i}. ${nameOfSubscription}";
- elif [ "$1" ] && [ "$1" = "--check" ]; then
- echo -e "${i}. ${nameOfSubscription}";
- echo -n "Getting news feed...";
- wget $rssLink -O /tmp/new_newsfeed_${i}.xml 2>/dev/null;
- if [ $? -eq 0 ]; then echo "[ OK ]";
- else echo -e "\nThere is no Internet connection"; exit 1; fi
- if [ -s /tmp/newsfeed_${i}.xml ]; then
- amountOfNewNewses=$(diff /tmp/new_newsfeed_${i}.xml /tmp/newsfeed_${i}.xml | grep '<title>' | wc -l);
- if [ $amountOfNewNewses -gt 0 ]; then
- notify-send "$nameOfSubscription" "New $amountOfNewNewses newses" --icon=/usr/share/icons/rss.png;
- j=1;
- sleep 1;
- while [ $j -le $amountOfNewNewses ]; do
- news=$(diff /tmp/new_newsfeed_${i}.xml /tmp/newsfeed_${i}.xml | \
- grep '<title>' | sed -n "${j}p" | sed 's/<title>//' | \
- sed 's/<\/title>//' | sed 's/[<>]//' | \
- sed 's/^[[:space:]]*//g');
- notify-send "newsfeed" "${nameOfSubscription}: ${news}" -t 10000 --icon=/usr/share/icons/rss.png;
- sleep 1;
- j=$((j + 1));
- done
- fi
- mv /tmp/new_newsfeed_${i}.xml /tmp/newsfeed_${i}.xml;
- else
- mv /tmp/new_newsfeed_${i}.xml /tmp/newsfeed_${i}.xml;
- amountOfNews=$(grep '<title>' /tmp/newsfeed_${i}.xml | sed -n '2,$p' | wc -l);
- if [ $amountOfNews -eq 0 ]; then
- compressed=1;
- amountOfNews=$(sed 's/<\/title>/\n/g' /tmp/newsfeed_${i}.xml | sed 's/<item>/\n/g' | grep '<title>' | wc -l)
- fi
- notify-send "$nameOfSubscription" "New $amountOfNews newses" --icon=/usr/share/icons/rss.png;
- fi
- fi
- i=$((i + 1));
- done
- if [ "$1" ] && [ "$1" = "--show" ] && [ "$2" ] && [ $2 -gt 0 ]; then
-
- #Parsing
- #Thanks to the linuxhint.com for command:
- #sed 's/^[[:space]]*//g'
- #https://linuxhint.com/trim_string_bash
-
- if grep -q 'CDATA' /tmp/newsfeed_${2}.xml; then
- sed 's/<\/title>/\n/g' /tmp/newsfeed_${2}.xml | \
- sed 's/<item>/\n/g' | grep '<title>' | sed -n '2,$p' | \
- sed 's/<title>//' | sed 's/"/"/g' | \
- sed 's/<!\[CDATA\[//g' | sed 's/\]\]>//g' | \
- sed 's/^[[:space:]]*//g' | nl | less;
- else
- sed 's/<\/title>/\n/g' /tmp/newsfeed_${2}.xml | \
- sed 's/<item>/\n/g' | grep '<title>' | sed -n '2,$p' | \
- sed 's/<title>//' | sed 's/"/"/g' | \
- sed 's/^[[:space:]]*//g' | nl | less;
- fi
- echo $2 > /tmp/lastShowedNewsFeed;
- elif [ "$1" ] && [ "$1" = "--open" ] && [ "$2" ] && [ $2 -gt 0 ]; then
- subscriptionNumber=$(cat /tmp/lastShowedNewsFeed);
- if ! grep -q 'CDATA' /tmp/newsfeed_${subscriptionNumber}.xml; then
- link=$(sed 's/<\/link>/\n/g' /tmp/newsfeed_${subscriptionNumber}.xml | sed 's/<\/title>/\n/g' | grep '<link>' | sed -n '2,$p' | sed 's/<link>//g' | sed -n "${2}p")
- else
- link=$(sed 's/<\/link>/\n/g' /tmp/newsfeed_${subscriptionNumber}.xml | sed 's/<\/description>/\n/g' | grep '<link>' | sed -n '2,$p' | sed 's/<link>//g' | sed -n "${2}p")
- fi
- exo-open --launch WebBrowser "$link";
- fi
-fi
+++ /dev/null
-#!/bin/bash
-
-source library.sh;
-
-if [ "$1" ]; then
- case $1 in
- "distro") if check_distro_version; then
- msg=$(check_distro_version --print);
- notify-send -i software-update-urgent "Distribution update" "New version (${msg}) of immudex is available to upgrade.";
- else
- msg=$(check_distro_version --print);
- notify-send -i apply "Distribution update" "This (${msg}) is the latest version of immudex.";
- fi;;
- "packages") msg=$(sudo apt update > /tmp/update.log 2>&1 && tail -1 /tmp/update.log;);
- notify-send -i software-update-available "Packages update" "$msg";;
- esac
-fi
-
+++ /dev/null
-#!/bin/bash
-
-launcher="/home/${USER}/Pulpit/Padlock.desktop";
-
-function main_unlock() {
- /usr/local/bin/immudex_crypt open $1;
- index=$(basename $(/usr/local/bin/immudex_crypt list | grep "$1" | head -1 | awk '{printf $2}' | grep -o '[0-9]'));
- #sudo mkdir -p /media/${USER}/$devName;
- #sudo mount /dev/mapper/$devName /media/${USER}/$devName;
-
- xfce4-terminal --default-working-directory=/ic${index};
- #sed -i 's/prevent/allow/' ${launcher};
- sudo rm /usr/share/icons/padlock-icon.png;
- sudo ln -s /usr/share/icons/changes-allow.png /usr/share/icons/padlock-icon.png;
-
-}
-
-function unlock() {
-
- cryptParts=$(sudo blkid | grep 'LUKS' | sed 's/://g' | awk '{printf $1" "}');
- if [ "$cryptParts" ]; then
- if [ $(echo $cryptParts | wc -w) -gt 1 ]; then
- select cryptPart in $cryptParts; do
- main_unlock $cryptPart;
- break;
- done
- else
- main_unlock $cryptParts;
- fi
- else
- echo -e "\e[31mThere is no LUKS partition to open.\e[0m";
- sleep 3;
- fi
-}
-
-function lock() {
-
- mapperDeviceList=$(ls /dev/mapper --hide=control | awk '{printf $1" "}');
-
- if [ "$mapperDeviceList" ]; then
- for dmDevice in $mapperDeviceList; do
- if sudo cryptsetup status /dev/mapper/${dmDevice} > /dev/null 2>&1; then
- mountPoint=$(df --output=source,target /dev/mapper/${dmDevice} | tail -n 1 | awk '{printf $2}');
- if [ "$mountPoint" ]; then
- if $(sudo lsof $mountPoint > /dev/null 2>&1); then
- notify-send "Padlock" "The /dev/mapper/${dmDevice} cannot be unmount, because there are opened file or running proceses." --icon=dialog-error;
- else
- sudo umount $mountPoint;
- if [ $? -ne 0 ]; then
- notify-send "Padlock" "The /dev/mapper/${dmDevice} cannot be unmount, because there are other filesystem is mounted in." --icon=dialog-error;
- fi
- sudo cryptsetup close /dev/mapper/${dmDevice};
- fi
- else
- sudo cryptsetup close /dev/mapper/${dmDevice};
- fi
- fi
- done
- fi
- if ! $(df -h | grep -q '/dev/mapper'); then
- #sed -i 's/allow/prevent/' ${launcher};
- sudo rm /usr/share/icons/padlock-icon.png;
- sudo ln -s /usr/share/icons/changes-prevent.png /usr/share/icons/padlock-icon.png;
- fi
-}
-
-mapperDeviceList=$(ls /dev/mapper --hide=control | awk '{printf $1" "}');
-
-if [ "$mapperDeviceList" ]; then lock;
-else unlock;
-fi
+++ /dev/null
-#!/bin/bash
-
-export HOME=/ic0;
-thunderbird;
+++ /dev/null
-#!/bin/bash
-
-if [ ! -d /tmp/${USER} ]; then
- mkdir /tmp/${USER}
- cp -prvv /home/${USER}/.mozilla /tmp/${USER}
-fi
-
-eth0=$(ip route show | grep 'default' | awk '{printf $5}');
-firejail --private=/tmp/${USER} --net=$eth0 /usr/bin/firefox
+++ /dev/null
-#!/bin/bash
-
-echo -n "What are you wanna listen? ";
-read search;
-
-function getDataBetweenHtmlMarks() {
- grep "$1" $2 | sed -n "${3}p" | cut -d ">" -f 2 | cut -d "<" -f 1;
-}
-wget http://dir.xiph.org/search?q=$search -O /tmp/shcast_dir.html >> /dev/null 2>&1;
-if [ ! -s /tmp/shcast_dir.html ]; then
- echo -e "\e[31mThere is no internet connection.\e[0m";
- exit 1;
-else
- amountOfStations=$(grep 'card-title' /tmp/shcast_dir.html | wc -l);
- i=1;
- while [ $i -le $amountOfStations ]; do
- stationName=$(getDataBetweenHtmlMarks 'card-title' /tmp/shcast_dir.html ${i});
- whatIsPlaying=$(getDataBetweenHtmlMarks 'card-subtitle' /tmp/shcast_dir.html ${i});
- echo -e "${i}. \e[33m${stationName}\e[0m";
- echo -e " \e[32m${whatIsPlaying}\e[0m";
- i=$((i + 1));
- done
- echo -n "Pick a one: ";
- read numberOfStation;
- echo $(grep 'Play' /tmp/shcast_dir.html | sed -n "${numberOfStation}p" | cut -d '"' -f 2) | xclip -selection c;
- echo "Station URL was copied to clipboard";
-
-fi
+++ /dev/null
-#!/bin/bash
-
-source ~/.sync.d/sync.conf;
-
-if [ ! -d "${HOME}/${ldirectory}" ]; then mkdir "${HOME}/${ldirectory}"; fi
-
-function printhelp {
-
- echo "Skrypt szybkiej synchronizacji katalogu zdalnego";
- echo "morketsmerke.org";
- echo "2023; COPYLEFT; ALL RIGHTS REVERSED";
- echo "";
- echo "push - Przesłanie danych z katalogu lokalnego na katalog zdalny";
- echo "pull - Pobranie zawartości katalogu zdalnego do katalogu lokalnego";
- echo "Plik konfiguracyjny musi znajdować się na ścieżce: ~/.sync.d/sync.conf";
- echo "Przykładowy plik konfiguracyjny znajduje się na ścieżce: /usr/share/sync.sh/sync.conf";
-}
-if [ ! "$1" ]; then
-
- printhelp;
- exit 1;
-
-else
- if [ "$1" = "push" ]; then
-
- echo "[*] Synchronizacja: local -> remote";
- rsync -avu ${HOME}/${ldirectory}/* ${ruser}@${server}:${rdirectory};
-
- elif [ "$1" = "pull" ]; then
-
- echo "[*] Synchronizacja remote -> local";
- rsync -avu ${ruser}@${server}:${rdirectory}/* ${HOME}/${ldirectory};
-
- else
- printhelp;
- exit 1;
- fi
-
-fi
+++ /dev/null
-#!/bin/bash
-
-GREEN="\e[32m";
-YELLOW="\e[33m";
-BLUE="\e[34m";
-ENDCOLOR="\e[0m";
-
-function help() {
- echo "ytplay - script which could play a video or audio track from youtube";
- echo "morketsmerke.net COPYLEFT @ 2022";
- echo "Options:";
- echo " -s - search given keyword on youtube.";
- echo " -v - play youtube video."
- echo " -a - play only youtube video audiotrack";
- echo "Ommiting -s option, assume you are give a yt video link.";
- echo "You have to put -v or -a before you paste a yt video link";
- echo "When you put keywords in -s option, you need to choose";
- echo "that you want listening an audiotrack (-a) oraz watch video (-v)";
- echo "Usage:";
- echo " $ ytplay -s -a [-f ytdl-format] 'lofi'";
- echo " $ ytplay -v https://youtube.com/watch?v=... [-f ytdl-format]";
- echo " $ ytplay -a https://youtube.com/watch?v=... [-f ytdl-format]";
- echo "You can search again the same keywords puting 'r' or 'R' instead";
- echo "of video numer";
-}
-
-function yt_search() {
- query=$(echo $* | sed 's/ /+/g');
- echo -n "Getting youtube site with search results...";
- wget https://youtube.com/results?search_query=$query -O /tmp/yt.html 2> /dev/null
- if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi
-
- sed -i 's/,/\n/g' /tmp/yt.html;
-
- listOfVideos=$(grep -n '^{\"url' /tmp/yt.html | cut -d ":" -f 1 | awk '{printf $1" "}');
-
- numberOfListElements=$(echo $listOfVideos | wc -w);
- i=1;
- lp=1;
- while [ $i -le $numberOfListElements ]; do
- if [ $i -eq $numberOfListElements ]; then
- ln1=$(echo $listOfVideos | cut -d " " -f $i);
- ln2='$';
- else
- j=$((i + 1));
- ln1=$(echo $listOfVideos | cut -d " " -f $i);
- ln2=$(echo $listOfVideos | cut -d " " -f $j);
- fi
- #if sed -n "${ln1},${ln2}p" /tmp/yt.html | grep -q '"iconType":"LIVE"'; then
- # i=$((i + 1)); continue;
- #else
- title=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'title' | head -1 | cut -d '"' -f 8);
- channel=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'ownerText' | head -1 | cut -d '"' -f 8);
- duration=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'simpleText' | sed -n '2p' | cut -d '"' -f 4);
- if [ "$duration" = "simpleText" ]; then duration="\e[31mLive\e[0m"; fi
- videoid=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'videoId' | sed -n '2p' | cut -d '"' -f 4);
- if [ "$title" ] && [ "$channel" ] && [ "$duration" ] && [ "$videoid" ] && [ "$duration" != "SHORTS" ]; then
- echo -e "${lp}. ${GREEN}${title}${ENDCOLOR}";
- echo -e " Channel: ${YELLOW}${channel}${ENDCOLOR} Duration: ${BLUE}${duration}${ENDCOLOR}";
- echo "${lp},${videoid},${title},${channel},${duration}" >> /tmp/yt.csv;
- else
- i=$((i + 1)); continue;
- fi
- #fi
- i=$((i + 1));
- lp=$((lp + 1));
- done
-}
-
-if [ "$1" ]; then
- if [ "$1" = "-a" ] || [ "$1" = "-v" ]; then
- mode=$1;
- shift;
- link=$(echo $1 | sed 's@https://@@');
- if [ $# -gt 1 ]; then
- shift;
- if [ "$1" = "-f" ]; then
- shift;
- if [ "$mode" = "-a" ]; then
- format="--no-video --ytdl-format=${1}";
- else
- format="--ytdl-format=${1}";
- fi
- fi
- fi
- elif [ "$1" = "-s" ]; then
- if [ -f /tmp/yt.html ]; then rm /tmp/yt.html; fi
- if [ -f /tmp/yt.csv ]; then rm /tmp/yt.csv; fi
-
- shift;
- mode=$1;
- if ! ([ "$mode" = "-v" ] || [ "$mode" = "-a" ]); then help; exit 1; fi
- shift;
- if [ "$1" = "-f" ]; then
- shift;
- if [ "$mode" = "-a" ]; then
- format="--no-video --ytdl-format=${1}";
- else
- format="--ytdl-format=${1}";
- fi
- fi
- while [ true ]; do
- yt_search $*;
- echo -n "Put number of which video you want to hear/watch: ";
- read numberOfVideo;
- if [[ $numberOfVideo -gt 0 ]]; then break;
- elif [ "$numberOfVideo" = "r" ] || [ "$numberOfVideo" = "R" ]; then
- continue;
- else
- help;
- exit 1;
- fi
- done
- title=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 3);
- channel=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 4);
- duration=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 5);
- videoId=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 2);
- clear;
- echo -e "Title: ${GREEN}${title}${ENDCOLOR}";
- echo -e "Channel: ${YELLOW}${channel}${ENDCOLOR} Duration: ${BLUE}${duration}${ENDCOLOR}";
- echo "====================================================================";
- link=${videoId};
- else
- help;
- exit 1;
- fi
-
- if [ "$mode" = "-a" ]; then
- if [ ! "$format" ]; then format="--ytdl-format=bestaudio"; fi
- mpv ${format} ytdl://${link};
- elif [ "$mode" = "-v" ]; then mpv ${format} ytdl://${link}; fi
-else
- help;
- exit 1;
-fi
+++ /dev/null
-#!/bin/bash
-
-vendor=$(hostnamectl | grep 'Vendor' | awk '{printf $3}')
-modelLine=$(hostnamectl | grep 'Model' | awk '{printf $3}')
-model=$(hostnamectl | grep 'Model' | awk '{printf $4}')
-
-case $vendor in
- "Lenovo") vendorShort="l";;
- "Dell") vendorShort="d";;
- *) hName="immudex";;
-esac
-
-case $modelLine in
- "ThinkPad") mLShort="TP";;
- "Latitude") mLShort="Lat";;
- *) hName="immudex";;
-esac
-
-if [ ! "$hName" ]; then
- hName="${vendorShort}-${mLShort}-$model"
- sudo hostnamectl set-hostname $hName;
- sudo sed -i "s/immudex/${hName}/" /etc/hosts;
- echo $hName | sudo tee /etc/hostname > /dev/null;
-fi
-
+++ /dev/null
-#!/bin/bash
-
-function help() {
- echo "meteo - prognoza pogody z wttr.in"
- echo "morketsmerke.org @ 2023";
- echo "Opcje:";
- echo " -s - format krótki (aktualna pogoda)";
- echo " -l - format długi (format krótki + 2 dniowa prognoza)"
- echo "Użycie:";
- echo "$ meteo <-s/-l> <miasto>";
-}
-
-if [ "$1" ]; then
- if [ "$1" = "-s" ]; then
- curl wttr.in/${2}?0\&lang=pl;
- elif [ "$1" = "-l" ]; then
- curl wttr.in/${2}?lang=pl;
- fi
-else
- help;
- exit 1;
-fi
+++ /dev/null
-#!/bin/bash
-
-file=$1;
-
-function help() {
- echo "pl - Play Links. Skrypt to odtwarzania multimediów z listy linków";
- echo "morketsmerke.org; COPYLEFT; 2023";
- echo;
- echo "Użycie:";
- echo "$ pl sciezka/do/listy/linkow";
- echo;
- echo "Format listy:";
- echo "nazwa linku: https://youtube.com/...";
-}
-
-if [ "$1" ]; then
- PS3="Link: ";
- linkNames=$(cut -d ":" -f 1 $1 | sed 's/\ /_/g' | awk '{printf $1" "}')
- select name in $linkNames; do
- if [ ! "$name" ]; then break; fi
- linkName=$(echo $name | sed 's/_/\ /g');
- link=$(grep "$linkName" $file | cut -d ":" -f 2-);
- if echo $link | grep -q "youtube"; then
- ytplay -a $link -f best[height=360];
- else
- mpv --no-video $link;
- fi
- done
-else
- help;
- exit 1;
-fi
+++ /dev/null
-#!/bin/bash
-
-function help() {
-
- echo "immudex_crypt - script used for listing, open and close crypt_LUKS ppartitions";
- echo "morketsmerke.net COPYLEFT @ 2022";
- echo "Options:";
- echo " list - displaing list of opened and available crypt_LUKS devices";
- echo " open - opening crypt_LUKS device, after this device is ready to mount";
- echo " close - unmount and closing crypt_LUKS devices";
- echo "Using:";
- echo "$ immudex_crypt list";
- echo "$ immudex_open <crypt_LUKS device>";
- echo "$ immudex_close immudex_crypt[0-9] | ic[0-9] | [0-9]";
-}
-
-function list() {
-
- mapperDeviceList=$(ls /dev/mapper --hide=control | awk '{printf $1" "}');
-
- echo "==============================================================";
- echo -e "Opened devices:";
- echo "==============================================================";
- echo -e "Device:\t\tMapper name:\t\tMount point:";
-
- if [ "$mapperDeviceList" ]; then
- for dmDevice in $mapperDeviceList; do
- if sudo cryptsetup status /dev/mapper/${dmDevice} > /dev/null 2>&1; then
- mountPoint=$(df --output=source,target /dev/mapper/${dmDevice} | tail -n 1 | awk '{printf $2}');
- device=$(sudo cryptsetup status /dev/mapper/${dmDevice} | grep "device" | awk '{printf $2}');
- if [ "$mountPoint" ] && [ "$mountPoint" != "/dev" ]; then
- echo -e "$device\t /dev/mapper/${dmDevice}\t$mountPoint";
- else
- echo -e "$device\t /dev/mapper/${dmDevice}\tNot mounted";
- fi
- fi
- done
- else
- echo -e "No opened crypt devices was found";
- fi
- echo "==============================================================";
-
- luksDevicesList=$(sudo blkid | grep 'LUKS' | cut -d ":" -f 1 | awk '{printf $1" "}');
-
- echo "==============================================================";
- echo -e "crypt_LUKS devices:";
- echo "==============================================================";
- echo -e "Device:\t\tMapper name:\t\tMount point:";
-
- if [ "$luksDevicesList" ]; then
- for lDevice in $luksDevicesList; do
- echo -e "$lDevice";
- done
- else
- echo "No crypt device was found";
- fi
- echo "==============================================================";
-}
-
-function open() {
-
- if [ $# -lt 1 ]; then help; exit 1;
- else
- index=$(ls --hide=control /dev/mapper | grep "immudex_crypt" | grep -o "[0-9]*$"| tail -1);
- if [ "$index" ]; then
- index=$((index + 1));
- else
- index=0;
- fi
- sudo cryptsetup open $1 immudex_crypt${index};
- sudo mkdir -p /media/${USER}/immudex_crypt${index};
- if ! $(sudo file -s /dev/dm-${index} | grep -q 'ext4'); then
- echo "Could not determine filesystem of unlocked device.";
- echo -n "Format this device to ext4? (y/n): "
- read format;
- if [ "$format" = "y" ]; then
- sudo mkfs.ext4 /dev/mapper/immudex_crypt${index};
- else
- echo "Refuse to mount.";
- sudo cryptsetup close immudex_crypt${index};
- exit 1;
- fi
- fi
- sudo mount /dev/mapper/immudex_crypt${index} /media/${USER}/immudex_crypt${index};
- if [ ! -e /ic${index} ]; then
- sudo ln -s /media/${USER}/immudex_crypt${index} /ic${index};
- fi
- fi
-
-}
-
-function close() {
-
- if [ $# -lt 1 ]; then help; exit 1;
- else
- if [ $1 -ge 0 ] 2> /dev/null; then
- cryptfsName="immudex_crypt${1}";
- elif echo $1 | grep -q 'ic'; then
- cryptfsName="immudex_crypt$(echo $1 | grep -o '[0-9]')";
- else
- cryptfsName=$1;
- fi
- if sudo cryptsetup status /dev/mapper/${cryptfsName} > /dev/null 2>&1; then
- mountPoint=$(df --output=source,target /dev/mapper/${cryptfsName} | tail -1 | awk '{printf $2}');
- if [ "$mountPoint" ] && [ "$mountPoint" != "/dev" ]; then
- sudo umount -R $mountPoint;
- sudo cryptsetup close ${cryptfsName};
- else
- sudo cryptsetup close ${cryptfsName};
- fi
- else
- echo "Given devices isn't opened crypt device or it was closed before";
- fi
- fi
-}
-
-if [ "$1" ]; then
-
- case $1 in
- "list") list;;
- "open") if [ "$2" ]; then open $2;
- else help; exit 1;
- fi;;
- "close") if [ "$2" ]; then close $2;
- else help; exit 1;
- fi;;
- *) help;;
- esac
-else
- help; exit 1;
-fi
+++ /dev/null
-#!/bin/bash
-
-RED="\e[31m";
-GREEN="\e[32m";
-ENDCOLOR="\e[0m";
-
-while [ true ]; do
- echo -e "${RED}This script will install immudex on first disk on your machine.${ENDCOLOR}";
- echo -e "${RED}It could be destructive for data placed on this disk${ENDCOLR}";
- echo -en "${RED}Are you sure that you want contiune? (y/n): ${ENDCOLOR}";
- read ans;
- if [ "$ans" = "y" ]; then break; fi
-done
-
-set -e
-
-function selectDisk() {
- disks=$(lsblk | grep 'disk' | awk '{printf $1" "}');
- if [ $(echo $disks | wc -w) -gt 1 ]; then
- select drive in $disks; do
- echo $drive;
- break;
- done
- else
- echo $disks | awk '{printf $1}';
- fi
-}
-
-if $(sudo efibootmgr > /dev/null 2>&1); then
-#uefi installation
- #partitioning
- echo -n "Installation immudex in EFI mode ... ";
- disk=$(selectDisk);
- originDisk=$disk;
- if [ ! "$disk" ]; then exit 1; fi
-
- sudo dd if=/dev/zero bs=1M of=/dev/$disk count=1 2> /dev/null
-
- sudo parted /dev/$disk mklabel msdos > /dev/null 2>&1;
- sudo parted /dev/$disk mkpart primary 1 101M > /dev/null 2>&1;
- sudo parted /dev/$disk set 1 boot on > /dev/null 2>&1;
- sudo parted /dev/$disk mkpart primary 101M 4G > /dev/null 2>&1;
-
- if $(echo $disk | egrep -qo "mmc|nve"); then disk="${disk}p"; fi
-
- #formatting
- sudo mkfs.vfat -F32 /dev/${disk}1 > /dev/null 2>&1;
- sudo mkfs.ext4 /dev/${disk}2 > /dev/null 2>&1;
-
- #Setting label for partition
- sudo e2label /dev/${disk}2 "immudex" > /dev/null 2>&1;
-
- #mount root partition
- sudo mount /dev/${disk}2 /media > /dev/null 2>&1;
-
- #creating directories for efi partition
- sudo mkdir -p /media/boot/efi > /dev/null 2>&1;
-
- #mount efi partition
- sudo mount /dev/${disk}1 /media/boot/efi > /dev/null 2>&1;
-
- #mount iso image in /mnt directory
- #sudo mount /dev/sr0 /mnt > /dev/null 2>&1;
-
- #copying whole iso image to the second partition
- sudo cp -rvv /run/live/medium/* /media > /dev/null 2>&1;
-
- #removing unnecessary directories from second partition
- sudo rm -rf /media/isolinux > /dev/null 2>&1;
- sudo rm -rf /media/EFI > /dev/null 2>&1;
-
- #GRUB Installation
- sudo grub-install --target=x86_64-efi --root-directory=/media --boot-directory=/media/boot --efi-directory=/media/boot/efi --bootloader-id=debian --removable > /dev/null 2>&1;
-
- #Adding entry to EFI Firmware
- sudo efibootmgr -c -d /dev/${originDisk} -p 1 -L "Debian" -l '\EFI\BOOT\grubx64.efi' > /dev/null 2>&1;
-
- #Umount all mounted filesystems
- sudo umount -R /media > /dev/null 2>&1;
-
- if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi
-
-else
-#mbr installation
- echo -n "Installation immudex in BIOS mode ... ";
-
- #partitioning
- disk=$(selectDisk);
- if [ ! "$disk" ]; then exit 1; fi
-
- sudo dd if=/dev/zero bs=1M of=/dev/$disk count=1 2> /dev/null
-
- sudo parted /dev/$disk mklabel msdos > /dev/null 2>&1;
- sudo parted /dev/$disk mkpart primary 1 4G > /dev/null 2>&1;
- sudo parted /dev/$disk set 1 boot on > /dev/null 2>&1;
-
- if $(echo $disk | egrep -qo "mmc|nve"); then disk="${disk}p"; fi
-
- #formatting
- sudo mkfs.ext4 /dev/${disk}1 > /dev/null 2>&1;
-
- #Setting label for partition is necessary for extlinux bootloader
- sudo e2label /dev/${disk}1 "immudex" > /dev/null 2>&1;
-
- #mount partition in /media directory
- sudo mount /dev/${disk}1 /media > /dev/null 2>&1;
-
- #Creating directory for extlinux
- sudo mkdir /media/extlinux > /dev/null 2>&1;
-
- #Instalation extlinux files in abovementioned directory
- sudo extlinux --install /media/extlinux > /dev/null 2>&1;
-
- #mount iso image in /mnt directory
- #sudo mount /dev/sr0 /mnt > /dev/null 2>&1;
-
- #copying live directory from iso image to partition
- sudo cp -rvv /run/live/medium/live /media > /dev/null; 2>&1;
-
- #installation extlinux MBR on first sector of hard drive (whole device)
- sudo dd if=/usr/lib/EXTLINUX/mbr.bin of=/dev/${disk} > /dev/null 2>&1;
-
- #creating extlinux configuration file
- cat > extlinux.conf <<EOF
-default immudex
-label immudex
-kernel /live/vmlinuz
-append quiet initrd=/live/initrd boot=live overlay-size=25% apparmor=1 security=apparmor
-EOF
- sudo cp extlinux.conf /media/extlinux > /dev/null 2>&1;
-
- #Unmounting filesystems
- sudo umount /media > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi
-fi
+++ /dev/null
-#!/bin/bash
-
-set -e
-
-RED="\e[31m";
-GREEN="\e[32m";
-YELLOW="\e[33m";
-ENDCOLOR="\e[0m";
-root="/run/live/medium";
-
-function help() {
- echo "immudex_upgrade - script for searching upgrades and upgrade immudex";
- echo "morketsmerke.net @ 2022";
- echo "Options:";
- echo " --check --print - check there are upgrades for immudex";
- echo " --upgrade - check there are upgrades for immudex and install them.";
- echo " If there is no new version, script will propose refreshing";
- echo " current immudex installation, its helpful when you tried";
- echo " remaster immudex and you get any trouble with this".
-}
-
-function main_upgrade() {
- set -e
- if [ "$(uname -m)" = "x86_64" ]; then arch="64";
- else arch="32";
- fi
- rootPart=$(grep "${1}" /etc/mtab | head -1 | awk '{printf $1}');
- sudo mount $rootPart $1 -o remount,rw;
- sudo rm -f ${1}/live/*;
- sudo wget -q https://sourceforge.net/projects/immudex/files/upgrades/${2}/${arch}/filesystem.squashfs/download -O ${1}/live/filesystem.squashfs;
- sudo wget -q https://sourceforge.net/projects/immudex/files/upgrades/${2}/${arch}/initrd/download -O ${1}/live/initrd;
- sudo wget -q https://sourceforge.net/projects/immudex/files/upgrades/${2}/${arch}/vmlinuz/download -O ${1}/live/vmlinuz;
- echo "$2" > /tmp/version;
- sudo cp /tmp/version ${1}/live;
-}
-
-function check(){
- set -e
- if [ -d ${root}/live ]; then
- if [ -f ${root}/live/version ]; then
- version=$(cat ${root}/live/version | sed 's/\.//g');
- else version="000";
- fi
- if [ ! -f /tmp/feed.xml ]; then
- wget -q https://sourceforge.net/p/immudex/activity/feed -O /tmp/feed.xml
- fi
- if [ ! -s /tmp/feed.xml ]; then sudo rm /tmp/feed.xml; return 255; fi;
- newVersionTxt=$(grep -o "[0-9]\.[0-9]\.[0-9]" /tmp/feed.xml | head -1);
- newVersionInt=$(echo $newVersionTxt | sed 's/\.//g');
- if [ $version -lt $newVersionInt ]; then
- exitcode=0;
- else
- exitcode=1;
- fi
- else
- exitcode=255;
- fi
- if [ "$1" ] && [ "$1" = "--print" ]; then
- echo $newVersionTxt;
- return 0;
- fi
- return $exitcode;
-}
-
-if [ "$1" ] && [ "$1" = "--check" ]; then
- if [ "$2" ] && [ "$2" = "--print" ]; then
- newVersion=$(check --print);
- if check; then
- echo -e "${YELLOW}New version (${ENDCOLOR}${RED}$newVersion${ENDCOLOR}${YELLOW}) of immudex is available to upgrade.${ENDCOLOR}";
- else
- echo -e "${YELLOW}This (${ENDCOLOR}${GREEN}$newVersion${ENDCOLOR}${YELLOW}) is the latest version of immudex.${ENDCOLOR}";
- fi
- fi
-elif [ "$1" ] && [ "$1" = "--upgrade" ]; then
- newVersionTxt=$(check --print);
- newVersionInt=$(echo $newVersionTxt | sed 's/\.//g');
- if check; then
- echo -en "${YELLOW}New version "
- echo -en "(${ENDCOLOR}${RED}${newVersionTxt}${ENDCOLOR}${YELLOW}) "
- echo -e "of immudex is available.${ENDCOLOR}";
- echo -e "${RED}Warning, reboot maybe necessary to continue work on this machine${ENDCOLOR}";
- echo -en "${YELLOW}Do you want upgrade this system? (y/n):${ENDCOLOR} ";
- read commit;
- if [ $commit = "y" ]; then
- echo -n "Upgrading immudex to the newest version...";
- main_upgrade $root $newVersionTxt;
- if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi
- else
- exit 1;
- fi
- else
- echo -e "${GREEN}There is no newer version of immudex,${ENDCOLOR}";
- echo -e "${YELLOW}but you can copy fresh system files from latest iso image";
- echo -e "${RED}Warning, reboot maybe necessary to continue work on this machine${ENDCOLOR}";
- echo -en "${YELLOW}Do you want refresh this system? (y/n):${ENDCOLOR} ";
- read commit;
- if [ $commit = "y" ]; then
- echo -n "Refreshing immudex to the latest iso image...";
- main_upgrade $root $newVersionTxt;
- if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi
- else
- exit 1;
- fi
- exit 0;
- fi
-else
- help;
- exit 1;
-fi
+++ /dev/null
-#!/bin/bash
-
-if [ -f ~/public.gpg ] && [ -f ~/private.gpg ]; then
- gpg --import ~/public.gpg
- gpg --import ~/private.gpg
- userId=$(gpg --list-keys | sed -nr 's/.+<(.*)>$/\1/p');
- gpg --edit-key $userId;
-fi
+++ /dev/null
-#!/bin/bash
-
-if $(ls $HOME | grep -q '.*_rsa.*'); then
- if [ -d /home/$USER/.ssh ]; then
- cp -v ~/*_rsa* /home/$USER/.ssh;
- else
- mkdir /home/$USER/.ssh;
- chmod 700 /home/$USER/.ssh;
- cp -v ~/*_rsa* /home/$USER/.ssh;
- fi
-fi
-
+++ /dev/null
-#!/bin/bash
-
-/usr/bin/figlet immudex;
-echo;
-echo "-= Today is: $(date) =-";
-cpuIdle=$(vmstat | tail -1 | awk '{printf $15}');
-cpuUsage=$((100 - $cpuIdle));
-echo -e "-=\tCPU: ${cpuUsage}%\t\t\t=-";
-echo -e "-=\tMEM: $(free -h | sed -n '2p' | awk '{printf $7}' | sed 's/i//') Free\t\t\t=-";
-diskSize=$(df -h | grep '/dev/mapper' | head -1 | awk '{printf $2}');
-diskFree=$(df -h | grep '/dev/mapper' | head -1 | awk '{printf $4}');
-diskUsage_perc=$(df -h | grep '/dev/mapper' | head -1 | sed 's/%//' | awk '{printf $5}');
-#FCP = First Crypt Partition
-echo -e "-=\tFCP: ${diskFree}/${diskSize} (${diskUsage_perc}%)\t\t=-";
-echo -e "-=\tPROCESSES: $(grep 'proces' /proc/stat | awk '{printf $2}')\t\t\t=-";
-echo -e "-=\tUPTIME: $(uptime | awk '{printf $3}' | sed 's/,//')\t\t\t=-";
-echo -e "-=\t$(uptime | grep -o "load.*$" | tr [a-z] [A-Z])\t=-";
-echo -e "-= morketsmerke.net @ 2022 https://github.com/xf0r3m/immudex =-";
-echo;
-/usr/local/bin/immudex_upgrade --check --print
-echo "====================================================================";
+++ /dev/null
-#!/bin/bash
-
-/usr/bin/figlet immudex;
-echo;
-echo "Today is: $(date)";
-echo;
-echo "System summary: ";
-cpuIdle=$(vmstat | tail -1 | awk '{printf $15}');
-cpuUsage=$((100 - $cpuIdle));
-echo -e " \tCPU: ${cpuUsage}%";
-echo -e " \tMEM: $(free -h | sed -n '2p' | awk '{printf $7}' | sed 's/i//') Free";
-if $(df -h 2> /dev/null | grep -q '/dev/mapper'); then
- i=1;
- echo -e " \tCRYPT_PARTi: Free/Total (Usage%)";
- amountOfDisks=$(df -h 2> /dev/null | grep '/dev/mapper' | wc -l | awk '{printf $1}');
- while [ $i -le $amountOfDisks ]; do
- diskSize=$(df -h 2> /dev/null | grep '/dev/mapper' | sed -n "${i}p" | awk '{printf $2}');
- diskFree=$(df -h 2> /dev/null | grep '/dev/mapper' | sed -n "${i}p" | awk '{printf $4}');
- diskUsage_perc=$(df -h 2> /dev/null | grep '/dev/mapper' | sed -n "${i}p" | sed 's/%//' | awk '{printf $5}');
- #FCP = First Crypt Partition
- echo -e " \tCRYPT_PART${i}: ${diskFree}/${diskSize} (${diskUsage_perc}%)";
- i=$((i + 1));
- done
-else
- echo -e " \tCRYPT_PART: N/A";
-fi
-echo -e " \tPROCESSES: $(ps -aux | wc -l | awk '{printf $1}')";
-utime=$(uptime | awk '{printf $3}' | sed 's/,//');
-if $(echo $utime | grep -q ":"); then
- echo -e " \tUPTIME: ${utime}";
-else
- echo -e " \tUPTIME: 0:${utime}";
-fi
-echo -e " \t$(uptime | grep -o "load.*$" | tr [a-z] [A-Z])";
-echo;
-echo -e "morketsmerke.net @ 2022 https://github.com/xf0r3m/immudex";
-echo;
-/usr/local/bin/immudex_upgrade --check --print;
-if [ $? -ne 0 ]; then
- echo -e "\e[31mThere is no internet connection or internal error.\e[0m";
- if [ -f /tmp/feed.xml ] && [ ! -s /tmp/feed.xml ]; then
- rm -f /tmp/feed.xml;
- fi
-else
- if [ "$USER" = "xf0r3m" ]; then
- sudo apt update > /tmp/update.log 2>&1 && tail -1 /tmp/update.log;
- fi
-fi
-echo "====================================================================";
+++ /dev/null
-#!/bin/bash
-
-function help() {
- echo "newsfeed - fetch and browse news feed from rss and atom channels";
- echo "morketsmerke.net; COPYLEFT @ 2022";
- echo;
- echo "Options:";
- echo " --list - shows numbered list of names, saved in ~/.newsfeed names and";
- echo " URL of rss channels";
- echo " --check - fetching new rss channel file from source";
- echo " --show <number_of_channel> - shows numbered list of news titles.";
- echo " Number of channel you can get from --list option.";
- echo " --open <number_of_title> - open web browser on link, which are under";
- echo " titles of news on rss channel. Number of title you can get";
- echo " from --show option. This option based on the last showed rss";
- echo " channel feed.";
- echo;
- echo "The ~/.newsfeed file:";
- echo " This file is simple csv (semicolon separated values) file which";
- echo " store rss channels in one line. One by one. The one line";
- echo " contains: name and URL of rss feed. For example:";
- echo;
- echo " News Feed;https://newsfeed.example.org/rss";
-}
-if [ ! -s ~/.newsfeed ]; then
- help;
- exit 1;
-else
- if [ ! "$1" ] || ([ "$1" != "--list" ] && \
- [ "$1" != "--check" ] && \
- [ "$1" != "--show" ] && \
- [ "$1" != "--open" ]); then
- help;
- exit 1;
- fi
- amountOfSubscriptions=$(cat ~/.newsfeed | wc -l);
- i=1;
- while [ $i -le $amountOfSubscriptions ]; do
- newsfeedLine=$(sed -n "${i}p" ~/.newsfeed);
- nameOfSubscription=$(echo $newsfeedLine | cut -d ";" -f 1);
- rssLink=$(echo $newsfeedLine | cut -d ";" -f 2);
- if [ "$1" ] && [ "$1" = "--list" ]; then
- echo -e "${i}. ${nameOfSubscription}";
- elif [ "$1" ] && [ "$1" = "--check" ]; then
- echo -e "${i}. ${nameOfSubscription}";
- echo -n "Getting news feed...";
- wget $rssLink -O /tmp/new_newsfeed_${i}.xml 2>/dev/null;
- if [ $? -eq 0 ]; then echo "[ OK ]";
- else echo -e "\nThere is no Internet connection"; exit 1; fi
- if [ -s /tmp/newsfeed_${i}.xml ]; then
- amountOfNewNewses=$(diff /tmp/new_newsfeed_${i}.xml /tmp/newsfeed_${i}.xml | grep '<title>' | wc -l);
- if [ $amountOfNewNewses -gt 0 ]; then
- notify-send "$nameOfSubscription" "New $amountOfNewNewses newses" --icon=/usr/share/icons/rss.png;
- j=1;
- sleep 1;
- while [ $j -le $amountOfNewNewses ]; do
- news=$(diff /tmp/new_newsfeed_${i}.xml /tmp/newsfeed_${i}.xml | \
- grep '<title>' | sed -n "${j}p" | sed 's/<title>//' | \
- sed 's/<\/title>//' | sed 's/[<>]//' | \
- sed 's/^[[:space:]]*//g');
- notify-send "newsfeed" "${nameOfSubscription}: ${news}" -t 10000 --icon=/usr/share/icons/rss.png;
- sleep 1;
- j=$((j + 1));
- done
- fi
- mv /tmp/new_newsfeed_${i}.xml /tmp/newsfeed_${i}.xml;
- else
- mv /tmp/new_newsfeed_${i}.xml /tmp/newsfeed_${i}.xml;
- amountOfNews=$(grep '<title>' /tmp/newsfeed_${i}.xml | sed -n '2,$p' | wc -l);
- if [ $amountOfNews -eq 0 ]; then
- compressed=1;
- amountOfNews=$(sed 's/<\/title>/\n/g' /tmp/newsfeed_${i}.xml | sed 's/<item>/\n/g' | grep '<title>' | wc -l)
- fi
- notify-send "$nameOfSubscription" "New $amountOfNews newses" --icon=/usr/share/icons/rss.png;
- fi
- fi
- i=$((i + 1));
- done
- if [ "$1" ] && [ "$1" = "--show" ] && [ "$2" ] && [ $2 -gt 0 ]; then
-
- #Parsing
- #Thanks to the linuxhint.com for command:
- #sed 's/^[[:space]]*//g'
- #https://linuxhint.com/trim_string_bash
-
- if grep -q 'CDATA' /tmp/newsfeed_${2}.xml; then
- sed 's/<\/title>/\n/g' /tmp/newsfeed_${2}.xml | \
- sed 's/<item>/\n/g' | grep '<title>' | sed -n '2,$p' | \
- sed 's/<title>//' | sed 's/"/"/g' | \
- sed 's/<!\[CDATA\[//g' | sed 's/\]\]>//g' | \
- sed 's/^[[:space:]]*//g' | nl | less;
- else
- sed 's/<\/title>/\n/g' /tmp/newsfeed_${2}.xml | \
- sed 's/<item>/\n/g' | grep '<title>' | sed -n '2,$p' | \
- sed 's/<title>//' | sed 's/"/"/g' | \
- sed 's/^[[:space:]]*//g' | nl | less;
- fi
- echo $2 > /tmp/lastShowedNewsFeed;
- elif [ "$1" ] && [ "$1" = "--open" ] && [ "$2" ] && [ $2 -gt 0 ]; then
- subscriptionNumber=$(cat /tmp/lastShowedNewsFeed);
- if ! grep -q 'CDATA' /tmp/newsfeed_${subscriptionNumber}.xml; then
- link=$(sed 's/<\/link>/\n/g' /tmp/newsfeed_${subscriptionNumber}.xml | sed 's/<\/title>/\n/g' | grep '<link>' | sed -n '2,$p' | sed 's/<link>//g' | sed -n "${2}p")
- else
- link=$(sed 's/<\/link>/\n/g' /tmp/newsfeed_${subscriptionNumber}.xml | sed 's/<\/description>/\n/g' | grep '<link>' | sed -n '2,$p' | sed 's/<link>//g' | sed -n "${2}p")
- fi
- exo-open --launch WebBrowser "$link";
- fi
-fi
+++ /dev/null
-#!/bin/bash
-
-launcher="/home/${USER}/.config/xfce4/panel/launcher-29/16633324331.desktop";
-
-function main_unlock() {
- /usr/local/bin/immudex_crypt open $1;
- index=$(basename $(/usr/local/bin/immudex_crypt list | grep "$1" | head -1 | awk '{printf $2}' | grep -o '[0-9]'));
- #sudo mkdir -p /media/${USER}/$devName;
- #sudo mount /dev/mapper/$devName /media/${USER}/$devName;
-
- xfce4-terminal --default-working-directory=/ic${index};
- sed -i 's/--unlock/--lock/' ${launcher};
- sed -i 's/padlock.png/unlocked.png/' ${launcher};
-}
-
-function unlock() {
-
- cryptParts=$(sudo blkid | grep 'LUKS' | sed 's/://g' | awk '{printf $1" "}');
- if [ "$cryptParts" ]; then
- if [ $(echo $cryptParts | wc -w) -gt 1 ]; then
- select cryptPart in $cryptParts; do
- main_unlock $cryptPart;
- break;
- done
- else
- main_unlock $cryptParts;
- fi
- else
- echo -e "\e[31mThere is no LUKS partition to open.\e[0m";
- sleep 3;
- fi
-}
-
-function lock() {
-
- mapperDeviceList=$(ls /dev/mapper --hide=control | awk '{printf $1" "}');
-
- if [ "$mapperDeviceList" ]; then
- for dmDevice in $mapperDeviceList; do
- if sudo cryptsetup status /dev/mapper/${dmDevice} > /dev/null 2>&1; then
- mountPoint=$(df --output=source,target /dev/mapper/${dmDevice} | tail -n 1 | awk '{printf $2}');
- if [ "$mountPoint" ]; then
- if $(sudo lsof $mountPoint > /dev/null 2>&1); then
- notify-send "Padlock" "The /dev/mapper/${dmDevice} cannot be unmount, because there are opened file or running proceses." --icon=dialog-error;
- else
- sudo umount $mountPoint;
- if [ $? -ne 0 ]; then
- notify-send "Padlock" "The /dev/mapper/${dmDevice} cannot be unmount, because there are other filesystem is mounted in." --icon=dialog-error;
- fi
- sudo cryptsetup close /dev/mapper/${dmDevice};
- fi
- else
- sudo cryptsetup close /dev/mapper/${dmDevice};
- fi
- fi
- done
- fi
- if ! $(df -h | grep -q '/dev/mapper'); then
- sed -i 's/--lock/--unlock/' ${launcher};
- sed -i 's/unlocked.png/padlock.png/' ${launcher};
- fi
-}
-
-if [ "$1" ] && [ "$1" = "--unlock" ]; then unlock;
-elif [ "$1" ] && [ "$1" = "--lock" ]; then lock;
-fi
+++ /dev/null
-#!/bin/bash
-
-mapperDeviceList=$(ls /dev/mapper --hide=control | awk '{printf $1" "}');
-
-if [ "$mapperDeviceList" ]; then
-
- for dmDevice in $mapperDeviceList; do
- if sudo cryptsetup status /dev/mapper/${dmDevice} > /dev/null 2>&1; then
- mountPoint=$(df --output=source,target /dev/mapper/${dmDevice} | tail -n 1 | awk '{printf $2}');
- if [ "$mountPoint" ]; then
- if $(sudo lsof $mountPoint > /dev/null 2>&1); then
- notify-send "Protected" "The $1 cannot be run, because your LUKS partition is open." --icon=dialog-error;
- exit 1;
- else
- sudo umount $mountPoint;
- sudo cryptsetup close /dev/mapper/${dmDevice};
- #zmiana na launcherze padlock
- launcher="/home/${USER}/.config/xfce4/panel/launcher-29/16633324331.desktop";
- sed -i 's/--lock/--unlock/' ${launcher};
- sed -i 's/unlocked.png/padlock.png/' ${launcher};
- fi
- fi
- fi
- done
- $1;
-else
- $1;
-
-fi
+++ /dev/null
-#!/bin/bash
-
-echo -n "What are you wanna listen? ";
-read search;
-
-function getDataBetweenHtmlMarks() {
- grep "$1" $2 | sed -n "${3}p" | cut -d ">" -f 2 | cut -d "<" -f 1;
-}
-wget http://dir.xiph.org/search?q=$search -O /tmp/shcast_dir.html >> /dev/null 2>&1;
-if [ ! -s /tmp/shcast_dir.html ]; then
- echo -e "\e[31mThere is no internet connection.\e[0m";
- exit 1;
-else
- amountOfStations=$(grep 'card-title' /tmp/shcast_dir.html | wc -l);
- i=1;
- while [ $i -le $amountOfStations ]; do
- stationName=$(getDataBetweenHtmlMarks 'card-title' /tmp/shcast_dir.html ${i});
- whatIsPlaying=$(getDataBetweenHtmlMarks 'card-subtitle' /tmp/shcast_dir.html ${i});
- echo -e "${i}. \e[33m${stationName}\e[0m";
- echo -e " \e[32m${whatIsPlaying}\e[0m";
- i=$((i + 1));
- done
- echo -n "Pick a one: ";
- read numberOfStation;
- echo $(grep 'Play' /tmp/shcast_dir.html | sed -n "${numberOfStation}p" | cut -d '"' -f 2) | xclip -selection c;
- echo "Station URL was copied to clipboard";
-
-fi
+++ /dev/null
-#!/bin/bash
-
-GREEN="\e[32m";
-YELLOW="\e[33m";
-BLUE="\e[34m";
-ENDCOLOR="\e[0m";
-
-function help() {
- echo "ytplay - script which could play a video or audio track from youtube";
- echo "morketsmerke.net COPYLEFT @ 2022";
- echo "Options:";
- echo " -s - search given keyword on youtube.";
- echo " -v - play youtube video."
- echo " -a - play only youtube video audiotrack";
- echo "Ommiting -s option, assume you are give a yt video link.";
- echo "You have to put -v or -a before you paste a yt video link";
- echo "When you put keywords in -s option, you need to choose";
- echo "that you want listening an audiotrack (-a) oraz watch video (-v)";
- echo "Usage:";
- echo " $ ytplay -s -a 'lofi'";
- echo " $ ytplay -v https://youtube.com/watch?v=...";
- echo " $ ytplay -a https://youtube.com/watch?v=...";
-}
-
-if [ "$1" ]; then
- if [ "$1" = "-a" ] || [ "$1" = "-v" ]; then
- mode=$1;
- shift;
- link=$(echo $1 | sed 's@https://@@');
- elif [ "$1" = "-s" ]; then
- if [ -f /tmp/yt.html ]; then rm /tmp/yt.html; fi
- if [ -f /tmp/yt.csv ]; then rm /tmp/yt.csv; fi
-
- shift;
- mode=$1;
- if ! ([ "$mode" = "-v" ] || [ "$mode" = "-a" ]); then help; exit 1; fi
- shift;
- query=$(echo $* | sed 's/ /+/g');
- echo -n "Getting youtube site with search results...";
- wget https://youtube.com/results?search_query=$query -O /tmp/yt.html 2> /dev/null
- if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi
-
- sed -i 's/,/\n/g' /tmp/yt.html;
-
- listOfVideos=$(grep -n '^{\"url' /tmp/yt.html | cut -d ":" -f 1 | awk '{printf $1" "}');
-
- numberOfListElements=$(echo $listOfVideos | wc -w);
- i=1;
- lp=1;
- while [ $i -le $numberOfListElements ]; do
- if [ $i -eq $numberOfListElements ]; then
- ln1=$(echo $listOfVideos | cut -d " " -f $i);
- ln2='$';
- else
- j=$((i + 1));
- ln1=$(echo $listOfVideos | cut -d " " -f $i);
- ln2=$(echo $listOfVideos | cut -d " " -f $j);
- fi
- if sed -n "${ln1},${ln2}p" /tmp/yt.html | grep -q '"iconType":"LIVE"'; then
- i=$((i + 1)); continue;
- else
- title=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'title' | head -1 | cut -d '"' -f 8);
- channel=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'ownerText' | head -1 | cut -d '"' -f 8);
- duration=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'simpleText' | sed -n '2p' | cut -d '"' -f 4);
- videoid=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'videoId' | sed -n '2p' | cut -d '"' -f 4);
- if [ "$title" ] && [ "$channel" ] && [ "$duration" ] && [ "$videoid" ] && [ "$duration" != "SHORTS" ]; then
- echo -e "${lp}. ${GREEN}${title}${ENDCOLOR}";
- echo -e " Channel: ${YELLOW}${channel}${ENDCOLOR} Duration: ${BLUE}${duration}${ENDCOLOR}";
- echo "${lp},${videoid},${title},${channel},${duration}" >> /tmp/yt.csv;
- else
- i=$((i + 1)); continue;
- fi
- fi
- i=$((i + 1));
- lp=$((lp + 1));
- done
- echo -n "Put number of which video you want to hear/watch: ";
- read numberOfVideo;
- title=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 3);
- channel=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 4);
- duration=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 5);
- videoId=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 2);
- clear;
- echo -e "Title: ${GREEN}${title}${ENDCOLOR}";
- echo -e "Channel: ${YELLOW}${channel}${ENDCOLOR} Duration: ${BLUE}${duration}${ENDCOLOR}";
- echo "====================================================================";
- link=${videoId};
- else
- help;
- exit 1;
- fi
-
- if [ "$mode" = "-a" ]; then mpv --ytdl-format=bestaudio ytdl://${link};
- elif [ "$mode" = "-v" ]; then mpv ytdl://${link}; fi
-else
- help;
- exit 1;
-fi
+++ /dev/null
-#!/bin/bash
-
-while [ ! -h /dev/mapper/immudex_crypt0 ]; do sleep 1; done
-HOME=/ic0 xfce4-notes > /dev/null 2>&1 &
+++ /dev/null
-#!/bin/bash
-
-GREEN="\e[32m";
-YELLOW="\e[33m";
-ENDCOLOR="\e[0m";
-
-function help() {
- echo "create_media - script used for write iso image to usb drive(mainly)";
- echo "morketsmerke.net COPYLEFT @ 2022";
- echo "Options:";
- echo " --i386-efi - creating 32-bit EFI usb drive with iso image";
- echo " (comapatible with immudex only iso images)";
- echo "Usage:";
- echo " $ create_media [--i386-efi] <usb_disk> <iso_image>";
-}
-
-if [ "$1" ] && [ "$1" = "--i386-efi" ]; then target="i386-efi"; shift; fi
-if [ "$1" ] && echo $1 | grep -Eq '/dev/(sd[a-z]|vd[a-z]|mmcblk[0-9])'; then
- disk=$1; shift;
-else
- help;
- exit 1;
-fi
-if [ "$1" ] && file $1 | grep -q 'ISO 9660'; then
- iso=$1;
-else
- help;
- exit 1;
-fi
-
-if [ "$target" ]; then
- echo -n "Writing zeros to 1st megabyte on disk...";
- sudo dd if=/dev/zero bs=1M of=$disk count=1 > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Creating MS-DOS partitionig scheme on disk...";
- sudo parted $disk mklabel msdos > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Creating FAT-32 partition...";
- sudo parted $disk mkpart primary fat32 1 100%Free > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Creating VFAT filesystem on partition...";
- sudo mkfs.vfat ${disk}1 > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Creating /mnt/usb directory...";
- sudo mkdir /mnt/usb > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]";
- else echo -e "[${YELLOW}Directory exist!${ENDCOLOR}]"; fi
-
- echo -n "Mounting VFAT partition on /mnt/usb...";
- sudo mount ${disk}1 /mnt/usb > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Instalation GRUB on disk...";
- sudo grub-install --target=i386-efi --efi-directory=/mnt/usb --boot-directory=/mnt/usb/boot --bootloader-id=boot --removable > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Creating /mnt/iso directory...";
- sudo mkdir /mnt/iso > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]";
- else echo -e "[${YELLOW}Directory exist!${ENDCOLOR}]"; fi
-
- echo -n "Mounting iso file on /mnt/iso...";
- sudo mount $iso /mnt/iso > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Copying grub config files to the disk...";
- sudo cp /mnt/iso/boot/grub/font.pf2 /mnt/usb/boot/grub > /dev/null 2>&1;
- sudo cp /mnt/iso/boot/grub/grub.cfg /mnt/usb/boot/grub > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Copying immudex files to the disk...";
- sudo cp -r /mnt/iso/live /mnt/usb > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Creating empty DEBIAN file...";
- sudo touch /mnt/usb/DEBIAN > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Umounting all mounted filesystems...";
- sudo umount /mnt/* > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-else
- echo -n "Writing zeros to 1st megabyte on disk...";
- sudo dd if=/dev/zero bs=1M of=$disk count=1 > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-
- echo -n "Writing iso image to the disk..."
- sudo dd if=$iso bs=1M of=$disk > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[${GREEN}OK${ENDCOLOR}]"; fi
-fi
+++ /dev/null
-#!/bin/bash
-
-function help() {
-
- echo "immudex_crypt - script used for listing, open and close crypt_LUKS ppartitions";
- echo "morketsmerke.org COPYLEFT @ 2023";
- echo "Options:";
- echo " list - displaing list of opened and available crypt_LUKS devices";
- echo " create - formatting device for crypt_LUKS";
- echo " open - opening crypt_LUKS device, after this device is ready to mount";
- echo " close - unmount and closing crypt_LUKS devices";
- echo "Using:";
- echo "$ immudex_crypt list";
- echo "$ immudex_crypt create <disk partition>";
- echo "$ immudex_crypt open <crypt_LUKS device>";
- echo "$ immudex_crypt close immudex_crypt[0-9] | ic[0-9] | [0-9]";
-}
-
-function list() {
-
- mapperDeviceList=$(ls /dev/mapper --hide=control | awk '{printf $1" "}');
-
- echo "==============================================================";
- echo -e "Opened devices:";
- echo "==============================================================";
- echo -e "Device:\t\tMapper name:\t\tMount point:";
-
- if [ "$mapperDeviceList" ]; then
- for dmDevice in $mapperDeviceList; do
- if sudo cryptsetup status /dev/mapper/${dmDevice} > /dev/null 2>&1; then
- mountPoint=$(df --output=source,target /dev/mapper/${dmDevice} | tail -n 1 | awk '{printf $2}');
- device=$(sudo cryptsetup status /dev/mapper/${dmDevice} | grep "device" | awk '{printf $2}');
- if [ "$mountPoint" ] && [ "$mountPoint" != "/dev" ]; then
- echo -e "$device\t /dev/mapper/${dmDevice}\t$mountPoint";
- else
- echo -e "$device\t /dev/mapper/${dmDevice}\tNot mounted";
- fi
- fi
- done
- else
- echo -e "No opened crypt devices was found";
- fi
- echo "==============================================================";
-
- luksDevicesList=$(sudo blkid | grep 'LUKS' | cut -d ":" -f 1 | awk '{printf $1" "}');
-
- echo "==============================================================";
- echo -e "crypt_LUKS devices:";
- echo "==============================================================";
- echo -e "Device:\t\tMapper name:\t\tMount point:";
-
- if [ "$luksDevicesList" ]; then
- for lDevice in $luksDevicesList; do
- echo -e "$lDevice";
- done
- else
- echo "No crypt device was found";
- fi
- echo "==============================================================";
-}
-
-function open() {
-
- if [ $# -lt 1 ]; then help; exit 1;
- else
- index=$(ls --hide=control /dev/mapper | grep "immudex_crypt" | grep -o "[0-9]*$"| tail -1);
- if [ "$index" ]; then
- index=$((index + 1));
- else
- index=0;
- fi
- sudo cryptsetup open $1 immudex_crypt${index};
- sudo mkdir -p /media/${USER}/immudex_crypt${index};
- dmDevice=$(ls -l /dev/mapper/immudex_crypt${index} | awk '{printf $10}' | cut -d "/" -f 2);
- if ! $(sudo file -s /dev/${dmDevice} | grep -q 'ext4'); then
- echo "Could not determine filesystem of unlocked device.";
- echo -n "Format this device to ext4? (y/n): "
- read format;
- if [ "$format" = "y" ]; then
- sudo mkfs.ext4 /dev/mapper/immudex_crypt${index};
- else
- echo "Refuse to mount.";
- sudo cryptsetup close immudex_crypt${index};
- exit 1;
- fi
- fi
- sudo mount /dev/mapper/immudex_crypt${index} /media/${USER}/immudex_crypt${index};
- if [ ! -e /ic${index} ]; then
- sudo ln -s /media/${USER}/immudex_crypt${index} /ic${index};
- fi
- fi
-
-}
-
-function close() {
-
- if [ $# -lt 1 ]; then help; exit 1;
- else
- if [ $1 -ge 0 ] 2> /dev/null; then
- cryptfsName="immudex_crypt${1}";
- elif echo $1 | grep -q 'ic'; then
- cryptfsName="immudex_crypt$(echo $1 | grep -o '[0-9]')";
- else
- cryptfsName=$1;
- fi
- if sudo cryptsetup status /dev/mapper/${cryptfsName} > /dev/null 2>&1; then
- mountPoint=$(df --output=source,target /dev/mapper/${cryptfsName} | tail -1 | awk '{printf $2}');
- if [ "$mountPoint" ] && [ "$mountPoint" != "/dev" ]; then
- sudo umount -R $mountPoint;
- sudo cryptsetup close ${cryptfsName};
- else
- sudo cryptsetup close ${cryptfsName};
- fi
- else
- echo "Given devices isn't opened crypt device or it was closed before";
- fi
- fi
-}
-
-function create() {
- if [ $# -lt 1 ]; then help; exit 1;
- else
- sudo cryptsetup -y -v luksFormat $1;
- fi
-}
-
-function set_ownership(){
- if [ $# -lt 1 ]; then help; exit 1;
- else
- mountPoint=$(list | grep "$USER" | grep "$1" | awk '{printf $3}')
- owner=$(stat -c %u $mountPoint);
- if [ $owner -eq $UID ]; then
- if id $USER | grep -q $UID; then
- echo "User $USER is already owner of $mountPoint";
- fi
- else
- sudo chown ${USER}:${USER} $mountPoint;
- fi
- fi
-}
-
-if [ "$1" ]; then
-
- case $1 in
- "list") list;;
- "open") if [ "$2" ]; then open $2;
- else help; exit 1;
- fi;;
- "close") if [ "$2" ]; then close $2;
- else help; exit 1;
- fi;;
- "create") if [ "$2" ]; then
- create $2;
- open $2;
- set_ownership $2;
- else help; exit 1;
- fi;;
- *) help;;
- esac
-else
- help; exit 1;
-fi
+++ /dev/null
-#!/bin/bash
-
-vendor=$(hostnamectl | grep 'Vendor' | awk '{printf $3}')
-modelLine=$(hostnamectl | grep 'Model' | awk '{printf $3}')
-model=$(hostnamectl | grep 'Model' | awk '{printf $4}')
-
-case $vendor in
- "Lenovo") vendorShort="l";;
- "Dell") vendorShort="d";;
- *) hName="immudex";;
-esac
-
-case $modelLine in
- "ThinkPad") mLShort="TP";;
- "Latitude") mLShort="Lat";;
- *) hName="immudex";;
-esac
-
-if [ ! "$hName" ]; then
- hName="${vendorShort}-${mLShort}-$model"
- sudo hostnamectl set-hostname $hName;
- sudo sed -i "s/immudex/${hName}/" /etc/hosts;
- echo $hName | sudo tee /etc/hostname > /dev/null;
-fi
-
+++ /dev/null
-#!/bin/bash
-
-RED="\e[31m";
-GREEN="\e[32m";
-ENDCOLOR="\e[0m";
-
-while [ true ]; do
- echo -e "${RED}This script will install immudex on first disk on your machine.${ENDCOLOR}";
- echo -e "${RED}It could be destructive for data placed on this disk${ENDCOLR}";
- echo -en "${RED}Are you sure that you want contiune? (y/n): ${ENDCOLOR}";
- read ans;
- if [ "$ans" = "y" ]; then break;
- elif [ "$ans" = "n" ]; then exit 1;
- fi
-done
-
-set -e
-
-function selectDisk() {
- disks=$(lsblk | grep 'disk' | awk '{printf $1" "}');
- if [ $(echo $disks | wc -w) -gt 1 ]; then
- select drive in $disks; do
- echo $drive;
- break;
- done
- else
- echo $disks | awk '{printf $1}';
- fi
-}
-
-if $(sudo efibootmgr > /dev/null 2>&1); then
-#uefi installation
- #partitioning
- echo -n "Installation immudex in EFI mode ... ";
- disk=$(selectDisk);
- originDisk=$disk;
- if [ ! "$disk" ]; then exit 1; fi
-
- sudo dd if=/dev/zero bs=1M of=/dev/$disk count=1 2> /dev/null
-
- sudo parted /dev/$disk mklabel msdos > /dev/null 2>&1;
- sudo parted /dev/$disk mkpart primary 1 101M > /dev/null 2>&1;
- sudo parted /dev/$disk set 1 boot on > /dev/null 2>&1;
- sudo parted /dev/$disk mkpart primary 101M 6G > /dev/null 2>&1;
-
- if $(echo $disk | egrep -qo "mmc|nvme"); then disk="${disk}p"; fi
-
- #formatting
- sudo mkfs.vfat -F32 /dev/${disk}1 > /dev/null 2>&1;
- sudo mkfs.ext4 /dev/${disk}2 > /dev/null 2>&1;
-
- #Setting label for partition
- sudo e2label /dev/${disk}2 "immudex" > /dev/null 2>&1;
-
- #mount root partition
- sudo mount /dev/${disk}2 /media > /dev/null 2>&1;
-
- #creating directories for efi partition
- sudo mkdir -p /media/boot/efi > /dev/null 2>&1;
-
- #mount efi partition
- sudo mount /dev/${disk}1 /media/boot/efi > /dev/null 2>&1;
-
- #mount iso image in /mnt directory
- #sudo mount /dev/sr0 /mnt > /dev/null 2>&1;
-
- #copying whole iso image to the second partition
- sudo cp -rvv /run/live/medium/* /media > /dev/null 2>&1;
-
- sudo sed -i '/set\ timeout=/ s/30/5/' /media/boot/grub/grub.cfg;
- sudo sed -i 's/bootfrom=removable //g' /media/boot/grub/grub.cfg;
-
- #removing unnecessary directories from second partition
- sudo rm -rf /media/isolinux > /dev/null 2>&1;
- sudo rm -rf /media/EFI > /dev/null 2>&1;
-
- #GRUB Installation
- if [ -f /usr/lib/live/mount/medium/EFI/BOOT/BOOTIA32.EFI ]; then
- target="i386-efi";
- else
- target="x86_64-efi";
- fi
- sudo grub-install --target=${target} --root-directory=/media --boot-directory=/media/boot --efi-directory=/media/boot/efi --bootloader-id=debian --removable > /dev/null 2>&1;
-
- #Adding entry to EFI Firmware
- sudo efibootmgr -c -d /dev/${originDisk} -p 1 -L "Debian" -l '\EFI\BOOT\grubx64.efi' > /dev/null 2>&1;
-
- #Umount all mounted filesystems
- sudo umount -R /media > /dev/null 2>&1;
-
- if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi
-
-else
-#mbr installation
- echo -n "Installation immudex in BIOS mode ... ";
-
- #partitioning
- disk=$(selectDisk);
- if [ ! "$disk" ]; then exit 1; fi
-
- sudo dd if=/dev/zero bs=1M of=/dev/$disk count=1 2> /dev/null
-
- sudo parted /dev/$disk mklabel msdos > /dev/null 2>&1;
- sudo parted /dev/$disk mkpart primary 1 6G > /dev/null 2>&1;
- sudo parted /dev/$disk set 1 boot on > /dev/null 2>&1;
-
- if $(echo $disk | egrep -qo "mmc|nvme"); then disk="${disk}p"; fi
-
- #formatting
- sudo mkfs.ext4 /dev/${disk}1 > /dev/null 2>&1;
-
- #Setting label for partition is necessary for extlinux bootloader
- sudo e2label /dev/${disk}1 "immudex" > /dev/null 2>&1;
-
- #mount partition in /media directory
- sudo mount /dev/${disk}1 /media > /dev/null 2>&1;
-
- #Creating directory for extlinux
- sudo mkdir /media/extlinux > /dev/null 2>&1;
-
- #Instalation extlinux files in abovementioned directory
- sudo extlinux --install /media/extlinux > /dev/null 2>&1;
-
- #mount iso image in /mnt directory
- #sudo mount /dev/sr0 /mnt > /dev/null 2>&1;
-
- #copying live directory from iso image to partition
- sudo cp -rvv /run/live/medium/live /media > /dev/null; 2>&1;
-
- #installation extlinux MBR on first sector of hard drive (whole device)
- sudo dd if=/usr/lib/EXTLINUX/mbr.bin of=/dev/${disk} > /dev/null 2>&1;
-
- #creating extlinux configuration file
- cat > extlinux.conf <<EOF
-default immudex
-label immudex
-kernel /live/vmlinuz
-append quiet initrd=/live/initrd boot=live overlay-size=25% apparmor=1 security=apparmor
-EOF
- sudo cp extlinux.conf /media/extlinux > /dev/null 2>&1;
- rm extlinux.conf;
-
- #Unmounting filesystems
- sudo umount /media > /dev/null 2>&1;
- if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi
-fi
+++ /dev/null
-#!/bin/bash
-
-set -e
-
-source library.sh
-
-RED="\e[31m";
-GREEN="\e[32m";
-YELLOW="\e[33m";
-ENDCOLOR="\e[0m";
-root="/run/live/medium";
-
-function help() {
- echo "immudex_upgrade - script for searching upgrades and upgrade immudex";
- echo "morketsmerke.org @ 2023";
- echo "Options:";
- echo " --check --print - check there are upgrades for immudex";
- echo " --upgrade - check there are upgrades for immudex and install them.";
- echo " If there is no new version, script will propose refreshing";
- echo " current immudex installation, its helpful when you tried";
- echo " remaster immudex and you get any trouble with this".
- echo " --version - getting latest version of immudex";
- echo " --branch <stable/testing> - change immudex branch";
- echo " Switch between stable or testing version and vice versa"
-}
-
-function main_upgrade() {
- set -e
- ARCH=$(get_machine_arch);
- if [ ! "$BRANCH" ]; then
- BRANCH=$(get_debian_branch);
- fi
- MIRROR=$(check_mirror);
- rootPart=$(grep "${1}" /etc/mtab | head -1 | awk '{printf $1}');
- sudo mount $rootPart $1 -o remount,rw;
- sudo rm -f ${1}/live/*;
- sudo wget -q ${MIRROR}/immudex/${BRANCH}/upgrades/${2}/${ARCH}/filesystem.squashfs -O ${1}/live/filesystem.squashfs;
- sudo wget -q ${MIRROR}/immudex/${BRANCH}/upgrades/${2}/${ARCH}/initrd -O ${1}/live/initrd;
- sudo wget -q ${MIRROR}/immudex/${BRANCH}/upgrades/${2}/${ARCH}/vmlinuz -O ${1}/live/vmlinuz;
- echo "$2" > /tmp/version;
- sudo cp /tmp/version ${1}/live;
-}
-
-function check_mirror() {
- mirrorList=("sourceforge.net=https://sourceforge.net/projects/immudex/files", "plikownia.zsgronowo.edu.pl=https://plikownia.zsgronowo.edu.pl/pliki/Nauczyciele/Administrator/files", "ftp.morketsmerke.org=https://ftp.morketsmerke.org");
- for i in ${mirrorList[@]}; do
- name=$(echo $i | cut -d "=" -f 1);
- address=$(echo $i | cut -d "=" -f 2 | sed 's/,//');
- echo -en "Checking is ${YELLOW}${name}${ENDCOLOR} available..." 1>&2;
- curl ${address}/immudex/stable/upgrades/latest/64/version > /dev/null 2>&1;
- if [ $? -eq 0 ]; then
- echo -e "[ ${GREEN}OK${ENDCOLOR} ]" 1>&2;
- mirror=$address;
- mirror_name=$name;
- else
- echo -e "[ ${RED}FAIL${ENDCOLOR} ]" 1>&2;
- fi
- done
- if [ "$mirror" ]; then
- echo "Choosing $mirror_name" 1>&2;
- echo $mirror;
- else exit 1; fi
-}
-
-if [ "$1" ] && [ "$1" = "--check" ]; then
- if [ "$2" ] && [ "$2" = "--print" ]; then
- newVersion=$(check_distro_version --print);
- if check_distro_version; then
- echo -e "${YELLOW}New version (${ENDCOLOR}${RED}$newVersion${ENDCOLOR}${YELLOW}) of immudex is available to upgrade.${ENDCOLOR}";
- else
- echo -e "${YELLOW}This (${ENDCOLOR}${GREEN}$newVersion${ENDCOLOR}${YELLOW}) is the latest version of immudex.${ENDCOLOR}";
- fi
- elif [ "$2" = "--mirror" ]; then
- mirror=$(check_mirror);
- echo $mirror;
- fi
-elif [ "$1" ] && [ "$1" = "--upgrade" ]; then
- newVersionTxt=$(check_distro_version --print);
- newVersionInt=$(echo $newVersionTxt | sed 's/\.//g');
- if check_distro_version; then
- echo -en "${YELLOW}New version "
- echo -en "(${ENDCOLOR}${RED}${newVersionTxt}${ENDCOLOR}${YELLOW}) "
- echo -e "of immudex is available.${ENDCOLOR}";
- echo -e "${RED}Warning, reboot maybe necessary to continue work on this machine${ENDCOLOR}";
- echo -en "${YELLOW}Do you want upgrade this system? (y/n):${ENDCOLOR} ";
- read commit;
- if [ $commit = "y" ]; then
- echo "Upgrading immudex to the newest version...";
- main_upgrade $root $newVersionTxt;
- if [ $? -eq 0 ]; then echo -e "Upgrading immudex to the newest version...[ ${GREEN}OK${ENDCOLOR} ]"; fi
- else
- exit 1;
- fi
- else
- echo -e "${GREEN}There is no newer version of immudex,${ENDCOLOR}";
- echo -e "${YELLOW}but you can copy fresh system files from latest iso image";
- echo -e "${RED}Warning, reboot maybe necessary to continue work on this machine${ENDCOLOR}";
- echo -en "${YELLOW}Do you want refresh this system? (y/n):${ENDCOLOR} ";
- read commit;
- if [ $commit = "y" ]; then
- echo "Refreshing immudex to the latest iso image...";
- main_upgrade $root $newVersionTxt;
- if [ $? -eq 0 ]; then echo -e "Refreshing immudex to the latest iso image...[ ${GREEN}OK${ENDCOLOR} ]"; fi
- else
- exit 1;
- fi
- exit 0;
- fi
-elif [ "$1" ] && [ "$1" = "--version" ]; then
- MIRROR=$(check_mirror);
- stable64=$(curl ${MIRROR}/immudex/stable/upgrades/latest/64/version 2>/dev/null)
- stable32=$(curl ${MIRROR}/immudex/stable/upgrades/latest/32/version 2>/dev/null)
- testing64=$(curl ${MIRROR}/immudex/testing/upgrades/latest/64/version 2>/dev/null)
- testing32=$(curl ${MIRROR}/immudex/testing/upgrades/latest/32/version 2>/dev/null)
- branch=$(get_debian_branch);
- localVer=$(cat /run/live/medium/live/version);
- if [ "$(uname -m)" = "x86_64" ]; then
- arch="amd64";
- stable=$stable64;
- testing=$testing64;
- else
- arch="i386";
- stable=$stable32;
- testing=$testing32;
- fi
- echo "Arch: $arch";
- echo "Local: ${localVer} (${branch})";
- echo "Stable: $stable";
- echo "Testing: $testing";
-elif [ "$1" ] && [ "$1" = "--branch" ]; then
- if [ "$2" ] && ([ "$2" = "stable" ] || [ "$2" = "testing" ]); then
- BRANCH=$2;
- ARCH=$(get_machine_arch);
- export $BRANCH;
- echo -en "${YELLOW}Do you really want change immudex branch (y/n):${ENDCOLOR} ";
- read commit;
- if [ $commit = "y" ]; then
- echo "Changing immudex branch to ${BRANCH}...";
- newVersionTxt=$(curl https://ftp.morketsmerke.org/immudex/${BRANCH}/upgrades/latest/${ARCH}/version 2>/dev/null);
- main_upgrade $root $newVersionTxt;
- if [ $? -eq 0 ]; then echo -e "Changing immudex branch to ${BRANCH}...[ ${GREEN}OK${ENDCOLOR} ]"; fi
- else
- exit 1;
- fi
- else
- help; exit 1;
- fi
-else
- help;
- exit 1;
-fi
+++ /dev/null
-#!/bin/bash
-
-if $(ls $HOME | grep -q '.*_rsa.*'); then
- if [ -d /home/$USER/.ssh ]; then
- cp -v ~/*_rsa* /home/$USER/.ssh;
- else
- mkdir /home/$USER/.ssh;
- chmod 700 /home/$USER/.ssh;
- cp -v ~/*_rsa* /home/$USER/.ssh;
- fi
-fi
-
+++ /dev/null
-#!/bin/bash
-
-function help() {
- echo "======================================================================";
- echo "morketsmerke - script for fetch and adjust morketsmerke.net site";
- echo "as offline available source of information.";
- echo "morketsmerke.net COPYLEFT @ 2022";
- echo;
- echo "Options:";
- echo " --browser - launching fetched site in default application for open"
- echo " html sites";
- echo " -[-]<any_other_chars_or_strings> - print this message";
- echo "By default script open downloaded site in terminal via W3M browser with";
- echo "monochrome mode";
- echo;
- echo "Usage:";
- echo " $ morketsmerke [--browser]";
-}
-
-function R() {
-
- if [ "$path" ]; then path=${path}/${1};
- else path=$1;
- fi
-
- fileList=$(ls $path);
- for file in $fileList; do
- if [ -d ${path}/${file} ]; then R ${file};
- else
- sed -i 's@https://morketsmerke.github.io/@/usr/share/doc/morketsmerke/index.html@' ${path}/${file};
- sed -i 's@https://morketsmerke.github.io@/usr/share/doc/morketsmerke/index.html@' ${path}/${file};
- sed -i 's@/style.css@/usr/share/doc/morketsmerke/style.css@' ${path}/${file};
- fi
- done
- path=$(echo $path | sed "s@/$1@@")
-
-}
-
-function install_morketsmerke() {
-
- if [ -d morketsmerke.github.io ]; then rm -rf morketsmerke.github.io; fi
- if [ ! -d morketsmerke.github.io ]; then
- git clone https://github.com/morketsmerke/morketsmerke.github.io;
- else
- exit 1;
- fi
-
- R morketsmerke.github.io
-
- if [ -d /usr/share/doc/morketsmerke ]; then
- sudo rm -rf /usr/share/doc/morketsmerke;
- fi
-
- sudo mv morketsmerke.github.io /usr/share/doc/morketsmerke
-
-}
-
-/usr/bin/ping -c 1 wp.pl >> /dev/null 2>&1;
-if [ $? -eq 0 ]; then install_morketsmerke; fi
-
-morketsmerke_path=/usr/share/doc/morketsmerke;
-
-if [ "$1" ] && [ "$1" = "--browser" ]; then
- xdg-open ${morketsmerke_path}/index.html;
-elif [ "$1" ]; then
- help;
- exit 1;
-else
- w3m -M ${morketsmerke_path}/index.html;
-fi
+++ /dev/null
-#!/bin/bash
-
-/usr/bin/figlet immudex;
-echo;
-echo "Today is: $(date)";
-echo;
-echo "System summary: ";
-cpuIdle=$(vmstat | tail -1 | awk '{printf $15}');
-cpuUsage=$((100 - $cpuIdle));
-echo -e " \tCPU: ${cpuUsage}%";
-echo -e " \tMEM: $(free -h | sed -n '2p' | awk '{printf $7}' | sed 's/i//') Free";
-if $(df -h 2> /dev/null | grep -q '/dev/mapper'); then
- i=1;
- echo -e " \tCRYPT_PARTi: Free/Total (Usage%)";
- amountOfDisks=$(df -h 2> /dev/null | grep '/dev/mapper' | wc -l | awk '{printf $1}');
- while [ $i -le $amountOfDisks ]; do
- diskSize=$(df -h 2> /dev/null | grep '/dev/mapper' | sed -n "${i}p" | awk '{printf $2}');
- diskFree=$(df -h 2> /dev/null | grep '/dev/mapper' | sed -n "${i}p" | awk '{printf $4}');
- diskUsage_perc=$(df -h 2> /dev/null | grep '/dev/mapper' | sed -n "${i}p" | sed 's/%//' | awk '{printf $5}');
- #FCP = First Crypt Partition
- echo -e " \tCRYPT_PART${i}: ${diskFree}/${diskSize} (${diskUsage_perc}%)";
- i=$((i + 1));
- done
-else
- echo -e " \tCRYPT_PART: N/A";
-fi
-echo -e " \tPROCESSES: $(ps -aux | wc -l | awk '{printf $1}')";
-utime=$(uptime | awk '{printf $3}' | sed 's/,//');
-if $(echo $utime | grep -q ":"); then
- echo -e " \tUPTIME: ${utime}";
-else
- echo -e " \tUPTIME: 0:${utime}";
-fi
-echo -e " \t$(uptime | grep -o "load.*$" | tr [a-z] [A-Z])";
-echo;
-echo -e "morketsmerke.org @ 2023 https://github.com/xf0r3m/immudex";
-echo;
-#/usr/local/bin/immudex_upgrade --check --print;
-#if [ $? -ne 0 ]; then
-# echo -e "\e[31mThere is no internet connection or internal error.\e[0m";
-# if [ -f /tmp/feed.xml ] && [ ! -s /tmp/feed.xml ]; then
-# rm -f /tmp/feed.xml;
-# fi
-#else
-# if [ "$USER" = "xf0r3m" ]; then
-# sudo apt update > /tmp/update.log 2>&1 && tail -1 /tmp/update.log;
-# fi
-#fi
-echo "====================================================================";
+++ /dev/null
-#!/bin/bash
-
-function help() {
- echo "newsfeed - fetch and browse news feed from rss and atom channels";
- echo "morketsmerke.net; COPYLEFT @ 2022";
- echo;
- echo "Options:";
- echo " --list - shows numbered list of names, saved in ~/.newsfeed names and";
- echo " URL of rss channels";
- echo " --check - fetching new rss channel file from source";
- echo " --show <number_of_channel> - shows numbered list of news titles.";
- echo " Number of channel you can get from --list option.";
- echo " --open <number_of_title> - open web browser on link, which are under";
- echo " titles of news on rss channel. Number of title you can get";
- echo " from --show option. This option based on the last showed rss";
- echo " channel feed.";
- echo;
- echo "The ~/.newsfeed file:";
- echo " This file is simple csv (semicolon separated values) file which";
- echo " store rss channels in one line. One by one. The one line";
- echo " contains: name and URL of rss feed. For example:";
- echo;
- echo " News Feed;https://newsfeed.example.org/rss";
-}
-if [ ! -s ~/.newsfeed ]; then
- help;
- exit 1;
-else
- if [ ! "$1" ] || ([ "$1" != "--list" ] && \
- [ "$1" != "--check" ] && \
- [ "$1" != "--show" ] && \
- [ "$1" != "--open" ]); then
- help;
- exit 1;
- fi
- amountOfSubscriptions=$(cat ~/.newsfeed | wc -l);
- i=1;
- while [ $i -le $amountOfSubscriptions ]; do
- newsfeedLine=$(sed -n "${i}p" ~/.newsfeed);
- nameOfSubscription=$(echo $newsfeedLine | cut -d ";" -f 1);
- rssLink=$(echo $newsfeedLine | cut -d ";" -f 2);
- if [ "$1" ] && [ "$1" = "--list" ]; then
- echo -e "${i}. ${nameOfSubscription}";
- elif [ "$1" ] && [ "$1" = "--check" ]; then
- echo -e "${i}. ${nameOfSubscription}";
- echo -n "Getting news feed...";
- wget $rssLink -O /tmp/new_newsfeed_${i}.xml 2>/dev/null;
- if [ $? -eq 0 ]; then echo "[ OK ]";
- else echo -e "\nThere is no Internet connection"; exit 1; fi
- if [ -s /tmp/newsfeed_${i}.xml ]; then
- amountOfNewNewses=$(diff /tmp/new_newsfeed_${i}.xml /tmp/newsfeed_${i}.xml | grep '<title>' | wc -l);
- if [ $amountOfNewNewses -gt 0 ]; then
- notify-send "$nameOfSubscription" "New $amountOfNewNewses newses" --icon=/usr/share/icons/rss.png;
- j=1;
- sleep 1;
- while [ $j -le $amountOfNewNewses ]; do
- news=$(diff /tmp/new_newsfeed_${i}.xml /tmp/newsfeed_${i}.xml | \
- grep '<title>' | sed -n "${j}p" | sed 's/<title>//' | \
- sed 's/<\/title>//' | sed 's/[<>]//' | \
- sed 's/^[[:space:]]*//g');
- notify-send "newsfeed" "${nameOfSubscription}: ${news}" -t 10000 --icon=/usr/share/icons/rss.png;
- sleep 1;
- j=$((j + 1));
- done
- fi
- mv /tmp/new_newsfeed_${i}.xml /tmp/newsfeed_${i}.xml;
- else
- mv /tmp/new_newsfeed_${i}.xml /tmp/newsfeed_${i}.xml;
- amountOfNews=$(grep '<title>' /tmp/newsfeed_${i}.xml | sed -n '2,$p' | wc -l);
- if [ $amountOfNews -eq 0 ]; then
- compressed=1;
- amountOfNews=$(sed 's/<\/title>/\n/g' /tmp/newsfeed_${i}.xml | sed 's/<item>/\n/g' | grep '<title>' | wc -l)
- fi
- notify-send "$nameOfSubscription" "New $amountOfNews newses" --icon=/usr/share/icons/rss.png;
- fi
- fi
- i=$((i + 1));
- done
- if [ "$1" ] && [ "$1" = "--show" ] && [ "$2" ] && [ $2 -gt 0 ]; then
-
- #Parsing
- #Thanks to the linuxhint.com for command:
- #sed 's/^[[:space]]*//g'
- #https://linuxhint.com/trim_string_bash
-
- if grep -q 'CDATA' /tmp/newsfeed_${2}.xml; then
- sed 's/<\/title>/\n/g' /tmp/newsfeed_${2}.xml | \
- sed 's/<item>/\n/g' | grep '<title>' | sed -n '2,$p' | \
- sed 's/<title>//' | sed 's/"/"/g' | \
- sed 's/<!\[CDATA\[//g' | sed 's/\]\]>//g' | \
- sed 's/^[[:space:]]*//g' | nl | less;
- else
- sed 's/<\/title>/\n/g' /tmp/newsfeed_${2}.xml | \
- sed 's/<item>/\n/g' | grep '<title>' | sed -n '2,$p' | \
- sed 's/<title>//' | sed 's/"/"/g' | \
- sed 's/^[[:space:]]*//g' | nl | less;
- fi
- echo $2 > /tmp/lastShowedNewsFeed;
- elif [ "$1" ] && [ "$1" = "--open" ] && [ "$2" ] && [ $2 -gt 0 ]; then
- subscriptionNumber=$(cat /tmp/lastShowedNewsFeed);
- if ! grep -q 'CDATA' /tmp/newsfeed_${subscriptionNumber}.xml; then
- link=$(sed 's/<\/link>/\n/g' /tmp/newsfeed_${subscriptionNumber}.xml | sed 's/<\/title>/\n/g' | grep '<link>' | sed -n '2,$p' | sed 's/<link>//g' | sed -n "${2}p")
- else
- link=$(sed 's/<\/link>/\n/g' /tmp/newsfeed_${subscriptionNumber}.xml | sed 's/<\/description>/\n/g' | grep '<link>' | sed -n '2,$p' | sed 's/<link>//g' | sed -n "${2}p")
- fi
- exo-open --launch WebBrowser "$link";
- fi
-fi
+++ /dev/null
-#!/bin/bash
-
-source library.sh;
-
-if [ "$1" ]; then
- case $1 in
- "distro") if check_distro_version; then
- msg=$(check_distro_version --print);
- notify-send -i software-update-urgent "Distribution update" "New version (${msg}) of immudex is available to upgrade.";
- else
- msg=$(check_distro_version --print);
- notify-send -i apply "Distribution update" "This (${msg}) is the latest version of immudex.";
- fi;;
- "packages") msg=$(sudo apt update > /tmp/update.log 2>&1 && tail -1 /tmp/update.log;);
- notify-send -i software-update-available "Packages update" "$msg";;
- esac
-fi
-
+++ /dev/null
-#!/bin/bash
-
-if [ "$1" ] && [ $1 = "--video" ]; then
- video=1;
- shift;
- if [ $# -gt 1 ]; then format=$1; shift; file=$1;
- else format="best"; file=$1; fi
-else
- file=$1;
-fi
-
-function help() {
- echo "pl - Play Links. Skrypt to odtwarzania multimediów z listy linków";
- echo "morketsmerke.org; COPYLEFT; 2023";
- echo;
- echo "Opcje:";
- echo;
- echo -e "\t--video [format] - możliwość odtwarzania linków jako filmów. Format";
- echo -e "\tjest opcjonalny, w przypadku jego braku, domyślnym formatem jest";
- echo -e "\t'best'.";
- echo;
- echo "Użycie:";
- echo -e "\t$ pl sciezka/do/listy/linkow";
- echo;
- echo "Format listy:";
- echo -e "\tnazwa linku: https://youtube.com/...";
-}
-
-if [ "$1" ]; then
- PS3="Link: ";
- linkNames=$(cut -d ":" -f 1 $1 | sed 's/\ /_/g' | awk '{printf $1" "}')
- select name in $linkNames; do
- if [ ! "$name" ]; then break; fi
- link=$(grep "$name" $file | cut -d ":" -f 2-);
- if [ ! "$link" ]; then
- linkName=$(echo $name | sed 's/_/\ /g');
- link=$(grep "$linkName" $file | cut -d ":" -f 2-);
- fi
- if echo $link | grep -q "youtube"; then
- if [ "$video" ]; then
- ytplay -v $link -f $format;
- else
- ytplay -a $link -f best[height=360];
- fi
- else
- mpv --no-video $link;
- fi
- done
-else
- help;
- exit 1;
-fi
+++ /dev/null
-#!/bin/bash
-
-if [ ! -d /tmp/${USER} ]; then
- mkdir /tmp/${USER}
- cp -prvv /home/${USER}/.mozilla /tmp/${USER}
-fi
-
-eth0=$(ip route show | grep 'default' | awk '{printf $5}');
-firejail --private=/tmp/${USER} --net=$eth0 /usr/bin/firefox
+++ /dev/null
-#!/bin/bash
-
-echo -n "What are you wanna listen? ";
-read search;
-
-function getDataBetweenHtmlMarks() {
- grep "$1" $2 | sed -n "${3}p" | cut -d ">" -f 2 | cut -d "<" -f 1;
-}
-wget http://dir.xiph.org/search?q=$search -O /tmp/shcast_dir.html >> /dev/null 2>&1;
-if [ ! -s /tmp/shcast_dir.html ]; then
- echo -e "\e[31mThere is no internet connection.\e[0m";
- exit 1;
-else
- amountOfStations=$(grep 'card-title' /tmp/shcast_dir.html | wc -l);
- i=1;
- while [ $i -le $amountOfStations ]; do
- stationName=$(getDataBetweenHtmlMarks 'card-title' /tmp/shcast_dir.html ${i});
- whatIsPlaying=$(getDataBetweenHtmlMarks 'card-subtitle' /tmp/shcast_dir.html ${i});
- echo -e "${i}. \e[33m${stationName}\e[0m";
- echo -e " \e[32m${whatIsPlaying}\e[0m";
- i=$((i + 1));
- done
- echo -n "Pick a one: ";
- read numberOfStation;
- echo $(grep 'Play' /tmp/shcast_dir.html | sed -n "${numberOfStation}p" | cut -d '"' -f 2) | xclip -selection c;
- echo "Station URL was copied to clipboard";
-
-fi
+++ /dev/null
-#!/bin/bash
-
-source ~/.sync.d/sync.conf;
-
-if [ ! -d "${HOME}/${ldirectory}" ]; then mkdir "${HOME}/${ldirectory}"; fi
-
-function printhelp {
-
- echo "Skrypt szybkiej synchronizacji katalogu zdalnego";
- echo "morketsmerke.org";
- echo "2023; COPYLEFT; ALL RIGHTS REVERSED";
- echo "";
- echo "push - Przesłanie danych z katalogu lokalnego na katalog zdalny";
- echo "pull - Pobranie zawartości katalogu zdalnego do katalogu lokalnego";
- echo "Plik konfiguracyjny musi znajdować się na ścieżce: ~/.sync.d/sync.conf";
- echo "Przykładowy plik konfiguracyjny znajduje się na ścieżce: /usr/share/sync.sh/sync.conf";
-}
-if [ ! "$1" ]; then
-
- printhelp;
- exit 1;
-
-else
- if [ "$1" = "push" ]; then
-
- echo "[*] Synchronizacja: local -> remote";
- rsync -avu ${HOME}/${ldirectory}/* ${ruser}@${server}:${rdirectory};
-
- elif [ "$1" = "pull" ]; then
-
- echo "[*] Synchronizacja remote -> local";
- rsync -avu ${ruser}@${server}:${rdirectory}/* ${HOME}/${ldirectory};
-
- else
- printhelp;
- exit 1;
- fi
-
-fi
+++ /dev/null
-#!/bin/bash
-
-GREEN="\e[32m";
-YELLOW="\e[33m";
-BLUE="\e[34m";
-ENDCOLOR="\e[0m";
-
-function help() {
- echo "ytplay - script which could play a video or audio track from youtube";
- echo "morketsmerke.net COPYLEFT @ 2022";
- echo "Options:";
- echo " -s - search given keyword on youtube.";
- echo " -v - play youtube video."
- echo " -a - play only youtube video audiotrack";
- echo "Ommiting -s option, assume you are give a yt video link.";
- echo "You have to put -v or -a before you paste a yt video link";
- echo "When you put keywords in -s option, you need to choose";
- echo "that you want listening an audiotrack (-a) oraz watch video (-v)";
- echo "Usage:";
- echo " $ ytplay -s -a [-f ytdl-format] 'lofi'";
- echo " $ ytplay -v https://youtube.com/watch?v=... [-f ytdl-format]";
- echo " $ ytplay -a https://youtube.com/watch?v=... [-f ytdl-format]";
- echo "You can search again the same keywords puting 'r' or 'R' instead";
- echo "of video numer";
-}
-
-function yt_search() {
- query=$(echo $* | sed 's/ /+/g');
- echo -n "Getting youtube site with search results...";
- wget https://youtube.com/results?search_query=$query -O /tmp/yt.html 2> /dev/null
- if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi
-
- sed -i 's/,/\n/g' /tmp/yt.html;
-
- listOfVideos=$(grep -n '^{\"url' /tmp/yt.html | cut -d ":" -f 1 | awk '{printf $1" "}');
-
- numberOfListElements=$(echo $listOfVideos | wc -w);
- i=1;
- lp=1;
- while [ $i -le $numberOfListElements ]; do
- if [ $i -eq $numberOfListElements ]; then
- ln1=$(echo $listOfVideos | cut -d " " -f $i);
- ln2='$';
- else
- j=$((i + 1));
- ln1=$(echo $listOfVideos | cut -d " " -f $i);
- ln2=$(echo $listOfVideos | cut -d " " -f $j);
- fi
- #if sed -n "${ln1},${ln2}p" /tmp/yt.html | grep -q '"iconType":"LIVE"'; then
- # i=$((i + 1)); continue;
- #else
- title=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'title' | head -1 | cut -d '"' -f 8);
- channel=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'ownerText' | head -1 | cut -d '"' -f 8);
- duration=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'simpleText' | sed -n '2p' | cut -d '"' -f 4);
- if [ "$duration" = "simpleText" ]; then duration="\e[31mLive\e[0m"; fi
- videoid=$(sed -n "${ln1},${ln2}p" /tmp/yt.html | grep 'videoId' | sed -n '2p' | cut -d '"' -f 4);
- if [ "$title" ] && [ "$channel" ] && [ "$duration" ] && [ "$videoid" ] && [ "$duration" != "SHORTS" ]; then
- echo -e "${lp}. ${GREEN}${title}${ENDCOLOR}";
- echo -e " Channel: ${YELLOW}${channel}${ENDCOLOR} Duration: ${BLUE}${duration}${ENDCOLOR}";
- echo "${lp},${videoid},${title},${channel},${duration}" >> /tmp/yt.csv;
- else
- i=$((i + 1)); continue;
- fi
- #fi
- i=$((i + 1));
- lp=$((lp + 1));
- done
-}
-
-if [ "$1" ]; then
- if [ "$1" = "-a" ] || [ "$1" = "-v" ]; then
- mode=$1;
- shift;
- link=$(echo $1 | sed 's@https://@@');
- if [ $# -gt 1 ]; then
- shift;
- if [ "$1" = "-f" ]; then
- shift;
- if [ "$mode" = "-a" ]; then
- format="--no-video --ytdl-format=${1}";
- else
- format="--ytdl-format=${1}";
- fi
- fi
- fi
- elif [ "$1" = "-s" ]; then
- if [ -f /tmp/yt.html ]; then rm /tmp/yt.html; fi
- if [ -f /tmp/yt.csv ]; then rm /tmp/yt.csv; fi
-
- shift;
- mode=$1;
- if ! ([ "$mode" = "-v" ] || [ "$mode" = "-a" ]); then help; exit 1; fi
- shift;
- if [ "$1" = "-f" ]; then
- shift;
- if [ "$mode" = "-a" ]; then
- format="--no-video --ytdl-format=${1}";
- else
- format="--ytdl-format=${1}";
- fi
- fi
- while [ true ]; do
- yt_search $*;
- echo -n "Put number of which video you want to hear/watch: ";
- read numberOfVideo;
- if [[ $numberOfVideo -gt 0 ]]; then break;
- elif [ "$numberOfVideo" = "r" ] || [ "$numberOfVideo" = "R" ]; then
- continue;
- else
- help;
- exit 1;
- fi
- done
- title=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 3);
- channel=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 4);
- duration=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 5);
- videoId=$(sed -n "${numberOfVideo}p" /tmp/yt.csv | cut -d "," -f 2);
- clear;
- echo -e "Title: ${GREEN}${title}${ENDCOLOR}";
- echo -e "Channel: ${YELLOW}${channel}${ENDCOLOR} Duration: ${BLUE}${duration}${ENDCOLOR}";
- echo "====================================================================";
- link=${videoId};
- else
- help;
- exit 1;
- fi
-
- if [ "$mode" = "-a" ]; then
- if [ ! "$format" ]; then format="--no-video --ytdl-format=best[height=360]"; fi
- mpv ${format} ytdl://${link};
- elif [ "$mode" = "-v" ]; then mpv ${format} ytdl://${link}; fi
-else
- help;
- exit 1;
-fi
+++ /dev/null
-#!/bin/bash
-
-vendor=$(hostnamectl | grep 'Vendor' | awk '{printf $3}')
-modelLine=$(hostnamectl | grep 'Model' | awk '{printf $3}')
-model=$(hostnamectl | grep 'Model' | awk '{printf $4}')
-
-case $vendor in
- "Lenovo") vendorShort="l";;
- "Dell") vendorShort="d";;
- "Acer") vendorShort="a";;
- "ASUSTeK") vendorShort="as";;
- "GOOGLE") vendorShort="go";;
- "QEMU") vendorShort="kvm";;
- *) hName="immudex";;
-esac
-
-case $modelLine in
- "ThinkPad") mLShort="TP";;
- "Latitude") mLShort="Lat";;
- "AOD260") mLShort="ao";
- model="D260";;
- "Candy") vendorShort="d";
- mLShort="chrbook";
- model="3120";;
- "Inspiron") mLShort="Ins";;
- "Standard") if [ $vendorShort = "kvm" ]; then
- mLShort=$(hostnamectl | grep 'Machine ID' | awk '{print $3}' | cut -c 26-33);
- model="";
- else
- mlShort="Std";
- fi;;
- *) hName="immudex";;
-esac
-
-if [ ! "$hName" ]; then
- hName="${vendorShort}-${mLShort}-$model"
- sudo hostnamectl set-hostname $hName;
- sudo sed -i "s/immudex/${hName}/" /etc/hosts;
- echo $hName | sudo tee /etc/hostname > /dev/null;
-fi
-
+++ /dev/null
-#!/bin/bash
-
-if [ "$1" ] && [ $1 = "--video" ]; then
- video=1;
- shift;
- if [ $# -gt 1 ]; then format="--ytdl-format=$1"; shift; file=$1;
- else format="--ytdl-forma=best"; file=$1; fi
-else
- file=$1;
-fi
-
-function help() {
- echo "pl - Play Links. Skrypt to odtwarzania multimediów z listy linków";
- echo "morketsmerke.org; COPYLEFT; 2023";
- echo;
- echo "Opcje:";
- echo;
- echo -e "\t--video [format] - możliwość odtwarzania linków jako filmów. Format";
- echo -e "\tjest opcjonalny, w przypadku jego braku, domyślnym formatem jest";
- echo -e "\t'best'.";
- echo;
- echo "Użycie:";
- echo -e "\t$ pl sciezka/do/listy/linkow";
- echo;
- echo "Format listy:";
- echo -e "\tnazwa linku: https://youtube.com/...";
-}
-if [ "$1" ]; then
- PS3="Link: ";
- linkNames=$(cut -d ":" -f 1 $1 | sed 's/\ /_/g' | awk '{printf $1" "}')
- select name in $linkNames; do
- if [ "$MPVPID" ]; then kill $MPVPID; fi
- if [ ! "$name" ]; then break; fi
- link=$(grep "$name" $file | cut -d ":" -f 2-);
- if [ ! "$link" ]; then
- linkName=$(echo $name | sed 's/_/\ /g');
- link=$(grep "$linkName" $file | cut -d ":" -f 2-);
- fi
- if echo $link | grep -q "youtube"; then
- if [ "$video" ]; then
- #ytplay -v $link -f $format
- mpv $format ytdl://$link > /dev/null 2>&1 & MPVPID=$!
- else
- #ytplay -a $link -f best[height=360]
- format="--no-video --ytdl-format=best[height=360]";
- mpv $format ytdl://$link > /dev/null 2>&1 & MPVPID=$!
- fi
- else
- mpv --no-video $link > /tmp/pl.log 2>&1 & MPVPID=$!;
- tail -f /tmp/pl.log | grep "icy-title" &
- fi
- #echo "MPV: $MPVPID";
- done
-else
- help;
- exit 1;
-fi
+++ /dev/null
-#!/bin/bash
-
-if [ "$1" ] && [ $1 = "--video" ]; then
- video=1;
- shift;
- if [ $# -gt 1 ]; then format="--ytdl-format=$1"; shift; file=$1;
- else format="--ytdl-forma=best"; file=$1; fi
-else
- file=$1;
-fi
-
-function help() {
- echo "pl - Play Links. Skrypt to odtwarzania multimediów z listy linków";
- echo "morketsmerke.org; COPYLEFT; 2023";
- echo;
- echo "Opcje:";
- echo;
- echo -e "\t--video [format] - możliwość odtwarzania linków jako filmów. Format";
- echo -e "\tjest opcjonalny, w przypadku jego braku, domyślnym formatem jest";
- echo -e "\t'best'.";
- echo;
- echo "Użycie:";
- echo -e "\t$ pl sciezka/do/listy/linkow";
- echo;
- echo "Format listy:";
- echo -e "\tnazwa linku: https://youtube.com/...";
-}
-if [ "$1" ]; then
- PS3="Link: ";
- linkNames=$(cut -d ":" -f 1 $1 | sed 's/\ /_/g' | awk '{printf $1" "}')
- select name in $linkNames; do
- if [ "$MPVPID" ]; then kill $MPVPID; fi
- if [ ! "$name" ]; then break; fi
- link=$(grep "$name" $file | cut -d ":" -f 2-);
- if [ ! "$link" ]; then
- linkName=$(echo $name | sed 's/_/\ /g');
- link=$(grep "$linkName" $file | cut -d ":" -f 2-);
- fi
- if echo $link | grep -q "youtube"; then
- link=$(echo $link | sed 's/\ //g');
- if [ "$video" ]; then
- #ytplay -v $link -f $format
- mpv $format ytdl://$link > /dev/null 2>&1 & MPVPID=$!
- else
- #ytplay -a $link -f best[height=360]
- format="--no-video --ytdl-format=best[height=360]";
- mpv $format ytdl://$link > /dev/null 2>&1 & MPVPID=$!
- fi
- else
- mpv --no-video $link > /tmp/pl.log 2>&1 & MPVPID=$!;
- tail -f /tmp/pl.log | grep "icy-title" &
- fi
- #echo "MPV: $MPVPID";
- done
-else
- help;
- exit 1;
-fi