как удалить httpd построен из источника

Мне известно о публикации: Как удалить Apache, установленный с помощью make install, и использовать apache из репозиториев? .

Я установил httpd2.4 из источника. Но для httpd2.4 нет доступных make uninstall. Существуют ли простые способы очистки httpd2.4, встроенного и установленного из исходного кода?

3
задан 13 April 2017 в 15:24

1 ответ

Я сделал это следующим образом:

ПРИМЕЧАНИЕ: пожалуйста, внимательно прочитайте, не ломайте свою операционную систему.

Идея: получить файлы, которые появляются после "make" (build). Затем найдите эти файлы в системе и удалите их.

Библиография:
Удаление файлов, установленных из tar-шара исходного кода - nixCraft

 - entered to source files of httpd-2.2/ folder.
 # need to clean previous build, and get empty build files snapshot.
 - make clean 
 # get empty build snapshot.
 - find . print | tee make.b4 
 # build project.
 - ./configure && make 
 # get files snapshot after build.
 - find . print | tee make.after 
 # get difference before and after build.
 - diff -y --suppress-common-lines make.b4 make.after | tee httpd_orig 
 # perform needed formatting.
 - cat httpd_orig | column -t | tr -d '>' | tr -d ' ' | sponge httpd_orig 
 # get only files name.
 - cat httpd_orig | xargs -n1 basename | tee httpd_orig_files 
 # get system files snapshot.
 - find /  \( -path /boot -o -path /dev -o -path /home -o -path /lost+find -o -path /media -o -path /mnt -o -path /proc -o -path /root -o -path /run -o -path /tmp -o -path /sys -o -path /var -o -path /opt \) -prune -o -type f -print | tee httpd_on_system 
 # run python script do remove files created on build project we find on system.
 - python unistall.py 

# File: uninstall.py
# Uninstall httpd 2.2 installed from source.
import os

# read file with build project files name.
with open("httpd_orig_files", "r") as f:
    files = f.readlines()

httpd_orig = list()
for line in files:
    # create a list of build files, strip remove newlines.
    httpd_orig.append(line.strip())

# print files name from project build.
print httpd_orig 

# open file with files paths on system.
with open("httpd_on_system", "r") as f:
    httpd_files = f.readlines()

for hfile in httpd_files:
    item = hfile.strip()
    filename = os.path.basename(item).strip()
    status = filename in httpd_orig
    if status:
        print "{:<10} {:50} {}".format(status, filename, item)
        try:    
            # remove files from system.
            os.remove(item)
        except Exception as e:
            print e
0
ответ дан 13 April 2017 в 15:24

Другие вопросы по тегам:

Похожие вопросы: