mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-11-22 14:07:55 +00:00
testsuite/REQUIREMENTS: Updated for Ubuntu 18.04.
This commit is contained in:
parent
c0e63fb81c
commit
c7851f76e2
|
@ -1,141 +1,199 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
mysqlrootpass=${mysqlrootpass:-b+Ydjq4ejT4E}
|
install_packages() {
|
||||||
|
# After first run, set this:
|
||||||
|
# export INSTALL=echo
|
||||||
|
INSTALL=${INSTALL:-"sudo aptitude -y install"}
|
||||||
|
|
||||||
# After first run, set this:
|
# The testsuite depends on this:
|
||||||
# export INSTALL=echo
|
test_pkgs="imagemagick expect autossh sshpass jq libpod-simple-perl pod2pdf gawk"
|
||||||
INSTALL=${INSTALL:-"sudo aptitude -y install"}
|
test_pkgs="$test_pkgs lua5.3 clisp php-cli nodejs mono-csharp-shell"
|
||||||
|
|
||||||
# The testsuite depends on this:
|
# DEBIAN package
|
||||||
test_pkgs="imagemagick expect autossh sshpass jq libpod-simple-perl pod2pdf gawk"
|
packaging_pkgs="dpkg-dev build-essential debhelper osc cvs"
|
||||||
test_pkgs="$test_pkgs lua5.2 clisp php7.0-cli nodejs-legacy mono-csharp-shell"
|
# SHEBANG TOOLS
|
||||||
|
shebang_pkgs="gnuplot octave ruby r-base-core"
|
||||||
|
# SQL TOOLS
|
||||||
|
sql_pkgs="libdbd-pg-perl libdbd-sqlite3-perl libdbd-csv-perl libdbd-mysql-perl rlwrap"
|
||||||
|
# Compression
|
||||||
|
compression_pkgs="zstd clzip liblz4-tool lzop pigz pixz pxz gzip plzip pbzip2 lzma xz-utils lzip bzip2 lbzip2 lrzip"
|
||||||
|
# Shells
|
||||||
|
shell_pkgs="ash csh dash fdclone fish fizsh ksh mksh posh rc rush sash tcsh yash zsh"
|
||||||
|
# Databases
|
||||||
|
database_pkgs="postgresql mysql-server sqlite"
|
||||||
|
if $INSTALL $test_pkgs $packaging_pkgs $shebang_pkgs $sql_pkgs $compression_pkgs $shell_pkgs $database_pkgs; then
|
||||||
|
# OK
|
||||||
|
true
|
||||||
|
else
|
||||||
|
echo Packages missing
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# DEBIAN package
|
setup_databases() {
|
||||||
packaging_pkgs="dpkg-dev build-essential debhelper osc cvs"
|
# DATABASES
|
||||||
# SHEBANG TOOLS
|
echo '# Create PostgreSQL'
|
||||||
shebang_pkgs="gnuplot octave ruby r-base-core"
|
sudo su - postgres -c 'createdb '`whoami`
|
||||||
# SQL TOOLS
|
sudo su - postgres -c 'createuser '`whoami`
|
||||||
sql_pkgs="libdbd-pg-perl libdbd-sqlite3-perl libdbd-csv-perl libdbd-mysql-perl rlwrap"
|
sudo su - postgres -c "sql pg:/// \"ALTER USER \\\"`whoami`\\\" WITH PASSWORD '`whoami`';\""
|
||||||
# Compression
|
|
||||||
compression_pkgs="zstd clzip liblz4-tool lzop pigz pixz pxz gzip plzip pbzip2 lzma xz-utils lzip bzip2 lbzip2 lrzip"
|
|
||||||
# Shells
|
|
||||||
shell_pkgs="ash csh dash fdclone fish fizsh ksh mksh posh rc rush sash tcsh yash zsh"
|
|
||||||
# Databases
|
|
||||||
database_pkgs="postgresql mysql-server sqlite"
|
|
||||||
$INSTALL $test_pkgs $packaging_pkgs $shebang_pkgs $sql_pkgs $compression_pkgs $shell_pkgs $database_pkgs
|
|
||||||
|
|
||||||
# DATABASES
|
mysqlrootpass=${mysqlrootpass:-b+Ydjq4ejT4E}
|
||||||
echo '# Create PostgreSQL'
|
|
||||||
sudo su - postgres -c 'createdb '`whoami`
|
|
||||||
sudo su - postgres -c 'createuser '`whoami`
|
|
||||||
sudo su - postgres -c "sql pg:/// \"ALTER USER \\\"`whoami`\\\" WITH PASSWORD '`whoami`';\""
|
|
||||||
|
|
||||||
echo '# Create MySQL'
|
echo '# Create MySQL'
|
||||||
sudo su - mysql mysqladmin create `whoami`
|
sudo su - mysql mysqladmin create `whoami`
|
||||||
sql mysql://root:"$mysqlrootpass"@/mysql "DROP DATABASE `whoami`;DROP USER '`whoami`'@'localhost';"
|
sudo sql mysql://root:"$mysqlrootpass"@/mysql "DROP DATABASE `whoami`;DROP USER '`whoami`'@'localhost';"
|
||||||
sql mysql://root:"$mysqlrootpass"@/mysql "CREATE DATABASE `whoami`;CREATE USER '`whoami`'@'localhost' IDENTIFIED BY '`whoami`'; GRANT ALL ON `whoami`.* TO '`whoami`'@'localhost';"
|
sudo sql mysql://root:"$mysqlrootpass"@/mysql "CREATE DATABASE `whoami`;CREATE USER '`whoami`'@'localhost' IDENTIFIED BY '`whoami`'; GRANT ALL ON `whoami`.* TO '`whoami`'@'localhost';"
|
||||||
|
}
|
||||||
|
|
||||||
# SHELLS
|
add_server_to_hosts() {
|
||||||
touch ~/.zshrc
|
# Insert 127.1.2.3 server in /etc/hosts
|
||||||
SSHPASS=`goodpasswd`
|
if grep -q 127.1.2.3 /etc/hosts; then
|
||||||
export SSHPASS
|
# skip
|
||||||
#shells="bash sh csh ash tcsh zsh ksh fish fizsh mksh pdksh posh rc sash yash nopathbash nopathcsh"
|
true
|
||||||
shells="bash sh csh ash dash tcsh zsh ksh fish fizsh mksh posh rc sash yash nopathbash nopathcsh"
|
else
|
||||||
create_shell_user() {
|
printf "127.1.2.3\tserver\n" |
|
||||||
shell="$1"
|
sudo tee -a /etc/hosts
|
||||||
sudo deluser $shell && sudo mv /home/$shell /tmp/$shell.$RANDOM
|
fi
|
||||||
sudo groupdel $shell
|
}
|
||||||
sudo adduser --disabled-password --gecos "$shell for parallel,,," $shell &&
|
|
||||||
echo "$shell:$SSHPASS" | sudo chpasswd &&
|
create_shell_logins() {
|
||||||
sshpass -e ssh-copy-id $shell@lo &&
|
# SHELLS
|
||||||
echo Add server keys for lo and server &&
|
echo '# Create shell logins'
|
||||||
ssh $shell@lo 'ssh-keyscan -t rsa lo >> .ssh/known_hosts' &&
|
touch ~/.zshrc
|
||||||
ssh $shell@lo 'ssh-keyscan -t rsa server >> .ssh/known_hosts' &&
|
SSHPASS=`goodpasswd`
|
||||||
echo Do chsh -s $(which $shell || which ${shell#"nopath"}) $shell &&
|
export SSHPASS
|
||||||
(echo $shell | grep parallel ||
|
shells="bash sh csh ash dash tcsh zsh ksh fish fizsh mksh posh rc sash yash nopathbash nopathcsh"
|
||||||
sudo chsh -s $(which $shell || which ${shell#"nopath"}) $shell) &&
|
del_add_user() {
|
||||||
echo Do ssh-keygen &&
|
shell="$1"
|
||||||
echo | ssh -t $shell@lo ssh-keygen -b 1024 &&
|
append-if-not-exists() {
|
||||||
echo Do ssh $shell@lo 'cat .ssh/id_rsa.pub >> .ssh/authorized_keys' &&
|
file="$1"
|
||||||
ssh $shell@lo 'cat .ssh/id_rsa.pub >> .ssh/authorized_keys' &&
|
shift
|
||||||
ssh $shell@lo cat .ssh/id_rsa.pub | ssh parallel@lo 'cat >> .ssh/authorized_keys' &&
|
string="$@"
|
||||||
ssh $shell@lo 'echo ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAxg+dh+BL1myqo6A+pHcQCKVV5v7cewdkN8xGtMDqm7xGgh+e5A44W7qKViIx641d6yoWb012XzDz2MKetG4Kosoma8Z/qkS27p6901RmI3ap2JFffzBESlpQtW1FyxQPlMyBfrd4ONy8xW6R/gEkjC3yOcXCQO2494/c46ouXs5gtE84Cusr3RsopR4bI7oloH1GQZ4vsHSFSakq8IwcujaSh1mmribMONLb2TjDpmE7tAY+yfOVWHPQ2J+EU1//Go60EZfSRKOu81oxW7SJ2uGgWfWcs2T1lRtT8Yh+TwVTz8UFV75kVtpZ10x5baN+ncsSpaBK+8sFLfoMvA9yQQ== tange@freebsd71.tange.dk >> .ssh/authorized_keys' &&
|
if grep -qF "$string" "$file"; then
|
||||||
echo Do env_parallel --install &&
|
# It is there already
|
||||||
ssh $shell@lo env_parallel --install &&
|
echo "$string is already in $file"
|
||||||
ssh $shell@lo 'mkdir .parallel; touch .parallel/will-cite' &&
|
else
|
||||||
echo OK Created $shell &&
|
echo "$string" | sudo tee -a "$file"
|
||||||
echo >&2 &&
|
fi
|
||||||
echo OK Created $shell >&2 &&
|
}
|
||||||
|
append-if-not-exists /etc/shells $(which $shell || which ${shell#"nopath"})
|
||||||
|
sudo deluser $shell && sudo mv /home/$shell /tmp/$shell.$RANDOM
|
||||||
|
sudo groupdel $shell
|
||||||
|
if echo $shell | grep -q parallel; then
|
||||||
|
loginshell=/bin/bash
|
||||||
|
else
|
||||||
|
loginshell=$(which $shell || which ${shell#"nopath"})
|
||||||
|
fi
|
||||||
|
sudo adduser --shell $loginshell --disabled-password --gecos "$shell for parallel,,," $shell &&
|
||||||
|
echo "$shell:$SSHPASS" | sudo chpasswd
|
||||||
|
}
|
||||||
|
export -f del_add_user
|
||||||
|
|
||||||
|
make_sshkey() {
|
||||||
|
shell="$1"
|
||||||
|
sshpass -e ssh-copy-id $shell@lo
|
||||||
|
echo Add server keys for lo and server &&
|
||||||
|
ssh $shell@lo 'rm -f .ssh/id_rsa; ssh-keyscan lo >>.ssh/known_hosts; ssh-keyscan server >> .ssh/known_hosts' &&
|
||||||
|
echo Do ssh-keygen &&
|
||||||
|
echo | ssh -t $shell@lo ssh-keygen -b 1024 -f .ssh/id_rsa &&
|
||||||
|
echo Do ssh $shell@lo 'cat .ssh/id_rsa.pub >> .ssh/authorized_keys' &&
|
||||||
|
ssh $shell@lo 'cat .ssh/id_rsa.pub | tee -a .ssh/authorized_keys' |
|
||||||
|
ssh parallel@lo 'cat >> .ssh/authorized_keys' &&
|
||||||
|
ssh $shell@lo "echo ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAxg+dh+BL1myqo6A+pHcQCKVV5v7cewdkN8xGtMDqm7xGgh+e5A44W7qKViIx641d6yoWb012XzDz2MKetG4Kosoma8Z/qkS27p6901RmI3ap2JFffzBESlpQtW1FyxQPlMyBfrd4ONy8xW6R/gEkjC3yOcXCQO2494/c46ouXs5gtE84Cusr3RsopR4bI7oloH1GQZ4vsHSFSakq8IwcujaSh1mmribMONLb2TjDpmE7tAY+yfOVWHPQ2J+EU1//Go60EZfSRKOu81oxW7SJ2uGgWfWcs2T1lRtT8Yh+TwVTz8UFV75kVtpZ10x5baN+ncsSpaBK+8sFLfoMvA9yQQ'==' tange@freebsd71.tange.dk >> .ssh/authorized_keys" &&
|
||||||
|
echo Do env_parallel --install &&
|
||||||
|
ssh $shell@lo 'mkdir -p .parallel; touch .parallel/will-cite; env_parallel --install' &&
|
||||||
|
echo OK Created $shell &&
|
||||||
|
echo >&2 &&
|
||||||
|
echo OK Created $shell >&2 &&
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
export -f make_sshkey
|
||||||
|
. `which env_parallel.bash`
|
||||||
|
shellsplus="parallel $shells"
|
||||||
|
|
||||||
|
echo '# (Re-)create user'
|
||||||
|
# Racecondition: if multiple adds a group it will the same group ID
|
||||||
|
parallel --timeout 15 --retries 5 --tag -j1 del_add_user ::: $shellsplus
|
||||||
|
echo '# Make and copy sshkey'
|
||||||
|
parallel --timeout 15 --retries 5 --tag -j5 make_sshkey ::: $shellsplus
|
||||||
|
|
||||||
|
ssh_a_to_b() {
|
||||||
|
ssh $1@lo ssh $2@lo echo OK ||
|
||||||
|
echo failed && false
|
||||||
|
}
|
||||||
|
export -f ssh_a_to_b
|
||||||
|
parallel -j8 --timeout 5 --tag ssh_a_to_b {} {} ::: $shellsplus
|
||||||
|
|
||||||
|
ssh_copy_id() {
|
||||||
|
from="$1"
|
||||||
|
to="$2"
|
||||||
|
ssh $from cat .ssh/id_rsa.pub | ssh $to 'cat >> .ssh/authorized_keys'
|
||||||
|
}
|
||||||
|
export -f ssh_copy_id
|
||||||
|
|
||||||
|
echo '# copy id from any X to any Y'
|
||||||
|
parallel -u --bar -j3 --timeout 3 --retries 10 --tag ssh_copy_id {1}@lo {2}@lo ::: $shellsplus ::: $shellsplus
|
||||||
|
echo '# Test the copying went well'
|
||||||
|
parallel -j3 --timeout 3 --retries 10 --tag ssh_a_to_b ::: $shellsplus ::: $shellsplus
|
||||||
|
|
||||||
|
echo '# change paths to no path'
|
||||||
|
(
|
||||||
|
ssh nopathbash@lo 'echo > .bashrc PATH=/bin:/usr/bin'
|
||||||
|
ssh nopathbash@lo 'echo > .profile PATH=/bin:/usr/bin'
|
||||||
|
# Remove env_parallel from .profile
|
||||||
|
ssh nopathbash@lo 'perl -i.bak -pe s/.*env_parallel.*// .profile .bashrc'
|
||||||
|
ssh nopathcsh@lo 'echo >> .cshrc setenv PATH /bin:/usr/bin'
|
||||||
|
ssh nopathbash@lo 'echo $PATH; echo 1 | parallel echo' || echo Should FAIL
|
||||||
|
ssh nopathcsh@lo 'echo $PATH; echo 1 | parallel echo' || echo Should FAIL
|
||||||
|
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
lsh_setup() {
|
||||||
|
ssh-keyscan localhost >>~/.ssh/known_hosts
|
||||||
|
ssh-copy-id localhost
|
||||||
|
|
||||||
|
# SHELLS: lsh-client against openssh server
|
||||||
|
$INSTALL lsh-client
|
||||||
|
cd
|
||||||
|
mkdir -p .lsh
|
||||||
|
lsh-make-seed -o ".lsh/yarrow-seed-file"
|
||||||
|
lsh -c aes256-ctr --sloppy-host-authentication --capture-to ~/.lsh/host-acls lo echo Added host-auth
|
||||||
|
lsh -c aes256-ctr --sloppy-host-authentication --capture-to ~/.lsh/host-acls localhost echo Added host-auth
|
||||||
|
lsh-keygen | lsh-writekey -c none
|
||||||
|
lsh-export-key --openssh < ~/.lsh/identity.pub | lsh -c aes256-ctr lo 'cat >>.ssh/authorized_keys'
|
||||||
|
lsh-export-key --openssh < ~/.lsh/identity.pub | ssh csh@lo 'cat >>.ssh/authorized_keys'
|
||||||
|
}
|
||||||
|
|
||||||
|
add_freebsd() {
|
||||||
|
echo "# Add public key to freebsd7.t"
|
||||||
|
ssh freebsd7.t cat .ssh/id_rsa.pub | ssh parallel@localhost 'cat >>.ssh/authorized_keys'
|
||||||
|
|
||||||
|
echo Add:
|
||||||
|
echo HostkeyAlgorithms +ssh-dss
|
||||||
|
echo to .ssh/config if you get
|
||||||
|
echo no matching host key type found. Their offer: ssh-dss
|
||||||
echo
|
echo
|
||||||
|
echo Add to /etc/ssh/sshd_config
|
||||||
|
echo Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes256-cbc,aes192-cbc,aes128-cbc,3des-cbc
|
||||||
|
echo KexAlgorithms diffie-hellman-group-exchange-sha256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,curve25519-sha256@libssh.org,diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1
|
||||||
|
echo
|
||||||
|
echo If you get:
|
||||||
|
echo Unable to negotiate with server port 22: no matching cipher found. Their offer: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se
|
||||||
|
echo add this to .ssh/config
|
||||||
|
echo Ciphers +aes256-cbc
|
||||||
}
|
}
|
||||||
export -f create_shell_user
|
|
||||||
. `which env_parallel.bash`
|
|
||||||
shellsplus="parallel $shells"
|
|
||||||
# Racecondition: if multiple adds a group it will the same group ID
|
|
||||||
parallel --timeout 15 --retries 5 --tag -j1 create_shell_user ::: $shellsplus
|
|
||||||
|
|
||||||
ssh_a_to_b() {
|
misc() {
|
||||||
ssh $1@lo ssh $2@lo echo OK ||
|
parallel --record-env
|
||||||
echo failed && false
|
|
||||||
|
sudo cp /usr/bin/tmux /usr/local/bin/tmux1.8
|
||||||
}
|
}
|
||||||
export -f ssh_a_to_b
|
|
||||||
parallel -j8 --timeout 5 --tag ssh_a_to_b {} {} ::: $shellsplus
|
|
||||||
|
|
||||||
ssh_copy_id() {
|
|
||||||
from="$1"
|
|
||||||
to="$2"
|
|
||||||
ssh $from cat .ssh/id_rsa.pub | ssh $to 'cat >> .ssh/authorized_keys'
|
|
||||||
}
|
|
||||||
export -f ssh_copy_id
|
|
||||||
|
|
||||||
# copy id from any X to any Y
|
|
||||||
parallel -u --bar -j3 --timeout 3 --retries 10 --tag ssh_copy_id {1}@lo {2}@lo ::: $shellsplus ::: $shellsplus
|
|
||||||
# Test the copying went well
|
|
||||||
parallel -j3 --timeout 3 --retries 10 --tag ssh_a_to_b ::: $shellsplus ::: $shellsplus
|
|
||||||
|
|
||||||
# change paths to no path
|
|
||||||
(
|
|
||||||
ssh nopathbash@lo 'echo > .bashrc PATH=/bin:/usr/bin'
|
|
||||||
ssh nopathbash@lo 'echo > .profile PATH=/bin:/usr/bin'
|
|
||||||
# Remove env_parallel from .profile
|
|
||||||
ssh nopathbash@lo 'perl -i.bak -pe s/.*env_parallel.*// .profile .bashrc'
|
|
||||||
ssh nopathcsh@lo 'echo >> .cshrc setenv PATH /bin:/usr/bin'
|
|
||||||
ssh nopathbash@lo 'echo $PATH; echo 1 | parallel echo' || echo Should FAIL
|
|
||||||
ssh nopathcsh@lo 'echo $PATH; echo 1 | parallel echo' || echo Should FAIL
|
|
||||||
|
|
||||||
)
|
|
||||||
|
|
||||||
ssh-copy-id localhost
|
|
||||||
|
|
||||||
# SHELLS: lsh-client against openssh server
|
|
||||||
$INSTALL lsh-client
|
|
||||||
cd
|
|
||||||
mkdir .lsh
|
|
||||||
lsh-make-seed -o ".lsh/yarrow-seed-file"
|
|
||||||
lsh -c aes256-ctr --sloppy-host-authentication --capture-to ~/.lsh/host-acls lo echo Added host-auth
|
|
||||||
lsh -c aes256-ctr --sloppy-host-authentication --capture-to ~/.lsh/host-acls localhost echo Added host-auth
|
|
||||||
lsh-keygen | lsh-writekey -c none
|
|
||||||
lsh-export-key --openssh < ~/.lsh/identity.pub | lsh -c aes256-ctr lo 'cat >>.ssh/authorized_keys'
|
|
||||||
lsh-export-key --openssh < ~/.lsh/identity.pub | ssh csh@lo 'cat >>.ssh/authorized_keys'
|
|
||||||
|
|
||||||
|
|
||||||
parallel --record-env
|
|
||||||
|
|
||||||
sudo cp /usr/bin/tmux /usr/local/bin/tmux1.8
|
|
||||||
|
|
||||||
ssh freebsd7.t cat .ssh/id_rsa.pub | ssh parallel@localhost 'cat >>.ssh/authorized_keys'
|
|
||||||
|
|
||||||
echo Add:
|
|
||||||
echo HostkeyAlgorithms +ssh-dss
|
|
||||||
echo to .ssh/config if you get
|
|
||||||
echo no matching host key type found. Their offer: ssh-dss
|
|
||||||
echo
|
|
||||||
echo Add to /etc/ssh/sshd_config
|
|
||||||
echo Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes256-cbc,aes192-cbc,aes128-cbc,3des-cbc
|
|
||||||
echo KexAlgorithms diffie-hellman-group-exchange-sha256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,curve25519-sha256@libssh.org,diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1
|
|
||||||
echo
|
|
||||||
echo If you get:
|
|
||||||
echo Unable to negotiate with server port 22: no matching cipher found. Their offer: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se
|
|
||||||
echo add this to .ssh/config
|
|
||||||
echo Ciphers +aes256-cbc
|
|
||||||
|
|
||||||
|
install_packages &&
|
||||||
|
setup_databases &&
|
||||||
|
add_server_to_hosts &&
|
||||||
|
create_shell_logins &&
|
||||||
|
lsh_setup &&
|
||||||
|
add_freebsd &&
|
||||||
|
misc
|
||||||
|
|
Loading…
Reference in a new issue