First upload!
This commit is contained in:
commit
cdc90f83e7
23 changed files with 788 additions and 0 deletions
3
README.md
Normal file
3
README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
# scripts
|
||||
|
||||
Schotty's personal scripts. Feel free to use, but expect to modify some/all of them to work for you
|
6
akmod-rebuild-all.sh
Executable file
6
akmod-rebuild-all.sh
Executable file
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
echo "Building modules for all installed kernels."
|
||||
for kernel in /usr/src/kernels/*; do
|
||||
kernel=$(basename $kernel)
|
||||
/usr/sbin/akmods --force --kernels $kernel
|
||||
done
|
2
asus laptop/bar_key_fix.sh
Executable file
2
asus laptop/bar_key_fix.sh
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/bin/bash
|
||||
xmodmap -e "keycode 94 = backslash bar"
|
43
cert-expiry.sh
Executable file
43
cert-expiry.sh
Executable file
|
@ -0,0 +1,43 @@
|
|||
#!/bin/bash
|
||||
#: <<'END'
|
||||
# RHEL/Fedora rigs
|
||||
RHELHOSTS=("www.schotty.com" "matrix.schotty.com" "shadow.schotty.com")
|
||||
for rhel in "${RHELHOSTS[@]}"
|
||||
do
|
||||
echo "╔═══════════════════════════════════════════════════════════════════════════════════════╗"
|
||||
echo -e "║Host :" $rhel "\t\t\t\t\t\t\t║"
|
||||
expiry=$(
|
||||
echo $rhel |
|
||||
xargs -n 1 bash -c ' \
|
||||
openssl s_client -connect $0:443 2> /dev/null | \
|
||||
openssl x509 -noout -enddate | \
|
||||
cut -d = -f 2 | \
|
||||
xargs -I {} echo {} $0 ')
|
||||
expiry="${expiry:0:24}"
|
||||
echo -e "║SSL Cert Expiry :" ${expiry} "\t\t\t\t\t\t║"
|
||||
echo -e "║System Status :" `ssh $rhel "uptime | awk -F'[a-z]:' '{ print $2}'"` "\t║"
|
||||
echo -e "║Updates :" `ssh $rhel "sudo yum -y list updates | wc -l"`\
|
||||
"\t\t\t\t\t\t\t\t\t║"
|
||||
echo -e "╚═══════════════════════════════════════════════════════════════════════════════════════╝"
|
||||
done
|
||||
#END
|
||||
# Debian based rigs
|
||||
DEBIANHOSTS=("mx.andrewschott.com")
|
||||
for debian in "${DEBIANHOSTS[@]}"
|
||||
do
|
||||
echo "╔═══════════════════════════════════════════════════════════════════════════════════════╗"
|
||||
echo -e "║Host :" $debian "\t\t\t\t\t\t\t║"
|
||||
expiry=$(
|
||||
echo $debian |
|
||||
xargs -n 1 bash -c ' \
|
||||
openssl s_client -connect $0:443 2> /dev/null | \
|
||||
openssl x509 -noout -enddate | \
|
||||
cut -d = -f 2 | \
|
||||
xargs -I {} echo {} $0 ')
|
||||
expiry="${expiry:0:24}"
|
||||
echo -e "║SSL Cert Expiry :" ${expiry} "\t\t\t\t\t\t║"
|
||||
echo -e "║System Status :" `ssh $debian "uptime | awk -F'[a-z]:' '{ print $2}'"` "\t║"
|
||||
echo -e "║Updates :" `ssh $debian "sudo apt update > /dev/null 2>&1;sudo apt-get -s upgrade | grep -P \"\\d\\K upgraded\" | cut -d \" \" -f1" `\
|
||||
"\t\t\t\t\t\t\t\t\t║"
|
||||
echo -e "╚═══════════════════════════════════════════════════════════════════════════════════════╝"
|
||||
done
|
8
check-ssl-expiry.sh
Executable file
8
check-ssl-expiry.sh
Executable file
|
@ -0,0 +1,8 @@
|
|||
#/bin/bash
|
||||
|
||||
SERVERLIST=("shadow.schotty.com" "schotty.com" "gitlab.schotty.com" "mx.andrewschott.com")
|
||||
|
||||
for i in ${SERVERLIST[*]}; do
|
||||
echo | openssl s_client -servername $i -connect $i:443 2>/dev/null | openssl x509 -noout -subject -enddate
|
||||
echo
|
||||
done
|
10
clockscript.sh
Executable file
10
clockscript.sh
Executable file
|
@ -0,0 +1,10 @@
|
|||
#!/bin/bash
|
||||
|
||||
while sleep 1
|
||||
do
|
||||
DATE=$(date)
|
||||
tput bold
|
||||
echo "${DATE} "
|
||||
tput cuu 2
|
||||
tput sgr0
|
||||
done
|
42
cxg_backup.sh
Executable file
42
cxg_backup.sh
Executable file
|
@ -0,0 +1,42 @@
|
|||
#!/bin/bash
|
||||
##
|
||||
## Crossover Bottle Mass Backup Utility -- Bash edition.
|
||||
##
|
||||
## Written by Andrew Schott ( with help from bashscripts.org )
|
||||
## Send any questions to andrew@schotty.com
|
||||
|
||||
##
|
||||
## v1.1 -- Fixed paths for Crossover 11
|
||||
## v1.0 -- Initial release.
|
||||
##
|
||||
|
||||
## Set backup file directories.
|
||||
CXOBACKUPDIR="$HOME/cxobackup/"
|
||||
|
||||
## Set default CX bottle directories.
|
||||
CXODIR="$HOME/.cxoffice"
|
||||
|
||||
## Create backup directories if they do not exist.
|
||||
[ -d "$CXOBACKUPDIR" ] || mkdir "$CXOBACKUPDIR"
|
||||
|
||||
## Perform backup of .cxoffice
|
||||
for bottle in $CXODIR/*/
|
||||
do
|
||||
if [[ "$bottle" = "$CXODIR/desktopdata/" ]]
|
||||
then echo Skipping $bottle as it is a CX directory/file
|
||||
elif [[ "$bottle" = "$CXODIR/installers/" ]]
|
||||
then echo Skipping $bottle as it is a CX directory/file
|
||||
elif [[ "$bottle" = "$CXODIR/tie/" ]]
|
||||
then echo Skipping $bottle as it is a CX directory/file
|
||||
elif [[ "$bottle" = "$CXODIR/cxoffice.conf" ]]
|
||||
then echo Skipping $bottle as it is a CX directory/file
|
||||
elif [[ "$bottle" = "$CXODIR/usage.log" ]]
|
||||
then echo Skipping $bottle as it is a CX directory/file
|
||||
else {
|
||||
echo Archiving $bottle
|
||||
/opt/cxoffice/bin/cxbottle --bottle "$bottle" --tar "${bottle%/}.cxarchive"
|
||||
mv "${bottle%/}.cxarchive" "$CXOBACKUPDIR"
|
||||
echo Archival of $bottle completed and moved to $CXOBACKUPDIR
|
||||
}
|
||||
fi
|
||||
done
|
8
dkmsall_openrazer.sh
Executable file
8
dkmsall_openrazer.sh
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/bin/bash
|
||||
MODULE=openrazer-driver
|
||||
MODULE_VERSION=3.5.1
|
||||
|
||||
for KERNEL in [ls /lib/modules/]
|
||||
do
|
||||
dkms build openrazer-driver/$MODULE_VERSION -k $KERNEL
|
||||
done
|
49
git_updatewowrepos.sh
Executable file
49
git_updatewowrepos.sh
Executable file
|
@ -0,0 +1,49 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
RETAIL="/home/andrew/Games/wine/blizzard_games/World of Warcraft/_retail_/Interface/AddOns"
|
||||
CLASSIC="/home/andrew/Games/wine/blizzard_games/World of Warcraft/_classic_/Interface/AddOns"
|
||||
CLASSIC_ERA="/home/andrew/Games/wine/blizzard_games/World of Warcraft/_classic_era_/Interface/AddOns"
|
||||
|
||||
echo $RETAIL
|
||||
echo $CLASSIC
|
||||
echo $CLASSIC_ERA
|
||||
|
||||
func_DONE () {
|
||||
|
||||
tput cuu1
|
||||
tput cuf 40
|
||||
tput rev
|
||||
tput smso
|
||||
tput bold
|
||||
#tput setb 42
|
||||
#tput setf 30
|
||||
echo "DONE"
|
||||
tput sgr0
|
||||
}
|
||||
|
||||
echo "Updating Retail addons git repo"
|
||||
{
|
||||
cd "$RETAIL"
|
||||
git add .
|
||||
git commit -m "Updated addons."
|
||||
git push
|
||||
} &> /dev/null
|
||||
func_DONE
|
||||
|
||||
echo "Updating Classic addons git repo"
|
||||
{
|
||||
cd "$CLASSIC"
|
||||
git add .
|
||||
git commit -m "Updated addons."
|
||||
git push
|
||||
} &> /dev/null
|
||||
func_DONE
|
||||
|
||||
echo "Updating Classic Era addons git repo"
|
||||
{
|
||||
cd "$CLASSIC_ERA"
|
||||
git add .
|
||||
git commit -m "Updated addons."
|
||||
git push
|
||||
} &> /dev/null
|
||||
func_DONE
|
114
install-crossover.sh
Executable file
114
install-crossover.sh
Executable file
|
@ -0,0 +1,114 @@
|
|||
#!/bin/bash
|
||||
# Root check
|
||||
clear > /dev/null
|
||||
echo -e "Determining root ..."
|
||||
[ `whoami` = root ] || { sudo "$0" "$@"; exit $?; }
|
||||
|
||||
#Install Dependencies
|
||||
echo -e "Installing Crossover package dependencies for 32 bit libraries."
|
||||
yum -y install lshw pciutils redhat-lsb-core libv4l.i686 fontconfig.i686 libXcomposite.i686 libXinerama.i686 libgphoto2.i686 libxml2.i686 libxslt.i686 openldap.i686 sane-backends-libs.i686 mesa-dri-drivers.i686 isdn4k-utils.i686 gsm.i686 gstreamer-plugins-base.i686 lcms2.i686 mesa-libOSMesa.i686 libtiff.i686 gnutls.i686 > /dev/null
|
||||
|
||||
#Install Symlinks for TIFF and Mesa support
|
||||
echo -e "Installing symlinks for TIFF and MESA support."
|
||||
ln -s /usr/lib/libtiff.so.5.2.0 /usr/lib/libtiff.so.4 > /dev/null
|
||||
ln -s /usr/lib/libOSMesa.so.8.0.0 /usr/lib/libOSMesa.so.6 > /dev/null
|
||||
|
||||
#Install CX
|
||||
echo -e "Installing latest Crossover Linux RPM."
|
||||
yum -y install http://crossover.codeweavers.com/redirect/crossover.rpm > /dev/null
|
||||
|
||||
#Tell the user to install their respective video drivers
|
||||
echo -e "Updating PCI ID database."
|
||||
update-pciids > /dev/null
|
||||
|
||||
#Retrieve display info
|
||||
hw=`lshw -short -class Display`
|
||||
|
||||
#Set display search patterns
|
||||
nvidia="(NVIDIA|GeForce|Quadro)"
|
||||
amd="(AMD|ATI|FireGL|Radeon)"
|
||||
intel="(Intel|INTEL)"
|
||||
|
||||
#Determine display manufacturer
|
||||
nv_detected=`echo $hw | grep -ciE $nvidia`
|
||||
amd_detected=`echo $hw | grep -ciE $amd`
|
||||
intel_detected=`echo $hw | grep -ciE $intel`
|
||||
|
||||
echo nv $nv_detected
|
||||
echo amd $amd_detected
|
||||
echo intel $intel_detected
|
||||
|
||||
#Set OS search patterns
|
||||
el="(RedHat|CentOS|Springdale|Scientific)"
|
||||
fedora="(Fedora)"
|
||||
|
||||
#Determine LSB OS and release
|
||||
lsb_os=`lsb_release -i`
|
||||
lsb_release=`lsb_release -r`
|
||||
lsb_el6="(6|6.1|6.2|6.3|6.4|6.5|6.6)"
|
||||
lsb_el7="(7|7.1)"
|
||||
|
||||
#Determine OS and release
|
||||
echo Determining OS and relase information
|
||||
el_detected=`echo $lsb_os | grep -ciE $el`
|
||||
el6_detected=`echo $lsb_release | grep -ciE $lsb_el6`
|
||||
el7_detected=`echo $lsb_release | grep -ciE $lsb_el7`
|
||||
fedora_detected=`echo $lsb_os | grep -ciE "$fedora"`
|
||||
|
||||
#NVIDIA test
|
||||
if [ $nv_detected == 1 ]
|
||||
then
|
||||
tput setaf 2
|
||||
echo -e "NVIDIA graphics card found"
|
||||
tput sgr0
|
||||
echo -e "Determining OS..."
|
||||
if [ $el_detected == 1 ]
|
||||
then
|
||||
echo -e "Enterprise Linux detected. Installing EPEL and ELRepo for drivers"
|
||||
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org > /dev/null
|
||||
if [ $el6_detected == 1 ]
|
||||
then
|
||||
yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm > /dev/null
|
||||
yum -y install http://www.elrepo.org/elrepo-release-6-6.el6.elrepo.noarch.rpm > /dev/null
|
||||
fi
|
||||
if [ $el7_detected == 1 ]
|
||||
then
|
||||
yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm > /dev/null
|
||||
yum -y install http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm > /dev/null
|
||||
fi
|
||||
#Install nvidia-detect and install proper kmod, proper xorg bits, proper 32bit xorg bits and nuke off x11-glamor as it is incompatible with the nvidia driver.
|
||||
yum -y install nvidia-detect > /dev/null
|
||||
yum -y install `nvidia-detect` nvidia-x11-drv nvidia-x11-drv-32bit > /dev/null
|
||||
echo -e "As part of the NVIDIA driver installation you must take care of glamorgl, in this case we are removing it. If you wish to keep it, and instead disable it, say NO to the install below."
|
||||
read -p "Press Enter or Return to continue with the process and choose to remove the packages or not." "mainmenuinput"
|
||||
yum remove xorg-x11-glamor
|
||||
fi
|
||||
|
||||
if [ $fedora_detected == 1 ]
|
||||
then
|
||||
echo -e "Fedora Linux detected. For driver installation process, please visit http://rpmfusion.org/Howto/nVidia for more information."
|
||||
fi
|
||||
fi
|
||||
|
||||
#AMD test
|
||||
if [ $amd_detected == 1 ]
|
||||
then
|
||||
tput setaf 1
|
||||
echo -e "AMD graphics card found.\n\nThis installer is not smart enough to know how to install drivers for your device."
|
||||
echo -e "Anaconda and Xorg should be using the Radeon driver. If your card is supported in the Catalyst proprietary driver, you would be advised to look into that."
|
||||
echo -e "\nFor EL Installs :"
|
||||
echo -e "http://elrepo.org/tiki/kmod-fglrx or"
|
||||
echo -e "http://elrepo.org/tiki/kmod-fglrx-legacy"
|
||||
echo -e "for installation instructions."
|
||||
echo -e "\nFedora is currently not supported at the time the script is written, and you are best served with the Radeon driver."
|
||||
echo -e "Sorry for any inconvenience."
|
||||
tput sgr0
|
||||
fi
|
||||
|
||||
#Intel test
|
||||
if [ $intel_detected == 1 ]
|
||||
then
|
||||
tput setaf 4
|
||||
echo 'Intel graphics card found. No drivers needed as of the time of writing of this script.'
|
||||
tput sgr0
|
||||
fi
|
12
kexec/kexec-latest.sh
Executable file
12
kexec/kexec-latest.sh
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -x
|
||||
|
||||
NEWEST_KERNEL_VERSION="$(
|
||||
rpm --query --queryformat='%{VERSION}-%{RELEASE}.%{ARCH}\n' kernel \
|
||||
| sort --version-sort --reverse \
|
||||
| head --lines=1
|
||||
)"
|
||||
kexec --load --append="`cat /proc/cmdline`" \
|
||||
--initrd="/boot/initramfs-$NEWEST_KERNEL_VERSION.img" \
|
||||
"/boot/vmlinuz-$NEWEST_KERNEL_VERSION"
|
115
kexec/kexec-reboot.sh
Executable file
115
kexec/kexec-reboot.sh
Executable file
|
@ -0,0 +1,115 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
[ -n "$BASH" ] && set -o pipefail
|
||||
set -u
|
||||
|
||||
# defaults
|
||||
wait=10
|
||||
detach_wait=3
|
||||
|
||||
usage() {
|
||||
cat << EOF
|
||||
Usage: kreboot [option ...] [kernel|boot-index]
|
||||
Options are:
|
||||
--wait, -w N wait N seconds before reboot (default $wait)
|
||||
--nowait don't wait, reboot immediately
|
||||
--detach Schedule reboot and return. Suitable to remote reboot.
|
||||
--help, -h show this help message
|
||||
--kargs, k additional kernel arguments
|
||||
|
||||
Example:
|
||||
$0 0 Boot kernel with index 0
|
||||
EOF
|
||||
exit $1
|
||||
}
|
||||
|
||||
uerr() {
|
||||
echo "ERROR: $*" 2>&1
|
||||
echo
|
||||
usage 1
|
||||
}
|
||||
|
||||
# Check that all programs we need are available, exit if not
|
||||
# (relying on 'set -e' and hash returning non-zero for errors)
|
||||
hash grubby kexec systemctl
|
||||
|
||||
# Process options and arguments
|
||||
target=''
|
||||
kargs=''
|
||||
while test $# -gt 0; do
|
||||
case $1 in
|
||||
-w|--wait)
|
||||
if [ "$#" -lt 2 ]; then
|
||||
uerr "Option $1 requires an argument"
|
||||
fi
|
||||
wait=$2
|
||||
if ! printf "%f" $wait > /dev/null 2>&1; then
|
||||
uerr "Option $1 argument not a number"
|
||||
fi
|
||||
shift
|
||||
;;
|
||||
--nowait)
|
||||
wait=0
|
||||
;;
|
||||
--detach)
|
||||
detach=yes
|
||||
;;
|
||||
--detach_wait)
|
||||
if [ "$#" -lt 2 ]; then
|
||||
uerr "Option $1 requires an argument"
|
||||
fi
|
||||
detach_wait=$2
|
||||
if ! printf "%f" $detach_wait > /dev/null 2>&1; then
|
||||
uerr "Option $1 argument not a number"
|
||||
fi
|
||||
shift
|
||||
;;
|
||||
-h|--help)
|
||||
usage 0
|
||||
;;
|
||||
-k|--kargs)
|
||||
kargs=$2
|
||||
shift
|
||||
;;
|
||||
-*)
|
||||
uerr "Unrecognized option: $1"
|
||||
;;
|
||||
*)
|
||||
if [ -n "$target" ]; then
|
||||
uerr "Extra arguments: $*"
|
||||
fi
|
||||
target=$1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if [ -z "$target" ]; then
|
||||
if ! target=$(grubby --default-kernel); then
|
||||
# grubby prints error to stdout
|
||||
echo "grubby: $target" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! info=$(grubby --info=$target); then
|
||||
# grubby prints error to stdout
|
||||
echo "grubby: $info" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
eval $(echo "$info" | sed "s|^\(\S*\)=\([^'\"].*\)$|\1='\2'|")
|
||||
|
||||
echo Booting $title...
|
||||
if [ "$wait" -ne 0 ]; then
|
||||
echo Press Ctrl-C within $wait seconds to cancel
|
||||
sleep $wait
|
||||
fi
|
||||
kexec -l "$kernel" --initrd="$initrd" --command-line="root=$root $args $kargs"
|
||||
|
||||
if [ -z "detach" ]; then
|
||||
systemctl kexec
|
||||
else
|
||||
setsid bash -c "sleep $detach_wait; systemctl kexec" &>/dev/null < /dev/null &
|
||||
fi
|
||||
`
|
37
kexec/kexec.py
Normal file
37
kexec/kexec.py
Normal file
|
@ -0,0 +1,37 @@
|
|||
#!/usr/bin/env python
|
||||
# From http://code.activestate.com/recipes/491277-kexec-the-newest-linux-kernel/
|
||||
import sys
|
||||
import os
|
||||
import subprocess
|
||||
import fnmatch
|
||||
import rpm
|
||||
|
||||
def newest_kernel_and_initrd():
|
||||
ts = rpm.TransactionSet()
|
||||
p = max(ts.dbMatch('name', 'kernel'))
|
||||
k = [ x for x in p['filenames']
|
||||
if fnmatch.fnmatch(x, '/boot/vmlinuz-*') ][0]
|
||||
#The initrd is not owned by the kernel rpm but generated in the %post script
|
||||
i = '/boot/initrd-%s.img' % k[len('/boot/vmlinuz-'):]
|
||||
return (k, i)
|
||||
|
||||
def kexec(kernel, initrd, cmdline=None):
|
||||
if cmdline == None:
|
||||
cmdline = file('/proc/cmdline').read()[:-1] # strip newline
|
||||
r = subprocess.call(['/sbin/kexec', '-l', kernel,
|
||||
'--initrd=%s' % initrd,
|
||||
'--command-line=%s' % cmdline])
|
||||
if r != 0:
|
||||
raise Exception('kexec returned %d' % r)
|
||||
|
||||
def program_name():
|
||||
return os.path.basename(sys.argv[0])
|
||||
|
||||
def main():
|
||||
(k, i) = newest_kernel_and_initrd()
|
||||
sys.stderr.write('%s: loading ("%s", "%s")\n' % (program_name(), k, i))
|
||||
kexec(k, i)
|
||||
sys.stderr.write('%s: reboot to load new kernel\n' % program_name())
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
16
kexec/kexec.sh
Executable file
16
kexec/kexec.sh
Executable file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Force root
|
||||
[ `whoami` = root ] || { sudo "$0" "$@"; exit $?; }
|
||||
|
||||
latestkernel=`ls -t /boot/vmlinuz-* | sed "s/\/boot\/vmlinuz-//g" | head -n1`
|
||||
echo "kernel current: $(uname -r)"
|
||||
echo "kernel target: ${latestkernel}"
|
||||
echo ""
|
||||
echo "Arming kexec..."
|
||||
#kexec -l /boot/vmlinuz-${latestkernel} --initrd=/boot/initramfs-${latestkernel}.img --append="`cat /proc/cmdline`"
|
||||
kexec -l /boot/vmlinuz-${latestkernel} --initrd=/boot/initramfs-${latestkernel}.img --reuse-cmdline
|
||||
echo ""
|
||||
read -p "Press [Enter] key to start new kernel..."
|
||||
#systemctl start kexec.target
|
||||
kexec -e
|
1
oomox.sh
Executable file
1
oomox.sh
Executable file
|
@ -0,0 +1 @@
|
|||
sh /home/andrew/workspace/git_repos/oomox/gui.sh
|
107
osupdater.sh
Executable file
107
osupdater.sh
Executable file
|
@ -0,0 +1,107 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Universal updater by Andrew Schott andrew@schotty.com
|
||||
# Will detect and update via various packaging formats for distros I currently use.
|
||||
|
||||
# Globals
|
||||
# edit as needed to set colors and soforth
|
||||
# presuming echo thus tput is chosen here as default\
|
||||
|
||||
# tput text formatting
|
||||
# bold=bold dim=dimmed
|
||||
# rev=reverse bel=bell sound
|
||||
# smul=underline on rmul=underline off
|
||||
# setaf=foreground setab=background
|
||||
# sgr0=clear
|
||||
#
|
||||
# Colors
|
||||
# 0 Black 1 Red 2 Green 3 Yellow
|
||||
# 4 Blue 5 Magenta 6 Cyan 7 White
|
||||
#
|
||||
# Default is
|
||||
# * green for a true finding
|
||||
# * yellow for a false finding
|
||||
# * clear at the end to resume normal output for said command's output
|
||||
|
||||
CMD_NOTIFY="tput rev bold setaf 7 setab 0"
|
||||
CMD_TRUE="tput rev bold setaf 2 setab 0"
|
||||
CMD_FALSE="tput rev bold setaf 1 setab 7"
|
||||
CMD_CLEAR="tput sgr0"
|
||||
|
||||
echo $($CMD_NOTIFY)"Looking for native package managers"$($CMD_CLEAR)
|
||||
|
||||
# apt -- Debian and derivatives
|
||||
if `which apt &> /dev/null 2>&1`
|
||||
then
|
||||
echo $($CMD_TRUE)"Found apt. Updating: ($(which apt))"$($CMD_CLEAR)
|
||||
sudo apt udate -y
|
||||
sudo apt upgrade -y
|
||||
else
|
||||
echo $($CMD_FALSE)"apt not found/needed"$($CMD_CLEAR)
|
||||
fi
|
||||
|
||||
# dnf -- RHEL 8+, Fedora, Openmandriva, and derivatives
|
||||
if `which dnf &> /dev/null 2>&1`
|
||||
then
|
||||
echo $($CMD_TRUE)"Found dnf. Updating: ($(which dnf))"$($CMD_CLEAR)
|
||||
sudo dnf --refresh --skip-broken --nobest -y update
|
||||
else
|
||||
echo $($CMD_FALSE)"dnf not found/needed"$($CMD_CLEAR)
|
||||
fi
|
||||
|
||||
# pacman -- arch & arch derivatives
|
||||
if `which pacman &> /dev/null 2>&1`
|
||||
then
|
||||
echo $($CMD_TRUE)"Found pacman. Updating: ($(which pacman))"$($CMD_CLEAR)
|
||||
sudo pacman -Syu
|
||||
else
|
||||
echo $($CMD_FALSE)"pacman not found/needed"$($CMD_CLEAR)
|
||||
fi
|
||||
|
||||
# yum -- RHEL 7 > (Ignored if dnf is present)
|
||||
if `which yum &> /dev/null 2>&1` && ! `which dnf &> /dev/null 2>&1`
|
||||
then
|
||||
echo $($CMD_TRUE)"Found yum. Updating: ($(which yum))"$($CMD_CLEAR)
|
||||
sudo yum --refresh --skip-broken --nobest -y update
|
||||
else
|
||||
echo $($CMD_FALSE)"yum not found/needed"$($CMD_CLEAR)
|
||||
fi
|
||||
|
||||
# urpmi -- Mageia
|
||||
if `which urpmi &> /dev/null 2>&1` && ! `which dnf &> /dev/null 2>&1`
|
||||
then
|
||||
echo $($CMD_TRUE)"Found urpmi. Updating: ($(which urpmi))"$($CMD_CLEAR)
|
||||
sudo urpmi --auto-update -y
|
||||
else
|
||||
echo $($CMD_FALSE)"urpmi not found/needed"$($CMD_CLEAR)
|
||||
fi
|
||||
|
||||
# zypper -- SuSE products
|
||||
if `which zypper &> /dev/null 2>&1`
|
||||
then
|
||||
echo $($CMD_TRUE)"Found zypper. Updating: ($(which zypper))"$($CMD_CLEAR)
|
||||
sudo zypper in -y
|
||||
else
|
||||
echo $($CMD_FALSE)"zypper not found/needed"$($CMD_CLEAR)
|
||||
fi
|
||||
|
||||
echo $($CMD_NOTIFY)"Looking for sandboxed package managers"$($CMD_CLEAR)
|
||||
|
||||
# flatpak
|
||||
if `which flatpak &> /dev/null 2>&1`
|
||||
then
|
||||
echo $($CMD_TRUE)"Found flatpak. Updating: ($(which flatpak))"$($CMD_CLEAR)
|
||||
flatpak update --user -y
|
||||
sudo flatpak update -y
|
||||
else
|
||||
echo $($CMD_FALSE)"flatpak not found/needed"$($CMD_CLEAR)
|
||||
fi
|
||||
|
||||
# snap
|
||||
if `which snap &> /dev/null 2>&1`
|
||||
then
|
||||
echo $($CMD_TRUE)"Found snap. Updating: ($(which snap))"$($CMD_CLEAR)
|
||||
sudo snap refresh -y
|
||||
else
|
||||
echo $($CMD_FALSE)"snap not found/needed"$($CMD_CLEAR)
|
||||
fi
|
16
red hat specific/initial-setup.sh
Executable file
16
red hat specific/initial-setup.sh
Executable file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
# written by Andrew Schott
|
||||
# Credits -- fedorafaq.org fedoraforums.org fedoraproject.org redhat.com google.com
|
||||
|
||||
rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm
|
||||
|
||||
yum -y install yum-plugin*
|
||||
|
||||
yum -y install java-1.6.0-openjdk-plugin flash-plugin nspluginwrapper.x86_64} pulseaudio-libs.i386 alsa-plugins-pulseaudio.i386 libcurl.i386 mozplugger evince totem-mozplugin ntfs-3g libdvdcss libdvdnav totem-xine xine-lib-extras-freeworld totem-backend xine gstreamer-plugins-ugly audacious-plugins-freeworld-mp3 alsa-plugins-pulseaudio control-center-extra ntfs-config ccsm emerald-themes compizconfig-backend-gconf fusion-icon-gtk emerald compiz-fusion compiz-fusion-gnome libcompizconfig compiz-gnome compiz-bcop compiz compizconfig-python compiz-fusion-extras compiz-fusion-extras-gnome system-config* openoffice.org-core openoffice.org-{base,impress,writer,calc}
|
||||
|
||||
mozilla-plugin-config -i -g -v
|
||||
|
||||
yum -y install wget
|
||||
|
||||
rpm -ivh http://linuxdownload.adobe.com/adobe-release/adobe-release-i386-1.0-1.noarch.rpm
|
||||
yum -y install flash-plugin.i386
|
176
red hat specific/install-depot-multisystem.sh
Executable file
176
red hat specific/install-depot-multisystem.sh
Executable file
|
@ -0,0 +1,176 @@
|
|||
#! /bin/bash
|
||||
#exec >& >(tee -a /tmp/debog-install-depot-multisystem.txt)
|
||||
|
||||
# │▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒│
|
||||
# │ install-depot-multisystem.sh │
|
||||
# │ écrit par François Fabre │
|
||||
# │ MultiSystem LiveUSB │
|
||||
# │▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒│
|
||||
|
||||
#Mr Fabre François @frafa
|
||||
#E-Mail: liveusb@gmail.com En Français SVP !
|
||||
#http://liveusb.info/
|
||||
|
||||
#License: GNU General Public License (GPL)
|
||||
#Ce programme est un logiciel libre: vous pouvez le redistribuer
|
||||
#et/ou le modifier selon les termes de la "GNU General Public
|
||||
#License", tels que publiés par la "Free Software Foundation"; soit
|
||||
#la version 2 de cette licence ou (à votre choix) toute version
|
||||
#ultérieure.
|
||||
#
|
||||
#Ce programme est distribué dans l'espoir qu'il sera utile, mais
|
||||
#SANS AUCUNE GARANTIE, ni explicite ni implicite; sans même les
|
||||
#garanties de commercialisation ou d'adaptation dans un but spécifique.
|
||||
#
|
||||
#Se référer à la "GNU General Public License" pour plus de détails.
|
||||
#
|
||||
#Vous devriez avoir reçu une copie de la "GNU General Public License"
|
||||
#en même temps que ce programme; sinon, écrivez a la "Free Software
|
||||
#Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA".
|
||||
#http://www.gnu.org/licenses/gpl-howto.fr.html
|
||||
|
||||
#Sous Kde en boot livecd Activer depôt universe et installer zenity
|
||||
if [ "$(sudo -A cat grep '^%admin ALL=(ALL) NOPASSWD: ALL' /etc/sudoers 2>/dev/null)" ]; then
|
||||
echo
|
||||
if [ "$(which software-properties-kde)" ]; then
|
||||
sudo software-properties-kde --enable-component universe
|
||||
if [ ! "$(which zenity)" ]; then
|
||||
xterm -title 'Install zenity' -e "sudo apt-get update && sudo apt-get install -q -y zenity"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
#quelques test...
|
||||
errorlist=()
|
||||
testlist="apt-get sudo lsb_release tee zenity nohup xterm dpkg"
|
||||
for i in ${testlist}
|
||||
do
|
||||
if [ ! "$(which "$i")" ]; then
|
||||
errorlist=(${errorlist[@]} $i)
|
||||
fi
|
||||
done
|
||||
#Stop si
|
||||
if [ "$(echo "${errorlist[@]}")" ]; then
|
||||
echo -e "\033[1;47;31m Error: ${errorlist[@]} \033[0m"
|
||||
miseenforme="${errorlist[@]}"
|
||||
zenity --error --text "Error: ${miseenforme}" 2>/dev/null
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#si pas sudo!
|
||||
if [ ! "$SUDO_USER" ]; then
|
||||
msg1="L'installation de multisystem necessite les droits d'administrateur."
|
||||
msg2="Installing multisystem requires administrator rights."
|
||||
if [ "$(echo $LANG | grep -i "fr_FR.utf")" ]; then
|
||||
zenity --info --text "<b>${msg1}</b>"
|
||||
else
|
||||
zenity --info --text "<b>${msg2}</b>"
|
||||
fi
|
||||
xterm -e "sudo "$0""
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#chmod 777 /media
|
||||
if [ "$(stat -c %a /media)" != "777" ]; then
|
||||
chmod 777 /media
|
||||
fi
|
||||
|
||||
#Rajouter test si deja installé sortie!
|
||||
if [ "$(dpkg -l | grep 'ii multisystem')" ]; then
|
||||
msg1="multisystem est déjà installé!"
|
||||
msg2="multisystem is already installed!"
|
||||
if [ "$(echo $LANG | grep -i "fr_FR.utf")" ]; then
|
||||
zenity --info --text "<b>${msg1}</b>"
|
||||
else
|
||||
zenity --info --text "<b>${msg2}</b>"
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#verifier que user appartiens au group disk
|
||||
if [ ! "$(grep ^disk /etc/group | grep "$SUDO_USER")" ]; then
|
||||
usermod -a -G disk "$SUDO_USER"
|
||||
fi
|
||||
|
||||
#verifier que user appartiens au group adm
|
||||
if [ ! "$(grep ^adm /etc/group | grep "$SUDO_USER")" ]; then
|
||||
usermod -a -G adm "$SUDO_USER"
|
||||
fi
|
||||
|
||||
#Activer depôt universe
|
||||
if [ "$(which software-properties-gtk)" ]; then
|
||||
#Sous Gnome
|
||||
software-properties-gtk -e universe
|
||||
elif [ "$(which software-properties-kde)" ]; then
|
||||
#Sous Kde
|
||||
software-properties-kde --enable-component universe
|
||||
fi
|
||||
|
||||
#Pour Ubuntu hardy il faut activer en + le depot hardy-backport
|
||||
if [ "$(lsb_release -cs)" == "hardy" ]; then
|
||||
echo
|
||||
#Sous Gnome
|
||||
if [ "$(which software-properties-gtk)" ]; then
|
||||
software-properties-gtk -e hardy-backport
|
||||
#Sous Kde
|
||||
elif [ "$(which software-properties-kde)" ]; then
|
||||
software-properties-kde --enable-component hardy-backport
|
||||
fi
|
||||
fi
|
||||
|
||||
#Ajouter le depôt
|
||||
if [ ! "$(grep '^deb http://liveusb.info/multisystem' /etc/apt/sources.list 2>/dev/null)" ]; then
|
||||
vardeb="## Depôt MultiSystem\ndeb http://liveusb.info/multisystem/depot all main"
|
||||
echo -e "$vardeb" | tee -a "/etc/apt/sources.list"
|
||||
fi
|
||||
|
||||
#Ajouter clé publique pour apt
|
||||
sudo -u "$SUDO_USER" wget -q http://liveusb.info/multisystem/depot/multisystem.asc -O- | apt-key add -
|
||||
|
||||
#Recharger les sources
|
||||
apt-get update
|
||||
|
||||
#Installer le paquet multisystem
|
||||
apt-get install -y --force-yes multisystem
|
||||
apt-get -f install -y
|
||||
|
||||
#Verifier que est bien installé
|
||||
if [ ! "$(dpkg -l | grep 'ii multisystem')" ]; then
|
||||
msg1="Une erreur est survenue"
|
||||
msg2="An error occurred"
|
||||
if [ "$(echo $LANG | grep -i "fr_FR.utf")" ]; then
|
||||
zenity --error --text "<b>${msg1}</b>"
|
||||
else
|
||||
zenity --error --text "<b>${msg2}</b>"
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#Rendre executable fusermount pour bases Debian !
|
||||
chmod +x "/usr/bin/fusermount" 2>/dev/null
|
||||
chmod +x "/bin/fusermount" 2>/dev/null
|
||||
|
||||
#Modifs pour lmde!
|
||||
if [ "$(stat -c "%a" $(which fusermount))" = "4754" ]; then
|
||||
chmod 755 $(which fusermount)
|
||||
fi
|
||||
if [ "$(stat -c "%a" /media)" -lt "755" ]; then
|
||||
chmod 755 /media
|
||||
fi
|
||||
if [ "$(stat -c "%G" "$HOME/.local")" = "root" ]; then
|
||||
sudo chown $SUDO_USER:$SUDO_USER -R "$HOME"/.local
|
||||
fi
|
||||
|
||||
#message
|
||||
msg1="Dorénavant pour lancer le script veuillez utiliser\nle Menu: /Applications/Accessoires/MultiSystem."
|
||||
msg2="Now to start the script please use\nthe menu: / Applications/Accessoires/MultiSystem."
|
||||
if [ "$(echo $LANG | grep -i "fr_FR.utf")" ]; then
|
||||
zenity --info --text "<b>${msg1}</b>"
|
||||
else
|
||||
zenity --info --text "<b>${msg2}</b>"
|
||||
fi
|
||||
|
||||
#lancer gui
|
||||
nohup sudo -u "$SUDO_USER" -i "/usr/local/share/multisystem/gui_multisystem.sh"&
|
||||
sleep 1
|
||||
exit 0
|
12
red hat specific/pyyum-update
Executable file
12
red hat specific/pyyum-update
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
# init
|
||||
function pause(){
|
||||
read -p -
|
||||
}
|
||||
clear
|
||||
echo Running Yum ....
|
||||
|
||||
beesu yum update
|
||||
echo -e '\E[5;32;47m'" Press any key to close window and return to program. "
|
||||
pause
|
||||
|
BIN
red hat specific/rpm cheat sheet.pdf
Normal file
BIN
red hat specific/rpm cheat sheet.pdf
Normal file
Binary file not shown.
2
red hat specific/rpmcheatsheet.html
Normal file
2
red hat specific/rpmcheatsheet.html
Normal file
|
@ -0,0 +1,2 @@
|
|||
<script>window.googleJavaScriptRedirect=1</script><script>var f={};f.navigateTo=function(b,a,g){if(b!=a&&b.google){if(b.google.r){b.google.r=0;b.location.href=g;a.location.replace("about:blank");}}else{a.location.replace(g);}};f.navigateTo(window.parent,window,"http://lpi-tbz.org/rpm%20cheat%20sheet.pdf");
|
||||
</script><noscript><META http-equiv="refresh" content="0;URL='http://lpi-tbz.org/rpm%20cheat%20sheet.pdf'"></noscript>
|
2
restartkde5.sh
Executable file
2
restartkde5.sh
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/bin/bash
|
||||
kquitapp5 plasmashell && kstart plasmashell
|
7
weatherscript.sh
Executable file
7
weatherscript.sh
Executable file
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
while sleep 15m
|
||||
do
|
||||
clear
|
||||
pwy
|
||||
done
|
Loading…
Add table
Add a link
Reference in a new issue