minor fix and add automatic updates
[distro-setup] / mymimes
1 #!/bin/bash
2
3 set -eE -o pipefail
4 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
5
6 [[ $EUID == 0 ]] || exec sudo -E "$BASH_SOURCE" "$@"
7
8 shopt -s extglob nullglob
9
10 echo '[Default Applications]' >/etc/xdg/defaults.list
11 sed -r '/^MimeType=/!d;s/^MimeType=//;s/;/=mpv.desktop\n/g' /usr/share/applications/mpv.desktop >>/etc/xdg/defaults.list
12
13 # this is the new one, according to
14 # https://specifications.freedesktop.org/mime-apps-spec/mime-apps-spec-1.0.html
15 # https://wiki.debian.org/MIME
16 # https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
17 cp /etc/xdg/defaults.list /etc/xdg/mimapps.list
18
19 for f in /usr/share/applications/!(defaults).list; do
20 cp /etc/xdg/defaults.list /etc/xdg/${f##*/}
21 done
22
23 update-desktop-database