blob: 284f1d4a408047401fc199a56e18d6da51eab937 (
plain)
1 #!/bin/sh
2
3 #
4 # This program creates symlinks in /usr/ports/installed to all the
5 # ports you have installed.
6 #
7
8 installed_path=/usr/ports/installed
9
10 # check if the dir exists
11 if [ ! -d $installed_path ]; then
12 install -d $installed_path
13 fi
14
15 # Remove the link if the port is not installed.
16 echo -n "Checking obsolete link for: "
17 for i in $installed_path/*; do
18 base=${i##*/}
19 if [ -L $i ]; then
20 printf "$base "
21 if ! prt-get isinst $base > /dev/null; then
22 rm $i
23 else
24 # packages do not have to have ports
25 if base_path=$(prt-get path $base 2>/dev/null); then
26 port_link=$(readlink $i)
27 if [ "$base_path" = "$port_link" ]; then
28 rm $i
29 fi
30 fi
31 fi
32 fi
33 done
34
35 # Add links for installed ports if they don't exist.
36 echo
37 echo -n "Checking missing link for: "
38 for i in $(prt-get listinst); do
39 printf "${i##*/} "
40 # packages do not have to have ports
41 if pad=$(prt-get path $i 2> /dev/null); then
42 if [ ! -L $installed_path/$pad ]; then
43 ln -s $pad $installed_path
44 fi
45 fi
46 done
|