mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 01:00:29 +08:00
lint fixes
This commit is contained in:
parent
fe13d146e5
commit
cef5f4ff23
25
kvmd.install
25
kvmd.install
@ -1,3 +1,5 @@
|
|||||||
|
# shellcheck disable=SC2148
|
||||||
|
|
||||||
post_install() {
|
post_install() {
|
||||||
post_upgrade
|
post_upgrade
|
||||||
}
|
}
|
||||||
@ -7,8 +9,9 @@ post_upgrade() {
|
|||||||
systemd-sysusers /usr/lib/sysusers.d/kvmd.conf
|
systemd-sysusers /usr/lib/sysusers.d/kvmd.conf
|
||||||
|
|
||||||
# https://github.com/systemd/systemd/issues/13522
|
# https://github.com/systemd/systemd/issues/13522
|
||||||
for user in `grep '^u ' /usr/lib/sysusers.d/kvmd.conf | awk '{print $2}'`; do
|
# shellcheck disable=SC2013
|
||||||
usermod --expiredate= $user >/dev/null
|
for user in $(grep '^u ' /usr/lib/sysusers.d/kvmd.conf | awk '{print $2}'); do
|
||||||
|
usermod --expiredate= "$user" >/dev/null
|
||||||
done
|
done
|
||||||
|
|
||||||
chown kvmd:kvmd /etc/kvmd/htpasswd || true
|
chown kvmd:kvmd /etc/kvmd/htpasswd || true
|
||||||
@ -16,7 +19,7 @@ post_upgrade() {
|
|||||||
chown kvmd-vnc:kvmd-vnc /etc/kvmd/vncpasswd || true
|
chown kvmd-vnc:kvmd-vnc /etc/kvmd/vncpasswd || true
|
||||||
chmod 600 /etc/kvmd/*passwd || true
|
chmod 600 /etc/kvmd/*passwd || true
|
||||||
for target in nginx redirect-to-https ssl listen-http listen-https; do
|
for target in nginx redirect-to-https ssl listen-http listen-https; do
|
||||||
chmod 644 /etc/kvmd/nginx/$target.conf || true
|
chmod 644 "/etc/kvmd/nginx/$target.conf" || true
|
||||||
done
|
done
|
||||||
|
|
||||||
chown kvmd /var/lib/kvmd/msd || true
|
chown kvmd /var/lib/kvmd/msd || true
|
||||||
@ -34,13 +37,16 @@ post_upgrade() {
|
|||||||
|
|
||||||
for target in nginx vnc; do
|
for target in nginx vnc; do
|
||||||
chown root:root /etc/kvmd/$target/ssl || true
|
chown root:root /etc/kvmd/$target/ssl || true
|
||||||
if [ ! -L /etc/kvmd/$target/ssl/server.key ]; then
|
owner="root:kvmd-$target"
|
||||||
chown root:kvmd-$target /etc/kvmd/$target/ssl/server.key || true
|
path="/etc/kvmd/$target/ssl/server.key"
|
||||||
chmod 440 /etc/kvmd/$target/ssl/server.key || true
|
if [ ! -L "$path" ]; then
|
||||||
|
chown "$owner" "$path" || true
|
||||||
|
chmod 440 "$path" || true
|
||||||
fi
|
fi
|
||||||
if [ ! -L /etc/kvmd/$target/ssl/server.crt ]; then
|
path="/etc/kvmd/$target/ssl/server.crt"
|
||||||
chown root:kvmd-$target /etc/kvmd/$target/ssl/server.crt || true
|
if [ ! -L "$path" ]; then
|
||||||
chmod 444 /etc/kvmd/$target/ssl/server.crt || true
|
chown "$owner" "$path" || true
|
||||||
|
chmod 444 "$path" || true
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -53,5 +59,6 @@ post_upgrade() {
|
|||||||
[ ! -f /etc/pam.d/system-auth ] || sed -i -e '/\<pam_systemd_home\.so\>/ s/^#*/#/' /etc/pam.d/system-auth
|
[ ! -f /etc/pam.d/system-auth ] || sed -i -e '/\<pam_systemd_home\.so\>/ s/^#*/#/' /etc/pam.d/system-auth
|
||||||
|
|
||||||
# Some update deletes /etc/motd, WTF
|
# Some update deletes /etc/motd, WTF
|
||||||
|
# shellcheck disable=SC2015,SC2166
|
||||||
[ ! -f /etc/motd -a -f /etc/motd.pacsave ] && mv /etc/motd.pacsave /etc/motd || true
|
[ ! -f /etc/motd -a -f /etc/motd.pacsave ] && mv /etc/motd.pacsave /etc/motd || true
|
||||||
}
|
}
|
||||||
|
|||||||
@ -63,4 +63,4 @@ commands = htmlhint --config=testenv/linters/htmlhint.json web/*.html web/*/*.ht
|
|||||||
|
|
||||||
[testenv:shellcheck]
|
[testenv:shellcheck]
|
||||||
whitelist_externals = bash
|
whitelist_externals = bash
|
||||||
commands = bash -c 'shellcheck --color=always scripts/*'
|
commands = bash -c 'shellcheck --color=always kvmd.install scripts/*'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user