I created a script to add a bunch of packages and update the system on a fresh install. Here's the relevant part of my init.d script that is giving me trouble:
#!/bin/sh ### BEGIN INIT INFO # Provides: update # Required-Start: $local_fs $syslog $network # Required-Stop: $local_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Description: Update my system ### END INIT INFO . /lib/lsb/init-functions case "$1" in start) log_daemon_msg "Starting update" apt-get --assume-yes update && apt-get --assume-yes dist-upgrade log_end_msg $? ;; *) echo "Usage: $0 start" >&2 exit 2 ;; esac exit 0
I made the script executable and registered it with
sudo update-rc.d update defaults. When I check on it after a reboot with
sudo service update status, I get all of the package repositories failing to resolve:
W: Failed to fetch http://.../Release.gpg Temporary failure resolving '...' W: Some index files failed to download. They have been ignored, or old ones used instead.
init.d script ends here with
code=exited. However, adding a
sleep 10 to the script before running the
apt commands fixes my issue. I would have thought that adding
$network to my
# Required-Start list would have fixed this issue by itself. Is there a better way of dealing with this issue?
I'm running this on
Raspian Jessie 2016-03-18 if that makes a difference, but I have a feeling it doesn't.