diff --git a/testing/packagemanagers/software/cydramanager b/testing/packagemanagers/software/cydramanager index bed3366a..2dd4711a 100644 --- a/testing/packagemanagers/software/cydramanager +++ b/testing/packagemanagers/software/cydramanager @@ -2,8 +2,8 @@ # shellcheck disable=SC2034 # shellcheck disable=SC2016 # shellcheck disable=SC2140 -# shellcheck disable=SC2157 # shellcheck disable=SC2128 +# shellcheck disable=SC2157 MIRROR_URL=$(cat /etc/cydrafetch/currentMirror) PM_URL=$(cat /etc/cydraterms/mainserver.list/mainserver.list) @@ -95,10 +95,11 @@ function open_help { echo " patchnote Affiche les nouveaute du gdp --without-updating-db Le gdp ne metteras pas a jour les db local " echo " help Affiche ce message d'aide -h / --help / -help Permet d'affiche ce message d'aide " echo - echo "[PAGE 0 - 1]" + echo -e "--------------------- ${ORANGE}[PAGE 0 - 1]${NC}" exit 0 elif [ "${PACKAGE}" == 1 ]; then echo "changever Permet de changé la version d'un packet --add-as-depends Le gdp interpretera le packet comme étant une dependance" + echo -e "--------------------- ${ORANGE}[PAGE 0 - 1]${NC}" exit 0 else echo -e "${RED}La page ${PAGE} n'existe pas pour le moment.${NC}" @@ -184,7 +185,45 @@ function fetch_warninglog { fi } +function update_ipacket { + for tp in ${updatedir}; do + echo -n "Traitement du packet: ${tp}" + tp_name=(basename "${tp}") + if [[ $(cat "${tp}") == $(cat "/usr/cydramanager/currentSoftware/${tp_name}/cydramanager_pkgver") ]]; then + echo -e "${NC}[A JOUR]" + else + if [[ -e /usr/cydramanager/oldSoftware/${tp_name}/ ]]; then + mv "/usr/cydramanager/currentSoftware/${tp_name}/*" "/usr/cydramanager/oldSoftware/${tp_name}" + + UPKG_INFO=$(grep -r -l -m 1 -o "${tp_name}-" /etc/cydramanager/cache | head -1) + UPKG_VERSION=$(sed -n 11p "${UPKG_INFO}") + UPKG_ARCHIVE=$(sed -n 2p "${UPKG_INFO}") + UPKG_SIG=$(sed -n 23p "${UPKG_INFO}") + + wget "${POOL_DL}/${UPKG_ARCHIVE}" -P /usr/cydramanager/pkgt --no-check-certificate -q + tar xf "/usr/cydramanager/pkgt/${UPKG_ARCHIVE}" -C "/usr/cydramanager/currentSoftware/${tp_name}" + md5sum "/usr/cydramanager/pkgt/${UPKG_ARCHIVE}" | cut -d ' ' -f 1 > "/usr/cydramanager/currentSoftware/${tp_name}/cydramanager_md5sig" + echo "${UPKG_VERSION}" > "/usr/cydramanager/currentSoftware/${tp_name}/cydramanager_pkgver" + rm -f "/usr/cydramanager/pkgt/${UPKG_ARCHIVE}" + echo -e "${NC}[A JOUR]" + else + rm -rf "/usr/cydramanager/oldSoftware/${tp_name}/*" + mv "/usr/cydramanager/currentSoftware/${tp_name}/*" "/usr/cydramanager/oldSoftware/${tp_name}" + + UPKG_INFO=$(grep -r -l -m 1 -o "${tp_name}-" /etc/cydramanager/cache | head -1) + UPKG_VERSION=$(sed -n 11p "${UPKG_INFO}") + UPKG_SIG=$(sed -n 23p "${UPKG_INFO}") + wget "${POOL_DL}/${UPKG_ARCHIVE}" -P /usr/cydramanager/pkgt --no-check-certificate -q + tar xf "/usr/cydramanager/pkgt/${UPKG_ARCHIVE}" -C "/usr/cydramanager/currentSoftware/${tp_name}" + md5sum "/usr/cydramanager/pkgt/${UPKG_ARCHIVE}" | cut -d ' ' -f 1 > "/usr/cydramanager/currentSoftware/${tp_name}/cydramanager_md5sig" + echo "${UPKG_VERSION}" > "/usr/cydramanager/currentSoftware/${tp_name}/cydramanager_pkgver" + rm -f "/usr/cydramanager/pkgt/${UPKG_ARCHIVE}" + echo -e "${NC}[A JOUR]" + fi + fi + done +} function install_packet { if [ "$PRINT_LOG" = true ]; then echo -e "${GREEN}Installation du packet${NC}" @@ -498,46 +537,16 @@ elif [[ "$1" == "update" ]]; then tar xf ${CACHE_FILE}/*.pkg.tar.zst -C / touch /etc/cydraterms/firstupdated - echo "Oui tu l'as fait.. Bravo!\nYes you did it.. Congrats!" + printf "Oui tu l'as fait.. Bravo!\nYes you did it.. Congrats!\n" > /etc/cydraterms/firstupdated echo -e "${GREEN}Votre systeme est a jour..${NC}" else update_db - for tp in "/etc/cydraterms/usersoftware"/*; do - echo -n "Traitement du packet: ${tp}" - tp_name=(basename "${tp}") - if [[ $(cat "${tp}") == $(cat "/usr/cydramanager/currentSoftware/${tp_name}/cydramanager_pkgver") ]]; then - echo -e "${NC}[A JOUR]" - else - if [[ -e /usr/cydramanager/oldSoftware/${tp_name}/ ]]; then - mv /usr/cydramanager/currentSoftware/${tp_name}/ * /usr/cydramanager/oldSoftware/${tp_name} - UPKG_INFO=$(grep -r -l -m 1 -o "${tp_name}-" /etc/cydramanager/cache | head -1) - UPKG_VERSION=$(sed -n 11p "${PKG_INFO}") - UPKG_SIG=$(sed -n 23p ${PKG_INFO}) + updatedir='/etc/cydraterms/usersoftware/*' + update_ipacket - wget "${POOL_DL}/${UPKG_ARCHIVE}" -P /usr/cydramanager/pkgt --no-check-certificate -q - tar xf /usr/cydramanager/pkgt/${UPKG_ARCHIVE} -C /usr/cydramanager/currentSoftware/${tp_name} - echo $(md5sum "/usr/cydramanager/pkgt/${UPKG_ARCHIVE}" | cut -d ' ' -f 1) > /usr/cydramanager/currentSoftware/${tp_name}/cydramanager_md5sig - echo "${UPKG_VERSION}" > /usr/cydramanager/currentSoftware/${tp_name}/cydramanager_pkgver - rm -f /usr/cydramanager/pkgt/${UPKG_ARCHIVE} - echo -e "${NC}[A JOUR]" - else - rm -rf /usr/cydramanager/oldSoftware/${tp_name}/* - mv /usr/cydramanager/currentSoftware/${tp_name}/* /usr/cydramanager/oldSoftware/${tp_name} - - UPKG_INFO=$(grep -r -l -m 1 -o "${tp_name}-" /etc/cydramanager/cache | head -1) - UPKG_VERSION=$(sed -n 11p "${PKG_INFO}") - UPKG_SIG=$(sed -n 23p ${PKG_INFO}) - - wget "${POOL_DL}/${UPKG_ARCHIVE}" -P /usr/cydramanager/pkgt --no-check-certificate -q - tar xf /usr/cydramanager/pkgt/${UPKG_ARCHIVE} -C /usr/cydramanager/currentSoftware/${tp_name} - echo $(md5sum "/usr/cydramanager/pkgt/${UPKG_ARCHIVE}" | cut -d ' ' -f 1) > /usr/cydramanager/currentSoftware/${tp_name}/cydramanager_md5sig - echo "${UPKG_VERSION}" > /usr/cydramanager/currentSoftware/${tp_name}/cydramanager_pkgver - rm -f /usr/cydramanager/pkgt/${UPKG_ARCHIVE} - echo -e "${NC}[A JOUR]" - fi - fi - done + updatedir='/etc/cydraterms/installedsoftware/*' + update_ipacket fi if [ "$WASH_CACHE" = true ]; then @@ -558,7 +567,7 @@ elif [[ "$1" == "changever" ]]; then PKG_INFO=$(grep -r -l -m 1 -o "$PACKAGE-" /etc/cydramanager/cache | head -1) PKG_VERSION=$(sed -n 11p "${PKG_INFO}") PKG_NAME=$(sed -n 5p "${PKG_INFO}") - PKG_SIG=$(sed -n 23p ${PKG_INFO}) + PKG_SIG=$(sed -n 23p "${PKG_INFO}") if [ ! -f /etc/cydraterms/usersoftware/"${PKG_NAME}" ]; then echo -e "${RED}Le packet ${PACKAGE} n'est pas installé sur votre systeme ..${NC}" @@ -573,10 +582,10 @@ elif [[ "$1" == "changever" ]]; then exit 5 fi - checkver=$(echo "$(cat /usr/cydramanager/oldSoftware/${PKG_NAME}/cydramanager_pkgver)" | sed 's/[[:alpha:]]//g') - mv /usr/cydramanager/currentSoftware/${PKG_NAME}/* /usr/cydramanager/pkgt - mv /usr/cydramanager/oldSoftware/${PKG_NAME}/* /usr/cydramanager/currentSoftware/${PKG_NAME} - mv /usr/cydramanager/pkgt/* /usr/cydramanager/oldSoftware/${PKG_NAME} + checkver=$("cat /usr/cydramanager/oldSoftware/${PKG_NAME}/cydramanager_pkgver" | sed 's/[[:alpha:]]//g') + mv "/usr/cydramanager/currentSoftware/${PKG_NAME}/*" "/usr/cydramanager/pkgt" + mv "/usr/cydramanager/oldSoftware/${PKG_NAME}/*" "/usr/cydramanager/currentSoftware/${PKG_NAME}" + mv "/usr/cydramanager/pkgt/*" "/usr/cydramanager/oldSoftware/${PKG_NAME}" else echo -e "${NC}Utilisation:" echo -e "${NC} sudo cydramanager changever PACKET back - Changer la version de votre paquet pour celle qui est stocké dans le dossier oldSoftware (contenant l'ancienne version)" @@ -585,5 +594,3 @@ elif [[ "$1" == "changever" ]]; then fi fi - -exit 0