Skip to content

Commit

Permalink
Merge pull request #5 from gsanhueza/refactor-make-local-repo
Browse files Browse the repository at this point in the history
Refactor make local repo
  • Loading branch information
gsanhueza authored Jun 13, 2017
2 parents 671b1c7 + 13280f2 commit 63420a0
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 37 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
work/
airootfs/etc/skel/pkg
TEMPMNT/
21 changes: 15 additions & 6 deletions airootfs/etc/skel/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,14 @@ customize_env() {
esac

# Desktop environment
echo "Choose your Desktop Environment (default=KDE)"
echo "Choose your Desktop Environment (default=${DESKTOP_ENV})"
printf "(1) KDE (2) GNOME: "
read ans
case $ans in
''|'1')
'')
DESKTOP_ENV="${DESKTOP_ENV}"
;;
'1')
DESKTOP_ENV="KDE"
;;
'2')
Expand All @@ -125,11 +128,14 @@ customize_env() {
esac

# Bootloader
echo "Choose your Bootloader (default=rEFInd)"
echo "Choose your Bootloader (default=${BOOTLOADER})"
printf "(1) rEFInd (2) GRUB: "
read ans
case $ans in
''|'1')
'')
BOOTLOADER="${BOOTLOADER}"
;;
'1')
BOOTLOADER="refind"
;;
'2')
Expand All @@ -142,11 +148,14 @@ customize_env() {
esac

# Xorg Drivers
echo "Choose your Graphic Drivers (default=nvidia)"
echo "Choose your Graphic Drivers (default=${XORG_DRIVERS})"
printf "(1) nVidia (2) AMD (3) VBox (4) Intel: "
read ans
case $ans in
''|'1')
'')
XORG_DRIVERS="${XORG_DRIVERS}"
;;
'1')
XORG_DRIVERS="nvidia"
;;
'2')
Expand Down
62 changes: 31 additions & 31 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,8 @@ make_iso() {
mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" -L "${iso_label}" -o "${out_dir}" iso "${iso_name}-${iso_version}-custom.iso"
}
# Make local pkg database and repo
make_local_repo() {
# Create obligatory directories
newroot="$(pwd)"/TEMPMNT
pkgdb="$(pwd)"/airootfs/etc/skel/pkg
# Create needed folders for make_local_repo
make_folder() {
# Make root directory
if [[ ! -e "$newroot" ]]; then
mkdir -p "$newroot"
Expand All @@ -231,33 +227,31 @@ make_local_repo() {
mkdir -m 0555 -p "$newroot"/{sys,proc}
fi
# Pull packages from the Internet if needed
if [[ ! -e "$pkgdb" || -e "repo.lock" || -e "pkgdl.lock" || -e "pkgdb.lock" ]]; then
touch "repo.lock"
if [[ ! -e "$pkgdb" ]]; then
mkdir -p "$pkgdb"
fi
if [[ ! -e "pkgdb.lock" || ! -e "pkgdl.lock" ]]; then
touch "pkgdl.lock"
pacman -Syw --root "$newroot" --cachedir "$pkgdb" --noconfirm base base-devel yaourt vim grml-zsh-config gstreamer smplayer nvidia bumblebee refind-efi grub os-prober xorg xorg-xinit xorg-drivers cantarell-fonts gnome gnome-tweak-tool plasma kdebase kde-l10n-es virtualbox-guest-modules-arch virtualbox-guest-utils intel-ucode lynx alsa-utils
fi
# Create DB
echo ""
echo "Creating DB for all packages in ${pkgdb}"
touch "pkgdb.lock"
repo-add "$pkgdb"/custom.db.tar.gz "$pkgdb"/*.xz
sync
rm "pkgdl.lock"
rm "pkgdb.lock"
rm "repo.lock"
# Make repo folder
if [[ ! -e "$pkgdb" ]]; then
mkdir -p "$pkgdb"
fi
}
# Pull packages from Internet
make_download() {
pacman -Syw --root "$newroot" --cachedir "$pkgdb" --noconfirm base base-devel yaourt vim grml-zsh-config gstreamer smplayer nvidia bumblebee refind-efi grub os-prober xorg xorg-xinit xorg-drivers cantarell-fonts gnome gnome-tweak-tool plasma kdebase kde-l10n-es virtualbox-guest-modules-arch virtualbox-guest-utils intel-ucode lynx alsa-utils
}
# Create Pacman DB
make_database() {
repo-add "$pkgdb"/custom.db.tar.gz "$pkgdb"/*.xz
}
# Make local pkg database and repo
make_local_repo() {
run_once make_folder
run_once make_download
run_once make_database
sync
echo ""
echo "*** Local repo is ready! ***"
echo "Local repo is ready!"
}
# Clean-up
Expand Down Expand Up @@ -298,7 +292,13 @@ done
mkdir -p ${work_dir}
#### Main script ####
run_once make_local_repo
export newroot="$(pwd)"/TEMPMNT
export pkgdb="$(pwd)"/airootfs/etc/skel/pkg
# Create new local repo only if needed
if [[ ! -e "$pkgdb/custom.db" ]]; then
run_once make_local_repo
fi
run_once make_pacman_conf
Expand Down

0 comments on commit 63420a0

Please sign in to comment.