Docker dedupe (#8441)

* Add Dockerfile for Scientific Linux 7 (RHEL7 recompile)

* revert version change

* remove duplicate docker-related files
This commit is contained in:
Omar Padron 2018-06-26 10:37:28 -04:00 committed by Todd Gamblin
parent a48bdfaf1d
commit 911b6d7671
22 changed files with 125 additions and 768 deletions

View File

@ -38,8 +38,8 @@ RUN echo "source /spack/share/spack/setup-env.sh" \
RUN echo "source /spack/share/spack/spack-completion.bash" \
>> /etc/profile.d/spack.sh
COPY handle-ssh.sh /etc/profile.d/handle-ssh.sh
COPY handle-prompt.sh /etc/profile.d/handle-prompt.sh.source
COPY common/handle-ssh.sh /etc/profile.d/handle-ssh.sh
COPY common/handle-prompt.sh /etc/profile.d/handle-prompt.sh.source
RUN ( \
echo "export DISTRO=$DISTRO" ; \
@ -50,7 +50,7 @@ RUN ( \
) > /etc/profile.d/handle-prompt.sh
RUN mkdir -p /root/.spack
COPY modules.yaml /root/.spack/modules.yaml
COPY common/modules.yaml /root/.spack/modules.yaml
RUN rm -rf /root/*.*

View File

@ -34,8 +34,8 @@ RUN echo "source /spack/share/spack/setup-env.sh" \
>> /etc/profile.d/spack.sh
RUN echo "source /spack/share/spack/spack-completion.bash" \
>> /etc/profile.d/spack.sh
COPY handle-ssh.sh /etc/profile.d/handle-ssh.sh
COPY handle-prompt.sh /etc/profile.d/handle-prompt.sh.source
COPY common/handle-ssh.sh /etc/profile.d/handle-ssh.sh
COPY common/handle-prompt.sh /etc/profile.d/handle-prompt.sh.source
RUN ( \
echo "export DISTRO=$DISTRO" ; \
@ -46,7 +46,7 @@ RUN ( \
) > /etc/profile.d/handle-prompt.sh
RUN mkdir -p /root/.spack
COPY modules.yaml /root/.spack/modules.yaml
COPY common/modules.yaml /root/.spack/modules.yaml
RUN rm -f /run/nologin

View File

@ -51,6 +51,30 @@ __write() {
return $?
}
__revparse_head() {
head="`git -C /spack rev-parse $@ HEAD 2>/dev/null`"
result="$?"
if [ "$result" '!=' '0' ] ; then
head="`git --git-dir=/spack/.git \\
--work-tree=/spack rev-parse $@ HEAD 2>/dev/null`"
result="$?"
fi
echo "$head"
return $result
}
__git_head() {
head="`__revparse_head --abbrev-ref`"
if [ "$?" '=' '0' ] ; then
if [ "$head" '=' 'HEAD' ] ; then
head="`__revparse_head | cut -c1-8`..."
fi
echo "$head"
fi
}
__update_prompt() {
local prompt
prompt=''
@ -63,14 +87,7 @@ __update_prompt() {
prompt="$prompt$linux_distro"
fi
git_head="`git --git-dir=/spack/.git --work-tree=/spack rev-parse --abbrev-ref HEAD 2>/dev/null`"
if [ "$?" '=' '0' ] ; then
if [ "$git_head" '=' 'HEAD' ] ; then
git_head="`git --git-dir=/spack/.git --work-tree=/spack rev-parse HEAD 2>/dev/null | cut -c1-8`..."
fi
else
git_head=''
fi
git_head="`__git_head`"
if [ -n "$git_head" ] ; then
git_head='\[\e[1;32m\](\[\e[0;32m\]'"$git_head"'\[\e[1;32m\])'

View File

@ -33,8 +33,8 @@ RUN echo "source /spack/share/spack/setup-env.sh" \
>> /etc/profile.d/spack.sh
RUN echo "source /spack/share/spack/spack-completion.bash" \
>> /etc/profile.d/spack.sh
COPY handle-ssh.sh /etc/profile.d/handle-ssh.sh
COPY handle-prompt.sh /etc/profile.d/handle-prompt.sh.source
COPY common/handle-ssh.sh /etc/profile.d/handle-ssh.sh
COPY common/handle-prompt.sh /etc/profile.d/handle-prompt.sh.source
RUN ( \
echo "export DISTRO=$DISTRO" ; \
@ -45,7 +45,7 @@ RUN ( \
) > /etc/profile.d/handle-prompt.sh
RUN mkdir -p /root/.spack
COPY modules.yaml /root/.spack/modules.yaml
COPY common/modules.yaml /root/.spack/modules.yaml
RUN rm -f /run/nologin

View File

@ -42,8 +42,8 @@ RUN echo "source /spack/share/spack/setup-env.sh" \
>> /etc/profile.d/spack.sh
RUN echo "source /spack/share/spack/spack-completion.bash" \
>> /etc/profile.d/spack.sh
COPY handle-ssh.sh /etc/profile.d/handle-ssh.sh
COPY handle-prompt.sh /etc/profile.d/handle-prompt.sh.source
COPY common/handle-ssh.sh /etc/profile.d/handle-ssh.sh
COPY common/handle-prompt.sh /etc/profile.d/handle-prompt.sh.source
RUN ( \
echo "export DISTRO=$DISTRO" ; \
@ -54,7 +54,7 @@ RUN ( \
) > /etc/profile.d/handle-prompt.sh
RUN mkdir -p /root/.spack
COPY modules.yaml /root/.spack/modules.yaml
COPY common/modules.yaml /root/.spack/modules.yaml
RUN rm -f /run/nologin

View File

@ -0,0 +1,62 @@
FROM sl:7
MAINTAINER Patrick Gartung (gartung@fnal.gov)
ENV SPACK_ROOT=/spack \
FORCE_UNSAFE_CONFIGURE=1 \
DISTRO=rhel7 \
container=docker
RUN yum update -y && \
yum install -y yum-conf-repos.noarch && \
yum update -y && \
yum -y install epel-release && \
yum update -y && \
yum --enablerepo epel \
groupinstall -y "Development Tools" && \
yum --enablerepo epel \
install -y \
curl \
findutils \
gcc-c++ \
gcc \
gcc-gfortran \
git \
gnupg2 \
hostname \
iproute \
Lmod \
make \
patch \
openssh-server \
python \
tcl
RUN git clone --depth=1 git://github.com/spack/spack.git /spack && \
rm -rf /var/cache/yum /spack/.git && yum clean all
RUN echo "source /usr/share/lmod/lmod/init/bash" \
> /etc/profile.d/spack.sh
RUN echo "source /spack/share/spack/setup-env.sh" \
>> /etc/profile.d/spack.sh
RUN echo "source /spack/share/spack/spack-completion.bash" \
>> /etc/profile.d/spack.sh
COPY common/handle-ssh.sh /etc/profile.d/handle-ssh.sh
COPY common/handle-prompt.sh /etc/profile.d/handle-prompt.sh.source
RUN ( \
echo "export DISTRO=$DISTRO" ; \
echo "if [ x\$PROMPT '!=' 'x' -a x\$PROMPT '!=' 'x0' ]" ; \
echo "then" ; \
echo "source /etc/profile.d/handle-prompt.sh.source" ; \
echo "fi" ; \
) > /etc/profile.d/handle-prompt.sh
RUN mkdir -p /root/.spack
COPY common/modules.yaml /root/.spack/modules.yaml
RUN rm -f /run/nologin
RUN rm -rf /root/*.*
WORKDIR /root
ENTRYPOINT ["bash"]
CMD ["-l"]

View File

@ -29,8 +29,8 @@ RUN echo "source /spack/share/spack/setup-env.sh" \
>> /etc/profile.d/spack.sh
RUN echo "source /spack/share/spack/spack-completion.bash" \
>> /etc/profile.d/spack.sh
COPY handle-ssh.sh /etc/profile.d/handle-ssh.sh
COPY handle-prompt.sh /etc/profile.d/handle-prompt.sh.source
COPY common/handle-ssh.sh /etc/profile.d/handle-ssh.sh
COPY common/handle-prompt.sh /etc/profile.d/handle-prompt.sh.source
RUN ( \
@ -42,7 +42,7 @@ RUN ( \
) > /etc/profile.d/handle-prompt.sh
RUN mkdir -p /root/.spack
COPY modules.yaml /root/.spack/modules.yaml
COPY common/modules.yaml /root/.spack/modules.yaml
RUN rm -rf /root/*.*

View File

@ -1,25 +1,41 @@
version: '3'
services:
arch:
build: ./spack_arch
build:
context: build
dockerfile: arch.dockerfile
volumes:
- '../../..:/spack'
environment:
PROMPT: "${PROMPT:-0}"
centos:
build: ./spack_centos
build:
context: build
dockerfile: centos.dockerfile
volumes:
- '../../..:/spack'
environment:
PROMPT: "${PROMPT:-0}"
fedora:
build: ./spack_fedora
build:
context: build
dockerfile: fedora.dockerfile
volumes:
- '../../..:/spack'
environment:
PROMPT: "${PROMPT:-0}"
opensuse:
build: ./spack_opensuse
build:
context: build
dockerfile: opensuse.dockerfile
volumes:
- '../../..:/spack'
environment:
PROMPT: "${PROMPT:-0}"
scilinux:
build:
context: build
dockerfile: scilinux.dockerfile
volumes:
- '../../..:/spack'
environment:
@ -31,7 +47,9 @@ services:
environment:
PROMPT: "${PROMPT:-0}"
ubuntu:
build: ./spack_ubuntu
build:
context: build
dockerfile: ubuntu.dockerfile
volumes:
- '../../..:/spack'
environment:

View File

@ -1,143 +0,0 @@
__tmp="`mktemp -d`"
__trylock() {
local dir
dir="$__tmp/$1.lock"
mkdir "$dir" &>/dev/null
return $?
}
__queue_init() {
local r
local w
mkdir "$__tmp/$1.read.lock" ; r=$?
mkdir "$__tmp/$1.write.lock" ; w=$?
if [ "$r" '=' '0' -a "$w" '=' '0' ] ; then
return 0
else
return 1
fi
}
__queue_try_read() {
__trylock "$1.read"
return $?
}
__queue_try_write() {
__trylock "$1.write"
return $?
}
__queue_make_readable() {
rm -r "$__tmp/$1.read.lock" &>/dev/null
return $?
}
__queue_make_writable() {
rm -r "$__tmp/$1.write.lock" &>/dev/null
return $?
}
__read() {
cat "$__tmp/$1" 2> /dev/null
return $?
}
__write() {
cat > "$__tmp/$1" 2> /dev/null
return $?
}
__update_prompt() {
local prompt
prompt=''
linux_distro="$DISTRO"
if [ -n "$linux_distro" ] ; then
linux_distro='\[\e[1;34m\][\[\e[0;34m\]'"$linux_distro"'\[\e[1;34m\]]'
if [ -n "$prompt" ] ; then
prompt="$prompt "
fi
prompt="$prompt$linux_distro"
fi
git_head="`git -C /spack rev-parse --abbrev-ref HEAD 2>/dev/null`"
if [ "$?" '=' '0' ] ; then
if [ "$git_head" '=' 'HEAD' ] ; then
git_head="`git -C /spack rev-parse HEAD 2>/dev/null | cut -c1-8`..."
fi
else
git_head=''
fi
if [ -n "$git_head" ] ; then
git_head='\[\e[1;32m\](\[\e[0;32m\]'"$git_head"'\[\e[1;32m\])'
if [ -n "$prompt" ] ; then
prompt="$prompt "
fi
prompt="$prompt$git_head"
fi
if [ -n "$prompt" ] ; then
prompt="$prompt "
fi
prompt="$prompt"'\[\e[0;m\]\W: '
echo "$prompt" | __write prompt
}
set -m
(
__queue_init query
__queue_init prompt
__update_prompt
__queue_make_readable prompt
__queue_make_writable query
while sleep 0.010 ; do
last_q_time=''
while sleep 0.010 ; do
q_time="`date +%s%N`"
if __queue_try_read query ; then
last_q_time="$q_time"
__queue_make_writable query
fi
if [ -n "$last_q_time" -a \
"$(( (q_time - last_q_time)/10000000 > 100 ))" '=' '1' ] ; then
break
fi
done
__update_prompt
__queue_make_readable prompt
done
) &>/dev/null &
set +m
__update_prompt_main_first_call=1
__update_prompt_main() {
if [ "$__update_prompt_main_first_call" '=' '1' ] ; then
while sleep 0.001 ; do
if __queue_try_read prompt ; then
PS1="`__read prompt`"
break
fi
done
__update_prompt_main_first_call=0
else
if __queue_try_read prompt ; then
PS1="`__read prompt`"
fi
fi
if __queue_try_write query ; then
__queue_make_readable query
fi
}
PROMPT_COMMAND=__update_prompt_main

View File

@ -1,143 +0,0 @@
__tmp="`mktemp -d`"
__trylock() {
local dir
dir="$__tmp/$1.lock"
mkdir "$dir" &>/dev/null
return $?
}
__queue_init() {
local r
local w
mkdir "$__tmp/$1.read.lock" ; r=$?
mkdir "$__tmp/$1.write.lock" ; w=$?
if [ "$r" '=' '0' -a "$w" '=' '0' ] ; then
return 0
else
return 1
fi
}
__queue_try_read() {
__trylock "$1.read"
return $?
}
__queue_try_write() {
__trylock "$1.write"
return $?
}
__queue_make_readable() {
rm -r "$__tmp/$1.read.lock" &>/dev/null
return $?
}
__queue_make_writable() {
rm -r "$__tmp/$1.write.lock" &>/dev/null
return $?
}
__read() {
cat "$__tmp/$1" 2> /dev/null
return $?
}
__write() {
cat > "$__tmp/$1" 2> /dev/null
return $?
}
__update_prompt() {
local prompt
prompt=''
linux_distro="$DISTRO"
if [ -n "$linux_distro" ] ; then
linux_distro='\[\e[1;34m\][\[\e[0;34m\]'"$linux_distro"'\[\e[1;34m\]]'
if [ -n "$prompt" ] ; then
prompt="$prompt "
fi
prompt="$prompt$linux_distro"
fi
git_head="`git --git-dir=/spack/.git --work-tree=/spack rev-parse --abbrev-ref HEAD 2>/dev/null`"
if [ "$?" '=' '0' ] ; then
if [ "$git_head" '=' 'HEAD' ] ; then
git_head="`git --git-dir=/spack/.git --work-tree=/spack rev-parse HEAD 2>/dev/null | cut -c1-8`..."
fi
else
git_head=''
fi
if [ -n "$git_head" ] ; then
git_head='\[\e[1;32m\](\[\e[0;32m\]'"$git_head"'\[\e[1;32m\])'
if [ -n "$prompt" ] ; then
prompt="$prompt "
fi
prompt="$prompt$git_head"
fi
if [ -n "$prompt" ] ; then
prompt="$prompt "
fi
prompt="$prompt"'\[\e[0;m\]\W: '
echo "$prompt" | __write prompt
}
set -m
(
__queue_init query
__queue_init prompt
__update_prompt
__queue_make_readable prompt
__queue_make_writable query
while sleep 0.010 ; do
last_q_time=''
while sleep 0.010 ; do
q_time="`date +%s%N`"
if __queue_try_read query ; then
last_q_time="$q_time"
__queue_make_writable query
fi
if [ -n "$last_q_time" -a \
"$(( (q_time - last_q_time)/10000000 > 100 ))" '=' '1' ] ; then
break
fi
done
__update_prompt
__queue_make_readable prompt
done
) &>/dev/null &
set +m
__update_prompt_main_first_call=1
__update_prompt_main() {
if [ "$__update_prompt_main_first_call" '=' '1' ] ; then
while sleep 0.001 ; do
if __queue_try_read prompt ; then
PS1="`__read prompt`"
break
fi
done
__update_prompt_main_first_call=0
else
if __queue_try_read prompt ; then
PS1="`__read prompt`"
fi
fi
if __queue_try_write query ; then
__queue_make_readable query
fi
}
PROMPT_COMMAND=__update_prompt_main

View File

@ -1,36 +0,0 @@
uid="`id -u`"
if [ "$uid" '=' '0' ] ; then
for key_type in dsa ecdsa ed25519 rsa ; do
private_key_file="/etc/ssh/ssh_host_${key_type}_key"
public_key_file="$private_key_file.pub"
if [ '!' -f "$private_key_file" ] ; then
ssh-keygen \
-q -t "$key_type" -N "" -f "$private_key_file"
chmod 600 "$private_key_file"
chmod 644 "$public_key_file"
fi
done
mkdir -p /var/run/sshd
pgrep -u 0 -U 0 sshd &> /dev/null
if [ '!' "$?" '=' '0' ] ; then
nohup /usr/sbin/sshd -f /etc/ssh/sshd_config < /dev/null &> /dev/null
fi
fi
if [ '!' -f "$HOME/.ssh/id_rsa" ] ; then
ssh-keygen \
-t rsa -C "spack.developer@docker.host" -N "" -f "$HOME/.ssh/id_rsa"
cat "$HOME/.ssh/id_rsa.pub" >> "$HOME/.ssh/authorized_keys"
chmod 600 "$HOME/.ssh/authorized_keys"
docker_ip="`ip address show dev eth0 |
grep inet |
cut -d' ' -f 6 |
cut -d/ -f 1`"
ssh-keyscan -t rsa 127.0.0.1 localhost "$docker_ip" "`hostname`" \
> "$HOME/.ssh/known_hosts" 2> /dev/null
fi

View File

@ -1,6 +0,0 @@
modules:
enable:
- lmod
lmod:
core_compilers:
- gcc

View File

@ -1,143 +0,0 @@
__tmp="`mktemp -d`"
__trylock() {
local dir
dir="$__tmp/$1.lock"
mkdir "$dir" &>/dev/null
return $?
}
__queue_init() {
local r
local w
mkdir "$__tmp/$1.read.lock" ; r=$?
mkdir "$__tmp/$1.write.lock" ; w=$?
if [ "$r" '=' '0' -a "$w" '=' '0' ] ; then
return 0
else
return 1
fi
}
__queue_try_read() {
__trylock "$1.read"
return $?
}
__queue_try_write() {
__trylock "$1.write"
return $?
}
__queue_make_readable() {
rm -r "$__tmp/$1.read.lock" &>/dev/null
return $?
}
__queue_make_writable() {
rm -r "$__tmp/$1.write.lock" &>/dev/null
return $?
}
__read() {
cat "$__tmp/$1" 2> /dev/null
return $?
}
__write() {
cat > "$__tmp/$1" 2> /dev/null
return $?
}
__update_prompt() {
local prompt
prompt=''
linux_distro="$DISTRO"
if [ -n "$linux_distro" ] ; then
linux_distro='\[\e[1;34m\][\[\e[0;34m\]'"$linux_distro"'\[\e[1;34m\]]'
if [ -n "$prompt" ] ; then
prompt="$prompt "
fi
prompt="$prompt$linux_distro"
fi
git_head="`git -C /spack rev-parse --abbrev-ref HEAD 2>/dev/null`"
if [ "$?" '=' '0' ] ; then
if [ "$git_head" '=' 'HEAD' ] ; then
git_head="`git -C /spack rev-parse HEAD 2>/dev/null | cut -c1-8`..."
fi
else
git_head=''
fi
if [ -n "$git_head" ] ; then
git_head='\[\e[1;32m\](\[\e[0;32m\]'"$git_head"'\[\e[1;32m\])'
if [ -n "$prompt" ] ; then
prompt="$prompt "
fi
prompt="$prompt$git_head"
fi
if [ -n "$prompt" ] ; then
prompt="$prompt "
fi
prompt="$prompt"'\[\e[0;m\]\W: '
echo "$prompt" | __write prompt
}
set -m
(
__queue_init query
__queue_init prompt
__update_prompt
__queue_make_readable prompt
__queue_make_writable query
while sleep 0.010 ; do
last_q_time=''
while sleep 0.010 ; do
q_time="`date +%s%N`"
if __queue_try_read query ; then
last_q_time="$q_time"
__queue_make_writable query
fi
if [ -n "$last_q_time" -a \
"$(( (q_time - last_q_time)/10000000 > 100 ))" '=' '1' ] ; then
break
fi
done
__update_prompt
__queue_make_readable prompt
done
) &>/dev/null &
set +m
__update_prompt_main_first_call=1
__update_prompt_main() {
if [ "$__update_prompt_main_first_call" '=' '1' ] ; then
while sleep 0.001 ; do
if __queue_try_read prompt ; then
PS1="`__read prompt`"
break
fi
done
__update_prompt_main_first_call=0
else
if __queue_try_read prompt ; then
PS1="`__read prompt`"
fi
fi
if __queue_try_write query ; then
__queue_make_readable query
fi
}
PROMPT_COMMAND=__update_prompt_main

View File

@ -1,36 +0,0 @@
uid="`id -u`"
if [ "$uid" '=' '0' ] ; then
for key_type in dsa ecdsa ed25519 rsa ; do
private_key_file="/etc/ssh/ssh_host_${key_type}_key"
public_key_file="$private_key_file.pub"
if [ '!' -f "$private_key_file" ] ; then
ssh-keygen \
-q -t "$key_type" -N "" -f "$private_key_file"
chmod 600 "$private_key_file"
chmod 644 "$public_key_file"
fi
done
mkdir -p /var/run/sshd
pgrep -u 0 -U 0 sshd &> /dev/null
if [ '!' "$?" '=' '0' ] ; then
nohup /usr/sbin/sshd -f /etc/ssh/sshd_config < /dev/null &> /dev/null
fi
fi
if [ '!' -f "$HOME/.ssh/id_rsa" ] ; then
ssh-keygen \
-t rsa -C "spack.developer@docker.host" -N "" -f "$HOME/.ssh/id_rsa"
cat "$HOME/.ssh/id_rsa.pub" >> "$HOME/.ssh/authorized_keys"
chmod 600 "$HOME/.ssh/authorized_keys"
docker_ip="`ip address show dev eth0 |
grep inet |
cut -d' ' -f 6 |
cut -d/ -f 1`"
ssh-keyscan -t rsa 127.0.0.1 localhost "$docker_ip" "`hostname`" \
> "$HOME/.ssh/known_hosts" 2> /dev/null
fi

View File

@ -1,6 +0,0 @@
modules:
enable:
- lmod
lmod:
core_compilers:
- gcc

View File

@ -1,36 +0,0 @@
uid="`id -u`"
if [ "$uid" '=' '0' ] ; then
for key_type in dsa ecdsa ed25519 rsa ; do
private_key_file="/etc/ssh/ssh_host_${key_type}_key"
public_key_file="$private_key_file.pub"
if [ '!' -f "$private_key_file" ] ; then
ssh-keygen \
-q -t "$key_type" -N "" -f "$private_key_file"
chmod 600 "$private_key_file"
chmod 644 "$public_key_file"
fi
done
mkdir -p /var/run/sshd
pgrep -u 0 -U 0 sshd &> /dev/null
if [ '!' "$?" '=' '0' ] ; then
nohup /usr/sbin/sshd -f /etc/ssh/sshd_config < /dev/null &> /dev/null
fi
fi
if [ '!' -f "$HOME/.ssh/id_rsa" ] ; then
ssh-keygen \
-t rsa -C "spack.developer@docker.host" -N "" -f "$HOME/.ssh/id_rsa"
cat "$HOME/.ssh/id_rsa.pub" >> "$HOME/.ssh/authorized_keys"
chmod 600 "$HOME/.ssh/authorized_keys"
docker_ip="`ip address show dev eth0 |
grep inet |
cut -d' ' -f 6 |
cut -d/ -f 1`"
ssh-keyscan -t rsa 127.0.0.1 localhost "$docker_ip" "`hostname`" \
> "$HOME/.ssh/known_hosts" 2> /dev/null
fi

View File

@ -1,6 +0,0 @@
modules:
enable:
- lmod
lmod:
core_compilers:
- gcc

View File

@ -1,143 +0,0 @@
__tmp="`mktemp -d`"
__trylock() {
local dir
dir="$__tmp/$1.lock"
mkdir "$dir" &>/dev/null
return $?
}
__queue_init() {
local r
local w
mkdir "$__tmp/$1.read.lock" ; r=$?
mkdir "$__tmp/$1.write.lock" ; w=$?
if [ "$r" '=' '0' -a "$w" '=' '0' ] ; then
return 0
else
return 1
fi
}
__queue_try_read() {
__trylock "$1.read"
return $?
}
__queue_try_write() {
__trylock "$1.write"
return $?
}
__queue_make_readable() {
rm -r "$__tmp/$1.read.lock" &>/dev/null
return $?
}
__queue_make_writable() {
rm -r "$__tmp/$1.write.lock" &>/dev/null
return $?
}
__read() {
cat "$__tmp/$1" 2> /dev/null
return $?
}
__write() {
cat > "$__tmp/$1" 2> /dev/null
return $?
}
__update_prompt() {
local prompt
prompt=''
linux_distro="$DISTRO"
if [ -n "$linux_distro" ] ; then
linux_distro='\[\e[1;34m\][\[\e[0;34m\]'"$linux_distro"'\[\e[1;34m\]]'
if [ -n "$prompt" ] ; then
prompt="$prompt "
fi
prompt="$prompt$linux_distro"
fi
git_head="`git -C /spack rev-parse --abbrev-ref HEAD 2>/dev/null`"
if [ "$?" '=' '0' ] ; then
if [ "$git_head" '=' 'HEAD' ] ; then
git_head="`git -C /spack rev-parse HEAD 2>/dev/null | cut -c1-8`..."
fi
else
git_head=''
fi
if [ -n "$git_head" ] ; then
git_head='\[\e[1;32m\](\[\e[0;32m\]'"$git_head"'\[\e[1;32m\])'
if [ -n "$prompt" ] ; then
prompt="$prompt "
fi
prompt="$prompt$git_head"
fi
if [ -n "$prompt" ] ; then
prompt="$prompt "
fi
prompt="$prompt"'\[\e[0;m\]\W: '
echo "$prompt" | __write prompt
}
set -m
(
__queue_init query
__queue_init prompt
__update_prompt
__queue_make_readable prompt
__queue_make_writable query
while sleep 0.010 ; do
last_q_time=''
while sleep 0.010 ; do
q_time="`date +%s%N`"
if __queue_try_read query ; then
last_q_time="$q_time"
__queue_make_writable query
fi
if [ -n "$last_q_time" -a \
"$(( (q_time - last_q_time)/10000000 > 100 ))" '=' '1' ] ; then
break
fi
done
__update_prompt
__queue_make_readable prompt
done
) &>/dev/null &
set +m
__update_prompt_main_first_call=1
__update_prompt_main() {
if [ "$__update_prompt_main_first_call" '=' '1' ] ; then
while sleep 0.001 ; do
if __queue_try_read prompt ; then
PS1="`__read prompt`"
break
fi
done
__update_prompt_main_first_call=0
else
if __queue_try_read prompt ; then
PS1="`__read prompt`"
fi
fi
if __queue_try_write query ; then
__queue_make_readable query
fi
}
PROMPT_COMMAND=__update_prompt_main

View File

@ -1,36 +0,0 @@
uid="`id -u`"
if [ "$uid" '=' '0' ] ; then
for key_type in dsa ecdsa ed25519 rsa ; do
private_key_file="/etc/ssh/ssh_host_${key_type}_key"
public_key_file="$private_key_file.pub"
if [ '!' -f "$private_key_file" ] ; then
ssh-keygen \
-q -t "$key_type" -N "" -f "$private_key_file"
chmod 600 "$private_key_file"
chmod 644 "$public_key_file"
fi
done
mkdir -p /var/run/sshd
pgrep -u 0 -U 0 sshd &> /dev/null
if [ '!' "$?" '=' '0' ] ; then
nohup /usr/sbin/sshd -f /etc/ssh/sshd_config < /dev/null &> /dev/null
fi
fi
if [ '!' -f "$HOME/.ssh/id_rsa" ] ; then
ssh-keygen \
-t rsa -C "spack.developer@docker.host" -N "" -f "$HOME/.ssh/id_rsa"
cat "$HOME/.ssh/id_rsa.pub" >> "$HOME/.ssh/authorized_keys"
chmod 600 "$HOME/.ssh/authorized_keys"
docker_ip="`ip address show dev eth0 |
grep inet |
cut -d' ' -f 6 |
cut -d/ -f 1`"
ssh-keyscan -t rsa 127.0.0.1 localhost "$docker_ip" "`hostname`" \
> "$HOME/.ssh/known_hosts" 2> /dev/null
fi

View File

@ -1,6 +0,0 @@
modules:
enable:
- lmod
lmod:
core_compilers:
- gcc