Skip to content

Commit

Permalink
Bump version
Browse files Browse the repository at this point in the history
git-svn-id: file:///home/bacon/SVN/auto-admin/auto-admin-0.6.3@545 15dee832-e547-e211-8a70-0017315c2eee
  • Loading branch information
outpaddling committed May 1, 2020
1 parent 81e9448 commit acc478a
Show file tree
Hide file tree
Showing 20 changed files with 485 additions and 150 deletions.
67 changes: 67 additions & 0 deletions Scripts/auto-check-ports-branch
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/bin/sh -e

##########################################################################
# Script description:
# Make sure ports branch matches pkg repo
#
# History:
# Date Name Modification
# 2020-04-16 J Bacon Begin
##########################################################################

usage()
{
printf "Usage: $0\n"
exit 1
}


##########################################################################
# Main
##########################################################################

if [ $# != 0 ]; then
usage
fi

case $(auto-ostype) in
FreeBSD)
: ${PORTSDIR:=/usr/ports}
export PORTSDIR

repo_branch=$(auto-pkg-branch)
if [ ! -e $PORTSDIR/Makefile ]; then
printf "No ports tree at $PORTSDIR. Checking one out now...\n"
auto-ports-checkout
else
ports_branch=$(auto-ports-branch)
if [ $ports_branch != $repo_branch ]; then
cat << EOM
Your binary packages are currently from the $repo_branch branch.
$PORTSDIR is currently using the $ports_branch branch.
Software installed via $PORTSDIR will likely have version mismatches
with the $repo_branch binary packages. To avoid this, you should replace
$PORTSDIR with the $repo_branch ports branch.
EOM
printf "Replace $PORTSDIR with $repo_branch? (y/n) [y] "
read correct
if [ 0$correct != 0n ]; then
# FIXME: Use svn switch where possible: Much faster
printf "Saving $PORTSDIR to $PORTSDIR.old.\n"
mv $PORTSDIR $PORTSDIR.old
auto-ports-checkout
fi
fi
fi
;;

*)
printf "$0: Not supported on $(auto-ostype).\n"
exit 1
;;

esac
4 changes: 2 additions & 2 deletions Scripts/auto-fastest-mirror
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ FreeBSD)

# Start with primary server, then compare all mirrors
fastest_mirror=''
fastest_time=`ping -o -n -t 1 ftp.freebsd.org \
fastest_time=`ping -o -n -t 1 ftp.freebsd.org 2> /dev/null \
| awk '$2 == "bytes" { print $7 }' | awk -F '=' ' { print $2 }' \
| awk -F '.' ' { print $1 }'`

Expand All @@ -61,7 +61,7 @@ FreeBSD)

for mirror in 1 2 3 4 6 7 8 9 10 11 12; do
url=ftp$mirror.freebsd.org
time=`ping -o -n -t 1 ftp$mirror.freebsd.org \
time=`ping -o -n -t 1 ftp$mirror.freebsd.org 2> /dev/null \
| awk '$2 == "bytes" { print $7 }' | awk -F '=' ' { print $2 }' \
| awk -F '.' ' { print $1 }'`
if [ $? != 0 ] || [ 0$time = 0 ]; then
Expand Down
36 changes: 19 additions & 17 deletions Scripts/auto-gpu-setup
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,24 @@ EOM
pause

# Remove old modules
sysrc "kld_list-=/boot/kernel/i915kms.ko"
sysrc "kld_list-=/boot/kernel/radeonkms.ko"
sysrc "kld_list-=/boot/modules/i915kms.ko"
sysrc "kld_list-=/boot/modules/radeonkms.ko"
sysrc "kld_list-=radeonkms"
sysrc "kld_list-=i915kms"
sysrc "kld_list-=amdgpu"
sysrc "kld_list-=nvidia"
sysrc "kld_list-=nvidia-modeset"
sysrc -q "kld_list-=/boot/kernel/i915kms.ko" > /dev/null
sysrc -q "kld_list-=/boot/kernel/radeonkms.ko" > /dev/null
sysrc -q "kld_list-=/boot/modules/i915kms.ko" > /dev/null
sysrc -q "kld_list-=/boot/modules/radeonkms.ko" > /dev/null
sysrc -q "kld_list-=radeonkms" > /dev/null
sysrc -q "kld_list-=i915kms" > /dev/null
sysrc -q "kld_list-=amdgpu" > /dev/null
sysrc -q "kld_list-=nvidia" > /dev/null
sysrc -q "kld_list-=nvidia-modeset" > /dev/null

if pciconf -lv | grep -B 2 display | grep vendor | grep -iq intel; then
printf "Intel GPU detected.\n"
pciconf -lv | grep -B 2 display
pause
cat << EOM
1.. For most Intel GPUs, you should use the modesetting driver and latest DRM:
1.. For most modern Intel GPUs, use the modesetting driver which is part of
the FreeBSD base.
pkg install -y drm-kmod
Add kld_list="/boot/modules/i915kms.ko" to /etc/rc.conf
Expand All @@ -87,8 +88,8 @@ EOM
pkg install -y drm-legacy-kmod
Add "kld_list=/boot/modules/i915kms.ko" to /etc/rc.conf
3.. For *really* old Intel GPUs, or if you encounter other issues with the
built-in Intel modesetting driver, try the Intel xorg driver:
3.. For even older Intel GPUs, or if you encounter other issues with the
built-in Intel modesetting driver, try the Intel xorg driver with no DRM:
pkg install -y xf86-video-intel
Expand Down Expand Up @@ -155,13 +156,14 @@ EOM
pkg install -y drm-legacy-kmod
Add "kld_list=/boot/modules/radeonkms.ko" to /etc/rc.conf
4.. For incredibly old AMD GPUs (not likely to be in use), try
4.. For even older AMD GPUs or systems lacking DRM support, try the ATI
driver with no DRM:
pkg install -y xf86-video-ati-legacy
pkg install -y xf86-video-ati
EOM
selection=0
while [ $selection -lt 1 ] || [ $selection -gt 3 ]; do
while [ $selection -lt 1 ] || [ $selection -gt 4 ]; do
read -p "Selection? [1] " selection
if [ 0$selection = 0 ]; then
selection=1
Expand Down Expand Up @@ -192,8 +194,8 @@ EOM
fi
;;
4)
pkg remove -y 'drm*kmod' xf86-video-amggpu xf86-video-ati || true
pkg install -y drm-kmod xf86-video-ati-legacy
pkg remove -y 'drm*kmod' xf86-video-amggpu xf86-video-ati-legacy || true
pkg install -y xf86-video-ati
;;
*)
printf "Invalid selection: $selection\n"
Expand Down
23 changes: 4 additions & 19 deletions Scripts/auto-harden
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ fi

os_type=`auto-ostype`
export PATH=${PATH}:`dirname $0`
sysctl_conf=/etc/sysctl.conf

if [ -z $EDITOR ]; then
EDITOR=vi
Expand Down Expand Up @@ -253,27 +252,13 @@ printf '\nDisabling ICMP redirects and other network vulnerabilities...\n\n'
# net.ipv4.conf.default.secure_redirects=0
case $os_type in
RHEL)
printf "# Added by $0\n" >> $sysctl_conf
for rule in \
net.ipv4.tcp_timestamps=0; do

sysctl "$rule"
auto-append-line "$rule" $sysctl_conf nocomment
done
printf "# End $0 addition\n" >> $sysctl_conf
auto-set-sysctl net.ipv4.tcp_timestamps 0 $0
;;

FreeBSD)
printf "# Added by $0\n" >> $sysctl_conf
for rule in \
net.inet.icmp.drop_redirect=1 \
net.inet.ip.sourceroute=0 \
net.inet.ip.accept_sourceroute=0; do

sysctl "$rule"
auto-append-line "$rule" $sysctl_conf nocomment
done
printf "# End $0 addition\n" >> $sysctl_conf
auto-set-sysctl net.inet.icmp.drop_redirect 1 $0
auto-set-sysctl net.inet.ip.sourceroute 0 $0
auto-set-sysctl net.inet.ip.accept_sourceroute 0 $0
;;

*)
Expand Down
40 changes: 40 additions & 0 deletions Scripts/auto-ipmi-remote-access
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/sh -e

##########################################################################
# Script description:
# Enable/disable remote access via ipmitool
#
# History:
# Date Name Modification
# 2020-02-23 Jason Bacon Begin
##########################################################################

usage()
{
printf "Usage: $0 on|off\n"
exit 1
}


##########################################################################
# Main
##########################################################################

if [ $# != 1 ]; then
usage
fi

auto-root-check $0

state="$1"
case "$state" in
on|off)
;;
*)
usage
;;
esac

# http://lists.us.dell.com/pipermail/linux-poweredge/2007-August/032915.html
# FIXME: Is -I open a good idea here? It was in an example.
ipmitool lan set 1 access $state
44 changes: 44 additions & 0 deletions Scripts/auto-ipmi-remote-power
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/sh -e

##########################################################################
# Script description:
# Issue IPMI power control over a node
#
# History:
# Date Name Modification
# 2020-02-02 Jason Bacon Begin
##########################################################################

usage()
{
printf "Usage: $0 host-bmc-address on|off\n"
exit 1
}


##########################################################################
# Main
##########################################################################

if [ $# != 2 ]; then
usage
fi

auto-operator-check $0

host=$1
state=$2
case $state in
on|off)
;;
*)
usage
;;
esac

if [ -r /root/.ipmipw ]; then
pw_flags="-f /root/.ipmipw"
fi

# FIXME: Don't hard-code lanplus, maybe just default to it?
ipmitool -v -I lanplus -H $host -U root $pw_flags chassis power $state
35 changes: 35 additions & 0 deletions Scripts/auto-ipmi-remote-status
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/sh -e

##########################################################################
# Script description:
# Check remote server status using IPMI
#
# History:
# Date Name Modification
# 2020-02-02 Jason Bacon Begin
##########################################################################

usage()
{
printf "Usage: $0 host-bmc-address\n"
exit 1
}


##########################################################################
# Main
##########################################################################

if [ $# != 1 ]; then
usage
fi

auto-operator-check $0

if [ -r /root/.ipmipw ]; then
pw_flags="-f /root/.ipmipw"
fi

# FIXME: Don't hard-code lanplus
# ipmitool -v -I lanplus -H $1 -U root sel list
ipmitool -v -I lanplus -H $1 -U root $pw_flags chassis status
7 changes: 3 additions & 4 deletions Scripts/auto-nfs-server-setup
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,15 @@ FreeBSD)
fi

touch /etc/exports
auto-append-line 'V4: /' /etc/exports $0
auto-append-line 'nfsv4_server_enable="YES"' /etc/rc.conf $0
auto-enable-service -s nfsd nfs_server $0
auto-enable-service -s statd rpc_statd $0
auto-enable-service -s lockd rpc_lockd $0

# FIXME: Present option to run nfsuserd or the sysctls below
auto-append-line 'vfs.nfs.enable_uidtostring=1' /etc/sysctl.conf $0
auto-append-line 'vfs.nfsd.enable_stringtouid=1' /etc/sysctl.conf $0
sysctl vfs.nfs.enable_uidtostring=1
sysctl vfs.nfsd.enable_stringtouid=1
auto-set-sysctl vfs.nfs.enable_uidtostring 1 $0
auto-set-sysctl vfs.nfsd.enable_stringtouid 1 $0
;;

*)
Expand Down
30 changes: 30 additions & 0 deletions Scripts/auto-operator-check
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/sh -e

##########################################################################
# Script description:
# Verify that calling user a member of operator.
#
# History:
# Date Name Modification
# 2019-07-16 Jason Bacon Begin
##########################################################################

usage()
{
printf "Usage: $0 calling-script-name\n"
exit 1
}


##########################################################################
# Main
##########################################################################

if [ $# != 1 ]; then
usage
fi

if ! groups | fgrep -q operator; then
printf "$1 can only be run by members of operator.\n"
exit 1
fi
Loading

0 comments on commit acc478a

Please sign in to comment.