aboutsummarylogtreecommitdiffstats
path: root/uau.install
blob: 3fd20a10d321ae3bb1168070a1a96e6cad811ef5 (plain)
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

post_install() {
    . /etc/unattended-arch-upgrade.conf

    useradd $UPDATEUSER -G systemd-journal -m
    # no account expiry, never set to inactive, no password expiry
    chage -E -1 -I -1 -m -1 -M -1 $UPDATEUSER

    # install archnews and ensure it is a supported version
    mkdir $ANEWSDIR
    git clone $GITANEWS $ANEWSDIR
    cd $ANEWSDIR
    git checkout $ANEWREL

    systemctl enable unattended-arch-upgrade.timer
    systemctl start unattended-arch-upgrade.timer
    systemctl list-timers unattended-arch-upgrade.timer

    sed -i '/\[options\]/a Include=/etc/unattended-arch-upgrade.ignore' $PACCONF

    mkdir -p $LOGDIR
    chown $UPDATEUSER $LOGDIR

    chmod 644 /etc/cron.d/archnews
}

pre_remove() {
    . /etc/unattended-arch-upgrade.conf
    
    sed -i 's#Include=/etc/unattended-arch-upgrade.ignore##g' $PACCONF

    systemctl stop unattended-arch-upgrade.timer
    systemctl disable unattended-arch-upgrade.timer
    userdel $UPDATEUSER -r
}