Skip to content
Snippets Groups Projects
Commit 71530909 authored by Dmitriy Safronov's avatar Dmitriy Safronov
Browse files

initial

parent 758f71ef
No related branches found
No related tags found
No related merge requests found
Pipeline #5181 passed
/.gitlab-ci.yml
/.hadolint.yaml
/README.md
ignored:
- DL3008
- DL3018
FROM registry.cyberbrain.pw/docker/alpine:latest
WORKDIR /tmp/openwrt
ENTRYPOINT [ "sh", "/entrypoint.sh" ]
RUN set -ex && \
apk --no-cache add sudo git rsync openssh-client && \
rm -rf /var/cache/apk/* && \
addgroup -S openwrt && \
adduser -S openwrt -G openwrt -h /home/openwrt && \
chown -R openwrt:openwrt /tmp/openwrt
COPY entrypoint.sh /entrypoint.sh
COPY sync.sh /sync.sh
#!/usr/bin/env sh
die() {
RED='\033[0;31m'
NC='\033[0m' # No Color
echo -e '\[ '"${RED}$1${NC}"' ]/'
exit 1
}
rsync -a /opt/ /home/openwrt/.ssh/ || die "Couldn't rsync user ssh settings"
chown -R openwrt:openwrt /home/openwrt/.ssh || die "Couldn't change ownership for user ssh settings"
chmod -R a-rwx,u+rwX /home/openwrt/.ssh || die "Couldn't change access rights for user ssh settings"
exec sudo -u openwrt -g openwrt -E -H sh -c 'exec sh /sync.sh' || die "Couldn't run sync sript as user"
sync.sh 0 → 100644
#!/usr/bin/env sh
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
BLUE='\033[0;34m'
NC='\033[39m' # No Color
die() {
echo -e '[ '"${RED}$1${NC}"' ]'
exit 1
}
warning() {
echo -e '[ '"${YELLOW}$1${NC}"' ]'
}
notify() {
echo -e '[ '"${BLUE}$1${NC}"' ]'
}
success() {
echo -e '[ '"${GREEN}$1${NC}"' ]'
}
warning "Starting at $(date -u)"
find overlay/ -type f -name .gitkeep -delete
LC_ALL=C.UTF-8 rsync -avn --delete-after --exclude '*-opkg' -e "ssh -p ${OPENWRT_SSH_PORT:-22}" overlay/ "${OPENWRT_SSH_HOST:-root@192.168.0.1}:/overlay/upper/" || die "Couldn't rsync config"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment