Skip to content

Commit

Permalink
init: check if file exists before linking and link it's realpath (#20)
Browse files Browse the repository at this point in the history
* init: check if file exists before linking and link it's realpath
* Revert commit: 5aaef54
  • Loading branch information
89luca89 authored Dec 8, 2021
1 parent 6db2fc4 commit 684aaab
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 83 deletions.
16 changes: 0 additions & 16 deletions distrobox-create
Original file line number Diff line number Diff line change
@@ -1,20 +1,4 @@
#!/bin/sh
# Copyright (C) 2021 Luca Di Maio
# This file is part of distrobox <https://github.com/89luca89/distrobox>.
#
# distrobox is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# distrobox is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with distrobox. If not, see <http://www.gnu.org/licenses/>.

# POSIX
# Expected env variables:
# HOME
Expand Down
16 changes: 0 additions & 16 deletions distrobox-enter
Original file line number Diff line number Diff line change
@@ -1,20 +1,4 @@
#!/bin/sh
# Copyright (C) 2021 Luca Di Maio
# This file is part of distrobox <https://github.com/89luca89/distrobox>.
#
# distrobox is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# distrobox is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with distrobox. If not, see <http://www.gnu.org/licenses/>.

# POSIX
# Expected env variables:
# HOME
Expand Down
16 changes: 0 additions & 16 deletions distrobox-export
Original file line number Diff line number Diff line change
@@ -1,20 +1,4 @@
#!/bin/sh
# Copyright (C) 2021 Luca Di Maio
# This file is part of distrobox <https://github.com/89luca89/distrobox>.
#
# distrobox is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# distrobox is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with distrobox. If not, see <http://www.gnu.org/licenses/>.

# POSIX
# Expected env variables:
# HOME
Expand Down
27 changes: 8 additions & 19 deletions distrobox-init
Original file line number Diff line number Diff line change
@@ -1,20 +1,4 @@
#!/bin/sh
# Copyright (C) 2021 Luca Di Maio
# This file is part of distrobox <https://github.com/89luca89/distrobox>.
#
# distrobox is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# distrobox is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with distrobox. If not, see <http://www.gnu.org/licenses/>.

# POSIX
# Expected env variables:
# HOME
Expand Down Expand Up @@ -182,8 +166,12 @@ list_sudo_groups() (
# install them if not found.
HOST_LINKS="/etc/host.conf /etc/hosts /etc/resolv.conf /etc/localtime /etc/timezone"
for link in ${HOST_LINKS}; do
rm -f "${link}"
ln -s /run/host"${link}" "${link}"
# Check if the file exists first
if [ -f /run/host"${link}" ]; then
rm -f "${link}"
# Use realpath to not have multi symlink messes
ln -s "$(realpath /run/host"${link}")" "${link}"
fi
done

# Extract shell name from the $SHELL environment variable
Expand Down Expand Up @@ -229,8 +217,9 @@ for mount in ${HOST_MOUNTS}; do
mount_bind /run/host"${mount}" "${mount}" rw
done

# Ensure passwordless sudo is set up for user
# Do not check fqdn when doing sudo, it will not work anyways
echo "Defaults !fqdn" >>/etc/sudoers
# Ensure passwordless sudo is set up for user
echo "${container_user_name} ALL = (root) NOPASSWD:ALL" >>/etc/sudoers

# Let's add our user to the container
Expand Down
16 changes: 0 additions & 16 deletions install
Original file line number Diff line number Diff line change
@@ -1,20 +1,4 @@
#!/bin/sh
# Copyright (C) 2021 Luca Di Maio
# This file is part of distrobox <https://github.com/89luca89/distrobox>.
#
# distrobox is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# distrobox is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with distrobox. If not, see <http://www.gnu.org/licenses/>.

# POSIX

dest_path="/usr/local/bin"
Expand Down

0 comments on commit 684aaab

Please sign in to comment.