-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-entrypoint.sh
More file actions
44 lines (37 loc) · 1.2 KB
/
Copy pathdocker-entrypoint.sh
File metadata and controls
44 lines (37 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
set -e
#set -x ## debug
# check for cupsd.conf existance
# if not exist re-copy it from skeleton
if [[ ! -f /etc/cups/cupsd.conf ]]; then
cp -rpn /etc/cups-skel/* /etc/cups/
fi
# delete lock file if exists for any unknown reason
if ! pgrep -l pacman && test -f /var/lib/pacman/db.lck; then
rm -vf /var/lib/pacman/db.lck
fi
# TrustedOnly sources
if ! grep -q "^SigLevel = Required DatabaseOptional TrustedOnly$" /etc/pacman.conf; then
sed -ri "0,/SigLevel/{s/^(#?)(SigLevel\s*=\s*)(.*)/\2\3 TrustedOnly/}" /etc/pacman.conf
fi
# update packages in background if connected to www
( ( while ! ping -c3 -W3 archlinux.org >/dev/null; do sleep 2; done; \
{ pacman -Syy --noconfirm && \
pacman -Syyu --noconfirm && \
pacman -Fyy --noconfirm; \
} || \
{ \
pacman -Sy archlinux-keyring --noconfirm && \
pacman-key --refresh-keys && \
pacman -Fyy --noconfirm; \
} \
)& )>/dev/null 2>&1
# cleanup pacman cache
pacman -Sc --noconfirm
pacman -Scc --noconfirm
rm -rvf /var/lib/pacman/sync/* /var/cache/pacman/pkg/* /tmp/*
# fix papersize
echo 'a4' > /etc/papersize
# run cupsd
echo "$(date +'%Y-%m-%d - %H:%M:%S') - cups started successfully."
exec "${@}"