From 0fcfa75a6041336f7fa1f863d86bf6aea500d56a Mon Sep 17 00:00:00 2001 From: =?utf8?q?N=C3=A9meth=20Ott=C3=B3?= Date: Fri, 21 Jun 2019 00:08:36 +0200 Subject: [PATCH] update repository --- kernel/config_helper/_depends_table.txt | 43 ------------------- kernel/config_helper/config_tuning.txt | 2 +- kernel/config_helper/kernel_config_review.sh | 2 +- kernel/find_builtin_firmware/check_firmwares.sh | 8 ++++ .../grep_objs_firmware_ar_archive.sh | 49 ++++++++++++++++++++++ kernel/find_builtin_firmware/list_firmware.sh | 1 + other_distro_useful/arch/pacman_update_key.sh | 1 + other_distro_useful/fedora/fedora_gcc.sh | 1 + other_distro_useful/systemd/journalctl_clean.sh | 1 + other_distro_useful/ubuntu_debian/console-setup.sh | 1 + .../dpkg-apt-install-devel-packages-base.cmds.sh | 4 ++ .../dpkg-apt-install-remove-update.txt | 17 ++++++++ .../ubuntu_debian/dpkg-apt-kernel-update-fix.sh | 2 + .../ubuntu_debian/ubutntu_disable_grub_install.sh | 3 ++ other_distro_useful/void/xbps-search.sh | 1 + other_distro_useful/void/xbps-update.sh | 2 + other_distro_useful/void/xbps_query.sh | 1 + other_distro_useful/void/xbps_query_grep_devel.sh | 1 + scripts/_find_shell_scripts.sh | 16 +++++++ scripts/_ls_drivers_mkinitramfs.sh | 7 ++++ scripts/_pkgdep | 2 + scripts/_pkgdep64 | 2 + scripts/_split_file | 24 +++++++++++ scripts/_strip | 21 +++++++++- scripts/local.d/blkuuid.start_ | 20 +++++++++ scripts/local.d/net.start_ | 20 +++++++++ scripts/local.d/net.stop_ | 6 +++ scripts/loginuser_openvt | 2 +- scripts/manage/createfs | 4 +- scripts/manage/createfs-byid | 4 +- scripts/manage/createfs.sgdisk | 17 +++++++- scripts/manage/createswap | 2 +- scripts/manage/createswap-byid | 4 +- scripts/manage/createswap.sgdisk | 15 +++++++ scripts/mountall | 20 ++++++++- scripts/umountall | 6 ++- searchfs/_findarchive.sh | 10 ++--- 37 files changed, 278 insertions(+), 64 deletions(-) delete mode 100644 kernel/config_helper/_depends_table.txt create mode 100644 kernel/find_builtin_firmware/check_firmwares.sh create mode 100644 kernel/find_builtin_firmware/grep_objs_firmware_ar_archive.sh create mode 100644 kernel/find_builtin_firmware/list_firmware.sh create mode 100644 other_distro_useful/arch/pacman_update_key.sh create mode 100644 other_distro_useful/fedora/fedora_gcc.sh create mode 100644 other_distro_useful/systemd/journalctl_clean.sh create mode 100644 other_distro_useful/ubuntu_debian/console-setup.sh create mode 100644 other_distro_useful/ubuntu_debian/dpkg-apt-install-devel-packages-base.cmds.sh create mode 100644 other_distro_useful/ubuntu_debian/dpkg-apt-install-remove-update.txt create mode 100644 other_distro_useful/ubuntu_debian/dpkg-apt-kernel-update-fix.sh create mode 100644 other_distro_useful/ubuntu_debian/ubutntu_disable_grub_install.sh create mode 100644 other_distro_useful/void/xbps-search.sh create mode 100644 other_distro_useful/void/xbps-update.sh create mode 100644 other_distro_useful/void/xbps_query.sh create mode 100644 other_distro_useful/void/xbps_query_grep_devel.sh create mode 100644 scripts/_find_shell_scripts.sh create mode 100644 scripts/_ls_drivers_mkinitramfs.sh create mode 100755 scripts/_split_file create mode 100755 scripts/local.d/blkuuid.start_ create mode 100755 scripts/local.d/net.start_ create mode 100755 scripts/local.d/net.stop_ diff --git a/kernel/config_helper/_depends_table.txt b/kernel/config_helper/_depends_table.txt deleted file mode 100644 index 993d5ec..0000000 --- a/kernel/config_helper/_depends_table.txt +++ /dev/null @@ -1,43 +0,0 @@ -"![0-9a-zA-Z_]\+" -A* -A true - -!A - - -0 1 -1 0 - -(A && B) - A -0 0 0 -0 1 0 -1 0 0 -1 1 1 - -(A || B) - A -0 0 0 -0 1 1 -1 0 1 -1 1 1 - -!(A && B) - A -0 0 1 -0 1 1 -1 0 1 -1 1 0 - -!(A || B) - - -0 0 1 -0 1 0 -1 0 0 -1 1 0 - -(!A && B) - - -0 0 0 -0 1 1 -1 0 0 -1 1 0 - -(!A || B) - A -0 0 1 -0 1 1 -1 0 0 -1 1 1 diff --git a/kernel/config_helper/config_tuning.txt b/kernel/config_helper/config_tuning.txt index e3d374a..5bd89e7 100644 --- a/kernel/config_helper/config_tuning.txt +++ b/kernel/config_helper/config_tuning.txt @@ -9,7 +9,7 @@ make menuconfig #turn off "Security options"/* - #On x86_64 the following modifications should be done -#(serial driver - don't compile) +#(serial driver - doesn't compile) #set "Device Drivers" / "Character devices" / "Serial drivers" / # / "8250/16550 and compatible serial support" - to "*" (compile into kernel image) # CONFIG_SERIAL_8250=y diff --git a/kernel/config_helper/kernel_config_review.sh b/kernel/config_helper/kernel_config_review.sh index f42355d..6348504 100644 --- a/kernel/config_helper/kernel_config_review.sh +++ b/kernel/config_helper/kernel_config_review.sh @@ -141,5 +141,5 @@ done | \ while read line; do FILE=`echo "$line" | cut -d : -f 1` NUM=`echo "$line" | cut -d : -f 2` - sh _find_file_section.sh -s -z -n -1 -2 "$FILE" "$NUM" "^comment\|^if\|^config\|^endif\|^choice\|^endchoice\|^endmenu\|^menuconfig\|^source\|^#" + bash /bin/_find_file_section.sh -s -z -n -1 -2 "$FILE" "$NUM" "^comment\|^if\|^config\|^endif\|^choice\|^endchoice\|^endmenu\|^menuconfig\|^source\|^#" done diff --git a/kernel/find_builtin_firmware/check_firmwares.sh b/kernel/find_builtin_firmware/check_firmwares.sh new file mode 100644 index 0000000..97f7d7d --- /dev/null +++ b/kernel/find_builtin_firmware/check_firmwares.sh @@ -0,0 +1,8 @@ +##source firmware fsroot /media/root/43e2ba7d-0832-4e10-b3a5-3b7f218a0658 +##copy destination /dest +##source list of kernel image's firmwares /lib/modules/4.20.15/firmware.for.builtins +cd /media/root/43e2ba7d-0832-4e10-b3a5-3b7f218a0658 +while read firmware; do + [ -e lib/firmware/"$firmware" ] && cp --parents lib/firmware/"$firmware" /dest +done < /lib/modules/4.20.15/firmware.for.builtins +## diff --git a/kernel/find_builtin_firmware/grep_objs_firmware_ar_archive.sh b/kernel/find_builtin_firmware/grep_objs_firmware_ar_archive.sh new file mode 100644 index 0000000..dfda97e --- /dev/null +++ b/kernel/find_builtin_firmware/grep_objs_firmware_ar_archive.sh @@ -0,0 +1,49 @@ +#add gpu include +#(copy to kernel dir) + +#KERNEL=/root/linux-4.11 +KERNEL=$(cd $(dirname "$0") && pwd -P) + +ARCH=x86 + +export MPATH=$PWD +find -type f -name "built-in.a" | sed 's%/built-in\.a%%' | \ +while read line; do + cd "$line" + find -maxdepth 1 -name "*.o" -printf "%f\n" | grep -v "/built-in.o$" | \ + while read obj; do + if grep -q "MODULE_FIRMWARE" `echo "$obj" | sed 's/\.o$/\.c/'` 2> /dev/null; then + echo -n "$line/" + echo "$obj" | sed 's/\.o$/\.c/' + fi + done + cd $MPATH +done | \ +while read line; do + if MODDEF=$(grep "MODULE_FIRMWARE([^\"]" $line); then + echo "$MODDEF" | sed -e 's/.*(//' -e 's/);$//' | sed "s%.*%$line &%" + else + grep "MODULE_FIRMWARE(\"" "$line" + fi +done | \ +while read file define; do +case $file in +MODULE*) + echo $file | sed -e 's/MODULE_FIRMWARE(//' -e 's/);$//' +;; +*) +(gcc -dM -E $file \ + -I$KERNEL/include \ + -I$KERNEL/arch/$ARCH/include/uapi \ + -I$KERNEL/arch/$ARCH/include/generated/uapi \ + -I$KERNEL/include/uapi \ + -I$KERNEL/include/generated/uapi \ + -include $KERNEL/include/linux/kconfig.h \ + -I$KERNEL/arch/$ARCH/include \ + -I$KERNEL/arch/$ARCH/include/generated/uapi \ + -I$KERNEL/arch/$ARCH/include/generated \ + -I$KERNEL/include \ + -I$KERNEL/include/drm | grep $define) 2> /dev/null | cut -d " " -f 3 +;; +esac +done diff --git a/kernel/find_builtin_firmware/list_firmware.sh b/kernel/find_builtin_firmware/list_firmware.sh new file mode 100644 index 0000000..1f49d36 --- /dev/null +++ b/kernel/find_builtin_firmware/list_firmware.sh @@ -0,0 +1 @@ +bash grep_objs_firmware_ar_archive.sh | sort | sed -e 's/^"//' -e 's/"$//' > firmware.for.builtins diff --git a/other_distro_useful/arch/pacman_update_key.sh b/other_distro_useful/arch/pacman_update_key.sh new file mode 100644 index 0000000..afdfeb6 --- /dev/null +++ b/other_distro_useful/arch/pacman_update_key.sh @@ -0,0 +1 @@ +pacman-key --refresh-keys diff --git a/other_distro_useful/fedora/fedora_gcc.sh b/other_distro_useful/fedora/fedora_gcc.sh new file mode 100644 index 0000000..cc53eeb --- /dev/null +++ b/other_distro_useful/fedora/fedora_gcc.sh @@ -0,0 +1 @@ +yum install make automake gcc gcc-c++ kernel-devel bison m4 flex autoconf diff --git a/other_distro_useful/systemd/journalctl_clean.sh b/other_distro_useful/systemd/journalctl_clean.sh new file mode 100644 index 0000000..37e0402 --- /dev/null +++ b/other_distro_useful/systemd/journalctl_clean.sh @@ -0,0 +1 @@ +journalctl --vacuum-time=2d diff --git a/other_distro_useful/ubuntu_debian/console-setup.sh b/other_distro_useful/ubuntu_debian/console-setup.sh new file mode 100644 index 0000000..5f747e2 --- /dev/null +++ b/other_distro_useful/ubuntu_debian/console-setup.sh @@ -0,0 +1 @@ +dpkg-reconfigure console-setup diff --git a/other_distro_useful/ubuntu_debian/dpkg-apt-install-devel-packages-base.cmds.sh b/other_distro_useful/ubuntu_debian/dpkg-apt-install-devel-packages-base.cmds.sh new file mode 100644 index 0000000..1cc04c6 --- /dev/null +++ b/other_distro_useful/ubuntu_debian/dpkg-apt-install-devel-packages-base.cmds.sh @@ -0,0 +1,4 @@ +apt-get install linux-headers-$(uname -r) +apt-get install build-essential git +apt-get install make bison flex gcc binutils m4 +apt-get install libssl-dev diff --git a/other_distro_useful/ubuntu_debian/dpkg-apt-install-remove-update.txt b/other_distro_useful/ubuntu_debian/dpkg-apt-install-remove-update.txt new file mode 100644 index 0000000..8b140f0 --- /dev/null +++ b/other_distro_useful/ubuntu_debian/dpkg-apt-install-remove-update.txt @@ -0,0 +1,17 @@ +#list installed packages +apt list --installed +#list all packages (available and installed) +apt list +#upgrade (update) packages +# +apt-get update +apt-get upgrade +# +#install package (download and install) +apt-get install [package] +#remove package +apt remove [package] +#(after eg.: kernel update - remove old kernels - command to remove not needed packages) +apt autoremove +#apt-cache +apt-cache pkgnames diff --git a/other_distro_useful/ubuntu_debian/dpkg-apt-kernel-update-fix.sh b/other_distro_useful/ubuntu_debian/dpkg-apt-kernel-update-fix.sh new file mode 100644 index 0000000..1f8b860 --- /dev/null +++ b/other_distro_useful/ubuntu_debian/dpkg-apt-kernel-update-fix.sh @@ -0,0 +1,2 @@ +#removing older kernel +dpkg -r linux-image-4.15.0-20-generic linux-kernel-generic linux-modules-extra-4.15.0-20-generic linux-image-4.15.0-20-generic diff --git a/other_distro_useful/ubuntu_debian/ubutntu_disable_grub_install.sh b/other_distro_useful/ubuntu_debian/ubutntu_disable_grub_install.sh new file mode 100644 index 0000000..bc1f703 --- /dev/null +++ b/other_distro_useful/ubuntu_debian/ubutntu_disable_grub_install.sh @@ -0,0 +1,3 @@ +#echo "set grub-pc/install_devices /dev/sda" | debconf-communicate +echo "set grub-pc/install_devices /dev/null" | debconf-communicate +echo "set grub-pc/install_devices_empty true" | debconf-communicate diff --git a/other_distro_useful/void/xbps-search.sh b/other_distro_useful/void/xbps-search.sh new file mode 100644 index 0000000..cf131d5 --- /dev/null +++ b/other_distro_useful/void/xbps-search.sh @@ -0,0 +1 @@ +xbps-query -Rs "" | grep $1 diff --git a/other_distro_useful/void/xbps-update.sh b/other_distro_useful/void/xbps-update.sh new file mode 100644 index 0000000..bc32782 --- /dev/null +++ b/other_distro_useful/void/xbps-update.sh @@ -0,0 +1,2 @@ +xbps-install -S +xbps-install -u diff --git a/other_distro_useful/void/xbps_query.sh b/other_distro_useful/void/xbps_query.sh new file mode 100644 index 0000000..8db4b7a --- /dev/null +++ b/other_distro_useful/void/xbps_query.sh @@ -0,0 +1 @@ +xbps-query -Rs "" diff --git a/other_distro_useful/void/xbps_query_grep_devel.sh b/other_distro_useful/void/xbps_query_grep_devel.sh new file mode 100644 index 0000000..6e3c7c0 --- /dev/null +++ b/other_distro_useful/void/xbps_query_grep_devel.sh @@ -0,0 +1 @@ +xbps-query -Rs "" | grep "^\[-\] [a-zA-Z0-9_.+-]\+-devel" diff --git a/scripts/_find_shell_scripts.sh b/scripts/_find_shell_scripts.sh new file mode 100644 index 0000000..b4b06c6 --- /dev/null +++ b/scripts/_find_shell_scripts.sh @@ -0,0 +1,16 @@ +#text and script +[ "$1" = "-t" ] && text=1 + +find -type f | \ +while read file; do + output=`file $file` + if [ $text ]; then + if echo "$output" | grep -q "POSIX shell script\|ASCII text"; then + echo $file + fi + else + if echo "$output" | grep -q "POSIX shell script"; then + echo $file + fi + fi +done diff --git a/scripts/_ls_drivers_mkinitramfs.sh b/scripts/_ls_drivers_mkinitramfs.sh new file mode 100644 index 0000000..a943172 --- /dev/null +++ b/scripts/_ls_drivers_mkinitramfs.sh @@ -0,0 +1,7 @@ + +cd /lib/modules/`uname -r`/kernel +if [ -z "$1" ]; then + find drivers -mindepth 1 -maxdepth 1 ! -path "drivers/gpu" | sed 's%^drivers/[a-z0-9]\+$%& \\%' +else + find drivers -mindepth 1 -maxdepth 1 ! -path "drivers/$1" | sed 's%^drivers/[a-z0-9]\+$%& \\%' +fi diff --git a/scripts/_pkgdep b/scripts/_pkgdep index bdd3a98..3ba24f1 100755 --- a/scripts/_pkgdep +++ b/scripts/_pkgdep @@ -1,5 +1,7 @@ #! /bin/bash +#pacman script + lspkgsource() { for i in ${depends[@]} ${makedepends[@]}; do diff --git a/scripts/_pkgdep64 b/scripts/_pkgdep64 index 24054f2..ac64348 100755 --- a/scripts/_pkgdep64 +++ b/scripts/_pkgdep64 @@ -1,5 +1,7 @@ #! /bin/bash +#pacman script + lspkgsource() { for i in ${depends[@]} ${makedepends[@]}; do diff --git a/scripts/_split_file b/scripts/_split_file new file mode 100755 index 0000000..5c9e65f --- /dev/null +++ b/scripts/_split_file @@ -0,0 +1,24 @@ +#!/bin/sh + +dir="$1" +file="$2" +#dir=/storage/sdcard0/android +#file=android.zip +[ -z "$dir" -o -z "$file" ] && echo "usage: _split_file 'directory' 'file' parts_num parts_size_in_megabytes" && exit 1 + +parts="$3" +size="$4" +#parts=5 +#size=10 +[ -z "$parts" -o -z "$size" ] && echo "usage: _split_file 'directory' 'file' parts_num size" && exit 1 +num=0 +while true; do + + if [ $num = $parts ]; then + break + fi + + dd if=${dir}/${file} of=${dir}/${file}.$num bs=${size}M count=1 skip=$num + num=$(expr $num + 1) + +done diff --git a/scripts/_strip b/scripts/_strip index fb695ee..cc27737 100755 --- a/scripts/_strip +++ b/scripts/_strip @@ -1,15 +1,32 @@ #! /bin/sh +# _strip [-x /path_to/strip] [strip in directory] + +if [ "$1" = "-x" ]; then + # not default strip command + shift + + if [ ! -z "$1" ]; then + STRIP="$1" + [ ! -e "$STRIP" ] && echo "No such strip command" && exit 1 + else + echo "strip command should be specified" && exit 1 + fi + shift +fi + if [ ! -z "$1" ]; then DIR="$1" [ ! -d "$DIR" ] && echo "No such directory" && exit 1 cd "$DIR" fi +[ -z "$STRIP" ] && STRIP=strip + find -type f -name "*.a" | \ while read file; do HEADER=`od -v -x -j 0 -N 7 "$file" 2> /dev/null | head -n 1 | cut -d ' ' -f 2-` - [ "$HEADER" = "3c21 7261 6863 003e" ] && strip -d "$file" + [ "$HEADER" = "3c21 7261 6863 003e" ] && $STRIP -d "$file" done -_findbin | xargs -r strip -d +_findbin | xargs -r $STRIP -d diff --git a/scripts/local.d/blkuuid.start_ b/scripts/local.d/blkuuid.start_ new file mode 100755 index 0000000..a4e76e6 --- /dev/null +++ b/scripts/local.d/blkuuid.start_ @@ -0,0 +1,20 @@ +#! /bin/sh + +lsdev() +{ +test -L /sys/block/$(ls /sys/block | head -n 1) && \ + find /sys/devices -path "*/block/*" \( -name "sd[a-z]*" -o -name "ub[a-z]*" \) | sed "s%.*/%%" || \ + find /sys/block \( -name "sd[a-z]*" -o -name "ub[a-z]*" \) | sed "s%.*/%%" +} + +[ ! -d /dev/disk/by-uuid ] && mkdir -p /dev/disk/by-uuid + +[ ! -z "$(ls /dev/disk/by-uuid | head -n 1)" ] && exit 0 + +lsdev | \ +while read dev; do + uuid=`blkid -p -s UUID -o value /dev/$dev` + if [ ! -z "$uuid" ]; then + ln -sf ../../$dev /dev/disk/by-uuid/$uuid + fi +done diff --git a/scripts/local.d/net.start_ b/scripts/local.d/net.start_ new file mode 100755 index 0000000..067f5ec --- /dev/null +++ b/scripts/local.d/net.start_ @@ -0,0 +1,20 @@ +#! /bin/sh +#iwlist wlp2s0 scanning +#iwlist wlp2s0 scanning | grep ESSID +#wpa_passphrase essid XXXXXXX(passwd) + +####/etc/wpa_supplicant.conf +#ctrl_interface=/var/run/wpa_supplicant +#ap_scan=1 +#network={ +# ssid="ESSID" +# #psk="XXXXXXXXXXXX" +# psk=XXXXXXXXXXXXXXXXXXXXX(generated psk) +# scan_ssid=1 +# key_mgmt=WPA-PSK +#} +####/etc/wpa_supplicant.conf + +ip link set dev wlp2s0 up +start-stop-daemon -S -b -q -m -p /run/wpa_supplicant.pid -x /usr/sbin/wpa_supplicant -- -c /etc/wpa_supplicant.conf -i wlp2s0 > /dev/null 2>&1 +start-stop-daemon -S -q -x /sbin/dhcpcd -- wlp2s0 > /dev/null 2>&1 diff --git a/scripts/local.d/net.stop_ b/scripts/local.d/net.stop_ new file mode 100755 index 0000000..2c376a6 --- /dev/null +++ b/scripts/local.d/net.stop_ @@ -0,0 +1,6 @@ +#! /bin/sh + +start-stop-daemon -K -q -p /run/dhcpcd-wlp2s0.pid > /dev/null 2>&1 +start-stop-daemon -K -q -p /run/wpa_supplicant.pid > /dev/null 2>&1 +rm -f /run/wpa_supplicant.pid +ip link set dev wlp2s0 down diff --git a/scripts/loginuser_openvt b/scripts/loginuser_openvt index 6ec7f3c..67af698 100755 --- a/scripts/loginuser_openvt +++ b/scripts/loginuser_openvt @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash #[$1 -f] force openvt #[$1 -w] wait process to exit diff --git a/scripts/manage/createfs b/scripts/manage/createfs index c82baf9..a957da2 100755 --- a/scripts/manage/createfs +++ b/scripts/manage/createfs @@ -1,4 +1,4 @@ -#! /bin/sh +#! /bin/bash : ${DIALOG=dialog} @@ -11,7 +11,7 @@ lslinpart() for drv in $(find /dev -maxdepth 1 -name "[hs]d[a-z]" -o -name "ub[a-z]" | sort); do LC_ALL=C sfdisk -d $drv 2> /dev/null | grep "^/dev/" | \ while read LINE; do - if echo "$LINE" | grep -q "type=83"; then + if echo "$LINE" | grep -q "type=83\|type=0FC63DAF-8483-4772-8E79-3D69D8477DE4"; then echo -n "$(echo "$LINE" | cut -d : -f 1 | tr -d " ") " eval $(echo "$LINE" | cut -d : -f 2 | cut -d , -f 2 | tr -d " ") echo -n "$(expr $size \* 512 / 1048576)MB " diff --git a/scripts/manage/createfs-byid b/scripts/manage/createfs-byid index 3dbc68e..41838e0 100755 --- a/scripts/manage/createfs-byid +++ b/scripts/manage/createfs-byid @@ -1,4 +1,4 @@ -#! /bin/sh +#! /bin/bash : ${DIALOG=dialog} @@ -11,7 +11,7 @@ lslinpart() for drv in $(find /dev -maxdepth 1 -name "[hs]d[a-z]" -o -name "ub[a-z]" | sort); do LC_ALL=C sfdisk -d $drv 2> /dev/null | grep "^/dev/" | \ while read LINE; do - if echo "$LINE" | grep -q "type=83"; then + if echo "$LINE" | grep -q "type=83\|type=0FC63DAF-8483-4772-8E79-3D69D8477DE4"; then DEVICE=$(echo "$LINE" | cut -d : -f 1 | tr -d " ") DEVNAME=$(basename $DEVICE) shopt -s lastpipe diff --git a/scripts/manage/createfs.sgdisk b/scripts/manage/createfs.sgdisk index 1a42662..1a53b7c 100755 --- a/scripts/manage/createfs.sgdisk +++ b/scripts/manage/createfs.sgdisk @@ -1,4 +1,4 @@ -#! /bin/sh +#! /bin/bash : ${DIALOG=dialog} @@ -7,12 +7,27 @@ trap "rm -f $tempfile" 0 1 2 5 15 gptlspart() { + ###sgdisk - test if sgdisk prints the name of partition type or not + + lsnum=0 for drv in $(find /dev -maxdepth 1 -name "[hs]d[a-z]" -o -name "ub[a-z]" | sort); do LC_ALL=C sgdisk -p $drv | grep "Linux filesystem$" | \ while read num start end size amo rest; do echo "$drv$num $size$amo" + lsnum=`expr $lsnum + 1` done done + + if [ $lsnum = 0 ]; then + + for drv in $(find /dev -maxdepth 1 -name "[hs]d[a-z]" -o -name "ub[a-z]" | sort); do + LC_ALL=C sgdisk -p $drv | grep "8300 $" | \ + while read num start end size amo rest; do + echo "$drv$num $size$amo" + done + done + + fi } #LC_ALL=C fdisk -l | grep "^/dev/.*Linux$" | cut -d " " -f 1 | sed 's/.*/& /dev/null | grep "^/dev/" | \ while read LINE; do - if echo "$LINE" | grep -q "type=82"; then + if echo "$LINE" | grep -q "type=82\|type=0657FD6D-A4AB-43C4-84E5-0933C84B4F4F"; then echo -n "$(echo "$LINE" | cut -d : -f 1 | tr -d " ") " eval $(echo "$LINE" | cut -d : -f 2 | cut -d , -f 2 | tr -d " ") echo -n "$(expr $size \* 512 / 1048576)MB " diff --git a/scripts/manage/createswap-byid b/scripts/manage/createswap-byid index 4e89391..b1fbae2 100755 --- a/scripts/manage/createswap-byid +++ b/scripts/manage/createswap-byid @@ -1,4 +1,4 @@ -#! /bin/sh +#! /bin/bash : ${DIALOG=dialog} @@ -10,7 +10,7 @@ lsswappart() for drv in $(find /dev -maxdepth 1 -name "[hs]d[a-z]" -o -name "ub[a-z]" | sort); do LC_ALL=C sfdisk -d $drv 2> /dev/null | grep "^/dev/" | \ while read LINE; do - if echo "$LINE" | grep -q "type=82"; then + if echo "$LINE" | grep -q "type=82\|type=0657FD6D-A4AB-43C4-84E5-0933C84B4F4F"; then DEVICE=$(echo "$LINE" | cut -d : -f 1 | tr -d " ") DEVNAME=$(basename $DEVICE) shopt -s lastpipe diff --git a/scripts/manage/createswap.sgdisk b/scripts/manage/createswap.sgdisk index 7cef214..4db0d82 100755 --- a/scripts/manage/createswap.sgdisk +++ b/scripts/manage/createswap.sgdisk @@ -7,12 +7,27 @@ trap "rm -f $tempfile" 0 1 2 5 15 gptlsswap() { + ###sgdisk - test if sgdisk prints the name of partition type or not + + lsnum=0 for drv in $(find /dev -maxdepth 1 -name "[hs]d[a-z]" -o -name "ub[a-z]" | sort); do LC_ALL=C sgdisk -p $drv | grep "Linux swap$" | \ while read num start end size amo rest; do echo "$drv$num $size$amo" + lsnum=`expr $lsnum + 1` done done + + if [ $lsnum = 0 ]; then + + for drv in $(find /dev -maxdepth 1 -name "[hs]d[a-z]" -o -name "ub[a-z]" | sort); do + LC_ALL=C sgdisk -p $drv | grep "8200 $" | \ + while read num start end size amo rest; do + echo "$drv$num $size$amo" + done + done + + fi } #LC_ALL=C fdisk -l | grep "^/dev/.*swap" | cut -d " " -f 1 | sed 's/.*/& /dev/null && mount -t tmpfs tmpfs /media fi -find /sys/devices -path "*/block/*" \( -name "sd*" -o -name "ub*" -o -name "hd*" -o -name "mmcblk*" \) | sed "s%.*/%%" | \ + +DEVS=`find /sys/devices -path "*/block/*" \( -name "sd*" -o -name "ub*" -o -name "hd*" -o -name "mmcblk*" \) | sed "s%.*/%%"` +kpartx=`ls /dev/mapper/loop?p?* | sed "s%^/dev/%%"` + + +lsdevs() +{ +for i in $DEVS; do + echo "$i" +done +for i in $kpartx; do + echo "$i" +done +} + + +lsdevs | \ while read dev; do type=`blkid -o udev -s TYPE -p /dev/$dev` if [ ! -z "$type" ]; then diff --git a/scripts/umountall b/scripts/umountall index 629eddd..4faaee1 100755 --- a/scripts/umountall +++ b/scripts/umountall @@ -10,6 +10,10 @@ else if [ -e /run/media ]; then find /run/media -mindepth 2 -maxdepth 2 -type d -print0 2> /dev/null | xargs -r -0 -i umount {} else - find /media -mindepth 1 -maxdepth 1 -type d -print0 2> /dev/null | xargs -r -0 -i umount {} + if [ -e /media/`whoami` ]; then + find /media/`whoami` -mindepth 1 -maxdepth 1 -type d -print0 2> /dev/null | xargs -r -0 -i umount {} + else + find /media -mindepth 1 -maxdepth 1 -type d -print0 2> /dev/null | xargs -r -0 -i umount {} + fi fi fi diff --git a/searchfs/_findarchive.sh b/searchfs/_findarchive.sh index ef7df43..a3274a0 100644 --- a/searchfs/_findarchive.sh +++ b/searchfs/_findarchive.sh @@ -52,11 +52,11 @@ else fi if [ "$VER" != 0 ]; then -if [ -z "$DIR" ]; then - echo "$NAME $VER $EXT" >> /tmp/file2 -else - echo "$NAME $VER $EXT $DIR" >> /tmp/file2 -fi + if [ -z "$DIR" ]; then + echo "$NAME $VER $EXT" >> /tmp/file2 + else + echo "$NAME $VER $EXT $DIR" >> /tmp/file2 + fi fi done -- 2.11.4.GIT