xref: /haiku/3rdparty/mmu_man/scripts/myupdate.sh (revision 3b07762c548ec4016dea480d1061577cd15ec614)
1#!/bin/sh
2
3cd "$(dirname "$0")"
4
5test "$1" = "-t" || exec Terminal -t "My Update" "$0" -t "$@" && shift
6
7notice () {
8	notify --type information \
9		--icon /boot/system/apps/HaikuDepot \
10		--title "Update" \
11		"$@"
12	echo "$@"
13}
14
15if [ "$1" != "-2" ]; then
16
17	notice "Closing Deskbar..."
18	notice "Checking for updates..."
19	quit application/x-vnd.Be-TSKB
20	#notice "Checking for updates..."
21	pkgman update || exit $?
22	sync
23	if [ "$(ls /system/packages/*_hrev*-* | grep -v $(uname -v | cut -d' ' -f1))" = "" ]; then
24		open /system/Deskbar < /dev/null > /dev/null 2>&1 &
25		notice "Restarting Deskbar..."
26		notice "Nothing to do"
27		read
28		exit 0
29	fi
30	makebootable /boot
31	sync
32	cat > $(finddir B_USER_SETTINGS_DIRECTORY)/boot/launch/myupdate2.sh << EOF
33#!/bin/sh
34cd "$PWD"
35$0 -2
36EOF
37	chmod +x $(finddir B_USER_SETTINGS_DIRECTORY)/boot/launch/myupdate2.sh
38	sync
39	notice "Restarting Deskbar..."
40	/system/Deskbar < /dev/null > /dev/null 2>&1 &
41	notice "You should reboot now..."
42	shutdown -r -a
43	read
44	exit 0
45fi
46
47rm $(finddir B_USER_SETTINGS_DIRECTORY)/boot/launch/myupdate2.sh
48
49disdir="$(finddir B_SYSTEM_PACKAGES_DIRECTORY)/disabled"
50mkdir -p "$disdir"
51
52notice "Moving old packages to disabled/ ..."
53mv $(ls /system/packages/*_hrev*-* | grep -v $(uname -v | cut -d' ' -f1)) $disdir/
54
55sync
56
57#notice "Adding back deskbar addons..."
58#ProcessController -deskbar
59#NetworkStatus --deskbar
60
61notice "Done"
62
63read
64