Update pm
This commit is contained in:
1 parent
29d7ea9d66
commit
a8c4a287eb
1 file changed
+10
@@ -76,6 +76,7 @@ checknonroot() {
|
|||||||
|
|
||||||
#----------------- add(install) package function ------------------------
|
#----------------- add(install) package function ------------------------
|
||||||
add() {
|
add() {
|
||||||
|
checkroot
|
||||||
[[ "$packages" == "" ]] \
|
[[ "$packages" == "" ]] \
|
||||||
&& help \
|
&& help \
|
||||||
&& exit 0
|
&& exit 0
|
||||||
@@ -92,6 +93,7 @@ a() {
|
|||||||
|
|
||||||
#-------------------- download package without install function ---------
|
#-------------------- download package without install function ---------
|
||||||
down() {
|
down() {
|
||||||
|
checkroot
|
||||||
[[ "$packages" == "" ]] \
|
[[ "$packages" == "" ]] \
|
||||||
&& help \
|
&& help \
|
||||||
&& exit 0
|
&& exit 0
|
||||||
@@ -131,6 +133,7 @@ download() {
|
|||||||
|
|
||||||
#-------------------- unpack local package archive ----------------------
|
#-------------------- unpack local package archive ----------------------
|
||||||
unpack() {
|
unpack() {
|
||||||
|
checkroot
|
||||||
[[ "$archives" == "" ]] \
|
[[ "$archives" == "" ]] \
|
||||||
&& printf "${BBLUE}**${BWHITE} Specify package name [${BRED} ERROR ${BWHITE}]\n${RESET}" \
|
&& printf "${BBLUE}**${BWHITE} Specify package name [${BRED} ERROR ${BWHITE}]\n${RESET}" \
|
||||||
&& exit 1
|
&& exit 1
|
||||||
@@ -205,6 +208,7 @@ u() {
|
|||||||
|
|
||||||
#------------------ delete package function -----------------------------
|
#------------------ delete package function -----------------------------
|
||||||
del() {
|
del() {
|
||||||
|
checkroot
|
||||||
printf "${YELLOW}**${GREEN} deleting\n${RESET}"
|
printf "${YELLOW}**${GREEN} deleting\n${RESET}"
|
||||||
for i in $packages; do
|
for i in $packages; do
|
||||||
printf "${YELLOW}**${GREEN} deleting $i\n${RESET}"
|
printf "${YELLOW}**${GREEN} deleting $i\n${RESET}"
|
||||||
@@ -345,6 +349,7 @@ ${RESET}"
|
|||||||
|
|
||||||
#------------------- sync repo function ---------------------------------
|
#------------------- sync repo function ---------------------------------
|
||||||
sync() {
|
sync() {
|
||||||
|
checkroot
|
||||||
servers=$(/usr/bin/cat $repofile)
|
servers=$(/usr/bin/cat $repofile)
|
||||||
for i in $servers; do
|
for i in $servers; do
|
||||||
printf "${YELLOW}**${GREEN} Sync ${BWHITE}$i\n${RESET}"
|
printf "${YELLOW}**${GREEN} Sync ${BWHITE}$i\n${RESET}"
|
||||||
@@ -408,6 +413,7 @@ ss() {
|
|||||||
|
|
||||||
#------------------- clear cached packages directory --------------------
|
#------------------- clear cached packages directory --------------------
|
||||||
clear() {
|
clear() {
|
||||||
|
checkroot
|
||||||
printf "${YELLOW}**${BWHITE} clearing cached packages directory "
|
printf "${YELLOW}**${BWHITE} clearing cached packages directory "
|
||||||
rm -rf $cachedpkgdir/*
|
rm -rf $cachedpkgdir/*
|
||||||
printf "[${GREEN} OK${BWHITE} ]\n${RESET}"
|
printf "[${GREEN} OK${BWHITE} ]\n${RESET}"
|
||||||
@@ -422,6 +428,7 @@ c() {
|
|||||||
|
|
||||||
#--- show package dependencies function ---
|
#--- show package dependencies function ---
|
||||||
deps() {
|
deps() {
|
||||||
|
checkroot
|
||||||
if [[ "$packages" == "" ]]; then
|
if [[ "$packages" == "" ]]; then
|
||||||
for i in $(/usr/bin/cat $packagesqueryfile); do
|
for i in $(/usr/bin/cat $packagesqueryfile); do
|
||||||
cd $installedpackagesdir
|
cd $installedpackagesdir
|
||||||
@@ -462,6 +469,7 @@ deps() {
|
|||||||
|
|
||||||
#--- build package uses PMBUILD file function ---
|
#--- build package uses PMBUILD file function ---
|
||||||
buildpkg() {
|
buildpkg() {
|
||||||
|
checknonroot
|
||||||
if [ ! -f ./PMBUILD ]; then
|
if [ ! -f ./PMBUILD ]; then
|
||||||
if [ "$1" != "" ]; then
|
if [ "$1" != "" ]; then
|
||||||
source $1
|
source $1
|
||||||
@@ -553,6 +561,7 @@ buildpkg() {
|
|||||||
|
|
||||||
# upgrade system packages function
|
# upgrade system packages function
|
||||||
upgrade() {
|
upgrade() {
|
||||||
|
checkroot
|
||||||
total_updates=0
|
total_updates=0
|
||||||
for i in $(cat $packagesqueryfile); do
|
for i in $(cat $packagesqueryfile); do
|
||||||
package=$(search $(get_pkgname $i) | awk -F' ' '{ for (i=2; i<=NF; i++) { print $i } }')
|
package=$(search $(get_pkgname $i) | awk -F' ' '{ for (i=2; i<=NF; i++) { print $i } }')
|
||||||
@@ -624,6 +633,7 @@ v() {
|
|||||||
|
|
||||||
# install pm to some rootfs directory function
|
# install pm to some rootfs directory function
|
||||||
selfinstall() {
|
selfinstall() {
|
||||||
|
checkroot
|
||||||
[ -z "$destdir" ] && destdir="rootfs"
|
[ -z "$destdir" ] && destdir="rootfs"
|
||||||
printf "${BGREEN}Installing pm to ${BWHITE}$destdir ${BGREEN}directory\n${RESET}"
|
printf "${BGREEN}Installing pm to ${BWHITE}$destdir ${BGREEN}directory\n${RESET}"
|
||||||
printf "${YELLOW}Creating directories... ${RESET}"
|
printf "${YELLOW}Creating directories... ${RESET}"
|
||||||
|
|||||||
Reference in new issue
Block a user