Commit de3f9c60 authored by Дмитрий Сафронов's avatar Дмитрий Сафронов
Browse files

Merge branch 'update' into 'main'

update

See merge request !9
parents 3ab203ca 08af3f79
Loading
Loading
Loading
Loading
Loading
+7 −9
Original line number Diff line number Diff line
#!/usr/bin/env sh

die() {
    RED='\033[0;31m'
    NC='\033[0m' # No Color
    echo -e '\[ '"${RED}$1${NC}"' ]/'
    echo -e "* $1"
    exit 1
}

@@ -15,4 +13,4 @@ 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"
exec sudo -u openwrt -g openwrt -E -H sh -c 'exec sh /sync.sh' || die "Couldn't run sync script as user"
+2 −24
Original line number Diff line number Diff line
#!/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}"' ]'
    echo -e "* $1"
    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 -acxv --no-times --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"

success "Done at $(date -u)"
LC_ALL=C.UTF-8 rsync -acxv --no-times --delete-after --exclude '*-opkg' -e "ssh -p ${OPENWRT_SSH_PORT:-22}" overlay/ "${OPENWRT_SSH_HOST:-root@192.168.1.1}:/overlay/upper/" || die "Couldn't rsync config"