if [ -d "$startdir/pkg/usr/share/applications" ]; then cd $startdir/pkg/usr/share/applications for desktop in *.desktop; do . desktop 2>/dev/null if [[ "$Icon" ]]; then if [ ! "$Icon" == "${Icon%.*}" ]; then sed '/Icon/s/\..*$//' -i $desktop . desktop 2>/dev/null fi if [ -d "$startdir/pkg/usr/share/pixmaps" ]; then cd $startdir/pkg/usr/share/pixmaps for pixmaps in *; do if [ "${pixmaps%.*}" == "$Icon" ]; then DIR=$(file $pixmaps | awk -F, '{print $2}' | sed 's/ //g') mkdir -p $startdir/pkg/usr/share/icons/hicolor/$DIR/apps mv $Icon $startdir/pkg/usr/share/icons/hicolor/$DIR/apps if [[ ! "$(ls $startdir/pkg/usr/share/pixmaps)" ]]; then rm -rf $startdir/pkg/usr/share/pixmaps fi fi done fi done fi