OpenWrt Forum Archive

Topic: Default packages attitude 12.09rc2 tplink 1043nd

The content of this topic has been archived on 11 Jul 2017. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hello!
   Can someone tell me what are the default packages installed on attitude adjustment 12.09rc2 as seen in luci webgui on a tplink 1043nd?
   Sry for the stupid question but i installed some new packages that installed some subpackeges and now i've run out of memory although i deinstalled the original packages. I've searched the forum but no luck!
  Thank you!

Hi,
The way I see it is you want the opposite. You want to uninstall 'user installed' packages (and dependencies), am I right?
The following script will list those I think. It is not very efficient, but I don't know how to reverse grep actually.

#!/bin/ash                                                                                                                                           
for packages in "$(cat /usr/lib/opkg/status | grep -n 'user install' | cut -d ':' -f1)"; do 
printf %s "$packages" | while IFS= read -r nline; do 
sed -n 1,$nline' s/Package/&/p' /usr/lib/opkg/status | tail -n 1 
done        
done

Cheers,
Guillermo

gsenna wrote:

Hi,
The way I see it is you want the opposite. You want to uninstall 'user installed' packages (and dependencies), am I right?
The following script will list those I think. It is not very efficient, but I don't know how to reverse grep actually.

#!/bin/ash                                                                                                                                           
for packages in "$(cat /usr/lib/opkg/status | grep -n 'user install' | cut -d ':' -f1)"; do 
printf %s "$packages" | while IFS= read -r nline; do 
sed -n 1,$nline' s/Package/&/p' /usr/lib/opkg/status | tail -n 1 
done        
done

Cheers,
Guillermo


Thank you for the answer. Finally i decided to do a firstboot command and start over smile I was hoping to avoid that(you never know what could happen in the process). But big thanks for help!

gsenna wrote:

The following script will list [the user-installed packages] I think.

I've been looking for how to do that for longer than I want to admit. Thanks!

Edit -- Looking into this a bit further, the script doesn't seem to catch dependencies of user-installed packages. For example, it finds tcpdump-mini, but not libpcap.

(Last edited by jeffster on 12 Apr 2013, 21:18)

Yes, you are right! Sorry about that. I found another keyword that may be used for dependencies. The problem is packages and dependencies are all mixed up. I cant think of a time when you are going to need this but..

#!/bin/ash                                                                                                                                           
echo "Installed Packages: "
packages="$(cat /usr/lib/opkg/status | grep -n 'user install' | cut -d ':' -f1)"'
' 
printf %s "$packages" | while IFS= read -r nline; do 
sed -n 1,$nline' s/Package/&/p' /usr/lib/opkg/status | tail -n 1 
done        
echo "***"
echo "Dependencies: "
packages="$(cat /usr/lib/opkg/status | grep -n 'Auto-Installed' | cut -d ':' -f1)"'
'
printf %s "$packages" | while IFS= read -r nline; do                            
sed -n 1,$nline' s/Package/&/p' /usr/lib/opkg/status | tail -n 1
done 

This one lists installed packages and first generation dependencies:

#!/bin/ash                                                                                                                                           
fautoi (){
printf %s "$dependencias" | while IFS= read -r ndep; do 
if [ "$ndepc" -ne 0 ]; then
nlinea=$(grep -n 'Package:\ '"$ndep" /usr/lib/opkg/status |  cut -d ':' -f1)    
nlineb=$(sed -n $(($nlinea + 1))',$p' /usr/lib/opkg/status | grep -m 1 -n 'Package:\ ' |  cut -d ':' -f1) 
nlineb=$(($nlinea + $nlineb))
if $(sed -n "$nlinea","$nlineb"p /usr/lib/opkg/status | grep -q 'Auto-Installed'); then
echo '++ '"$(sed -n "$nlinea"p /usr/lib/opkg/status)" 
fi
else 
ndepc=1
fi
done
}

echo "Installed Packages: "
echo ""
packages="$(cat /usr/lib/opkg/status | grep -n 'user install' | cut -d ':' -f1)"'
' 
printf %s "$packages" | while IFS= read -r nline; do 
sed -n 1,$nline' s/Package/&/p' /usr/lib/opkg/status | tail -n 1 
dependencias="$(sed -n 1,$nline' s/Depends:\ /&/p' /usr/lib/opkg/status | tail -n 1)"

dependencias="$(echo $dependencias | sed 's/Depends:\ //' | sed 's/,\ /\n/g' )"'
' 
ndepc=0
fautoi
echo "***"
done

(Last edited by gsenna on 13 Apr 2013, 02:07)

The discussion might have continued from here.