Last active
November 30, 2020 15:44
-
-
Save SkymeFactor/bc29a2534d3c5036af50fa0dd06ea703 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# 1. Install "Development tools" from remote repo | |
dnf groupinstall -y "Development Tools" | |
# Will be important later | |
dnf install -y rpm-build | |
# 2. Install bastet from source | |
# Mount host sharefolder which contains fortunes, checkinstall and bastet as is | |
mount -t vboxsf ShFolder /mnt | |
# Copy bastet to $pwd | |
cp /mnt/bastet-0.43.tgz ./ | |
# Extract bastet-0.43.tgz | |
tar -zxf bastet-0.43.tgz | |
# Move to the bastet folder | |
cd ./bastet-0.43 | |
# Make sure that all dependencies are satisfied | |
dnf install -y boost boost-thread boost-devel ncurses-devel | |
# Make the executable file "bastet" | |
make | |
# Run bastet to make sure it's ok | |
./bastet | |
# Change makefile and add install option | |
patch ./Makefile << EOF | |
@@ -22,2 +21,7 @@ | |
mrproper: clean | |
rm -f *~ | |
+ | |
+install: clean all | |
+ cp bastet /usr/bin | |
+ chmod a+x /usr/bin/bastet | |
+ | |
EOF | |
#echo -e "install: clean all\n\tcp bastet /usr/bin\n\tchmod a+x /usr/bin/bastet\n" >> Makefile | |
# Check the proper installation: | |
make install | |
ls -l /usr/bin | grep bastet | |
# Results: -rwxr-x--x. 1 root root 718104 Nov 26 15:37 bastet | |
cd ~/ | |
# 3. List all installed packages into task3.log file | |
dnf list installed > task3.log | |
# 4. List all dependencies of gcc package into task4_1.log file | |
dnf repoquery --requires gcc > task4_1.log | |
# List all reverse-dependencies for libgcc package into task4_2.log | |
dnf repoquery --whatrequires libgcc > task4_2.log | |
# Local only: rpm --query --whatrequires libgcc | |
# 5. Create localrepo/ folder within root home | |
mkdir /root/localrepo/ | |
# Copy checkinstall package into there | |
cp /mnt/checkinstall-1.6.2-3.el6.1.x86_64.rpm /root/localrepo/ | |
# Make sure that createrepo package is installed | |
dnf install -y createrepo | |
# Create the local repository localrepo | |
createrepo /root/localrepo/ | |
# Make .repo file within /etc/yum.repos.d/ | |
echo "[localrepo] | |
name=LocalRepository | |
baseurl=file:///root/localrepo/ | |
enabled=1 | |
gpgcheck=0 | |
" > /etc/yum.repos.d/localrepo.repo | |
# 6. List all available repos into task6.log | |
dnf repolist > task6.log | |
# Result: | |
# repo id repo name | |
# AppStream CentOS-8 - AppStream | |
# BaseOS CentOS-8 - Base | |
# extras CentOS-8 - Extras | |
# localrepo LocalRepository | |
# 7. Make all external repositories invisible for dnf | |
for file in $(ls /etc/yum.repos.d/) | |
do | |
[[ "${file}" != "localrepo.repo" ]] && mv /etc/yum.repos.d/${file} /etc/yum.repos.d/${file}_bad | |
done | |
dnf clean all | |
# List all available packages | |
dnf list available | |
# Result: | |
# Last metadata expiration check: 0:00:44 ago on Thu 26 Nov 2020 08:50:22 PM EST. | |
# Available Packages | |
# checkinstall.x86_64 1.6.2-3.el6.1 localrepo | |
# Turn them back on, cuz we need them after the next step | |
for file in $(ls /etc/yum.repos.d/ | grep repo_bad) | |
do | |
mv /etc/yum.repos.d/${file} /etc/yum.repos.d/$(basename $file .repo_bad).repo | |
done | |
# 8. Copy the fortunes package into ~/, turn it into rpm and install | |
cp /mnt/fortunes-ru_1.52-2_all.deb /root/ | |
# Obtain "alien" utility source code | |
wget -c https://sourceforge.net/projects/alien-pkg-convert/files/release/alien_8.95.tar.xz | |
tar -xf alien_8.95.tar.xz | |
# Make sure that perl is installed | |
dnf install perl <<< y | |
# Build "alien" from source | |
cd alien-8.95 | |
perl Makefile.PL; make; make install | |
cd .. | |
# Turn .deb into .rpm | |
alien --to-rpm fortunes-ru_1.52-2_all.deb | |
# Install fortunes | |
rpm --install --force fortunes-ru-1.52-3.noarch.rpm | |
# 9. Download the source rpm file with nano editor from centos repository | |
dnf download --source nano | |
# Unpack the source package | |
rpm -i ./nano-* | |
# Insert the symbolic link creation right after the installation process | |
patch ./rpmbuild/SPECS/nano.spec << EOF | |
@@ -53,6 +53,7 @@ | |
mkdir -p %{buildroot}%{_sysconfdir} | |
install -m 0644 ./nanorc %{buildroot}%{_sysconfdir}/nanorc | |
+ln --symbolic --relative %{buildroot}%{_bindir}/nano %{buildroot}%{_bindir}/newnano | |
%find_lang %{name} | |
%post | |
EOF | |
#sed -i '/^%find_lang %{name}/i \ | |
#ln --symbolic --relative %{buildroot}%{_bindir}/nano %{buildroot}%{_bindir}/newnano' ./rpmbuild/SPECS/nano.spec | |
# Build the new nano rpm package | |
rpmbuild --bb --nodeps --nodebuginfo --rmsource --rmspec ./rpmbuild/SPECS/nano.spec | |
# Make sure that nano doesn't exist in current system | |
dnf remove -y nano | |
# Install the new nano | |
dnf install -y ./rpmbuild/RPMS/x86_64/nano-* | |
# Clean the buildroot path | |
rm -rf ./rpmbuild |
Ну вот во имя защиты и разберётесь как сделать так чтобы из репы ставилось.
удаляется очень легко, просто в папке alien прописать make clean
И заодно в том, что делает цель clean
(спойлер: не деинсталляцию)
@AlexTalker, я знаю, что clean не для этого, но модуль uninstall там deprecated, и я попробовал методом тыка clean использовать, нет, он и правда не сработал, скорее всего до этого я alien, значит, ручками удалил
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@AlexTalker, а-ля ему нужен debhelper, которому нужен dpkg-perl, а он уже в свою очередь ругается, что у меня perl не под deb собран, в целом, удаляется очень легко, просто в папке alien прописать make clean