updated some funcs in pm
This commit is contained in:
1 parent
40e7e57a04
commit
6f8cb4243f
3 files changed
+26
-6
No files matched your search
@@ -12,7 +12,7 @@
|
||||
## ## ##
|
||||
|
||||
#---------------- variables --------------------------
|
||||
rootdir=/home/tola/Documents/linux/pm/rootfs
|
||||
export rootdir=/
|
||||
repofile=$rootdir/etc/pm/repo
|
||||
packagesqueryfile=$rootdir/usr/share/pm/query
|
||||
reposquerydir=$rootdir/usr/share/pm/repos
|
||||
@@ -108,15 +108,19 @@ unpack() {
|
||||
packagename=${packagename#*pkg/}
|
||||
printf "$YELLOW**$GREEN Installing ${packagename%.pkg*}\n$RESET"
|
||||
if [[ "$(/usr/bin/cat $packagesqueryfile | grep ${packagename%.pkg*})" != "" ]]; then
|
||||
printf "$YELLOW**$RESET Package already installed:$YELLOW reinstalling\n"
|
||||
printf "$YELLOW**$RESET Package already installed:$YELLOW reinstalling\n$RESET"
|
||||
fi
|
||||
tar -xvf $1 -C $rootdir/tmp &> /dev/null
|
||||
cd $rootdir/tmp/$packagename
|
||||
mkdir $installedpackagesdir/$packagename &> /dev/null
|
||||
mv -v list $installedpackagesdir/$packagename &> /dev/null
|
||||
cp -rv ./* $rootdir &> /dev/null
|
||||
cp -r ./* $rootdir/
|
||||
if [ -f $rootdir/post_install ]; then
|
||||
rm $rootdir/post_install
|
||||
fi
|
||||
printf "$YELLOW**$GREEN post_install script ${packagename%.pkg*}\n$RESET"
|
||||
if [ -f $rootdir/tmp/$packagename/post_install ]; then
|
||||
sh -c $rootdir/tmp/$packagename/post_install
|
||||
/usr/bin/sh -c $rootdir/tmp/$packagename/post_install &> /dev/null
|
||||
fi
|
||||
if [[ "$(/usr/bin/cat $packagesqueryfile | grep ${packagename%.pkg*})" == "" ]]; then
|
||||
echo ${packagename%.pkg*} >> $packagesqueryfile
|
||||
@@ -138,7 +142,10 @@ del() {
|
||||
printf "$YELLOW**$BRED error:$RESET package not installed\n"
|
||||
exit 0
|
||||
fi
|
||||
rm -v $rootdir/$(/usr/bin/cat $installedpackagesdir/$i.pkg/list) &> /dev/null
|
||||
for file in $(/usr/bin/cat $installedpackagesdir/$i.pkg/list); do
|
||||
rm -v $rootdir/$file
|
||||
done
|
||||
# rm -v $rootdir/$(/usr/bin/cat $installedpackagesdir/$i.pkg/list)
|
||||
rm -rv $installedpackagesdir/$i.pkg &> /dev/null
|
||||
sed -i "/$i/d" $packagesqueryfile
|
||||
printf "$YELLOW**$GREEN delete $i successful\n$RESET"
|
||||
|
||||
Reference in new issue
Block a user