aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: aaec756cc96f267ea09abc7452804d0883baab95 (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# Slack Autoupdate

Update your Slackware system automatically by integrating these simple
customizable bash scripts.

The updates are downloaded in the background for installation during the next
startup.  If available, you are given the chance to opt out of the upgrade by
pressing enter.  For server situations, the system can be configured to reboot
after a specified time to upgrade automatically.  More advanced users could
integrate email notifications giving admins time to intervene when necessary.

Update information is stored under the /var/spool/slack-autoupdate directory.

## Support

These scripts only currently support stable Slackware64 releases (sorry -current).

Please refer to the project's [linux questions
post](https://www.linuxquestions.org/questions/slackware-14/tool-to-help-with-automatic-updates-4175735340/)
for feedback and bug reports. You can find known bugs or possible improvements
on the project's
[todo](https://git.server.ky/slackcoder/slack-autoupdate/tree?h=todo) branch.

## Installation and Configuration

There are three components. the [cron script](./src/slack-autoupdate) which
downloads packages, the [rc.slack-autoupdate script](./src/rc.slack-autoupdate)
which installs the packages, and the [install-kernel
script](./src/install-kernel) which updates your computer after a kernel
update.

### Cron script

Your system downloads the packages using this script.

Adjust the script using your favorite editor:

```
vim src/slack-autoupdate
```

Then as root:

```
cp src/slack-autoupdate /etc/cron.hourly
chown root:root /etc/cron.hourly/slack-autoupdate
chmod +x /etc/cron.hourly/slack-autoupdate
```

### rc.slack-autoupdate

Your system updates your installed packages using this script.

Adjust the script using your favorite editor:

```
vim src/rc.slack-autoupdate
```

Then as root:

```
cp src/rc.slack-autoupdate /etc/rc.d/
chown root:root /etc/rc.d/rc.slack-autoupdate
```

Then add this to /etc/rc.d/rc.local:

```
if [ -x /etc/rc.d/rc.slack-autoupdate ]; then
  /etc/rc.d/rc.slack-autoupdate
fi
```

To enable installation on reboot:

```
chmod +x /etc/rc.d/rc.slack-autoupdate
```

or to disable it again:

```
chmod -x /etc/rc.d/rc.slack-autoupdate
```

### install-kernel

This part depends on your system setup and will automatically update the kernel
into your system.  You should modify it to suit your circumstance.

The default script assumes you are using elilo and the kernel for your EFI is
installed into /efi/EFI/Slackware/vmlinuz.

Adjust the script to your system using your favorite editor:

```
vim install-kernel
```

Then as root:

```
cp install-kernel /usr/local/sbin
chown root:root /usr/local/sbin/install-kernel
chmod +x /usr/local/sbin/install-kernel
```

## Source

### Customizing Update Downloads

You can add a section to the [cron script](./src/slack-autoupdate) to pull
updates using different tools or sources. The sections use the following
structure.  Place the code within the 'if-then' block just after the 'exec'.
Examples may be found in the [recipes](./src/recipes) directory.

```
if ! OUTPUT="$(
  # Redirect error output to standard output.
  exec 2>&1

  # Your update code goes here.
  #
  # Download updates into $STAGING_DIR.
  #
  # On failure the command output is appended to the error file.
  # Update information should be appended to the $UPDATE_INFO file.

)"; then
  if [ -f "$UPDATE_ERROR" ]; then
    >>"$UPDATE_ERROR" echo ""
    >>"$UPDATE_ERROR" echo ""
  fi

  >>"$UPDATE_ERROR" echo -e "[Update Name]:\n\n$OUTPUT"
fi
```

### Testing

You can test the project by running the shell files under the 'test' folder.

```
sh src/test/*.sh
```